如何定义和QUOT; UCHAR * POINTER_32"和"无效* POINTER_32"在德尔福类型? [英] How to define "UCHAR * POINTER_32" and "VOID * POINTER_32" types in Delphi?

查看:1194
本文介绍了如何定义和QUOT; UCHAR * POINTER_32"和"无效* POINTER_32"在德尔福类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

翻译 IP_OPTION_INFORMATION32 和的 ICMP_ECHO_REPLY32 为64位编译我得到了stucked数据类型的结构使用那里。从参考结构的定义:

Translating the IP_OPTION_INFORMATION32 and ICMP_ECHO_REPLY32 structures for 64-bit compiler I got stucked with data types to use there. Structure definitions from the reference:

的IP_OPTION_INFORMATION32结构:

typedef struct _IP_OPTION_INFORMATION32 {
  UCHAR              Ttl;
  UCHAR              Tos;
  UCHAR              Flags;
  UCHAR              OptionsSize;
  UCHAR * POINTER_32 OptionsData;
} IP_OPTION_INFORMATION32, *PIP_OPTION_INFORMATION32;

我会翻译这种方式(德尔福XE2,64位目标平台)。正如你所看到的,我不知道要用于结构的 OptionsData 字段是什么类型的:

I would translate this way (for Delphi XE2, 64-bit target platform). As you can see, I don't know what type to use for the OptionsData field of the structure:

IP_OPTION_INFORMATION32 = record
  Ttl: UCHAR;
  Tos: UCHAR;
  Flags: UCHAR;
  OptionsSize: UCHAR;
  OptionsData:       // what should I use here for UCHAR * POINTER_32 ?
end;

ICMP_ECHO_REPLY32结构:

typedef struct icmp_echo_reply32 {
  IPAddr                         Address;
  ULONG                          Status;
  ULONG                          RoundTripTime;
  USHORT                         DataSize;
  USHORT                         Reserved;
  VOID * POINTER_32              Data;
  struct ip_option_information32  Options;
} ICMP_ECHO_REPLY32, *PICMP_ECHO_REPLY32;

有关德尔福XE2 64位目标平台,我会写:

For Delphi XE2 64-bit target platform I would write:

ICMP_ECHO_REPLY32 = record
  Address: TIPAddr;  // defined before
  Status: ULONG;
  RoundTripTime: ULONG;
  DataSize: USHORT;
  Reserved: USHORT;
  Data:              // what should I use here for VOID * POINTER_32 ?
  Options: IP_OPTION_INFORMATION32;
end;

问:

你如何定义的 UCHAR * POINTER_32 VOID * POINTER_32 类型在Delphi中的64位平台的目标?据我所知,目前还没有32位的指针类型可用于64位平台的目标,我只是不喜欢它是定义如作为的Int32 键入: - )

Question:

How would you define the UCHAR * POINTER_32 and VOID * POINTER_32 types in Delphi for 64-bit platform target ? As far as I know, there is no 32-bit pointer type available for 64-bit platform target and I just don't like it to be defined e.g. as a Int32 type :-)

什么是最precise翻译所提到的类型?

What is the most precise translation for the mentioned types ?

推荐答案

什么 POINTER_32 是覆盖在另一个堆栈溢出问题的问题:的POINTER_32 - 它是什么,以及为什么

The issue of what POINTER_32 is covered in another Stack Overflow question: POINTER_32 - what is it, and why?

与在一个不同的过程定义的结构,一个具有32位指针的互操作执行时,您会使用它。

You would use it when performing interop with structs that are defined in a different process, one that has 32 bit pointers.

您不必 __ ptr32 的德尔福相当于所以你根本没有选择,只能声明为32位整数。我会用一个无符号的类型。

You don't have the equivalent of __ptr32 in Delphi so you have simply no choice other than to declare it as a 32 bit integer. I would use an unsigned type.

这篇关于如何定义和QUOT; UCHAR * POINTER_32"和"无效* POINTER_32"在德尔福类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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