A DWORD
uint
ve WORD
ushort
'dur. Bir union
[StructLayout(LayoutKind.Sequential)]
struct CACHE_DESCRIPTOR
{
public byte Level;
public byte Associativity;
public ushort LineSize;
public uint Size;
public PROCESSOR_CACHE_TYPE Type;
}
enum PROCESSOR_CACHE_TYPE
{
Unified = 0,
Instruction = 1,
Data = 2,
Trace = 3,
}
bir Explicit
düzeni ve FieldOffset
bir yapıdır.
[StructLayout(LayoutKind.Sequential)]
struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION
{
public UIntPtr ProcessorMask;
public LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
public ProcessorRelationUnion RelationUnion;
}
[StructLayout(LayoutKind.Explicit)]
struct ProcessorRelationUnion
{
[FieldOffset(0)] public CACHE_DESCRIPTOR Cache;
[FieldOffset(0)] public uint NumaNodeNumber;
[FieldOffset(0)] public byte ProcessorCoreFlags;
[FieldOffset(0)] private UInt64 Reserved1;
[FieldOffset(8)] private UInt64 Reserved2;
}
[StructLayout(LayoutKind.Sequential)]
struct CACHE_DESCRIPTOR
{
public byte Level;
public byte Associativity;
public ushort LineSize;
public uint Size;
public PROCESSOR_CACHE_TYPE Type;
}
enum LOGICAL_PROCESSOR_RELATIONSHIP : uint
{
ProcessorCore = 0,
NumaNode = 1,
RelationCache = 2,
}
bir ULONGLONG
bir UInt64
olup. Yapının 8 bayt sınırına (24 bayt) hizalanmasıdır. David'in yorumlarda belirttiği gibi, bazı nedenlerden dolayı Microsoft Interop kütüphanesinden eksikti.
Güncelleştirme: Microsoft Research'ten Windows Interop Kütüphanesi'ne eksik yapılar ve bağlantı eklendi.
Kaynak: WindowsInteropLib/Kernel32.cs
Reddetme nedenlerinden herhangi biri mi var? – VMAtm