SMSS.EXE · SETUPEXECUTE · PRIMITIVE OPERATIONS QUEUE · KTM TRANSACTION SetupExecute poqexec.exe Session 0 Native FsTx / KTM Atomic 1ms Commit WIN 11 26100/28000 POQEXEC POQEXEC PRIMITIVE OPERATIONS QUEUE · EARLY-BOOT SERVICING · KTM ENGINE

Inside poqexec.exe & the Primitive Operations Queue (POQ) — static reverse engineering (IDA Pro 9.4 + Microsoft PDB symbols) and live Hyper-V kernel tracing of Windows' native Session 0 early-boot servicing engine across Windows 11 24H2 (26100.8875) and 26H1 (28000.2804): smss.exe SetupExecute dispatch, self-purging execution, all 19 POQ XML primitives, KTM/TxF volume boundaries, CBS PendingXmlIdentifier collisions, and DFIR auditing.

Platform Binary Grammar Engine Analysis Focus

Research Baseline & Verification

Every symbol, switch, and XML attribute documented below was verified directly against the official Microsoft poqexec.exe binary from Windows 11 24H2 (10.0.26100.8875, 655,360 bytes, poqexec.pdb) and corroborated empirically on Windows 11 26H1 (10.0.28000.2804) inside an instrumented Hyper-V VM.

💡 Critical Operational Rule — Isolate Custom Manifests from WinSxS

Never drop standalone POQ manifests into C:\Windows\WinSxS\pending.xml. When TiWorker.exe wakes up later in the boot sequence, it inspects WinSxS\pending.xml against PendingXmlIdentifier in the registry and flags uncoordinated files with 0x80073712 (ERROR_SXS_COMPONENT_STORE_CORRUPT). Always stage custom manifests in an external path (such as \??\C:\ProgramData\PoqServicing\...) and pass /ignore_execution_state — noting that poqexec.exe still writes its hardcoded telemetry log to C:\Windows\WinSxS\poqexec.log.


Table of Contents


Abstract

Every major Windows update, security patch, and system component deployment concludes with a reboot phase during which locked in-use system binaries (ntoskrnl.exe, ntdll.dll, drivers, core subsystem executables) are swapped on disk before the Win32 subsystem initializes. The binary responsible for this critical transactional swap is poqexec.exe (Primitive Operations Queue Executor). Running as a pure native NT subsystem application invoked by the Session Manager (smss.exe) through the undocumented SetupExecute dispatch registry value, poqexec parses declarative XML transaction manifests (pending.xml) and executes atomic filesystem and registry modifications using the Kernel Transaction Manager (KTM) and transactional NTFS (FsTx).

Despite its ubiquitous role across Windows NT from Vista through modern Windows 11 builds (24H2 build 26100 and 26H1 build 28000), poqexec internals, command-line arguments, primitive operations grammar, and interaction boundaries remain completely undocumented by Microsoft. Furthermore, attempts by automated AI assistants to analyze or summarize this subsystem have frequently triggered safety classifier refusals under false positives of boot persistence.

This paper presents the first comprehensive reverse engineering study of poqexec.exe based on static dissection in IDA Pro 9.4 with official Microsoft PDB symbols, live kernel tracing, and empirical Hyper-V execution trials. We document:

  1. The smss.exe SetupExecute dispatch pipeline and poqexec's autonomous self-purging logic via DeleteFromSetupExecuteList.
  2. The undocumented command-line parser (ParseCommandLine) and its complete switch matrix (/noreboot, /ignore_execution_state, /skip_critical_poq, /commit_critical_poq, etc.).
  3. The formal grammar of all 19 Primitive Operations (POQ) spanning atomic file transfers, hardlinks, deletions, directory structures, and deep registry manipulation.
  4. The transactional subsystem mechanics, KTM rollback guarantees, and the undocumented DisableKernelTransactions registry control governing cross-volume operations on non-NTFS targets such as the FAT32 EFI System Partition (\Device\SystemPartition).
  5. The architectural collision boundary between standalone poqexec invocations and the Component-Based Servicing (CBS / TiWorker) daemon, detailing why missing PendingXmlIdentifier keys trigger 0x80073712 (ERROR_SXS_COMPONENT_STORE_CORRUPT) rollbacks and how to reliably isolate user-defined early-boot operations.

1. Introduction and Research Motivation

In modern Windows operating system servicing, updating active system libraries is inherently complicated by mandatory file locking: the Windows memory manager creates section objects for running binaries (SEC_IMAGE), prohibiting standard user-mode write or deletion operations. When Windows Update, DISM, or an MSI installer deploys a servicing payload, it defers locked modifications to the next boot cycle.

While legacy Win32 applications historically relied on the Wininit PendingFileRenameOperations registry mechanism (MoveFileExW with MOVEFILE_DELAY_UNTIL_REBOOT), modern Windows Component-Based Servicing (CBS) and the Side-by-Side (WinSxS) store require transactional atomicity, security descriptor inheritance, hardlink reconfiguration, compression state changes, and registry synchronizations executed simultaneously.

This requirement gave rise to the Primitive Operations Queue (POQ) engine, driven by poqexec.exe. Located in C:\Windows\System32\poqexec.exe, this small executable possesses extraordinary privileges:

  • It runs under NT AUTHORITY\SYSTEM before user logons.
  • It operates in Session 0 as a pure Native Subsystem binary (IMAGE_SUBSYSTEM_NATIVE), independent of csrss.exe, kernel32.dll, or advapi32.dll.
  • It executes before user-mode EDR agents and anti-malware services start. File-system minifilter drivers are already loaded in the kernel, but their user-mode policy, signature, and telemetry components are not yet fully active.
  • It leverages the NT Kernel Transaction Manager (KTM) to ensure that hundreds of file replacements either commit atomically or roll back completely without leaving an unbootable OS state.

Despite its importance, vendor-neutral technical documentation regarding POQ operations is non-existent. System administrators and kernel engineers troubleshooting servicing corruption or designing low-level recovery mechanisms face opaque error messages such as 0x80073712 or silent boot rollbacks. This research demystifies the POQ architecture down to individual functions, structures, and registry entries.

Historical Lineage

poqexec.exe is not a recent addition. It has shipped as a native Session 0 executable since Windows Vista (NT 6.0) — the first release built around Component-Based Servicing (CBS) and the WinSxS store. Pre-release Vista builds already carried \Windows\System32\poqexec.exe (observed as file version 6.0.5308.x), and the identical poqexec.exe + SetupExecute + pending.xml mechanism is documented in Windows 7 SP1 servicing failures of the 0xC0000034 family. The engine has been carried forward largely intact across Windows 7, 8, 8.1, 10, and 11, plus the matching Windows Server editions: the <PendingTransaction Version="3.1"> schema and the onecore\base\wcp (Windows Component Platform) code lineage are still present in the 24H2/26H1 binaries analyzed here. The POQ executor is therefore one of the oldest continuously shipping components of the modern servicing stack — a point that matters when reasoning about its reliance on the now-deprecated Kernel Transaction Manager (see §7).


