Post · 10 min read· pp. 2506–2513

NTPSAPI_X.H

The public symbol file NTKRPAMP.PDB for the original release of Windows 10 tells that the kernel is built with the NTPSAPI_X.H header at

d:\th.public.fre\internal\sdk\inc

and draws from it the type definitions that are tabulated below. The header NTPSAPI_X.H is not known in any Device Driver Kit (DDK) or Windows Driver Kit (WDK).

Line NumberType
42struct _PEB_LDR_DATA
83struct _GDI_TEB_BATCH
114struct _CLIENT_ID64
230struct _CLIENT_ID
259struct _EXCEPTION_REGISTRATION_RECORD
266struct _NT_TIB
287struct _NT_TIB32
306struct _NT_TIB64
855enum _HARDWARE_COUNTER_TYPE
1382enum JOB_OBJECT_NET_RATE_CONTROL_FLAGS
1419enum JOB_OBJECT_IO_RATE_CONTROL_FLAGS
1605enum _JOBOBJECTINFOCLASS

Though only these dozen types that are defined in NTPSAPI_X.H show in the public symbols for the kernel, many more show in symbol files for other modules. Among these are user-mode modules that are very far removed from system-level programming, e.g., URLMON.DLL from Internet Explorer. Though the symbol files in question have private symbols, Microsoft has published them freely in downloadable packages of all the public symbols for all of Windows, starting with Windows 8, and continues to make them available on demand to debugging tools via the public symbol server. If distribution of these unusually detailed symbol files was at first an oversight, it is a disclosure that has been left to stand for a decade, though not for all modules. For instance, it ceased for URLMON.DLL after the 1709 release of Windows 10.

Reconstuction

Most, though certainly not all, of the types that multiple symbol files attribute to the unpublished NTPSAPI_X.H are defined in other headers that Microsoft does publish: WDM.H and NTDDK.H from the WDK and WINNT.H from the Software Development Kit (SDK). These are in some sense the standard headers for their level of Windows programming, one or another (or more) being included by the source code for almost all kernel-mode or user-mode software.

It may be that content is extracted from NTPSAPI_X.H to these standard headers or that all are extracted from yet some other input. However it’s done, the effect looks to be that successive lines of NTPSAPI_X.H are appended to zero or more of the published headers, and each of the latter then has one contiguous region of lines that are each in NTPSAPI_X.H. Matching line numbers for type definitions as seen in the standard headers and deduced from type information for NTPSAPI_X.H then supports a reasonable attempt at reconstructing much of what the unseen NTPSAPI_X.H must have between its type definitions. The table below is then a skeleton for reconstructing NTPSAPI_X.H for the original Windows 10.

Types and line numbers in this table are collected from all known type information not just in symbol files but also in the statically linked library CLFSMGMT.LIB from the SDK for Windows 10. That this library has type information for NTPSAPI_X.H means, of course, that one of the object files it archives has a #include of this header, if not directly then as a nested inclusion. That this library has no much type information for NTPSAPI_X.H is because this object file is a by-product of creating a pre-compiled header. It thus records not what types were regarded as used for any compilation of a source file but all the types that might get used. Its list of types defined in NTPSAPI_X.H is plausibly complete.

