Post · 17 min read· pp. 2410–2420

HVGDK_MINI.H

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

d:\th.public.fre\internal\minwin\priv_sdk\inc

and draws from it the following type definitions:

The header HVGDK_MINI.H is not known in any Device Driver Kit (DDK) or Windows Driver Kit (WDK). There was, however, an HVGDK.H in the WDK for Windows 7. It defines the HV_PARTITION_PRIVILEGE_MASK at line 2653. That’s no small difference. It may mean that the reduction suggested by the MINI suffix was of thousands of lines. More likely, though, is that separating material to another header brought with it a substantial rearrangement.

Anti-Trust Settlement Forensics

For the record, Microsoft’s possibly accidental inclusion of private symbol files for URLMON.DLL in downloadable packages of public symbols shows that many more types were accessible to the source code for URLMON.DLL from including HVGDK_MINI.H when building for the original release of 32-bit Windows 10:

Line NumberType
431struct _HV_HYPERVISOR_VERSION_INFO
449union _HV_PARTITION_PRIVILEGE_MASK
565union _HV_X64_PLATFORM_CAPABILITIES
650enum _HV_CPUID_FUNCTION
689struct _HV_VENDOR_AND_MAX_FUNCTION
700struct _HV_HYPERVISOR_INTERFACE_INFO
717struct _HV_X64_HYPERVISOR_FEATURES
811struct _HV_X64_ENLIGHTENMENT_INFORMATION
885struct _HV_IMPLEMENTATION_LIMITS
917struct _HV_X64_HYPERVISOR_HARDWARE_FEATURES
960struct _HV_X64_HYPERVISOR_CPU_MANAGEMENT_FEATURES
1062struct _HV_HYPERVISOR_SVM_FEATURES
1089union _HV_CPUID_RESULT
1101unnamed struct for VersionAndFeatures in union _HV_CPUID_RESULT

None of these types are known from headers that Microsoft publishes for either kernel-mode or user-mode programming for Windows 10 by programmers outside Microsoft. Most were not yet defined for Windows 7 and therefore were not published even in the short-lived HVGDK.H. Indeed, most are not disclosed even as type information in other symbol files except for the Windows 8.1 kernel. Aside from the curiosity of their appearance for just one version, there is also that the symbol files for the Windows 8.1 kernel have type information for one enumeration that the symbol files for the Windows 8.1 URLMON do not. This is the HV_HYPERVISOR_INTERFACE. How this happened is not known: more research is required.

The point to singling out URLMON.DLL is of course that it is part of Internet Explorer. It was first distributed with Internet Explorer. Even for Windows 10 its version numbering still follows that of Internet Explorer. Microsoft defended an anti-trust suit that was largely motivated by complaints that Microsoft’s development and distribution of Internet Explorer in competition with other web browsers benefited from Microsoft’s monopoly control of the operating system that these web browsers run on. Among the complaints is that Microsoft’s programmers of Internet Explorer had access to programming resources for Windows that were not available to the programmers of competing web browsers. Plainly they did!

Whether such access got Internet Exlorer any direct benefit is another question. Whether it got an indirect benefit, as with faster or easier development just from knowing more than was explicitly used, is also another question. The evidence here is just that they did have the alleged access and still had it many years after the supposed enforcement of a settlement that ought to have seen the access removed. Either that or the access has been arranged since, which some would say is worse for its surely deliberate contempt of the settlement.

The published symbol files for URLMON.DLL also suggest a little of how HVGDK_MINI.H comes to exist. As noted above, Microsoft published an HVGDK.H for Windows 7 but never for any later version. Also described above from symbol files for Windows 8 and higher, some types that are defined in the Windows 7 HVGDK.H are later defined in HVGDK_MINI.H. The natural supposition is that HVGDK_MINI.H was extracted from HVGDK.H, but does the latter still exist and is the former the only extract? The answers look to be yes and no, respectively.

