HANDLE
On Windows a HANDLE type is defined as a "void *".
For Win32 (32-bit) and int and long and void * are all 32-bit. This can mean that lots of C and C++ programmers have taken the HANDLE and placed it in a long or an int, or vice versa.
To modify the code, so that it is fully Win32 & Win64 compatible, you should really not interchange HANDLE and int or long. In the Windows 64-bit programming model (LLP) they decided that an int and long are both 32-bit, this is in contrast to the LP64 model used by all other operating systems which has int as 32-bit and long as 64-bit.
But under both LLP and LP64, pointers are 64-bit, so a void * will not fit into a (LP64 32-bit int) or (LLP 32-bit int/long). Beware of this, although the compiler warnings will help out a lot.
Use /Wp64 to enable 64-bit porting warnings when using Visual Studio .NET 2003 or 2005.
Advice on HANDLEs
MS 64-bit help for developers
Microsoft Windows 64-bit types
Microsoft 64-bit tools and tips
No comments:
Post a Comment