I want to call via c#/PInvoke the GetLogicalProcessorInformation function, but I’m stuck with SYSTEM_LOGICAL_PROCESSOR_INFORMATION struct and CACHE_DESCRIPTOR struct.
How should I define these structs for correct usage?
Main problems:
1. SYSTEM_LOGICAL_PROCESSOR_INFORMATION has union in its definition
2. SYSTEM_LOGICAL_PROCESSOR_INFORMATION has ULONGLONG in its definition
3. CACHE_DESCRIPTOR has WORD and DWORD in its definition.
Can you help me with these structures?
Updated: fixed the structure marshalling which has to be done manually.
This is quite a messy P/invoke. Even when you have the structs and the union defined, it’s non-trivial to call the function because you have to marshal the structures manually.