Symbol files for URLMON.DLL in Windows 8 and higher confirm the continued existence of a header named HVGDK.H and the existence of an otherwise unknown HVGDK_EXT.H. These are not in the same directory as HVGDK_MINI.H. For the original Windows 10, they are instead at

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

as if to suggest they are specialised to a “vm” project, separate from the “minkernel” and not as any sort of SDK, private or otherwise. No type definitions are reported from these headers and it may indeed be that URLMON.DLL would be no different if built without access to these headers. What is reported is that the two paths that have the various HVGDK headers are named in -I switches that are given to the compiler only when building source files while the current directory is

d:\th\inetcore\lib\common\iel1_sp

The source files are all in this directory’s parent: strcmpii.cpp, ieisos_sp.cpp, easyclassfactory.cpp, brproc.cpp, handlehelpers.cpp, dxhardwaredenylist.cpp, dxgiadapterwrapper.cpp, gcount.cpp, lrieutil.cpp, privacieutil.cpp, ieprocesshelper.cpp, strutil.cpp, hashtable.cpp, iecrypt.cpp, ieverdetect.cpp, ieisos_phonentimpl.cpp, cmptime.cpp, useraccess.cpp, idllib.cpp, ishost_sp.cpp and arrayimpl.cpp.

The point to the tedium of listing them, aside from noticing that several are plainly named for Internet Explorer, is that this—meaning their names and their inclusion of system-level headers that aren’t generally available to the programmers of web browsers—is what can be learnt from forensic analysis of an Internet Explorer DLL at the distance of having only the symbol files. For supervising Microsoft’s compliance with the anti-trust settlement, the Technical Committee had source code. Whatever this supervision achieved, however it was conducted, it evidently did not establish at Microsoft any persistent caution that Microsoft’s web browser in competition with others must not have the anti-competitive advantage of being programmed with access to definitions for Microsoft’s monopoly product that are withheld from the competitors. It might not be too cynical to suspect that what was established at Microsoft is an attitude that inevitably inadequate supervision lets Microsoft get away with pretty much whatever it wants.

There is here an enduring lesson for governments: advanced technology might still be influenced through business, legal and political mechanisms but it is too advanced for enforcement. Probably everyone knows, but it’s as well to have a record.

Other Forensics

The most complete catalogue that I know of types defined in HVGDK_MINI.H is from type information not in any symbol files but in a statically linked library. That object files and libraries (which are essentially archives of object files) can have type information is often overlooked, even by experts at reverse engineering. Type information is retained in only very few libraries that Microsoft publishes for programmers to link their code to. It seems fair to suspect that almost all cases, especially in any WDK or Software Development Kit (SDK), are oversights. Still, they are as openly published as are any symbol files that Microsoft publishes as debugging support. In some ways type information in libraries is better than in symbol files, and in some ways worse. Their forensic value is less because the libraries are typically developed separately from the operating system. Type information in a library is immaterial to the library’s role as supplier of code for a linker’s resolution of external references. Even in a library that is clearly targeted to one version of the operating system, its type information can be a long way out of date, and often is. Against this is that type information in a library or object file is sometimes—rarely, but sometimes—much more extensive than in symbol files because there hasn’t yet been any selection according to use.

Two statically linked libraries in open distribution are known to have type information from compiling HVGDK_MINI.H. One is relatively recent, only for Windows 10 but continuing at least to the 2004 release, and has obvious relevance to the Hypervisor. It is named KDHV.LIB. Microsoft distributes it among the programming samples in the package of Debugging Tools for Windows. If only for the version that targets the original Windows 10, its type information from HVGDK_MINI.H comes from compiling two source files. Their names, kdhvintel.c and kdhvhc.c, likely don’t matter. What does is that the type information is already selected according to what the compiler used for each object. What used means in this context can be surprising, but the essential point is that although the private symbols in this library cover many more hypervisor types than do the public symbols for the kernel, the library is not much of a gold mine.

