Post · 10 min read· pp. 2398–2405

HAL.H

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

d:\th\minkernel\ntos\inc

and draws from it the type definitions that are tablulated below.

The header HAL.H is not known in any Device Driver Kit (DDK) or Windows Driver Kit (WDK), but all the types that the kernel’s public symbol file picks up from HAL.H are defined in the NTOSP.H which Microsoft looks to have published by oversight with the original and Version 1511 editions of the Windows 10 WDK. Two of these types are also defined in the standard headers of kernel-mode programming, WDM.H and NTDDK.H, one each. The line numbers on the left are from the unseen HAL.H but are known from the symbol file. Those on the right are from the published headers.

Line NumberTypeWDM.HNTDDK.HNTOSP.H
99struct _DEVICE_DESCRIPTION3322134620
931enum _IPI_TYPE35156
3983struct _HAL_NODE_RANGE37940
3998struct _HAL_CHANNEL_MEMORY_RANGES37955
4155enum HAL_APIC_DESTINATION_MODE1222838080
4188struct _INTERRUPT_REMAPPING_INFO38113
4193anonymous union u in struct _INTERRUPT_REMAPPING_INFO38118
4196anonymous struct Msi in anonymous union u in struct _INTERRUPT_REMAPPING_INFO38121
4235enum INTERRUPT_CONNECTION_TYPE38160
4246struct _INTERRUPT_HT_INTR_INFO38171
4248anonymous union LowPart in struct _INTERRUPT_HT_INTR_INFO38173
4249anonymouns struct bits in anonymous union LowPart in struct _INTERRUPT_HT_INTR_INFO38174
4265anonymous union HighPart in struct _INTERRUPT_HT_INTR_INFO38190
4266anonymous struct bits in anonymous union HighPart in struct _INTERRUPT_HT_INTR_INFO38191
4283struct _INTERRUPT_VECTOR_DATA38208
4303anonymous struct ControllerInput in struct _INTERRUPT_VECTOR_DATA38228
4310anonymous struct XapicMessage in struct _INTERRUPT_VECTOR_DATA32235
4315anonymous struct Hypertransport in struct _INTERRUPT_VECTOR_DATA38240
4319anonymous struct GenericMessage in struct _INTERRUPT_VECTOR_DATA38244
4324anonymous struct MessageRequest in struct _INTERRUPT_VECTOR_DATA38249
4337struct _INTERRUPT_CONNECTION_DATA38262

Reconstruction

HAL.H line numbers for a few more types are known from the pubilc symbol file for Microsoft’s ACPI.SYS driver. Plainly, HAL.H defines many more types than show in public symbol files. Conversly, although WDM.H and NTDDK.H each have only one of the HAL.H types that show in the public symbol files for the kernel, even a brief look at surrounding lines suggests that both headers have yet more types from HAL.H—more, even, than show in any symbol files that Microsoft is known to have published.

By far the greatest disclosure of types that are defined in HAL.H is not from any symbol file or from any header for kernel-mode programming. It is instead from a statically linked library, named CLFSMGMT.LIB, which Microsoft distributes with the Software Development Kit (SDK) as if for user-mode programming. It has type information from archiving an object file that’s produced by making a pre-compiled header. This PCH will have saved time when compiling other source files for the library, but a side-effect is that type information, if there’s any, is for all the types that might be used, rather than just those that actually do get used. Microsoft surely didn’t mean it, but this publicly released library’s record of types and line numbers in the otherwise very private HAL.H is credibly complete.

A detraction of type information in libraries is that it can be, and often is, out of date. Symbol files for a binary that is distributed with the operating system are created with the binary and can be taken as definitive for this operating system. This is depended on vitally for the debugger’s location of internal functions and variables, if not for the debugger extensions’ interpretation of types. In contrast, a library may be targeted for an operating system but have been built even years before. It exists to help the linker resolve external references and it remains relevant for as long as do the references. Especially if type information is in the library only by oversight, it can be quite stale without any effect for the library’s intended use.