Line NumberTypeWDM.HNTDDK.HWINNT.H
42struct _PEB_LDR_DATA
83struct _GDI_TEB_BATCH
94struct _Wx86ThreadState
114struct _CLIENT_ID64
217struct _JOB_SET_ARRAY10929
230struct _CLIENT_ID7360
259struct _EXCEPTION_REGISTRATION_RECORD427410938
266struct _NT_TIB428110945
272anonymous union in struct _NT_TIB428710951
287struct _NT_TIB32430210966
294anonymous union in struct _NT_TIB32430910973
306struct _NT_TIB64432110985
313anonymous union in struct _NT_TIB64432810992
336enum _PROCESSINFOCLASS4345
422enum _THREADINFOCLASS4424
491enum _THREAD_UMS_INFORMATION_COMMAND
498struct _THREAD_UMS_INFORMATION
505anonymous union in struct _THREAD_UMS_INFORMATION
507anonymous struct in anonymous union in struct _THREAD_UMS_INFORMATION
526anonymous union in anonymous union in struct _THREAD_UMS_INFORMATION
528anonymous struct in anonymous union in anonymous union in struct _THREAD_UMS_INFORMATION
541struct _UMS_CREATE_THREAD_ATTRIBUTES11012
552anonymous union in struct _UMS_CREATE_THREAD_ATTRIBUTES
561anonymous union in struct _UMS_CREATE_THREAD_ATTRIBUTES
578enum _MEMORY_EXHAUSTION_TYPE
586struct _MEMORY_EXHAUSTION_INFORMATION
593struct _PROCESS_JOB_MEMORY_INFO
612struct _PAGE_PRIORITY_INFORMATION4478
620struct _PROCESS_WS_WATCH_INFORMATION4486
630struct _PROCESS_BASIC_INFORMATION4496
639struct _PROCESS_EXTENDED_BASIC_INFORMATION4505
642anonymous union in struct _PROCESS_EXTENDED_BASIC_INFORMATION4508
644anonymous struct in anonymous union in struct _PROCESS_EXTENDED_BASIC_INFORMATION4510
673struct _PROCESS_DEVICEMAP_INFORMATION4531
674anonymous union in struct _PROCESS_DEVICEMAP_INFORMATION4532
675unnamed struct Set in anonymous union in struct _PROCESS_DEVICEMAP_INFORMATION4533
678unnamed struct Query in anonymous union in struct _PROCESS_DEVICEMAP_INFORMATION4536
685struct _PROCESS_DEVICEMAP_INFORMATION_EX4543
686anonymous union in struct _PROCESS_DEVICEMAP_INFORMATION_EX4544
687unnamed struct Set in anonymous union in struct  _PROCESS_DEVICEMAP_INFORMATION_EX4545
690unnamed struct for Query in anonymous union in struct _PROCESS_DEVICEMAP_INFORMATION_EX4548
708struct _PROCESS_SESSION_INFORMATION4566
712struct _PROCESS_HANDLE_TRACING_ENABLE4570
716struct _PROCESS_HANDLE_TRACING_ENABLE_EX4574
728struct _PROCESS_HANDLE_TRACING_ENTRY4586
735struct _PROCESS_HANDLE_TRACING_QUERY4593
750struct _QUOTA_LIMITS460811018
765union _RATE_QUOTA_LIMIT462311033
767anonymous struct in union _RATE_QUOTA_LIMIT462511035
773struct _QUOTA_LIMITS_EX463111041
796struct _IO_COUNTERS465411056
813struct _VM_COUNTERS4671
828struct _VM_COUNTERS_EX4686
845struct _VM_COUNTERS_EX24703
855enum _HARDWARE_COUNTER_TYPE471311069
865struct _HARDWARE_COUNTER4720
877enum _PROCESS_MITIGATION_POLICY473211073
896struct _PROCESS_MITIGATION_ASLR_POLICY475111092
897anonymous union in struct _PROCESS_MITIGATION_ASLR_POLICY475211093
899anonymous struct in anonymous union in struct _PROCESS_MITIGATION_ASLR_POLICY475411095
909struct _PROCESS_MITIGATION_DEP_POLICY476411105
910anonymous union in struct _PROCESS_MITIGATION_DEP_POLICY476511106
912anonymous struct in anonymous union in struct _PROCESS_MITIGATION_DEP_POLICY476711108
921struct _PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY477611117
922anonymous union in struct _PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY477711118
924anonymous struct in anonymous union in struct _PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY477911120
932struct _PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY478711128
933anonymous union in struct _PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY478811129
935anonymous struct in anonymous union in struct _PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY479011131
942struct _PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY479711138
943anonymous union in struct _PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY479811139
945anonymous struct in anonymous union in struct _PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY480011141
952struct _PROCESS_MITIGATION_DYNAMIC_CODE_POLICY480711148
953anonymous union in struct _PROCESS_MITIGATION_DYNAMIC_CODE_POLICY480811149
955anonymous struct in anonymous union in struct _PROCESS_MITIGATION_DYNAMIC_CODE_POLICY481011151
964struct _PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY
965anonymous union in struct _PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY
967anonymous struct in anonymous union in struct _PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY
976struct _PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY481811159
977anonymous union in struct _PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY481911160
979anonymous struct in anonymous union in struct _PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY482111162
986struct _PROCESS_MITIGATION_FONT_DISABLE_POLICY482811169
987anonymous union in struct _PROCESS_MITIGATION_FONT_DISABLE_POLICY482911170
989anonymous struct in anonymous union in struct _PROCESS_MITIGATION_FONT_DISABLE_POLICY483111172
1003struct _PROCESS_KEEPALIVE_COUNT_INFORMATION4845
1012struct _PROCESS_REVOKE_FILE_HANDLES_INFORMATION4854
1021struct _POOLED_USAGE_AND_LIMITS4863
1041struct _PROCESS_ACCESS_TOKEN4883
1072struct _PROCESS_EXCEPTION_PORT4914
1095struct _KERNEL_USER_TIMES4937
1159struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION11181
1170struct _JOBOBJECT_BASIC_LIMIT_INFORMATION11192
1182struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION11204
1197struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION_V2
1216struct _JOBOBJECT_BASIC_PROCESS_ID_LIST11214
1222struct _JOBOBJECT_BASIC_UI_RESTRICTIONS11220
1230struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION11228
1238struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION11236
1242struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT11240
1247struct _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION11245
1252struct _JOBOBJECT_JOBSET_INFORMATION11250
1256enum _JOBOBJECT_RATE_CONTROL_TOLERANCE11254
1262enum _JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL11260
1269struct _JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION11267
1279struct JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_211277
1283anonymous union in struct JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_211281
1288anonymous union in struct JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_211286
1293anonymous union in struct JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_211291
1313struct _JOBOBJECT_LIMIT_VIOLATION_INFORMATION11306
1328struct JOBOBJECT_LIMIT_VIOLATION_INFORMATION_211321
1338anonymous union in struct JOBOBJECT_LIMIT_VIOLATION_INFORMATION_211331
1343anonymous union in struct JOBOBJECT_LIMIT_VIOLATION_INFORMATION_211336
1348anonymous union in struct JOBOBJECT_LIMIT_VIOLATION_INFORMATION_211341
1366struct _JOBOBJECT_CPU_RATE_CONTROL_INFORMATION11354
1368anonymous union in struct _JOBOBJECT_CPU_RATE_CONTROL_INFORMATION11356
1371anonymous struct in anonymous union in struct _JOBOBJECT_CPU_RATE_CONTROL_INFORMATION11359
1382enum JOB_OBJECT_NET_RATE_CONTROL_FLAGS11370
1401struct JOBOBJECT_NET_RATE_CONTROL_INFORMATION11389
1419enum JOB_OBJECT_IO_RATE_CONTROL_FLAGS11402
1432struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE11415
1605enum _JOBOBJECTINFOCLASS11552
1695struct _SILOOBJECT_BASIC_INFORMATION11604
1703struct _SILOOBJECT_ROOT_DIRECTORY11612
1709enum _SERVERSILO_STATE11618
1716struct _SERVERSILO_BASIC_INFORMATION11625
1724enum _SILOOBJECTINFOCLASS11633