The other library is. It is named CLFSMGMT.LIB. That it has no obvious relevance to any hypervisor may be why it seems to have escaped the attention of most researchers (including me in 2016 when I first wrote about Hyper-V support). Yet this library knows of HVGDK_MINI.H as far back as Windows Vista—curiously without knowing of HVGDK.H even in the library’s versions for Windows 7. This is a very odd library. Microsoft distributes it only with the SDK, not the WDK. The Windows 10 SDK even puts it in a subdirectory named “um” as if to make explicit that it’s for user-mode programming. Yet the library has kernel-mode code to support the CLFS.SYS file system driver. This mixture of modes may explain the curious way it got built. Still, take its publication as a gift.

What makes CLFSMGMT.LIB a gold mine for hypervisor studies is that its type information from HVGDK_MINI.H comes from precompilation. This type information is therefore not of types that have got used but of types that might get used. Speaking again of the version for the original Windows 10, just for concreteness, the library archives five objects. Four are compiled from C++ source files that are particular to the library’s contribution to its project. Again the names likely don’t matter: public_interface.cpp, managed_log.cpp, managed_client.cpp and log_collection.cpp. Each is compiled using a pre-compiled header. The fifth object in the library, stdpch.obj, is what was precompiled from a (pre-processed) C++ source file named pch_hdr.src to use for the other source files where they would #include stdpch.h.

The lesson here goes several ways. For programmers, even at Microsoft, understand that if you throw everything but the kitchen sink into a precompiled header that you create by compiling a source file into an object file, then the object file contains pretty much everything but the kitchen sink! If the project was to build a library of archived object files, then be sure to exempt this object file from the archive—well, unless you really do mean that reverse engineers should have everything but the kitchen sink. For commentators on reverse engineering, especially if taking the line that information supposedly found by reverse engineering couldn’t possibly have been found without source code, please think a little more about what some techniques of building from source code may let slip into the finished product. For reverse engineers, remember that symbol files aren’t everything. Even a software manufacturer as careful as Microsoft sometimes builds the software in ways that reveal far more than intended.

The table that follows is of user-defined types (classes, enumerations, structures and unions) for which the CLFSMGMT.LIB from the SDK for the original release of Windows 10 shows the type as defined in HVGDK_MINI.H:

