What structure packing do the Windows SDK header files expect?



In words, integral types and pointers up to eight bytes in size are stored at their natural alignment. Larger types are stored at eight-byte alignment.

Type Alignment
BYTE, char, UCHAR 1-byte alignment
WORD, WCHAR, short, USHORT 2-byte alignment
DWORD, int, long, UINT, ULONG, float, 32-bit pointer 4-byte alignment
QWORD, __int64, unsigned __int64, double, 64-bit pointer 8-byte alignment

In other words (saying it a third time), let T be an integral or pointer type. If sizeof(T) ≤ 8, then T is aligned at a sizeof(T)-byte boundary. If sizeof(T) ≥ 8, then T is aligned at an 8-byte boundary.


Comments are closed. Login to edit/delete your existing comments