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

查看:30
本文介绍了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天全站免登陆