Line NumberType
82union _HV_UINT128
84anonymous struct in union _HV_UINT128
97struct _HV_UINT256
108struct _HV_UINT512
326enum _HV_HYPERVISOR_INTERFACE
341enum _HV_SERVICE_BRANCH
369enum _HV_GUEST_OS_VENDOR
375enum _HV_GUEST_OS_MICROSOFT_IDS
386enum _HV_GUEST_OS_OPENSOURCE_IDS
401union _HV_GUEST_OS_ID_CONTENTS
404anonymous struct in union _HV_GUEST_OS_ID_CONTENTS
417unnamed struct for OpenSource in union _HV_GUEST_OS_ID_CONTENTS
431struct _HV_HYPERVISOR_VERSION_INFO
449union _HV_PARTITION_PRIVILEGE_MASK
452anonymous struct in union _HV_PARTITION_PRIVILEGE_MASK
565union _HV_X64_PLATFORM_CAPABILITIES
567anonymous struct in union _HV_X64_PLATFORM_CAPABILITIES
650enum _HV_CPUID_FUNCTION
689struct _HV_VENDOR_AND_MAX_FUNCTION
700struct _HV_HYPERVISOR_INTERFACE_INFO
717struct _HV_X64_HYPERVISOR_FEATURES
811struct _HV_X64_ENLIGHTENMENT_INFORMATION
885struct _HV_IMPLEMENTATION_LIMITS
917struct _HV_X64_HYPERVISOR_HARDWARE_FEATURES
960struct _HV_X64_HYPERVISOR_CPU_MANAGEMENT_FEATURES
1062struct _HV_HYPERVISOR_SVM_FEATURES
1089union _HV_CPUID_RESULT
1091anonymous struct in union _HV_CPUID_RESULT
1101unnamed struct for VersionAndFeatures in union _HV_CPUID_RESULT
1157union _HV_X64_MSR_HYPERCALL_CONTENTS
1160anonymous struct in union _HV_X64_MSR_HYPERCALL_CONTENTS
1183union _HV_REGISTER_VP_ASSIST_PAGE
1186anonymous struct in union _HV_REGISTER_VP_ASSIST_PAGE
1316union _HV_X64_MSR_RESET_CONTENTS
1319anonymous struct in union _HV_X64_MSR_RESET_CONTENTS
1358struct _HV_VIRTUAL_APIC_ASSIST
1360anonymous union in struct _HV_VIRTUAL_APIC_ASSIST
1363anonymous struct in anonymous union in struct _HV_VIRTUAL_APIC_ASSIST
1373enum _HV_CALL_CODE
1979union _HV_HYPERCALL_INPUT
1984anonymous struct in union _HV_HYPERCALL_INPUT
1999union _HV_HYPERCALL_OUTPUT
2004anonymous struct in union _HV_HYPERCALL_OUTPUT
2031union _HV_GVA_RANGE_SIMPLE
2035anonymous struct in union _HV_GVA_RANGE_SIMPLE
2052union _HV_GVA_RANGE_EXTENDED
2056anonymous struct in union _HV_GVA_RANGE_EXTENDED
2078anonymous struct in union _HV_GVA_RANGE_EXTENDED
2108union _HV_GVA_RANGE
2146struct _HV_INPUT_FLUSH_VIRTUAL_ADDRESS_SPACE_HEADER
2160struct _HV_INPUT_FLUSH_VIRTUAL_ADDRESS_SPACE
2171struct _HV_INPUT_FLUSH_VIRTUAL_ADDRESS_LIST
2181struct _HV_OUTPUT_GET_PARTITION_ID
2192struct _HV_INPUT_SEND_SYNTHETIC_CLUSTER_IPI
2244union _HV_X64_MSR_REFERENCE_TSC_CONTENTS
2247anonymous struct in union _HV_X64_MSR_REFERENCE_TSC_CONTENTS
2266struct _HV_REFERENCE_TSC_PAGE
2302enum _HV_INTERRUPT_TYPE
2339union _HV_SYNIC_SINT
2342anonymous struct in union _HV_SYNIC_SINT
2407enum _HV_ARCHITECTURE
2415struct _HV_X64_SEGMENT_REGISTER
2420anonymous union in struct _HV_X64_SEGMENT_REGISTER
2422anonymous struct in anonymous union in struct _HV_X64_SEGMENT_REGISTER
2439struct _HV_X64_TABLE_REGISTER
2453union _HV_X64_XSAVE_XFEM_REGISTER
2457anonymous struct in union _HV_X64_XSAVE_XFEM_REGISTER
2463anonymous struct in union _HV_X64_XSAVE_XFEM_REGISTER
2477struct _HV_X64_XSAVE_HEADER
2503union _HV_X64_FP_CONTROL_STATUS_REGISTER
2506anonymous struct in union _HV_X64_FP_CONTROL_STATUS_REGISTER
2514anonymous union in anonymous struct in union _HV_X64_FP_CONTROL_STATUS_REGISTER
2519anonymous struct in anonymous union in anonymous struct in union _HV_X64_FP_CONTROL_STATUS_REGISTER
2528union _HV_X64_XMM_CONTROL_STATUS_REGISTER
2531anonymous struct in union _HV_X64_XMM_CONTROL_STATUS_REGISTER
2533anonymous union in anonymous struct in union _HV_X64_XMM_CONTROL_STATUS_REGISTER
2538anonymous struct in anonymous union in anonymous struct in union _HV_X64_XMM_CONTROL_STATUS_REGISTER
2549union _HV_X64_FP_REGISTER
2552anonymous struct in union _HV_X64_FP_REGISTER
2561union _HV_X64_FP_MMX_REGISTER
2573union _HV_X64_FX_REGISTERS
2575anonymous struct in union _HV_X64_FX_REGISTERS
2604union _HV_X64_X_REGISTERS
2606anonymous struct in union _HV_X64_X_REGISTERS
2612anonymous union in anonymous struct in union _HV_X64_X_REGISTERS
2645union _HV_X64_XSAVE_AREA
2651struct _HV_X64_CONTEXT
2779anonymous union in struct _HV_X64_CONTEXT
2800struct _HV_ARM64_CONTEXT
2924struct _HV_VP_CONTEXT
2938anonymous union in struct _HV_VP_CONTEXT
2950struct _HV_X64_MSR_STIMER_CONFIG_CONTENTS
2952anonymous union in struct _HV_X64_MSR_STIMER_CONFIG_CONTENTS
2955anonymous struct in anonymous union in struct _HV_X64_MSR_STIMER_CONFIG_CONTENTS
2979union _HV_PORT_ID
2983anonymous struct in union _HV_PORT_ID
3002enum _HV_MESSAGE_TYPE
3061union _HV_SYNIC_SIMP
3064anonymous struct in union _HV_SYNIC_SIMP
3082enum HV_EVENTLOG_TYPE
3094struct _HV_EVENTLOG_MESSAGE_PAYLOAD
3106union _HV_MESSAGE_FLAGS
3109anonymous struct in union _HV_MESSAGE_FLAGS
3120struct _HV_MESSAGE_HEADER
3126anonymous union in struct _HV_MESSAGE_HEADER
3138struct _HV_TIMER_MESSAGE_PAYLOAD
3150struct _HV_MESSAGE
3153anonymous union in struct _HV_MESSAGE
3165struct _HV_MESSAGE_PAGE
3176union _HV_X64_MSR_NPIEP_CONFIG_CONTENTS
3179anonymous struct in union _HV_X64_MSR_NPIEP_CONFIG_CONTENTS
3227struct _HV_INPUT_POST_DEBUG_DATA
3234struct _HV_OUTPUT_POST_DEBUG_DATA
3239struct _HV_INPUT_RETRIEVE_DEBUG_DATA
3246struct _HV_OUTPUT_RETRIEVE_DEBUG_DATA
3253struct _HV_DEBUG_NET_DATA
3271struct _HV_INPUT_RESET_DEBUG_SESSION
3276struct _HV_OUTPUT_RESET_DEBUG_SESSION
3300union _HV_CRASH_CTL_REG_CONTENTS
3303anonymous struct in union _HV_CRASH_CTL_REG_CONTENTS
3336union _HV_INPUT_VTL
3339anonymous struct in union _HV_INPUT_VTL
3351struct _HV_INITIAL_VP_CONTEXT
3425union _HV_ENABLE_PARTITION_VTL_FLAGS
3428anonymous struct in union _HV_ENABLE_PARTITION_VTL_FLAGS
3435struct _HV_INPUT_ENABLE_PARTITION_VTL
3450struct _HV_INPUT_DISABLE_PARTITION_VTL
3465struct _HV_INPUT_ENABLE_VP_VTL
3480struct _HV_INPUT_DISABLE_VP_VTL
3493union _HV_VTL_RETURN_INPUT
3497anonymous struct in union _HV_VTL_RETURN_INPUT
3513enum _HV_VTL_MBEC_MODE
3527union _HV_REGISTER_VSM_VP_VTL_CONTROL
3530anonymous struct in union _HV_REGISTER_VSM_VP_VTL_CONTROL
3546union _HV_REGISTER_VSM_CODE_PAGE_OFFSETS
3549anonymous struct in union _HV_REGISTER_VSM_CODE_PAGE_OFFSETS
3564union _HV_REGISTER_VSM_PARTITION_STATUS
3567anonymous struct in union _HV_REGISTER_VSM_PARTITION_STATUS
3582union _HV_REGISTER_VSM_VP_STATUS
3585anonymous struct in union _HV_REGISTER_VSM_VP_STATUS
3594enum _HV_REGISTER_NAME
3601union _HV_REGISTER_VSM_VINA
3604anonymous struct in union _HV_REGISTER_VSM_VINA
3640union _HV_REGISTER_VSM_CAPABILITIES
3643anonymous struct in union _HV_REGISTER_VSM_CAPABILITIES
3663union _HV_REGISTER_VSM_VP_SECURE_VTL_CONFIG
3666anonymous struct in union _HV_REGISTER_VSM_VP_SECURE_VTL_CONFIG
3681union _HV_REGISTER_VSM_PARTITION_CONFIG
3684anonymous struct in union _HV_REGISTER_VSM_PARTITION_CONFIG
3696enum _HV_VTL_ENTRY_REASON
3717struct _HV_VP_VTL_CONTROL
3730unnamed union for VinaStatus in struct _HV_VP_VTL_CONTROL
3733anonymous struct in unnamed union for VinaStatus in struct _HV_VP_VTL_CONTROL
3749anonymous union in struct _HV_VP_VTL_CONTROL
3751anonymous struct in anonymous union in struct _HV_VP_VTL_CONTROL
3757anonymous struct in anonymous union in struct _HV_VP_VTL_CONTROL
3775struct _HV_VP_ASSIST_PAGE
4363union _HV_EXPLICIT_SUSPEND_REGISTER
4366anonymous struct in union _HV_EXPLICIT_SUSPEND_REGISTER
4369anonymous struct in union _HV_EXPLICIT_SUSPEND_REGISTER
4373union _HV_INTERCEPT_SUSPEND_REGISTER
4383union _HV_X64_INTERRUPT_STATE_REGISTER
4386anonymous struct in union _HV_X64_INTERRUPT_STATE_REGISTER
4396enum _HV_X64_PENDING_INTERRUPTION_TYPE
4403union _HV_X64_PENDING_INTERRUPTION_REGISTER
4406anonymous struct in union _HV_X64_PENDING_INTERRUPTION_REGISTER
4453union _HV_REGISTER_VALUE
4494struct _HV_REGISTER_ASSOC
4501struct _HV_INPUT_SET_VP_REGISTERS
4517struct _HV_INPUT_GET_VP_REGISTERS
4528union _HV_REGISTER_CR_INTERCEPT_CONTROL
4531anonymous struct in union _HV_REGISTER_CR_INTERCEPT_CONTROL
4559struct _HV_INPUT_START_VIRTUAL_PROCESSOR
4569struct _HV_INPUT_GET_VP_INDEX_FROM_APIC_ID
4591struct _HV_INPUT_MODIFY_VTL_PROTECTION_MASK