2. Target Environment and Binary Dissection Baseline

Our primary reverse engineering target is the official poqexec.exe image shipped with Windows 11 24H2, corroborated against execution traces on Windows 11 26H1:

Metric / Attribute Primary Disassembly Target Empirical VM Verification Target
Operating System Windows 11 Enterprise 24H2 Windows 11 Pro 26H1
OS Build Number 10.0.26100.8875 (x64) 10.0.28000.2804 (x64)
Binary Path C:\Windows\System32\poqexec.exe C:\Windows\System32\poqexec.exe
Binary Size 655,360 bytes (640 KB) 667,648 bytes (652 KB)
Subsystem IMAGE_SUBSYSTEM_NATIVE (1) IMAGE_SUBSYSTEM_NATIVE (1)
Primary Dependencies ntdll.dll ntdll.dll
Symbol Artifact (PDB) poqexec.pdb (GUID: 9541C5CC67B781AA10EA2B8181FC79AE1) Official Microsoft Symbol Server
Static Tooling IDA Pro 9.4 (Hex-Rays 64-bit Decompiler) IDAPython Custom Extraction Harness
Dynamic Platform Hyper-V Generation 2 (UEFI + TPM 2.0, Secure Boot) Elevated Windows PowerShell 7.4 / SSH

Unlike standard user-mode Win32 binaries, poqexec.exe links solely against the native API runtime exported by ntdll.dll (Rtl*, Nt*, Zw*, DbgPrintEx). All XML parsing, string formatting, and error routing are handled either internally or via statically linked onecore runtime libraries (onecore\base\wcp\tools\poqexec\lib\poqexec.cpp).


3. The SMSS Early-Boot Pipeline & SetupExecute Dispatch

To understand how poqexec receives control, we must inspect the Session Manager (smss.exe) initialization sequence. During phase 1 of system startup, smss.exe processes several registry keys located under:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager

The Three Execution Vectors in Session Manager

As established in our prior study of native execution dispatch, smss.exe supports multiple distinct execution lists:

