angr.analyses.decompiler.known_patterns.wdk_shared_data

Reads of KUSER_SHARED_DATA, the page Windows maps read-only at the fixed virtual address 0x7FFE0000 in every user-mode process (x86, x64 and ARM64 alike). ntdll, kernel32 and countless drivers read its fields through the SharedUserData macro of ntddk.h/wdm.h, which compiles to a bare load from an absolute constant address:

SharedUserData->NtMajorVersion   ==   *(volatile ULONG *)0x7FFE026C

Kernel-mode code reaches the same page through KI_USER_SHARED_DATA (0xFFDF0000 on x86, 0xFFFFF78000000000 on x64), so each field’s pattern accepts the user- and the arch-appropriate kernel-mode address.

The absolute address is the guard here: there is no plausible non-Windows meaning for a load from 0x7FFE0000 + small offset, so these are default-on and take no parameters (params=()); the synthesized call is a nullary accessor whose return type is the field’s type.

Field offsets are those of the WDK ddk/ntddk.h KUSER_SHARED_DATA (cross-checked with offsetof on i686 and x86_64, and against Geoff Chappell’s version-annotated layout); only offsets that have been stable from Windows XP through Windows 11 are default-on. Calibrated against tests/x86_64/windows/known_patterns_wdk_ksud.exe (-O2, mingw).

class angr.analyses.decompiler.known_patterns.wdk_shared_data.KsudField

Bases: object

One KUSER_SHARED_DATA field access: its byte offset, the load width used to read it, and the accessor’s name.

stable is False for offsets that moved between Windows versions; those templates exist but are not enabled by default.

offset: int
name: str
size: int
stable: bool = True
__init__(offset, name, size, stable=True)
Parameters:
Return type:

None

angr.analyses.decompiler.known_patterns.wdk_shared_data.make_shared_user_data_template(field)

A SharedUserData-> field-read template for one KUSER_SHARED_DATA field: a load of field.size bytes from the field’s fixed address.

Parameters:

field (KsudField)

angr.analyses.decompiler.known_patterns.wdk_shared_data.make_ntstatus_severity_template(macro, severity)

An NTSTATUS severity-predicate template: (s >> 30) == severity, in either the literal shift form or the mask form the compilers prefer.

Parameters: