Specifically, the decision tree that
If the image is an MS-DOS application with an .exe, .com, or .pif extension, a message is sent to the Windows subsystem to check whether an MS-DOS support process (Ntvdm.exe, specified in the registry value HKLM\SYSTEM\CurrentControlSet\Control\WOW\cmdline) has already been created for this session. If a support process has been created, it is used to run the MS-DOS application. (The Windows subsystem sends the message to the VDM [Virtual DOS Machine] process to run the new image.) Then
If the file to run has a .bat or .cmd extension, the image to be run becomes Cmd.exe, the Windows command prompt, and
If the image is a Win16 (Windows 3.1) executable,
Stage 3: Creating the Windows Executive Process Object (
At this point,
Setting up the EPROCESS object
Creating the initial process address space
Initializing the kernel process structure(KPROCESS)
Setting up the PEB
Concluding the setup of the process address space (which includes initializing the working set list and virtual address space descriptors and mapping the image into address space)
Note
The only time there won’t be a parent process is during system initialization. After that point, a parent process is always required to provide a security context for the new process.
Stage 3A: Setting Up the EPROCESS Object
This substage involves the following steps:
Inherit the affinity of the parent process, unless it was explicitly set during process creation (through the attribute list).
Choose the ideal node that was specified in the attribute list, if any.
Inherit the I/O and page priority from the parent process. If there is no parent process, the default page priority (5) and I/O priority (Normal) are used.
Set the new process’ exit status to STATUS_PENDING.
Choose the hard error processing mode selected by the attribute list; otherwise, inherit the parent’s processing mode if none was given. If no parent exists, use the default processing mode which is to display all errors.
Store the parent process’ process ID in the
Query the Image File Execution Options key to check if the process should be mapped with large pages. Also, query the key to check if NTDLL has been listed as a DLL that should be mapped with large pages within this process.
Query the Image File Execution Options key for a specific NUMA node assignment associated with the process. The assignment can be either based on inheritance (in which the NUMA node will be propagated from the parent) or an explicit NUMA assignment, as long as this assignment does not override the initial NUMA node specified in the attribute list.
Disable stack randomization if ASLR was disabled on the executable containing the process.