To include line numbers for anonymous structures and unions nested in other structures and unions is undeniably tedious and yet it can be instructive. Look, for instance, at _UMS_CREATE_THREAD_ATTRIBUTES. The definition in WINNT.H does not have the anonymous unions, but their existence is known from type information in CLFSMGMT.LIB. The explanation is that the definition in WINNT.H is not whole:

source
typedef struct _UMS_CREATE_THREAD_ATTRIBUTES {  
    DWORD UmsVersion;   
        PVOID UmsContext;   
        PVOID UmsCompletionList;   
} UMS_CREATE_THREAD_ATTRIBUTES, *PUMS_CREATE_THREAD_ATTRIBUTES; 

Practised readers of Microsoft’s published headers will recognise that the unusual alignment of the text—and especially the trailing white space that does not show readily in a web browser—is a tip-off. The full definition has two anonymous unions, each wrapping one of the pointers that seem overly-indented in the WINNT.H definition. Programmers who have access to the full definition have additional members whose types show what’s pointed to. The full definition must look very much like:

source
typedef struct _UMS_CREATE_THREAD_ATTRIBUTES {  // winnt
    DWORD UmsVersion;   // winnt
    union {
        PRTL_UMS_CONTEXT RtlUmsContext;
        PVOID UmsContext;   // winnt
    };
    union {
        PRTL_UMS_COMPLETION_LIST RtlUmsCompletionList;
        PVOID UmsCompletionList;   // winnt
    };
} UMS_CREATE_THREAD_ATTRIBUTES, *PUMS_CREATE_THREAD_ATTRIBUTES; // winnt

There are a few editorical choices here. I omit whatever it is (empty lines and commenting, most likely) that spreads the definition so that the successive opening braces are 11 and 9 lines apart instead of the 2 and 4 that I show. Though the single-line comments that mark their lines for passing into WINNT.H have no neat alignment, they reproduce the trailing white space that survives in WINNT.H. With one exception, each is simply at the next tab stop. The PRTL_UMS_CONTEXT and PRTL_UMS_COMPLETION_LIST are known from the type information to be Microsoft’s typedef names for pointers to the relevant structures (defined in ntrtl_x.h) and it would be unusual of Microsoft not to use them here.

Which definition shows in symbol files varies with the module and how it was built. For instance, URLMON.DLL picks up the reduced definition from WINNT.H but OLE32.DLL has the full definition from NTPSAPI_X.H—well, as full as we yet know.

The wonder is that WINNT.H has any definition at all of UMS_CREATE_THREAD_ATTRIBUTES. Someone at Microsoft evidently took trouble to get it there, and yet it’s an orphan: neither WINNT.H nor any other header in either the SDK or WDK has any reference to it.

Anti-Trust Settlement Forensics

Of all the types that are known to be defined in NTPSAPI_X.H for the original Windows 10 (see the preceding table), here for the record are those that are not defined in any of the standard headers for either kernel-mode or user-mode programming and were not accessible to the source code for URLMON.DLL from including NTPSAPI_X.H when building for the original release of 32-bit Windows 10: none.

Many of the other types that are defined in NTPSAPI_X.H will have been accessible too, of course, but the symbol file shows that URLMON.DLL got these unremarkably: from WINNT.H, as might any other user-mode DLL. For those that are not defined in the standard headers, the programmers of URLMON had complete access.