Post · 3 min read· pp. 2162–2164

RTL_USER_PROCESS_PARAMETERS

CURRENT WORK ITEM - PREVIEW ONLY

The RTL_USER_PROCESS_PARAMETERS structure (formally _RTL_USER_PROCESS_PARAMETERS) is the low-level packaging of the numerous arguments and parameters that can be specified to such Win32 API functions as CreateProcess.

By the phrase “low-level packaging” I mean very deliberately that the structure is not specifically a packaging for the transition to and from kernel mode. Ask almost anyone in the last decade or more for a potted description of the RTL_USER_PROCESS_PARAMETERS, and you can expect to hear that these are parameters that are passed from user mode to kernel mode for handling the NtCreateUserProcess and ZwCreateUserProcess functions, and that the kernel creates a copy in the created process’s address space where it is then available in user mode through the created process’s PEB. This, however, is not the history. Even now, it is not the full story. The clue is in the name, specifically in the RTL prefix.

For the first decade and more of Windows history, the RTL_USER_PROCESS_PARAMETERS structure does not cross between user and kernel modes as anything other than an uninterpreted blob that the creating process copies into the created process’s address space. The structure exists only as input to the RtlCreateUserProcess function. This Run Time Library (RTL) function is exported by name from NTDLL in all Windows versions, right from the beginning with version 3.10. It also exists in all versions of the kernel, but only as an internal routine which the kernel uses for starting the first user-mode process (and which is in a section that the kernel discards soon afterwards).

Variability

Presumably because of its role as input to an API function, albeit an undocumented one, the RTL_USER_PROCESS_PARAMETERS structure is strikingly stable. Indeed, while the RtlCreateUserProcess function was the only means of creating a user-mode process, its input structure did not change at all. Since then, the structure’s only variability is that new members are appended:

VersionSize (x86)Size (x64)
3.10 to 5.20x02900x03F0
6.00x02940x03F8
6.10x02980x0400
6.2 to 6.30x02A00x0410
10.0 to 18030x02A40x0410
18090x02AC0x0420
19030x02BC0x0440
20040x02C00x0440

Layout

These sizes, and the offsets, names and types of members in the table below, are from Microsoft’s public symbol files for the kernel starting with Windows 2000 SP3.

For versions that predate the availability of type information in symbol files, continuity with the known definition for later versions is confirmed by inspection of the implementations and uses of RtlCreateUserProcess. For a handful of these early versions, the continuity can be established more readily. For instance, the import libraries GDISRVL.LIB and SHELL32.LIB that Microsoft supplied with the Device Driver Kit (DDK) for Windows NT 3.51 and 4.0, respectively, have an early form of type information, including for RTL_USER_PROCESS_PARAMETERS.

Offset (x86)Offset (x64)DefinitionVersions
0x000x00ULONG MaximumLength;all
0x040x04ULONG Length;all
0x080x08ULONG Flags;all
0x0C0x0CULONG DebugFlags;all
0x100x10HANDLE ConsoleHandle;all
0x140x18ULONG ConsoleFlags;all
0x180x20HANDLE StandardInput;all
0x1C0x28HANDLE StandardOutput;all
0x200x30HANDLE StandardError;all
0x240x38CURDIR CurrentDirectory;all
0x300x50UNICODE_STRING DllPath;all
0x380x60UNICODE_STRING ImagePathName;all
0x400x70UNICODE_STRING CommandLine;all
0x480x80PVOID Environment;all
0x4C0x88ULONG StartingX;all
0x500x8CULONG StartingY;all
0x540x90ULONG CountX;all
0x580x94ULONG CountY;all
0x5C0x98ULONG CountCharsX;all
0x600x9CULONG CountCharsY;all
0x640xA0ULONG FillAttribute;all
0x680xA4ULONG WindowFlags;all
0x6C0xA8ULONG ShowWindowFlags;all
0x700xB0UNICODE_STRING WindowTitle;all
0x780xC0UNICODE_STRING DesktopInfo;all
0x800xD0UNICODE_STRING ShellInfo;all
0x880xE0UNICODE_STRING RuntimeData;all
0x900xF0RTL_DRIVE_LETTER_CURDIR CurrentDirectores [0x20];all
0x02900x03F0ULONG_PTR volatile EnvironmentSize;6.0 to 6.1
ULONG_PTR EnvironmentSize;6.2 and higher
0x02940x03F8ULONG_PTR volatile EnvironmentVersion;6.1 only
ULONG_PTR EnvironmentVersion;6.2 and higher
0x02980x0400PVOID PackageDependencyData;6.2 and higher
0x029C0x0408ULONG ProcessGroupId;6.2 and highe
0x02A00x040CULONG LoaderThreads;10.0 and higher
0x02A40x0410UNICODE_STRING RedirectionDllName;1809 and higher
0x02AC0x0420UNICODE_STRING HeapPartitionName;1903 and higher
0x02B40x0430ULONGLONG *DefaultThreadpoolCpuSetMasks;1903 and higher
0x02B80x0438ULONG DefaultThreadpoolCpuSetMaskCount;1903 and higher
0x02BC0x043CULONG DefaultThreadpoolThreadMaximum;2004 and higher

The spelling of CurrentDirectores is Microsoft’s.