mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 16:59:12 +02:00
fixed structure sizes for any slang on 32 bit platform,
fiexed buggy conversions from c-short to pascal-integer, needs some more work to be Win64 compliant, szDescription/szSystemStatus is a zero terminated string with extra zero.
This commit is contained in:
parent
79aa1752e9
commit
ec5ee74a21
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
|
|
||||||
{$PACKRECORDS 4}
|
{$PACKRECORDS 1}
|
||||||
unit winsock;
|
unit winsock;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
@ -96,9 +96,9 @@ unit winsock;
|
|||||||
{ alias list }
|
{ alias list }
|
||||||
h_aliases: ^pchar;
|
h_aliases: ^pchar;
|
||||||
{ host address type }
|
{ host address type }
|
||||||
h_addrtype: integer;
|
h_addrtype: SmallInt;
|
||||||
{ length of address }
|
{ length of address }
|
||||||
h_length: integer;
|
h_length: SmallInt;
|
||||||
{ list of addresses }
|
{ list of addresses }
|
||||||
case byte of
|
case byte of
|
||||||
0: (h_addr_list: ^pchar);
|
0: (h_addr_list: ^pchar);
|
||||||
@ -117,7 +117,8 @@ unit winsock;
|
|||||||
{ alias list }
|
{ alias list }
|
||||||
n_aliases : ^pchar;
|
n_aliases : ^pchar;
|
||||||
{ net address type }
|
{ net address type }
|
||||||
n_addrtype : integer;
|
n_addrtype : SmallInt;
|
||||||
|
n_pad1 : SmallInt; { ensure right packaging }
|
||||||
{ network # }
|
{ network # }
|
||||||
n_net : u_long;
|
n_net : u_long;
|
||||||
end;
|
end;
|
||||||
@ -130,7 +131,8 @@ unit winsock;
|
|||||||
{ alias list }
|
{ alias list }
|
||||||
s_aliases : ^pchar;
|
s_aliases : ^pchar;
|
||||||
{ port # }
|
{ port # }
|
||||||
s_port : integer;
|
s_port : SmallInt;
|
||||||
|
n_pad1 : SmallInt; { ensure right packaging }
|
||||||
{ protocol to use }
|
{ protocol to use }
|
||||||
s_proto : ^char;
|
s_proto : ^char;
|
||||||
end;
|
end;
|
||||||
@ -143,7 +145,8 @@ unit winsock;
|
|||||||
{ alias list }
|
{ alias list }
|
||||||
p_aliases : ^pchar;
|
p_aliases : ^pchar;
|
||||||
{ protocol # }
|
{ protocol # }
|
||||||
p_proto : integer;
|
p_proto : SmallInt;
|
||||||
|
p_pad1 : SmallInt; { ensure packaging }
|
||||||
end;
|
end;
|
||||||
TProtoEnt = protoent;
|
TProtoEnt = protoent;
|
||||||
PProtoEnt = ^TProtoEnt;
|
PProtoEnt = ^TProtoEnt;
|
||||||
@ -214,13 +217,15 @@ unit winsock;
|
|||||||
PInAddr = ^TInAddr;
|
PInAddr = ^TInAddr;
|
||||||
|
|
||||||
sockaddr_in = record
|
sockaddr_in = record
|
||||||
sin_family : u_short;
|
sin_family : SmallInt; (* 2 byte *)
|
||||||
case integer of
|
case integer of
|
||||||
0 : (sin_port : u_short;
|
0 : ( (* equals to sockaddr_in, size is 16 byte *)
|
||||||
sin_addr : TInAddr;
|
sin_port : u_short; (* 2 byte *)
|
||||||
sin_zero : array[0..7] of char;
|
sin_addr : TInAddr; (* 4 byte *)
|
||||||
|
sin_zero : array[0..8-1] of char; (* 8 byte *)
|
||||||
);
|
);
|
||||||
1 : (sin_data : array[0..13] of char;
|
1 : ( (* equals to sockaddr, size is 16 byte *)
|
||||||
|
sin_data : array[0..14-1] of char; (* 14 byte *)
|
||||||
);
|
);
|
||||||
end;
|
end;
|
||||||
TSockAddrIn = sockaddr_in;
|
TSockAddrIn = sockaddr_in;
|
||||||
@ -251,14 +256,15 @@ unit winsock;
|
|||||||
|
|
||||||
type
|
type
|
||||||
WSADATA = record
|
WSADATA = record
|
||||||
wVersion : WORD;
|
wVersion : WORD; { 2 byte, ofs 0 }
|
||||||
wHighVersion : WORD;
|
wHighVersion : WORD; { 2 byte, ofs 2 }
|
||||||
szDescription : array[0..WSADESCRIPTION_LEN-1] of char;
|
szDescription : array[0..(WSADESCRIPTION_LEN+1)-1] of char; { 257 byte, ofs 4 }
|
||||||
szSystemStatus : array[0..WSASYS_STATUS_LEN-1] of char;
|
szSystemStatus : array[0..(WSASYS_STATUS_LEN+1)-1] of char; { 129 byte, ofs 261 }
|
||||||
iMaxSockets : word;
|
iMaxSockets : word; { 2 byte, ofs 390 }
|
||||||
iMaxUdpDg : word;
|
iMaxUdpDg : word; { 2 byte, ofs 392 }
|
||||||
lpVendorInfo : pchar;
|
pad1 : SmallInt; { 2 byte, ofs 394 } { ensure right packaging }
|
||||||
end;
|
lpVendorInfo : pchar; { 4 byte, ofs 396 }
|
||||||
|
end; { total size 400 }
|
||||||
TWSAData = WSADATA;
|
TWSAData = WSADATA;
|
||||||
PWSAData = TWSAData;
|
PWSAData = TWSAData;
|
||||||
|
|
||||||
@ -725,8 +731,8 @@ unit winsock;
|
|||||||
|
|
||||||
procedure GetAcceptExSockaddrs(lpOutputBuffer:Pointer;
|
procedure GetAcceptExSockaddrs(lpOutputBuffer:Pointer;
|
||||||
dwReceiveDataLength,dwLocalAddressLength,dwRemoteAddressLength:dword;
|
dwReceiveDataLength,dwLocalAddressLength,dwRemoteAddressLength:dword;
|
||||||
var LocalSockaddr:TSockAddr; var LocalSockaddrLength:Integer;
|
var LocalSockaddr:TSockAddr; var LocalSockaddrLength:LongInt;
|
||||||
var RemoteSockaddr:TSockAddr; var RemoteSockaddrLength:Integer);stdcall;
|
var RemoteSockaddr:TSockAddr; var RemoteSockaddrLength:LongInt);stdcall;
|
||||||
|
|
||||||
function WSAMakeSyncReply(Buflen,Error:Word):dword;
|
function WSAMakeSyncReply(Buflen,Error:Word):dword;
|
||||||
function WSAMakeSelectReply(Event,Error:Word):dword;
|
function WSAMakeSelectReply(Event,Error:Word):dword;
|
||||||
@ -836,8 +842,8 @@ unit winsock;
|
|||||||
|
|
||||||
procedure GetAcceptExSockaddrs(lpOutputBuffer:Pointer;
|
procedure GetAcceptExSockaddrs(lpOutputBuffer:Pointer;
|
||||||
dwReceiveDataLength,dwLocalAddressLength,dwRemoteAddressLength:dword;
|
dwReceiveDataLength,dwLocalAddressLength,dwRemoteAddressLength:dword;
|
||||||
var LocalSockaddr:TSockAddr; var LocalSockaddrLength:Integer;
|
var LocalSockaddr:TSockAddr; var LocalSockaddrLength:LongInt;
|
||||||
var RemoteSockaddr:TSockAddr; var RemoteSockaddrLength:Integer);stdcall;
|
var RemoteSockaddr:TSockAddr; var RemoteSockaddrLength:LongInt);stdcall;
|
||||||
external winsockdll name 'GetAcceptExSockaddrs';
|
external winsockdll name 'GetAcceptExSockaddrs';
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -927,7 +933,13 @@ unit winsock;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.7 2000-02-23 15:00:55 jonas
|
Revision 1.8 2000-02-23 16:48:10 alex
|
||||||
|
fixed structure sizes for any slang on 32 bit platform,
|
||||||
|
fiexed buggy conversions from c-short to pascal-integer,
|
||||||
|
needs some more work to be Win64 compliant,
|
||||||
|
szDescription/szSystemStatus is a zero terminated string with extra zero.
|
||||||
|
|
||||||
|
Revision 1.7 2000/02/23 15:00:55 jonas
|
||||||
* fixed WSADATA record structure bug
|
* fixed WSADATA record structure bug
|
||||||
|
|
||||||
Revision 1.6 2000/02/20 20:34:02 florian
|
Revision 1.6 2000/02/20 20:34:02 florian
|
||||||
|
Loading…
Reference in New Issue
Block a user