Background:
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:
The IP_OPTION_INFORMATION32 structure:
typedef struct _IP_OPTION_INFORMATION32 {
UCHAR Ttl;
UCHAR Tos;
UCHAR Flags;
UCHAR OptionsSize;
UCHAR * POINTER_32 OptionsData;
} IP_OPTION_INFORMATION32, *PIP_OPTION_INFORMATION32;
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 structure:
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;
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;
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 :-)
What is the most precise translation for the mentioned types ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…