POINTER_32 - what is it and why?

I have just been given the task of updating an outdated application from 32-bit to 64-bit. Considering the scope of the task, I found the following definition immediately before including external (e.g., platform) headers:

#define POINTER_32 

I can’t find what this definition uses or what effect it has, but it looks like a thing that will be directly related to my task!

What is this for? What uses it? Would it be safe to remove it immediately (I believe it will need to be removed in the end)?

It is used by MS VC ++ 2008, 2010 will be soon.

+4
source share
2 answers

This is a macro that is usually declared in the header of the Windows SDK, the BaseTsd.h header file. When compiling in 32-bit mode, it is determined as shown. When compiled in 64-bit mode, it is defined as

  #define POINTER_32 __ptr32 

which is an extension of the MSVC compiler for declaring 32-bit pointers in a 64-bit code model. There is also a 32-bit code for a 32-bit code:

  #define POINTER_64 __ptr64 

You would use it if you are writing a 64-bit program and must interact with structures that are used by 32-bit code in another process. For instance:

 typedef struct _SCSI_PASS_THROUGH_DIRECT32 { USHORT Length; UCHAR ScsiStatus; UCHAR PathId; UCHAR TargetId; UCHAR Lun; UCHAR CdbLength; UCHAR SenseInfoLength; UCHAR DataIn; ULONG DataTransferLength; ULONG TimeOutValue; VOID * POINTER_32 DataBuffer; // <== here ULONG SenseInfoOffset; UCHAR Cdb[16]; }SCSI_PASS_THROUGH_DIRECT32, *PSCSI_PASS_THROUGH_DIRECT32; 
+5
source

Used to bypass Warning C4244 . Provides a 32-bit pointer in both 32-bit and 64-bit models

+1
source

All Articles