The simplest would be
liSize.QuadPart = FileSizeDistance;
Your assignment is not wrong, but the castings should be according to the desitination type (
DWORD
for LowPart and
LONG
for HighPart). Even your print output is correct. To get the expected output, just print the low part as
unsigned
:
_tprintf("LowPart:%u, HighPart:%d\n", liSize.LowPart, liSize.HighPart);