%%{init: {"themeVariables": {"fontFamily": "Segoe UI", "fontSize": "14px", "lineColor": "#0891b2", "primaryTextColor": "#0f172a"}, "flowchart": {"curve": "basis", "nodeSpacing": 28, "rankSpacing": 34, "htmlLabels": true, "wrappingWidth": 260}}}%% flowchart LR S(["Phase 1 initialization
smss.exe"]) B["1 · BootExecute
autocheck autochk *
native fsck"] X["2 · SetupExecute
poqexec.exe \SystemRoot\WinSxS\pending.xml"] E["3 · Execute
early subsystem helpers"] S --> B S --> X S --> E classDef entry fill:#ecfeff,stroke:#0891b2,color:#164e63,stroke-width:1.8px; classDef step fill:#f8fafc,stroke:#94a3b8,color:#0f172a,stroke-width:1.3px; classDef key fill:#cffafe,stroke:#0e7490,color:#0f172a,stroke-width:2px; classDef warn fill:#fff7ed,stroke:#ea580c,color:#7c2d12,stroke-width:1.8px; linkStyle default stroke:#0891b2,stroke-width:1.5px; class S entry; class B,E step; class X key;
  1. BootExecute (REG_MULTI_SZ): Evaluated early to run non-interactive volume checks (autochk.exe).
  2. SetupExecute (REG_MULTI_SZ): Dedicated to offline setup and servicing execution. If this value is populated, smss.exe iterates over each string entry, constructs native process parameters via RtlCreateProcessParametersEx, and creates the process via RtlCreateUserProcess.
  3. Execute (REG_MULTI_SZ): Used for auxiliary native bootstrap tasks before starting the Win32 subsystem processes (csrss.exe and wininit.exe).

Registering poqexec for Early Execution

A standard manual or CBS-driven registration of poqexec populates SetupExecute:

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" ^
    /v SetupExecute /t REG_MULTI_SZ ^
    /d "poqexec.exe \SystemRoot\WinSxS\pending.xml" /f

Because smss.exe parses this string in native NT space, argument separation follows native command-line rules:

  • argv[0]: The executable image name (poqexec.exe). smss.exe automatically searches \SystemRoot\System32\ if a relative path is supplied.
  • argv[1..n]: The parameters forwarded to the image, including the path to the XML transaction file.

4. Internal Architecture & Autonomous Execution Lifecycle

Once spawned, poqexec.exe follows a strictly ordered lifecycle designed to prevent infinite boot loops in the event of an unexpected crash or power failure.

%%{init: {"themeVariables": {"fontFamily": "Segoe UI", "fontSize": "14px", "lineColor": "#0891b2", "primaryTextColor": "#0f172a"}, "flowchart": {"curve": "basis", "nodeSpacing": 28, "rankSpacing": 34, "htmlLabels": true, "wrappingWidth": 260}}}%% flowchart TD A(["poqexec!RunPoqExec entry"]) B["ParseCommandLine(argc, argv)
evaluates switches (/noreboot, /use_fstx, etc.)
extracts the XML manifest path"] C["MountComponentsHive(#amp;mounted)
→ HKLM\COMPONENTS"] D["PoqOpenAndNavigateDocument(XML path)
validates the XML format via RtlXmlNextLogicalThingEx
checks #lt;PendingTransaction Version=#quot;3.1#quot;#gt;
PoqVerifyPendingXmlIdentifier (optional)"] E["DeleteFromSetupExecuteList(argv[0], argv[1])
critical: purges itself from SetupExecute in the registry"] F["RtlRunPrimitiveOperationsAgainstSilCallback
iterates POQ operations
executes PoqSilExecuteOperation → PoqTransferFile
commits the KTM transaction"] G(["System reboot
unless /noreboot is specified"]) A --> B --> C --> D --> E --> F --> G classDef entry fill:#ecfeff,stroke:#0891b2,color:#164e63,stroke-width:1.8px; classDef step fill:#f8fafc,stroke:#94a3b8,color:#0f172a,stroke-width:1.3px; classDef key fill:#cffafe,stroke:#0e7490,color:#0f172a,stroke-width:2px; classDef warn fill:#fff7ed,stroke:#ea580c,color:#7c2d12,stroke-width:1.8px; linkStyle default stroke:#0891b2,stroke-width:1.5px; class A,G entry; class B,C,D,F step; class E warn;

The Pre-Execution Deferral Gate

Before any of the steps above run, RunPoqExec consults a second, independent gate that can suppress the entire queue for the current boot. Immediately after PoqexecInitialize, it calls ShouldDeferExecution (decomp3.c, 0x14004A900), which queries:

\Registry\Machine\SOFTWARE\Microsoft\WindowsUpdate\CommitStatus   value: NoCommit (REG_DWORD)

If NoCommit is present and non-zero, poqexec logs "Deferring poqexec at users request", returns STATUS_SUCCESS, and — crucially — does not purge SetupExecute. The queue is therefore left armed and re-attempted on the next boot. This is the mechanism by which the Windows Update orchestrator can hold back commitment of pending operations (for example, while updates are paused or the maintenance window has not opened) without discarding them.

The check is deliberately fail-open: if the CommitStatus key cannot be read, the guard condition (status < 0 || flag == 0) still lets execution proceed, so an unreadable key never blocks servicing. ShouldDeferExecution resides in onecore\base\wcp\rtllib\nativelib\defer_library.cpp — a shared servicing-runtime facility rather than poqexec-specific logic — so the same deferral contract governs other native servicing stages.

Decompilation Analysis: Autonomous Self-Purging

One of the most notable design features of poqexec.exe is that it guarantees one-shot execution by deleting itself from the registry before or immediately after validating the queued operations.

In decomp3.c at address 0x140008838, we find DeleteFromSetupExecuteList:

// IDA Pro 9.4 Decompilation (poqexec.exe 10.0.26100.8875)
__int64 __fastcall DeleteFromSetupExecuteList(
        struct Windows::Rtl::IRtlSystemIsolationLayer *IsolationLayer,
        const wchar_t *ImageName,     // argv[0]: L"poqexec.exe"
        const wchar_t *XmlFilePath)   // argv[1]: L"\\SystemRoot\\WinSxS\\pending.xml"
{
  UNICODE_STRING KeyPath = RTL_CONSTANT_STRING(
      L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager");
  UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"SetupExecute");

  // Open Session Manager key
  NTSTATUS status = IsolationLayer->OpenKey(&KeyPath, &hKey);
  if (NT_SUCCESS(status)) {
      // Constructs LUNICODE_STRING descriptors for ImageName and XmlFilePath...
      // Removes any matching substring combination from REG_MULTI_SZ
      status = Windows::Rtl::SilRemoveStringFromMultiSzValueHelper(
          IsolationLayer,
          hKey,
          &ValueName,
          &StrImage,
          &StrXmlPath,
          ...);
  }
  return status;
}

This routine ensures that even if a subsequent file copy fails or throws a hardware fault, the system will not become trapped in an unbootable loop repeatedly executing poqexec.


5. Command-Line Parser & Undocumented Switches

The command-line parser of poqexec.exe is implemented in ParseCommandLine (0x140005890 in decomp1.c). It requires at least one positional parameter (the path to the transaction manifest) and accepts eight undocumented operational switches.

Decompiled Switch Table

// Excerpt from ParseCommandLine (decomp1.c L1444-1486)
v33[2]  = L"noreboot";                // Match index 0
v33[5]  = L"skip_critical_poq";       // Match index 1
v33[8]  = L"skip_noncritical_poq";    // Match index 2
v33[11] = L"commit_critical_poq";     // Match index 3
v33[14] = L"display_progress";        // Match index 4
v33[17] = L"ignore_execution_state";  // Match index 5
v33[20] = L"transaction";             // Match index 6
v33[23] = L"use_fstx";                // Match index 7

Complete Switch Specification

Switch Syntax Internal Effect Operational Purpose
/noreboot /noreboot or -noreboot Sets Flags.NoReboot = 1 Prevents poqexec from issuing NtShutdownSystem(ShutdownReboot). Allows subsequent smss components to execute without an immediate restart.
/ignore_execution_state /ignore_execution_state Sets Flags.WriteExecutionState = 0 Crucial for standalone testing. Suppresses writing PoqexecFailure or store transaction states into HKLM\COMPONENTS. Prevents CBS corruption alerts.
/skip_critical_poq /skip_critical_poq Sets Flags.SkipCritical = 1 Bypasses operations flagged as critical during component servicing rollback.
/skip_noncritical_poq /skip_noncritical_poq Sets Flags.SkipNonCritical = 1 Bypasses non-essential deferred actions.
/commit_critical_poq /commit_critical_poq Sets Flags.CommitCritical = 1 Forces immediate commitment of critical queue segments.
/display_progress /display_progress Sets Flags.DisplayProgress = 1 Activates native graphical boot progress updates on the boot splash screen.
/transaction /transaction <HexHandle> Parses numerical handle via wcstoul Attaches the POQ session to an existing Kernel Transaction Manager (KTM) transaction handle passed from an external caller.
/use_fstx /use_fstx Sets Flags.UseFsTx = 1 Forces transactional NTFS file modifications (FsTx) across all targeted volumes.

6. Primitive Operations Queue (POQ) Grammar Specification

The core of poqexec is a declarative, state-driven XML processing engine. When RunPoqExec navigates the input document, it parses child elements of the <POQ> container via PoqParseOperationElement (0x14000BFAC).

Our reverse engineering of funcs.txt, attrs.txt, and decomp1.c identified 19 distinct primitive operations.

The 19 Supported POQ Primitives

POQ Primitive Dispatch Table (&unk_140073010 / funcs_14000C0A5):
----------------------------------------------------------------------
01. BeginTransaction         11. FlushFileBuffers
02. Checkpoint               12. HardlinkFile
03. CopyFile                 13. MoveFile
04. CreateDirectory          14. SetFileInformation
05. CreateFile               15. SetKeyInfo
06. CreateKey                16. SetKeySecurity
07. DecompressFile           17. SetKeyValue
08. DeleteFile               18. WofDecompressFile
09. DeleteKey                19. WriteFile
10. DeleteKeyValue

Detailed XML Syntax and Attribute Matrix

<?xml version="1.0" encoding="utf-8"?>
<PendingTransaction Version="3.1">
  <POQ>
    <!-- 1. CopyFile -->
    <CopyFile source="\Device\HarddiskVolume3\staging\driver.sys"
              destination="\SystemRoot\System32\drivers\driver.sys"
              securityDescriptor="O:BAG:BAD:(A;;GA;;;SY)"/>

    <!-- 2. MoveFile -->
    <MoveFile source="\SystemRoot\System32\hostname.exe"
              destination="\SystemRoot\System32\hostname.bak"/>

    <!-- 3. HardlinkFile -->
    <HardlinkFile source="\SystemRoot\WinSxS\amd64_...\calc.exe"
                  destination="\SystemRoot\System32\calc.exe"/>

    <!-- 4. CreateFile & 5. DeleteFile -->
    <CreateFile path="\SystemRoot\System32\flag.lock"/>
    <DeleteFile path="\SystemRoot\System32\obsolete.dll"/>

    <!-- 6. CreateDirectory -->
    <CreateDirectory path="\SystemRoot\System32\NewServiceDir"/>

    <!-- 7. WriteFile with base64 / base16 data -->
    <WriteFile path="\SystemRoot\System32\config\version.dat"
               data="V0VTTUFSLVBPUUVYRUNURVNUCg=="
               encoding="base64"
               offset="0"/>

    <!-- 8. Registry Key Primitives -->
    <CreateKey path="\Registry\Machine\SOFTWARE\CustomVendor"/>
    <DeleteKey path="\Registry\Machine\SOFTWARE\OldVendor"/>

    <!-- 9. Registry Value Primitives (Note: type MUST be numeric integer; payload carried in value=) -->
    <SetKeyValue path="\Registry\Machine\SYSTEM\CurrentControlSet\Services\TestSvc"
                 name="Start"
                 type="4"
                 encoding="base16"
                 value="02000000"/>
    <SetKeyValue path="\Registry\Machine\SYSTEM\CurrentControlSet\Control\Session Manager"
                 name="BootExecute"
                 type="7"
                 encoding="base16"
                 value="6100750074006f0063006800650063006b0020006100750074006f00630068006b0020002a0000000b2000000000"/>
    <DeleteKeyValue path="\Registry\Machine\SYSTEM\CurrentControlSet\Services\TestSvc"
                    name="ObsoleteParam"/>

    <!-- 10. File Metadata Adjustment -->
    <SetFileInformation path="\SystemRoot\System32\driver.sys"
                        lastWriteTime="0x01DA4E9283748200"
                        fileAttribute="0x00000020"/>
  </POQ>
</PendingTransaction>

Supported Attributes and Error Suppression Flags

Extracted directly from IDA string table references (attrs.txt), poqexec recognizes the following operational attributes:

Attribute Scope Functional Description
source CopyFile, MoveFile, HardlinkFile NT path to the source file (\SystemRoot\..., \Device\..., \??\...).
destination CopyFile, MoveFile, HardlinkFile NT path to the destination file.
path File/Dir/Registry operations Target object namespace path.
securityDescriptor File, Dir, Registry Key SDDL string applied atomically upon creation or modification.
encoding WriteFile, SetKeyValue Data payload encoding: base16 (code 1, raw hex), base64 (code 2, default), or string/unicode (code 3).
value SetKeyValue Carries the registry payload. (Note: SetKeyValue ignores data=; payload must be in value=).
data WriteFile Raw or encoded file data payload for file write operations.
type SetKeyValue Must be a numeric integer (1 = REG_SZ, 2 = REG_EXPAND_SZ, 3 = REG_BINARY, 4 = REG_DWORD, 7 = REG_MULTI_SZ, 11 = REG_QWORD). Textual names like "REG_MULTI_SZ" cause STATUS_INVALID_PARAMETER (0xC000000D).
offset WriteFile 64-bit integer file byte offset for incremental patching.
name SetKeyValue, DeleteKeyValue Registry value name to set or remove.
lastWriteTime SetFileInformation 64-bit FILETIME applied to the target file.
creationTime / lastAccessTime SetFileInformation 64-bit FILETIME values for the creation and last-access timestamps.
endOfFile SetFileInformation 64-bit logical end-of-file (file size) to set on the target.
fileAttribute SetFileInformation File attribute bitmask (e.g. 0x00000020 = FILE_ATTRIBUTE_ARCHIVE).
fileHash / hashAlgorithm / hashTransform DecompressFile Integrity triple — expected payload hash, the hash algorithm, and an optional transform — verified before the decompressed result is committed.
class SetKeyInfo Registry key class string (the Class parameter of the underlying key create/set).
postAction <POQ> (container) Reboot policy for the whole queue: reboot or NoReboot. Lets the manifest itself request a restart, parsed by PoqParseOpeningElementAttributes independently of the /noreboot switch.
Version / Identifier <PendingTransaction> (root) Schema version (3.1) and the optional CBS correlation identifier matched against HKLM\COMPONENTS\PendingXmlIdentifier (see §8).
flags / id per-operation Optional operation flag bitmask and identifier; the executor rejects any unknown or reserved flag bit ("Valid flags check failed").

Reverse Engineering SetKeyValue: Numeric Type and Payload Geometry

A critical trap when crafting <SetKeyValue> operations in poqexec lies in the attribute types expected by PoqOperation_SetKeyValue (0x14000B600):

// IDA Pro 9.4 Decompilation: Attribute parsing in PoqOperation_SetKeyValue
v22 = &unk_140074528;  // "path"
v25 = &unk_140074498;  // "name"
v28 = &unk_140074488;  // "type"
v31 = &unk_140074478;  // "value"
v34 = &unk_140074518;  // "encoding"
status = PoqOperationParseAttributes(pXmlState, pElement, 5, &v22, NULL);
if (status >= 0) {
    // Parses the 'value' attribute according to 'encoding'
    status = PoqParseBinaryData(pXmlState, EncodingCode, &ValueAttr, &ParsedBlob);
}
  1. type is parsed as an Integer, NOT a String:
    The type descriptor points to an integer parser (PoqParseLargeInteger). If a user passes string literals like type="REG_MULTI_SZ" or type="REG_DWORD", the parser rejects the value, generating STATUS_INVALID_PARAMETER (0xC000000D) in ExpandTxfLog during boot, and the registry key is never created.
    The value must be the native numerical constant:

    • 1 = REG_SZ
    • 2 = REG_EXPAND_SZ
    • 3 = REG_BINARY
    • 4 = REG_DWORD
    • 7 = REG_MULTI_SZ
    • 11 = REG_QWORD
  2. Payload lives in value=, NOT data=:
    While <WriteFile> takes data="...", <SetKeyValue> binds its payload exclusively to value="...". If data="..." is provided, SetKeyValue parses an empty blob (count = 0).

  3. Encoding Table (0x1400743A0):
    PoqParseEncodingType maps the encoding string against internal table unk_1400743A0:

    • encoding="base16" (code 1): Raw hexadecimal byte pairs. Essential for REG_MULTI_SZ and binary payloads.
    • encoding="base64" (code 2): Standard Base64 encoding (default if omitted).
    • code 3: Raw null-terminated Unicode string.
  4. Constructing REG_MULTI_SZ (type="7") Buffers:
    In Windows NT, a multi-string is an array of null-terminated UTF-16LE strings terminated by an additional null character (\0\0). Using encoding="base16", a multi-string such as autocheck autochk * followed by a secondary native binary name can be encoded directly into the manifest:

    <SetKeyValue path="\Registry\Machine\SYSTEM\CurrentControlSet\Control\Session Manager"
                name="BootExecute"
                type="7"
                encoding="base16"
                value="6100750074006f0063006800650063006b0020006100750074006f00630068006b0020002a0000000b2000000000"/>

    Empirical testing confirms this produces a valid 2-element MultiString in BootExecute directly during the poqexec early-boot pass without requiring external helper scripts.

Internal Error Suppression & Option Flags

During execution in PoqSilExecuteOperation, each operation carries a per-operation tolerance mask: a non-suppressed error rolls the whole transaction back, while a suppressed one is logged and skipped. The full set recovered from attrs.txt is:

  • AllowFileNotFound: Ignores STATUS_OBJECT_NAME_NOT_FOUND (e.g. deleting something already gone).
  • AllowPathNotFound: Tolerates STATUS_OBJECT_PATH_NOT_FOUND (a parent directory is missing).
  • AllowTransactionalConflict: Ignores transient KTM lock collisions.
  • AllowCannotDelete: Tolerates read-only or system-attribute locks during cleanup (STATUS_CANNOT_DELETE).
  • AllowDeletePending: Tolerates STATUS_DELETE_PENDING (a prior delete is still finalizing).
  • AllowSharingViolation: Ignores non-exclusive lock attempts (STATUS_SHARING_VIOLATION).
  • AllowDirectoryNotEmpty: Continues if a directory to be purged still contains untracked files.
  • AllowAccessDenied: Tolerates STATUS_ACCESS_DENIED on the target.
  • AllowInvalidDeviceRequest: Tolerates STATUS_INVALID_DEVICE_REQUEST — e.g. an operation a FAT32/ESP volume cannot service (see §7).
  • AllowNotSupported: Tolerates STATUS_NOT_SUPPORTED.
  • AllowTypeMismatch: Tolerates a registry value type mismatch.
  • AllowBufferTooSmall: Tolerates STATUS_BUFFER_TOO_SMALL on a query.
  • KeyNotFoundIsOk: Tolerates missing registry keys during deletion.
  • InvalidPathIsOk: Treats a malformed/invalid path as a non-fatal skip rather than a failure.
  • OpenForBackupIntent: Opens the target with backup/restore semantics (FILE_FLAG_BACKUP_SEMANTICS), letting the operation traverse and modify objects whose ACL would otherwise deny SYSTEM — the same privileged path that lets poqexec write under WinSxS (see §10).

7. Kernel Transaction Manager (KTM) & Volume Boundaries

poqexec.exe does not rely on standard Win32 file streaming. In decomp2.c, the execution of file operations converges inside PoqTransferFile (0x140015578) and CopyFileContents (0x14002CB8C).

The FsTx Transactional Engine

By default, operations run inside an active KTM transaction created via NtCreateTransaction or inherited via the /transaction command-line switch:

  1. When performing a MoveFile, poqexec calls FsTxMoveFileByHandleNT, performing an instant, atomic metadata rename within the NTFS Master File Table (MFT).
  2. When performing a CopyFile, poqexec opens the source with FILE_READ_DATA | FILE_READ_ATTRIBUTES and creates the destination with FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_GENERIC_WRITE.
  3. If all operations in <POQ> succeed, poqexec executes NtCommitTransaction.
  4. If any non-suppressed error occurs, the entire transaction is rolled back via NtRollbackTransaction, ensuring zero partial file writes.

The FAT32 / EFI System Partition (ESP) Volume Boundary

A frequent operational requirement in firmware research, bootloader development, or recovery engineering is copying or restoring files directly from the EFI System Partition (ESP) (e.g., \Device\SystemPartition\EFI\Boot\...) into the Windows partition (\SystemRoot\System32\...).

Because the ESP is formatted as FAT32, it does not support NTFS transactional logging (TxF) or KTM resource managers. However, our disassembly of CopyFileContents (0x14002CB8C) reveals an important asymmetry:

  • In a <CopyFile> operation, poqexec opens the source file strictly with read-only access (FILE_READ_DATA | FILE_READ_ATTRIBUTES) and streams content through a dynamic 4 MB memory buffer (RtlAllocateLBlob(0x400000)).
  • Because the source volume is never modified, fastfat.sys processes standard NT I/O requests without enlisting into the KTM transaction.
  • The KTM transaction binds exclusively to the destination NTFS volume (C:\Windows\...).

Empirical Conclusion: Copying files from the EFI System Partition to an NTFS volume succeeds natively under default system settings without disabling KTM!

The Undocumented Transaction Bypass (DisableKernelTransactions)

The undocumented transaction override verified in decomp3.c (Windows::Rtl::AreTransactionsDisabled, 0x140019898) serves as an essential fallback mechanism implemented by Microsoft:

// IDA Pro 9.4 Decompilation (decomp3.c)
NTSTATUS Windows::Rtl::AreTransactionsDisabled(
    struct Windows::Rtl::IRtlSystemIsolationLayer *IsolationLayer,
    bool *pTransactionsDisabled)
{
  UNICODE_STRING KeyPath = RTL_CONSTANT_STRING(
      L"\\Registry\\Machine\\Software\\Microsoft\\Windows\\CurrentVersion\\SideBySide");
  UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"DisableKernelTransactions");

  // Reads DWORD value; if 1, KTM is entirely bypassed
  return IsolationLayer->QueryDwordValue(&KeyPath, &ValueName, pTransactionsDisabled);
}

While synthetic Hyper-V tests demonstrate that basic streaming reads from FAT32 ESP into NTFS succeed without this key, physical deployments on bare-metal hardware can introduce variables where KTM enforcement causes transaction aborts:

  1. Target volume non-transactionality: Writing, modifying, or creating files directly on FAT32, exFAT, or ReFS media.
  2. Storage stack edge cases: Hardware RAID controllers, Intel VMD/RST filters, or BitLocker volume unlock states during early Session 0.
  3. Transaction timeout / deadlock: Complex multi-step operations triggering lock contention.

Staging the following registry key disables KTM transactional enforcement entirely, serving as a primary recovery switch:

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide" ^
    /v DisableKernelTransactions /t REG_DWORD /d 1 /f

8. The CBS/TiWorker Collision Boundary (PendingXmlIdentifier)

One of the most elusive failure modes encountered when working with poqexec involves silent transaction cancellations accompanied by the following errors in C:\Windows\Logs\CBS\CBS.log:

2026-10-26 01:01:32, Error  CSI  Could not find pending.xml identifier in registry.
2026-10-26 01:01:32, Error  CSI  Attempting to mark store corrupt with category: CorruptPendingXmlIdentifier
2026-10-26 01:01:32, Error  CSI  Store corruption detected: RegistryCorruption on resource '\Registry\Machine\COMPONENTS\PendingXmlIdentifier'
2026-10-26 01:01:33, Error  CBS  Startup: Failed to initiate a rollback transaction. [HRESULT = 0x80073712 - ERROR_SXS_COMPONENT_STORE_CORRUPT]

Our reverse engineering of PoqVerifyPendingXmlIdentifier (decomp1.c, 0x14000C288) pinpoints the exact architectural reason for this collision.

Decompilation of Identifier Verification

// IDA Pro 9.4 Decompilation (decomp1.c L14000C288)
__int64 __fastcall PoqVerifyPendingXmlIdentifier(
        struct _POQ_XML_STATE *XmlState,
        struct _XMLDOC_ELEMENT *RootElement)
{
  LUNICODE_STRING XmlIdentifier = {0};
  LUNICODE_STRING RegistryIdentifier = {0};

  // Attempt to extract 'Identifier' attribute from <PendingTransaction>
  NTSTATUS status = PoqExtractAttribute(XmlState, RootElement, &strIdentifier, &XmlIdentifier);

  if (status < 0) {
      // 0xC0000034 = STATUS_OBJECT_NAME_NOT_FOUND
      // IF THE ATTRIBUTE IS NOT PRESENT, POQEXEC RETURNS SUCCESS (0)!
      return (status != 0xC0000034) ? 0xC015001A : 0;
  }

  // If 'Identifier' IS present, query HKLM\COMPONENTS\PendingXmlIdentifier
  status = PoqGetExpectedIdentifier(&RegistryIdentifier);
  if (status >= 0) {
      // Compare XML identifier with Registry identifier
      if (RtlCompareEncodedLBlobs(&XmlIdentifier, &RegistryIdentifier) != 0) {
          return 0xC015001A; // STATUS_SXS_CORRUPT_ACTIVATION_STACK
      }
  }
  return status;
}

The Architectural Takeaway: Two Distinct Systems

The confusion arises because two entirely different components read pending.xml at different stages of the boot cycle:

[Timeline: System Boot]
   |
   |--- 1. Early Boot (Session 0 Native): poqexec.exe
   |       - Reads XML specified in SetupExecute.
   |       - If NO 'Identifier' attribute is present, IT DOES NOT CHECK REGISTRY!
   |       - Executes file operations immediately and successfully.
   |
   |--- 2. Late Boot (Session 0 Win32, post-services): TrustedInstaller.exe / TiWorker.exe (CBS)
   |       - Wakes up and automatically inspects C:\Windows\WinSxS\pending.xml.
   |       - Assumes this file belongs to an active Windows Update servicing transaction!
   |       - Checks HKLM\COMPONENTS\PendingXmlIdentifier.
   |       - If missing, CBS concludes the Component Store is corrupted!
   |       - Triggers CorruptPendingXmlIdentifier, initiates rollback, and purges SetupExecute!

Isolation Rule for Custom Early-Boot Servicing

To execute custom early-boot file replacements without triggering CBS corruption alarms:

  1. Never place custom manifests in \SystemRoot\WinSxS\pending.xml. Instead, place the file in an isolated directory, such as C:\ProgramData\Servicing\custom_pending.xml or \SystemRoot\System32\boot_ops.xml.
  2. Always invoke poqexec with /ignore_execution_state. This switch prevents poqexec from writing temporary flags into HKLM\COMPONENTS.
  3. Omit the Identifier attribute in <PendingTransaction Version="3.1">.

Note on logging: This isolation does not redirect the log. poqexec.exe always writes its execution log to the hardcoded path C:\Windows\WinSxS\poqexec.log, never beside the isolated manifest — so an execution trace remains in WinSxS even when the manifest lives elsewhere (see §10).


9. Empirical Validation & Hyper-V Case Studies

To prove the accuracy of this reverse engineering model, we conducted controlled empirical trials inside a Windows 11 Hyper-V Generation 2 virtual machine.

Case Study 1: The Atomic MoveFile Verification

In our first experiment, we staged an atomic MoveFile relocating the native executable from \SystemRoot\regedit.exe to \SystemRoot\System32\regedit.bak — a cross-directory move within the same NTFS volume.

XML Manifest (C:\Windows\WinSxS\pending.xml)

<?xml version="1.0" encoding="utf-8"?>
<PendingTransaction Version="3.1">
  <POQ>
    <MoveFile source="\SystemRoot\regedit.exe" destination="\SystemRoot\System32\regedit.bak"/>
  </POQ>
</PendingTransaction>

Registry Staging

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" ^
    /v SetupExecute /t REG_MULTI_SZ ^
    /d "poqexec.exe \SystemRoot\WinSxS\pending.xml" /f

Boot Telemetry & Results

Upon rebooting the VM, execution completed seamlessly. Examination of the generated log file C:\Windows\WinSxS\poqexec.log revealed:

1dd64d9f17550ba: StartTime
Primitive operation timings: Registry: 0ms, Files: 1ms
Transaction UoW: {2E12B127-D0CD-11F1-9499-806E6F6E6963} for CommitTransaction
221ms: ValidateQueuedOpsStart
221ms: ValidateQueuedOpsFinish
221ms: EndTime

Forensic Findings:

  • File transfer completed in 1 millisecond under KTM transaction {2E12B127-D0CD-11F1-9499-806E6F6E6963}.
  • C:\Windows\System32\regedit.bak was successfully created (size: 585,728 bytes).
  • HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SetupExecute was completely purged ([]) by DeleteFromSetupExecuteList.

Case Study 2: The FAT32 / ESP Cross-Volume Restoral

In our second experiment, we targeted the restoral of a master utility binary (hostname.exe) from the FAT32 EFI System Partition into System32:

Target Architecture

Source:      \Device\SystemPartition\EFI\Backup\hostname.bak  (FAT32 Volume)
Destination: \SystemRoot\System32\hostname.exe                (NTFS Volume)

Manifest (C:\ProgramData\PoqServicing\esp_restore.xml)

<?xml version="1.0" encoding="utf-8"?>
<PendingTransaction Version="3.1">
  <POQ>
    <CopyFile source="\Device\SystemPartition\EFI\Backup\hostname.bak"
              destination="\SystemRoot\System32\hostname.exe"/>
  </POQ>
</PendingTransaction>

Execution Staging with Isolated Switches

:: Register poqexec targeting the external XML and suppressing CBS telemetry
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" ^
    /v SetupExecute /t REG_MULTI_SZ ^
    /d "poqexec.exe /noreboot /ignore_execution_state \??\C:\ProgramData\PoqServicing\esp_restore.xml" /f

Telemetry Verification

Following reboot, hostname.exe was successfully restored to System32. Because the XML was isolated outside WinSxS and /ignore_execution_state was applied, CBS.log remained completely clean with zero store corruption flags or rollback interruptions.


10. Defensive Matrix, Forensic Auditing & EDR Visibility

From an offensive and defensive security perspective, poqexec.exe occupies a sensitive operational tier:

%%{init: {"themeVariables": {"fontFamily": "Segoe UI", "fontSize": "14px", "lineColor": "#0891b2", "primaryTextColor": "#0f172a"}, "flowchart": {"curve": "basis", "nodeSpacing": 28, "rankSpacing": 34, "htmlLabels": true, "wrappingWidth": 260}}}%% flowchart TD T0["00 s · UEFI firmware / Secure Boot"] T1["02 s · Windows Boot Manager (bootmgfw.efi) → winload.efi"] T2["04 s · ntoskrnl.exe and Early-Launch Anti-Malware (ELAM) drivers"] T3["05 s · smss.exe"] P["SetupExecute: poqexec.exe
runs prior to wininit / services.exe
no user-mode EDR agents loaded
security minifilters partially inactive"] T4["07 s · wininit.exe → services.exe (Service Control Manager)"] T5["08 s · EDR user-mode hooks injected into the Win32 subsystem"] T0 --> T1 --> T2 --> T3 --> T4 --> T5 T3 -.->|EDR blind spot| P classDef entry fill:#ecfeff,stroke:#0891b2,color:#164e63,stroke-width:1.8px; classDef step fill:#f8fafc,stroke:#94a3b8,color:#0f172a,stroke-width:1.3px; classDef key fill:#cffafe,stroke:#0e7490,color:#0f172a,stroke-width:2px; classDef warn fill:#fff7ed,stroke:#ea580c,color:#7c2d12,stroke-width:1.8px; linkStyle default stroke:#0891b2,stroke-width:1.5px; class T0,T1,T2,T4,T5 step; class T3 entry; class P warn;

Forensic Indicators of POQ Activity

Forensic examiners investigating unauthorized early-boot file modifications should audit the following artifacts:

  1. C:\Windows\WinSxS\poqexec.log: Records timestamps, operation durations, and KTM Transaction Units of Work (UoW). The path is hardcoded inside poqexec.exe — the literal \SystemRoot\WinSxS\poqexec.log is the only .log string in the image, with no variant derived from the manifest path. The log is therefore always written here regardless of where the manifest resides: a custom manifest isolated under C:\ProgramData\... or on the EFI System Partition still leaves its execution trace in WinSxS. poqexec can write it despite the restrictive WinSxS ACL (SYSTEM holds only read/execute there) because it runs during the smss phase with backup/restore privileges that bypass the ACL.
  2. Session Manager Registry Audit: Monitor write events on:
    HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SetupExecute

    Legitimate Windows Updates populate this key briefly before a reboot. Any persistent or suspicious binary path registered in SetupExecute represents an immediate persistence indicator.

  3. CBS Servicing Logs (C:\Windows\Logs\CBS\CBS.log):
    Examine entries tagged with CSI and POQ:
    • Poqexec successfully registered in 'SetupExecute'
    • Attempting to remove poqexec from SetupExecute
    • CorruptPendingXmlIdentifier (flags uncoordinated manual XML drops).

11. Reference Implementation & POQ Automation Harness

To enable researchers to reliably test and utilize this pipeline, we provide a complete PowerShell automation script that stages an atomic POQ operation safely, applies all required registry flags, and monitors execution telemetry.

Invoke-PoqStage.ps1

<#
.SYNOPSIS
    Automates staging of early-boot POQ transactions via poqexec.exe.
.DESCRIPTION
    Creates an isolated POQ XML manifest, sets DisableKernelTransactions if necessary,
    registers poqexec in SetupExecute with /ignore_execution_state, and monitors logs.
.AUTHOR
    Marek Wesolowski (WESMAR) - kvc.pl
#>

[CmdletBinding()]
param(
    [Parameter(Mandatory=$true)]
    [ValidateSet("CopyFile", "MoveFile", "HardlinkFile", "DeleteFile")]
    [string]$Operation,

    [Parameter(Mandatory=$true)]
    [string]$SourcePath,

    [Parameter(Mandatory=$false)]
    [string]$DestinationPath,

    [switch]$DisableKtm
)

$ErrorActionPreference = "Stop"

# 0. Validate destination for operations that require it
if ($Operation -in @("CopyFile", "MoveFile", "HardlinkFile") -and [string]::IsNullOrWhiteSpace($DestinationPath)) {
    throw "Operation '$Operation' requires -DestinationPath."
}

# 1. Prepare Staging Directory outside WinSxS
$StageDir = "C:\ProgramData\PoqServicing"
if (-not (Test-Path $StageDir)) {
    New-Item -ItemType Directory -Path $StageDir -Force | Out-Null
}
$XmlPath = Join-Path $StageDir "manifest.xml"

# 2. Build XML Payload
$XmlBuilder = [System.Text.StringBuilder]::new()
[void]$XmlBuilder.AppendLine('<?xml version="1.0" encoding="utf-8"?>')
[void]$XmlBuilder.AppendLine('<PendingTransaction Version="3.1">')
[void]$XmlBuilder.AppendLine('  <POQ>')

switch ($Operation) {
    "CopyFile" {
        [void]$XmlBuilder.AppendLine("    <CopyFile source=`"$SourcePath`" destination=`"$DestinationPath`"/>")
    }
    "MoveFile" {
        [void]$XmlBuilder.AppendLine("    <MoveFile source=`"$SourcePath`" destination=`"$DestinationPath`"/>")
    }
    "HardlinkFile" {
        [void]$XmlBuilder.AppendLine("    <HardlinkFile source=`"$SourcePath`" destination=`"$DestinationPath`"/>")
    }
    "DeleteFile" {
        [void]$XmlBuilder.AppendLine("    <DeleteFile path=`"$SourcePath`"/>")
    }
}

[void]$XmlBuilder.AppendLine('  </POQ>')
[void]$XmlBuilder.AppendLine('</PendingTransaction>')
[System.IO.File]::WriteAllText($XmlPath, $XmlBuilder.ToString(), [System.Text.Encoding]::UTF8)
Write-Host "[+] Generated POQ Manifest at: $XmlPath" -ForegroundColor Cyan

# 3. Optional: Disable KTM for non-transactional write destinations
if ($DisableKtm) {
    Write-Host "[*] Configuring DisableKernelTransactions for non-transactional target volume..." -ForegroundColor Yellow
    $SxsKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide"
    if (-not (Test-Path $SxsKey)) { New-Item -Path $SxsKey -Force | Out-Null }
    Set-ItemProperty -Path $SxsKey -Name "DisableKernelTransactions" -Value 1 -Type DWord
}

# 4. Stage SetupExecute in Session Manager
# Note: Using native NT path format \??\ for custom stage path
$NtXmlPath = "\??\" + $XmlPath
$Cmdline = "poqexec.exe /noreboot /ignore_execution_state $NtXmlPath"

Write-Host "[*] Staging SetupExecute: $Cmdline" -ForegroundColor Cyan
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" `
                 -Name "SetupExecute" -Value @($Cmdline) -Type MultiString

Write-Host "[+] Staging complete. Execute a system restart to trigger poqexec." -ForegroundColor Green

12. Code Quality Assessment: Engineering Discipline and Legacy Debt

A frequent assumption about an obscure, decades-old boot binary is that it must be crude or hastily maintained. Reverse engineering the 24H2 image tells the opposite story for the parts that matter, while also exposing where the subsystem shows its age. The following assessment is drawn directly from the Hex-Rays decompilation of the servicing core (onecore\base\wcp\poq\poqsil.cpp and onecore\base\wcp\sil\ntsystem.cpp).

Engineering Discipline

The operation executor is defensively coded to a degree rarely seen outside kernel code:

  • RAII and deterministic cleanup. The source is modern C++ built on smart-pointer and auto types (Windows::AutoNewPtr<>, Auto<_UNICODE_STRING>) and reference-counted, COM-style interfaces (IRtlSystemIsolationLayer). Every handle, interface, and heap string is released on all control-flow paths — success and failure alike.
  • Exhaustive per-operation validation. Before dispatching any of the 19 primitives, PoqSilExecuteOperation validates the operation payload pointer against nullptr, validates every UNICODE_STRING field (RtlpValidateNonEmptyUnicodeString / RtlpValidateUnicodeString), rejects unknown or reserved flag bits (the recurring "Valid flags check failed" guard), bounds payload lengths to ≤ 0xFFFFFFFF, and rejects any path still containing an unexpanded environment variable (CheckForUnexpandedVariables).
  • Assertion origination. Every rejection routes through RtlReportErrorOrigination carrying the exact source file and line number; internal "this cannot happen" invariants are guarded with __debugbreak().
  • Precise status translation. Provider results are mapped to specific, meaningful NTSTATUS codes rather than a generic failure:
Condition Mapped NTSTATUS
Destination locked by another handle 0xC0000043 STATUS_SHARING_VIOLATION
Target marked read-only / system 0xC0000121 STATUS_CANNOT_DELETE
Delete already scheduled 0xC0000056 STATUS_DELETE_PENDING
Cross-volume transactional conflict 0xC0190001 (transaction conflict)
Unreachable internal branch 0xC00000E5 STATUS_INTERNAL_ERROR
Allocation failure 0xC0000017 STATUS_NO_MEMORY
  • Declarative, granular error suppression. Tolerated failures are driven by an explicit allow-mask rather than blanket try/catch: AllowFileNotFound, AllowSharingViolation, AllowCannotDelete, AllowDirectoryNotEmpty, AllowTransactionalConflict, AllowAccessDenied, AllowPathNotFound, AllowNotSupported, AllowTypeMismatch, KeyNotFoundIsOk, OpenForBackupIntent, and more.
  • Bounded, safe buffers. CopyFileContents allocates min(fileSize, 4 MiB) and streams in a loop; PoqTransferFile performs an explicit bounds check before the memcpy that assembles the destination path, raising rather than overflowing.
  • Correct handling of in-use files. When a target cannot be deleted because it is locked, DeleteFileWithOptionalRename falls back to RenameToPendingDeletes and registers the file for deferred cleanup.

A Note on Decompiler Artifacts

The raw Hex-Rays output looks chaotic — the operation dispatch is rendered as a cascade of value - 1; if (== 0) subtractions rather than a switch; the same payload pointer appears under many aliased temporaries (v46/v47/v48); cleanup epilogues are duplicated across branches; and spurious SIMD such as _mm_extract_epi16((__m128i)0, 1) appears on zeroed constants. None of this reflects the source: it is the expected result of decompiling optimized C++ with inlined RAII destructors and SEH unwinding. The apparent "mess" is the decompiler's, not the author's.

Weaknesses and Slip-ups

Two genuine criticisms survive scrutiny — neither is a classic memory-safety bug:

  1. Architectural debt — dependence on deprecated transactions. The entire atomicity guarantee rests on the Kernel Transaction Manager and Transactional NTFS (TxF). Microsoft's own documentation has, since the Windows 8 era, strongly discouraged new use of TxF and warned it may be removed in a future release — yet the single most boot-critical servicing step still depends on it, with the DisableKernelTransactions override as an escape hatch and the FAT32/ESP incompatibility (§7) as the visible symptom. The engine is effectively the Vista-era Windows Component Platform design carried forward largely intact; the <PendingTransaction Version="3.1"> schema has not moved in over a decade (§1, Historical Lineage).
  2. A missing progress guarantee in the copy loop. CopyFileContents terminates only when its remaining-byte counter reaches zero and advances that counter solely by the byte count returned from each read. There is no guard against a successful zero-byte read. A source truncated between the size query and the copy (a TOCTOU window), or a provider returning zero bytes without an error status, would spin the loop indefinitely — a boot-time hang. In practice the risk is low (a true end-of-file surfaces as STATUS_END_OF_FILE, and the source is transaction-locked for the duration), but the guard is conspicuously absent from code that is otherwise paranoid about every other failure mode.

The net picture: a disciplined, heavily instrumented executor wrapped around a frozen, deprecated transactional foundation. The reliability problems administrators encounter with POQ are overwhelmingly architectural and environmental (TxF semantics, volume boundaries, CBS coordination) rather than defects in the executor's own logic.


13. Conclusion

The Primitive Operations Queue and its native executor poqexec.exe represent one of the most sophisticated, high-privilege subsystems within the Windows NT architecture. By bridging the gap between declarative servicing specifications and atomic kernel transactions, poqexec enables deep operating system renewal without risking partially written binaries or broken dependency graphs.

Through static reverse engineering of IDA Pro decompilations and empirical kernel tracing, this research has established:

  • The exact command-line interface and switch matrix accepted by poqexec.exe.
  • The complete 19-operation grammar supported by the POQ XML parser.
  • The autonomous self-cleanup routine (DeleteFromSetupExecuteList) that guarantees single-shot execution.
  • The root cause of CBS servicing collisions involving PendingXmlIdentifier and the architectural necessity of isolating custom manifests from the Component Store.
  • The role of Kernel Transaction Manager (KTM) constraints across volume boundaries and the undocumented DisableKernelTransactions switch enabling FAT32/ESP interactions.
  • A code-quality verdict: a disciplined, RAII-based, exhaustively validated executor bolted onto a frozen, deprecated transactional foundation — so that POQ's real reliability problems are architectural and environmental rather than defects in the executor's own logic.

Understanding these mechanisms provides systems engineers, security researchers, and forensic investigators with the authoritative technical foundation required to diagnose boot-level servicing failures and analyze Session 0 native execution on modern Windows platforms.

Add a comment

human test