Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

64-bit Windows API: what is the size of a C/C++ "DWORD"?

I only have 32-bit Windows installed, so I cannot verify this myself.

If I understand correctly, the DWORD used in various places in the Microsoft API is in reference to the original 16-bit word, and has nothing to do with the current hardware architecture?

So DWORD which seems to be 32 bits, will remain 32 bits even when I eventually compile and link my app to run in 64-bit Windows? Or will DWORD become 128 bits wide?

like image 235
Stéphane Avatar asked Feb 14 '11 07:02

Stéphane


People also ask

What is the size of DWORD?

A DWORD is a 32-bit unsigned integer (range: 0 through 4294967295 decimal).

What is DWORD C#?

DWORD is defined as unsigned long , which ends up being a 32-bit unsigned integer.


2 Answers

The only thing that changes size between 32 and 64 are pointers. So DWORD stays 32 bits wide.

Some things are not immediately obviously pointers, e.g. HANDLE, LPARAM, WPARAM. But these three change width as they actually hold pointers.

like image 193
David Heffernan Avatar answered Sep 23 '22 02:09

David Heffernan


DWORD is always 32 bits (unsigned). QWORD is always 64 bits (unsigned). Then there are the DWORD32 and a DWORD64 that are 32 and 64 bits. Don't ask me why are they there :-)

http://msdn.microsoft.com/en-us/library/cc230318(v=PROT.10).aspx

http://msdn.microsoft.com/en-us/library/cc230362(v=PROT.10).aspx

and in general

http://msdn.microsoft.com/en-us/library/cc230309(v=PROT.10).aspx

like image 24
xanatos Avatar answered Sep 22 '22 02:09

xanatos