Geoff Chappell, Software Analyst
The HvlQueryProcessorTopology function obtains up to three topological properties of a given logical processor.
NTSTATUS HvlQueryProcessorTopology ( ULONG LpIndex, USHORT *Node, ULONG *Package, ULONG *Core);
The LpIndex argument specifies which logical processor to look up.
The optional Node, Package and Core arguments provide the addresses of variables that are to receive the given logical processor’s node, package and core numbers. Any or all of these arguments may be NULL.
The function returns STATUS_SUCCESS if successful, else a negative error code.
The HvlQueryProcessorTopology function is exported by name from the kernel in version 6.2 and higher.
The HvlQueryProcessorTopology function is not documented.
Types and names in the declaration above are invented for this note, pending discovery of Microsoft’s.
The function depends on the CPU Management feature of the hypervisor. If this is not enabled, the function fails, returning STATUS_ACCESS_DENIED.
The function also fails, but returning STATUS_INVALID_PARAMETER, if it cannot find the given logical processor index in the kernel’s array of logical processor control blocks. If only for now, this array provides for 0x0200 logical processors: the given index must be smaller.
Otherwise, the function copies the desired properties from the control block to whichever of the addresses given in the corresponding arguments are not NULL, and returns STATUS_SUCCESS.