C++ code (Visual studio started with devenv /useenv (x64) and isWOW64 is false)
DWORD64 check;
check = -1;
printf("value %u", check);
it prints the value 4294967295 i.e. 0x(32)f which is the same if i do it with simple DWORD in an x32 environment
yes i know DWORD64 is unsigned __int64, but shouldn't it be 0x(64)f ?
what did the assembler do there ? disassembling the code didn't help me much.
You problem here lies in the printf
format string. Using %u
tells printf
to print a 32 bits value. Hence, it uses only the first 32 bits of your DWORD64
. To print all the 64 bits that has been pushed onto the stack, use %llu
(for unsigned long long
).
Note also that DWORD64
cannot be unsigned long
. On all Windows versions, even on Windows 64 bits, long
is 32 bits.
See LLP64 model.