1

基于这个问题How to declarate LARGE_INTEGER in C# with answer of:

[StructLayout(LayoutKind.Absolute, Size=8)]
struct LARGE_INTEGER
{
    [FieldOffset(0)]public Int64 QuadPart;
    [FieldOffset(0)]public UInt32 LowPart;
    [FieldOffset(4)]public Int32 HighPart;
}

我在下面的假设是否声明ULARGE_INTEGER正确?

[StructLayout(LayoutKind.Explicit, Size = 8)]
public struct ULARGE_INTEGER
{
    [FieldOffset(0)] public UInt64 QuadPart;
    [FieldOffset(0)] public UInt32 LowPart;
    [FieldOffset(4)] public UInt32 HighPart;
}
4

1 回答 1

1

它只是 C# 中的一个 ulong,无需跳过 LayoutKind.Explicit 箍。联合是必要的,因为 C 和 C++ 编译器在过去没有原生 64 位类型。

于 2010-06-16T13:24:31.943 回答