For instance, the CLFSMGMT.LIB in the SDK for Windows 7 was built on 11th June 2009, more than a month before the Windows 7 kernel on 14th July. The headers that were used when building the library can have been edited since. Type information from those headers as compiled for the library is still informative, even immensely so, but is not definitive for the not-quite-matching operating system.

It happens that no such delay affects the CLFSMGMT.LIB in the SDK for the original Windows 10. Indeed, this library was built a little later on the same day as the operating system. For all the types in the symbol files for the kernel and for drivers such as ACPI.SYS, the line numbers agree perfectly with those in the library. For the many more types that are known from the library, the line numbers almost certainly are correct. The CLFSMGMT.LIB from the original Windows 10 SDK plausibly contains a catalogue of all types that are defined in the unseen HAL.H in Microsoft’s source code for the original Windows 10.

Other published material allows for more than a catalogue of which types are defined in HAL.H and the line numbers at which those definitions start. Some of these types are also defined in one or more of the standard headers of kernel-mode programming, e.g., WDM.H and NTDDK.H. It may be that content is extracted from HAL.H to the standard headers. It may be that all are extracted from yet some other input. However it’s done, the effect looks to be that successive lines of HAL.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 HAL.H. Matching line numbers for type definitions as seen in the standard headers and deduced for HAL.H then supports a reasonable attempt at reconstructing much of what HAL.H must have between its type definitions. The table below is a skeleton for reconstructing the HAL.H from the original Windows 10.

Reconstruction is greatly helped by Microsoft’s disclosure of NTOSP.H. This header covers much more of HAL.H than do all the standard WDK headers in total. Between the type definitions are many function prototypes, macro definitions and even the occasional comment that might pass as informative. Without the C-language definitions in NTOSP.H and the type information in CLFSMGMT.LIB, hardly anything from HAL.H would ever have been known except through different reverse engineers' made-up definitions (or through leaked source code or, worse, through leaked definitions that are passed off as reverse engineering). With these disclosures by Microsoft, studies of the HAL and its interface with the kernel and a few drivers can share Microsoft’s definitions, which is no small help.

