POINTER_32 - 是什么,为什么? [英] POINTER_32 - what is it, and why?

查看:512
本文介绍了POINTER_32 - 是什么,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚被赋予将遗留应用程序从32位更新为64位的任务。在检查任务的范围时,我在包含外部(例如平台)头文件之前发现了以下定义:

I have just been given the task of updating a legacy application from 32-bit to 64-bit. While reviewing the extent of the task, I discovered the following definition immediately before the inclusion of external (eg. platform) headers:

#define POINTER_32



我找不到什么使用这个定义或它有什么效果,但它看起来像那种与我的任务直接相关的事情!

I cannot find what uses this definition or what effect it has, but it looks like the kind of thing that will be directly relevant to my task!

这是什么?什么用的?

What is it for? What uses it? Will it be safe to remove it immediately (I presume it will be necessary to remove it in the long run)?

这是使用MS VC ++ 2008,很快就是2010年。

This is using MS VC++ 2008, soon to be 2010.

推荐答案

这是一个通常在Windows SDK头文件BaseTsd.h头文件中声明的宏。在32位模式下编译时,按照显示的定义。在64位模式下编译时,定义为

This is a macro that's normally declared in a Windows SDK header, BaseTsd.h header file. When compiling in 32-bit mode, it is defined as you showed. When compiling in 64-bit mode it is defined as

 #define POINTER_32 __ptr32

这是一个MSVC编译器扩展,用于在64位代码模型中声明32位指针。对于32位代码还有一个64位的风格:

which is an MSVC compiler extension to declare 32-bit pointers in a 64-bit code model. There's also a 64-bit flavor for 32-bit code:

 #define POINTER_64 __ptr64

如果您编写64位程序并需要与另一个进程中32位代码使用的结构互操作,则可以使用它。例如:

You'd use it if you write a 64-bit program and need to interop with structures that are used by 32-bit code in another process. For example:

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;

这篇关于POINTER_32 - 是什么,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