Platform:Windows
Appearance
| On this wiki | Facts · Code · Notes · Topics |
|---|
Windows NT user-mode as a reverser meets it: x86/x64 PE programs that read the TEB and PEB through fs/gs, walk the loader module lists, read KUSER_SHARED_DATA at a fixed address and handle NTSTATUS codes. The 16-bit line is on Platform:Win16.
Overview
Windows NT (NT 3.1 to Windows 11) runs PE executables (Format:PE) on x86, x64, ARM and ARM64. Besides the documented Win32 API, programs and system DLLs keep using undocumented-but-stable user-mode structures that a reverser sees constantly in disassembly. The layouts below come from the phnt headers (MIT) and are cross-checked by static_asserts in them.
Where the details are
- Platform:Windows/PEB and TEB: Thread and Process Environment Blocks, the
fs:[0x30]/gs:[0x60]access patterns, RTL_USER_PROCESS_PARAMETERS. - Platform:Windows/Loader module lists: PEB_LDR_DATA and LDR_DATA_TABLE_ENTRY, how code walks loaded modules.
- Platform:Windows/KUSER_SHARED_DATA: the read-only page at 0x7FFE0000.
- Platform:Windows/NTSTATUS: code structure and the values that show up in crashes and error paths.
- Platform:Windows/Build numbers: build number to product version table.
- 16-bit programs: Platform:Win16. Hooking and DLL injection by proxy: Technique:Function hooking, Technique:DLL proxy loading.
Topics
- PEB and TEB — The Thread Environment Block (TEB) and Process Environment Block (PEB): how user-mode code finds them (fs:[0x18]/fs:[0x30] on x86, gs:[0x30]/gs:[0x60] on x64)…
- Loader module lists — How user-mode code enumerates loaded modules without API calls: PEB.Ldr -> PEB_LDR_DATA -> three doubly linked lists of LDR_DATA_TABLE_ENTRY, and what the…
- KUSER SHARED DATA — The page the kernel maps read-only into every process at 0x7FFE0000 (also at 0xFFFFF78000000000 in kernel mode): time, tick count, version, processor features…
- NTSTATUS — The 32-bit NTSTATUS code: severity in the top two bits, customer flag, facility and code, plus the values that appear most in crashes, loader failures and Nt*…
- Build numbers — Windows product to NT build number table, and where a program or binary reveals it (PEB.OSBuildNumber, KUSER_SHARED_DATA.NtBuildNumber, RtlGetVersion, PE…
- Kernel drivers — Reading a Windows kernel-mode driver (.sys) as an analyst: PE with subsystem native, imports from ntoskrnl.exe/HAL/WDFLDR.SYS, INIT and PAGE sections…
- Minifilter drivers — File system minifilter drivers of Windows (Filter Manager, FLTMGR.SYS): how to recognise one, the FLT_REGISTRATION and FLT_OPERATION_REGISTRATION tables that…
Code & repositories
- https://github.com/winsiderss/phnt @
53fbbdc5b5d2b08761db1c7b26bfa8c820924356· license: MIT
phnt (MIT): Native API headers of System Informer; PEB, TEB, loader, RTL_USER_PROCESS_PARAMETERS, KUSER_SHARED_DATA with offset static_asserts.
Tested on: source read, not run: source read · checked 2026-10-18; last activity 2026-03-26 - https://github.com/microsoft/Windows-driver-samples @
2dc3fd3a0cc84a2933f2194e7ec0871584979071· license: MS-PL
Microsoft driver samples (MS-PL): general/ioctl has the same IOCTL driver as WDM (sioctl.c, all four METHOD_* cases) and KMDF (nonpnp.c, control device).
Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2026-10-14 - https://github.com/microsoft/Windows-Driver-Frameworks @
b6191d9543441329154da32f7ab9bdd97228dd3c· license: MIT
WDF source (MIT): public KMDF/UMDF headers per version (wdffuncenum.h function table indexes) and the loader structures WDF_BIND_INFO, WdfVersionBind in fxldr.h.
Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2024-09-10 - https://github.com/mingw-w64/mingw-w64 @
63ebe6cdb3ec4d5c586b7f0f0c03dd502e44c296· license: ZPL-2.1 AND LicenseRef-PD (declared by the contributor for the files used; GitHub reports BSD-2-Clause (read from COPYING; GitHub's detector did not classify it) for the repository)
mingw-w64 DDK headers (mingw-w64-headers/ddk/include/ddk/wdm.h): DRIVER_OBJECT, DEVICE_OBJECT, IRP, IO_STACK_LOCATION, IRP_MJ_* values; devioctl.h has CTL_CODE and METHOD_*.
Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2026-10-12 - https://github.com/reactos/reactos @
52eaf78aa0273c0436d256cc9a0ee97aaa8eabae· license: GPL-2.0-or-later (declared by the contributor for the files used; GitHub reports GPL-2.0 for the repository)
ReactOS: sdk/include/ddk/fltkernel.h, a public-domain re-implementation of the Windows DDK Filter Manager header
Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2026-10-18; Note: the latest release ships binaries; the wiki links only the source, never the binaries
Pitfalls
- Struct layouts grow with each Windows version; offsets of fields near the start are stable, tail fields are not. Always check
OSBuildNumberbefore trusting a late offset. - 32-bit programs on 64-bit Windows (WOW64) see a 32-bit TEB/PEB (
fs:) but the process also has 64-bit ones.