HAL.HTypeWDM.HNTDDK.HNTOSP.H
53struct _OEM_FONT_FILE_HEADER34577
84unnamed struct Map in struct _OEM_FONT_FILE_HEADER34608
99struct _DEVICE_DESCRIPTION3322134620
153struct _DMA_ADAPTER_INFO_V13326434674
161struct _DMA_ADAPTER_INFO3327234682
163anonymous union in struct _DMA_ADAPTER_INFO3327434684
174struct _DMA_TRANSFER_INFO_V13328534695
180struct _DMA_TRANSFER_INFO3329134701
182anonymous union in struct _DMA_TRANSFER_INFO3329334703
218struct _PARTITION_DESCRIPTOR34739
769enum _HAL_DMA_CRASH_DUMP_REGISTER_TYPE1145035046
931enum _IPI_TYPE35156
983struct _HAL_LOG_REGISTER_CONTEXT35183
1131struct _SUPPORTED_RANGE
1139struct _SUPPORTED_RANGES
1163struct _BUS_HANDLER
1318struct _HAL_STATE_ELEMENT35275
1325struct _HAL_STATE_ELEMENT_INFORMATION35282
1337enum _HAL_QUERY_INFORMATION_CLASS1155735294
1385enum _HAL_SET_INFORMATION_CLASS1160535342
1409struct _HAL_SET_I386_EXCEPTION_CHAIN_TERMINATOR_INFORMATION35366
1513struct _PM_DISPATCH_TABLE1170035470
1615struct _MAP_REGISTER_ENTRY1177535572
1687struct DEBUG_DEVICE_ADDRESS1182935644
1695struct DEBUG_MEMORY_REQUIREMENTS1183735652
1704enum KD_NAMESPACE_ENUM1184635661
1717enum KD_CALLBACK_ACTION1185935674
1728struct _DEBUG_TRANSPORT_DATA1187035685
1739struct _DEBUG_DEVICE_DESCRIPTOR1188135696
1748anonymous union in struct _DEBUG_DEVICE_DESCRIPTOR1189035705
1750anonymous struct in anonymous union in struct _DEBUG_DEVICE_DESCRIPTOR1189235707
1773struct _PCI_DEBUGGING_DEVICE_IN_USE1191535730
1779struct _ACPI_DEBUGGING_DEVICE_IN_USE1192135736
1784struct _DEBUGGING_DEVICE_IN_USE1192635741
1787anonymous union in struct _DEBUGGING_DEVICE_IN_USE1192935744
1793struct _DEBUGGING_DEVICE_IN_USE_INFORMATION1193535750
1991struct _HAL_DP_REPLACE_PARAMETERS35948
2194struct _HAL_CLOCK_TIMER_MODE36151
2204struct _HAL_CLOCK_TIMER_CONFIGURATION36161
2205anonymous union in struct _HAL_CLOCK_TIMER_CONFIGURATION36162
2207anonymous struct in anonymous union in struct _HAL_CLOCK_TIMER_CONFIGURATION36164
2556union _HAL_UNMASKED_INTERRUPT_FLAGS36513
2557anonymous struct in union _HAL_UNMASKED_INTERRUPT_FLAGS36514
2566struct _HAL_UNMASKED_INTERRUPT_INFORMATION36523
2726struct HAL_DISPATCH1206036683
2806struct HAL_PRIVATE_DISPATCH36763
3318struct _HAL_IOMMU_DISPATCH37275
3366struct _HAL_BUS_INFORMATION1213837323
3374struct _HAL_DISPLAY_BIOS_INFORMATION1214637331
3381struct _HAL_POWER_INFORMATION1215337338
3386struct _HAL_PROCESSOR_SPEED_INFO1215837343
3391struct _HAL_CALLBACKS1216337348
3397struct _HAL_PROCESSOR_FEATURE1216837354
3405struct _HAL_PROFILE_SOURCE_INFORMATION37362
3413struct _HAL_PROFILE_SOURCE_INFORMATION_EX37370
3423struct _HAL_PROFILE_SOURCE_INTERVAL37380
3429struct _HAL_PROFILE_SOURCE_LIST37386
3438enum _HAL_PLATFORM_TIMER_SOURCE37395
3459struct _HAL_PLATFORM_TIMER_INFORMATION37416
3467struct _HAL_ACPI_AUDIT_INFORMATION37424
3469anonymous struct in struct _HAL_ACPI_AUDIT_INFORMATION37426
3478struct _HAL_PARKING_PAGE_INFORMATION37435
3486struct _HAL_IOMMU_RESERVED_REGION_INFORMATION37443
3493struct _HAL_QUERY_PROCESSOR_EFFICIENCY_INFORMATION37450
3679union _HAL_X64_SEGMENT_SELECTOR37636
3681anonymous struct in _HAL_X64_SEGMENT_SELECTOR37638
3708struct _HAL_HV_SVM_SYSTEM_CAPABILITIES37665
3709anonymous struct in struct _HAL_HV_SVM_SYSTEM_CAPABILITIES37666
3735struct _HAL_HV_SVM_DEVICE_CAPABILITIES37692
3736anonymous struct in struct _HAL_HV_SVM_DEVICE_CAPABILITIES37693
3846struct _HAL_INTEL_ENLIGHTENMENT_INFORMATION37803
3970struct _HAL_NUMA_TOPOLOGY_INTERFACE37927
3983struct _HAL_NODE_RANGE37940
3990struct _HAL_IRT_INFORMATION37947
3998struct _HAL_CHANNEL_MEMORY_RANGES37955
4014enum HAL_PCC_CHANNEL_POWER_COMMAND37971
4022struct _HAL_CHANNEL_COMMAND37979
4035struct _HAL_EXTERNAL_CACHE_INFO37992
4044union _HAL_PSCI_INFO38001
4046anonymous struct in union _HAL_PSCI_INFO38003
4056union _INTERRUPT_CONTROLLER_INFO38013
4058anonymous struct in union _INTERRUPT_CONTROLLER_INFO38015
4071struct _ARM_ERRATA_INFO38028
4072anonymous union in struct _ARM_ERRATA_INFO38029
4074anonymous struct in anonymous union in struct _ARM_ERRATA_INFO38031
4096struct _HAL_AMLI_BAD_IO_ADDRESS_LIST1218838053
4130struct _HAL_MCA_INTERFACE12222
4142enum HAL_INTERRUPT_TARGET_TYPE38067
4155enum HAL_APIC_DESTINATION_MODE1222838080
4164struct _HAL_INTERRUPT_TARGET_INFORMATION38089
4169anonymous union in struct _HAL_INTERRUPT_TARGET_INFORMATION38094
4170unnamed struct Apic in anonymous union in struct _HAL_INTERRUPT_TARGET_INFORMATION38095
4176unnamed struct Irt in anonymous union in struct _HAL_INTERRUPT_TARGET_INFORMATION38101
4188struct _INTERRUPT_REMAPPING_INFO38113
4193unnamed union u in struct _INTERRUPT_REMAPPING_INFO38118
4196unnamed struct Msi in unnamed union u in struct _INTERRUPT_REMAPPING_INFO39121
4204struct _HAL_MESSAGE_TARGET_REQUEST38129
4207unnamed struct Apic in struct _HAL_MESSAGE_TARGET_REQUEST38132
4235enum INTERRUPT_CONNECTION_TYPE38160
4246struct _INTERRUPT_HT_INTR_INFO38171
4248unnamed union LowPart in struct _INTERRUPT_HT_INTR_INFO38173
4249unnamed struct bits in unnamed union LowPart in struct _INTERRUPT_HT_INTR_INFO38174
4265unnamed union HighPart in struct _INTERRUPT_HT_INTR_INFO38190
4266unnamed struct bits in unnamed union HighPart in struct _INTERRUPT_HT_INTR_INFO38191
4283struct _INTERRUPT_VECTOR_DATA38208
4303unnamed struct ControllerInput in struct _INTERRUPT_VECTOR_DATA38228
4309anonymous union in struct _INTERRUPT_VECTOR_DATA38234
4310unnamed struct XapicMessage in anonymous union in struct _INTERRUPT_VECTOR_DATA38235
4315unnamed struct Hypertransport in anonymous union in struct _INTERRUPT_VECTOR_DATA38240
4319unnamed struct GenericMessage in anonymous union in struct _INTERRUPT_VECTOR_DATA38244
4324unnamed struct MessageRequest in anonymous union in struct _INTERRUPT_VECTOR_DATA38249
4337struct _INTERRUPT_CONNECTION_DATA38262
4401struct _MCA_DRIVER_INFO12289
4412enum KERNEL_MCE_DELIVERY_OPERATION
4428struct KERNEL_ERROR_HANDLER_INFO
4467struct _HAL_ERROR_INFO12297
4560struct _CMC_DRIVER_INFO12379
4566struct _CPE_DRIVER_INFO12385
4572struct _HAL_PLATFORM_INFORMATION12391
4592struct _SCATTER_GATHER_ELEMENT3337438272
4604struct _SCATTER_GATHER_LIST3338638284
4628struct _DMA_ADAPTER3341038308
4635enum DMA_COMPLETION_STATUS3341738315
4956struct _DMA_OPERATIONS3373838636
5404struct _MEMORY_CACHING_REQUIREMENTS
5422enum _PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE12598
5451struct _PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR12627
5454unnamed union u in struct _PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR12630
5457unnamed struct Range in unnamed union u in struct _PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR12633
5484struct _PHYSICAL_COUNTER_RESOURCE_LIST12660