Not listed above are the types that HVGDK_MINI.H apparently defines in conditional blocks for the 32-bit and 64-bit ARM platforms. These can be found by inspecting the ARM-specific CLFSMGMT.LIB. They fill some of the gaps between the Intel-specific definitions.

For instance, that  _HV_X64_HYPERVISOR_FEATURES is defined at line 717 survives into the x86 and x64 builds of the library. These show nothing of a _HV_ARM64_HYPERVISOR_FEATURES, presumably because its definition was eliminated by the preprocessor’s interpretation of some sort of #if directive. The ARM builds similarly miss the X64 structure but show that _HV_ARM64_HYPERVISOR_FEATURES is defined at line 775, i.e., between _HV_X64_HYPERVISOR_FEATURES and _HV_X64_ENLIGHTENMENT_INFORMATION.

It would be a sound guess, but is not knowable from the libraries, that such paired definitions as those of _HV_X64_HYPERVISOR_FEATURES and _HV_AMD64_HYPERVISOR_FEATURES are followed by definitions of macros, in this case HV_HYPERVISOR_FEATURES, that equate to the appropriate type for whichever platform the source code is built for.

That the types have platform-specific names means that conditional compilation to eliminate the “wrong” one causes no error. Conditional compilation does indeed look to have been skipped for _HV_X64_CONTEXT and _HV_AMD64_CONTEXT. Each library for the original Windows 10 has both. This is deliberate, so that both are nested within the multi-platform HV_VP_CONTEXT.