如何修改以下C结构为Delphi结构,谢谢:struct __PACKET_BUFFER__
{
BYTE Status;
BYTE AclType;
BYTE NetType;
BYTE TimeType; ULONG AclId; union
{
struct
{
USHORT TcpCode : 6;
USHORT Reserved : 10;
};
struct
{
USHORT TcpFin : 1;
USHORT TcpSyn : 1;
USHORT TcpRst : 1;
USHORT TcpPsh : 1;
USHORT TcpAck : 1;
USHORT TcpUrg : 1; USHORT Direction : 1; // 0: IN, 1: OUT
USHORT SendOrRecv : 1;
USHORT Action : 8;
};
};
BYTE bReserved[2]; BYTE Protocol;
BYTE Week;
BYTE IcmpType;
BYTE IcmpSubType; ULONG Time;
ULONG SourceIp;
ULONG DestinationIp; union
{
ULONG Id;
struct
{
ULONG SourcePort : 16;
ULONG DestinationPort : 16;
};
}; ULONG DataBytes;
ULONG ProcessHandle; char sProcess[16];
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////
struct __PACKET_DIRECTION__
{
ULONG Id; struct
{
BYTE Direction : 4;
BYTE Action : 4;
}; BYTE NetType; struct
{
BYTE AclType : 4;
BYTE Reserved : 2;
BYTE DeleteIn : 1;
BYTE DeleteOut: 1;
}; BYTE Protocol; ULONG AclId;
ULONG Time;
ULONG ProcessHandle;
ULONG SendData;
ULONG RecvData;
ULONG LocalIp;
ULONG RemoteIp; USHORT LocalPort;
USHORT RemotePort; char sProcess[16];
};
{
BYTE Status;
BYTE AclType;
BYTE NetType;
BYTE TimeType; ULONG AclId; union
{
struct
{
USHORT TcpCode : 6;
USHORT Reserved : 10;
};
struct
{
USHORT TcpFin : 1;
USHORT TcpSyn : 1;
USHORT TcpRst : 1;
USHORT TcpPsh : 1;
USHORT TcpAck : 1;
USHORT TcpUrg : 1; USHORT Direction : 1; // 0: IN, 1: OUT
USHORT SendOrRecv : 1;
USHORT Action : 8;
};
};
BYTE bReserved[2]; BYTE Protocol;
BYTE Week;
BYTE IcmpType;
BYTE IcmpSubType; ULONG Time;
ULONG SourceIp;
ULONG DestinationIp; union
{
ULONG Id;
struct
{
ULONG SourcePort : 16;
ULONG DestinationPort : 16;
};
}; ULONG DataBytes;
ULONG ProcessHandle; char sProcess[16];
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////
struct __PACKET_DIRECTION__
{
ULONG Id; struct
{
BYTE Direction : 4;
BYTE Action : 4;
}; BYTE NetType; struct
{
BYTE AclType : 4;
BYTE Reserved : 2;
BYTE DeleteIn : 1;
BYTE DeleteOut: 1;
}; BYTE Protocol; ULONG AclId;
ULONG Time;
ULONG ProcessHandle;
ULONG SendData;
ULONG RecvData;
ULONG LocalIp;
ULONG RemoteIp; USHORT LocalPort;
USHORT RemotePort; char sProcess[16];
};
这是我写的开发包,你看看
http://www.csdn.net/cnshare/soft/15/15543.shtm这是2个结构的翻译type
TTcpCode = record
TcpCode: Smallint;
Reserved: Smallint;
end;
TTcpFin = record
TcpFim: Smallint;
RcpSyn: Smallint;
TcpRst: Smallint;
TcpPsh: Smallint;
TcpAck: Smallint;
TcpUrg: Smallint;
Direction: Smallint;
SendOrRecv: Smallint;
Action: Smallint;
end;
TSourcePort = record
SourcePort: ULong;
DestinationPort: ULong;
end;
TID = record
ID: Ulong;
SourcePort: TSourcePort;
end;
PACKET_BUFFER = record
Status: Byte;
AclType: Byte;
NetType: Byte;
TimeType: Byte;
AclID: ULong;
TcpCode: TTcpCode;
TcpFin: TTcpFin;
bReserved: array [0..1] of byte;
Protocol: Byte;
Week: Byte;
IcmpType: Byte;
IcmpSubType: Byte;
Time: ULong;
SourceIp: ULong;
DestinationIP: Ulong;
ID: TID;
DataBytes: ULong;
ProcessHandle: ULong;
sProcess: array [0..15] of char;
end;
TDirection = record
Direction: Byte;
Action: Byte;
end; TAclType = record
AclType: Byte;
Reserved: Byte;
DeleteIn: Byte;
DeleteOut: Byte;
end;
PACKET_DIRECTION = record
id: ULong;
Direction: TDirection;
NetType: Byte;
AclType: TAclType;
Protocol: Byte;
AclID: ULong;
Time: ULong;
Processhandle: ULong;
SendData: ULong;
RecvData: ULong;
LocalIp: ULong;
RemoteIP: ULong;
sProcess: array [0..15] of char;
end;
看这里,不是这样译的。http://expert.csdn.net/Expert/topic/1397/1397405.xml?temp=6.853884E-02