Friday, June 11, 2010

DWORD and HANDLE

Win32:

  • DWORD 32 bit unsigned long
  • HANDLE void * (32 bit pointer)

Win64

  • DWORD 32 bit unsigned long
  • HANDLE void * (64 bit pointer)

DO NOT just assume you can cast one to the other. It will work for Win32 and break when you port it to Win64.


1

If you're asking in the context of the Win32 API, then there is no substantive difference. A HANDLE is a 32-bit number, same as DWORD.

If you're asking in some other context (you have tagged this ansi-c for a reason?) then you will need to explain what context that is.


A HANDLE is a PVOID or a void* typedef, A DWORD is a uint32. Isn't a void* length depending from the memory architecture (eg. x86 & x64)?

No comments: