Q
qfgj
Unregistered / Unconfirmed
GUEST, unregistred user!
出下面的错:the procedure entry point wsastartup could not be located in the dynamic link library wsock32.dll,高手帮忙看一下<br><br>源程序如下:增加了delphi的winsock.pas中没有的一些函数,包括mswsock.dll和ws2_32.dll中的函数.<br><br>library wsock32;<br><br>uses<br> WinSock in 'WinSock.pas';<br><br>exports<br>AcceptEx index 1141 ,// MSWSOCK.AcceptEx<br>EnumProtocolsA index 1111 ,// MSWSOCK.EnumProtocolsA<br>EnumProtocolsW index 1112 ,// MSWSOCK.EnumProtocolsW<br>GetAcceptExSockaddrs index 1142 ,// MSWSOCK.GetAcceptExSockaddrs<br>GetAddressByNameA index 1109 ,// MSWSOCK.GetAddressByNameA<br>GetAddressByNameW index 1110 ,// MSWSOCK.GetAddressByNameW<br>GetNameByTypeA index 1115 ,// MSWSOCK.GetNameByTypeA<br>GetNameByTypeW index 1116 ,// MSWSOCK.GetNameByTypeW<br>GetServiceA index 1119 ,// MSWSOCK.GetServiceA<br>GetServiceW index 1120 ,// MSWSOCK.GetServiceW<br>GetTypeByNameA index 1113 ,// MSWSOCK.GetTypeByNameA<br>GetTypeByNameW index 1114 ,// MSWSOCK.GetTypeByNameW<br>MigrateWinsockConfiguration index 24 ,// MSWSOCK.MigrateWinsockConfiguration<br>NPLoadNameSpaces index 1130 ,// MSWSOCK.NPLoadNameSpaces<br>SetServiceA index 1117 ,// MSWSOCK.SetServiceA<br>SetServiceW index 1118 ,// MSWSOCK.SetServiceW<br>TransmitFile index 1140 ,// MSWSOCK.TransmitFile<br>WSARecvEx index 1107 ,// MSWSOCK.WSARecvEx<br>dn_expand index 1106 ,// MSWSOCK.dn_expand<br>inet_network index 1100 ,// MSWSOCK.inet_network<br>getnetbyname index 1101 ,// MSWSOCK.getnetbyname<br>rcmd index 1102 ,// MSWSOCK.rcmd<br>rexec index 1103 ,// MSWSOCK.rexec<br>rresvport index 1104 ,// MSWSOCK.rresvport<br>s_perror index 1108 ,// MSWSOCK.s_perror<br>sethostname index 1105 ,// MSWSOCK.sethostname<br><br>WEP index 500 ,// ws2_32.WEP<br>WSAAsyncGetHostByAddr index 102 ,// ws2_32.WSAAsyncGetHostByAddr<br>WSAAsyncGetHostByName index 103 ,// ws2_32.WSAAsyncGetHostByName<br>WSAAsyncGetProtoByName index 105 ,// ws2_32.WSAAsyncGetProtoByName<br>WSAAsyncGetProtoByNumber index 104 ,// ws2_32.WSAAsyncGetProtoByNumber<br>WSAAsyncGetServByName index 107 ,// ws2_32.WSAAsyncGetServByName<br>WSAAsyncGetServByPort index 106 ,// ws2_32.WSAAsyncGetServByPort<br>WSAAsyncSelect index 101 ,// ws2_32.WSAAsyncSelect<br>WSACancelAsyncRequest index 108 ,// ws2_32.WSACancelAsyncRequest<br>WSACancelBlockingCall index 113 ,// ws2_32.WSACancelBlockingCall<br>WSACleanup index 116 ,// ws2_32.WSACleanup<br>WSAGetLastError index 111 ,// ws2_32.WSAGetLastError<br>WSAIsBlocking index 114 ,// ws2_32.WSAIsBlocking<br>WSASetBlockingHook index 109 ,// ws2_32.WSASetBlockingHook<br>WSASetLastError index 112 ,// ws2_32.WSASetLastError<br>WSAStartup index 115 ,// ws2_32.WSAStartup<br>WSAUnhookBlockingHook index 110 ,// ws2_32.WSAUnhookBlockingHook<br>WSApSetPostRoutine index 1000 ,// ws2_32.WSApSetPostRoutine<br>__WSAFDIsSet index 151 ,// ws2_32.__WSAFDIsSet<br>accept index 1 ,// ws2_32.accept<br>bind index 2 ,// ws2_32.bind<br>closesocket index 3 ,// ws2_32.closesocket<br>connect index 4 ,// ws2_32.connect<br>gethostbyaddr index 51 ,// ws2_32.gethostbyaddr<br>gethostbyname index 52 ,// ws2_32.gethostbyname<br>gethostname index 57 ,// ws2_32.gethostname<br>getpeername index 5 ,// ws2_32.getpeername<br>getprotobyname index 53 ,// ws2_32.getprotobyname<br>getprotobynumber index 54 ,// ws2_32.getprotobynumber<br>getservbyname index 55 ,// ws2_32.getservbyname<br>getservbyport index 56 ,// ws2_32.getservbyport<br>getsockname index 6 ,// ws2_32.getsockname<br>getsockopt index 7 ,//<br>htonl index 8 ,// ws2_32.htonl<br>htons index 9 ,// ws2_32.htons<br>inet_addr index 10 ,// ws2_32.inet_addr<br>inet_ntoa index 11 ,// ws2_32.inet_ntoa<br>ioctlsocket index 12 ,// ws2_32.ioctlsocket<br>listen index 13 ,// ws2_32.listen<br>ntohl index 14 ,// ws2_32.ntohl<br>ntohs index 15 ,// ws2_32.ntohs<br>select index 18 ,// ws2_32.select<br>send index 19 ,// ws2_32.send<br>sendto index 20 ,// ws2_32.sendto<br>setsockopt index 21 ,//<br>shutdown index 22 ,// ws2_32.shutdown<br>socket index 23, // ws2_32.socket<br><br>recv index 16 ,//<br>recvfrom index 17 ;//<br>{$R *.RES}<br><br>begin<br>end.<br><br>{ *********************************************************************** }<br>{ }<br>{ Delphi Runtime Library }<br>{ }<br>{ Copyright (c) 1996-2001 Borland Software Corporation }<br>{ }<br>{ *********************************************************************** }<br><br>{*******************************************************}<br>{ Win32 sockets API Interface Unit }<br>{*******************************************************}<br><br>unit WinSock;<br><br>{$WEAKPACKAGEUNIT}<br><br>interface<br><br>uses Windows;<br><br>{ HPPEMIT '#include <windows.h>'}<br><br>type<br> {$EXTERNALSYM u_char}<br> u_char = Char;<br> {$EXTERNALSYM u_short}<br> u_short = Word;<br> {$EXTERNALSYM u_int}<br> u_int = Integer;<br> {$EXTERNALSYM u_long}<br> u_long = Longint;<br><br>{ The new type to be used in all<br> instances which refer to sockets. }<br> {$EXTERNALSYM TSocket}<br> TSocket = u_int;<br><br>const<br> {$EXTERNALSYM FD_SETSIZE}<br> FD_SETSIZE = 64;<br><br>// WinSock 2 extension -- manifest constants for shutdown()<br> {$EXTERNALSYM SD_RECEIVE}<br> SD_RECEIVE = 0;<br> {$EXTERNALSYM SD_SEND}<br> SD_SEND = 1;<br> {$EXTERNALSYM SD_BOTH}<br> SD_BOTH = 2;<br><br>type<br>// the following emits are a workaround to the name conflict with<br>// procedure FD_SET and struct fd_set in winsock.h<br>(*$HPPEMIT '#include <winsock.h>'*)<br>(*$HPPEMIT 'namespace Winsock'*)<br>(*$HPPEMIT '{'*)<br>(*$HPPEMIT 'typedef fd_set *PFDSet;'*) // due to name conflict with procedure FD_SET<br>(*$HPPEMIT 'typedef fd_set TFDSet;'*) // due to name conflict with procedure FD_SET<br>(*$HPPEMIT '}'*)<br><br> {$NODEFINE PFDSet}<br> PFDSet = ^TFDSet;<br> {$NODEFINE TFDSet}<br> TFDSet = record<br> fd_count: u_int;<br> fd_array: array[0..FD_SETSIZE-1] of TSocket;<br> end;<br><br> PTimeVal = ^TTimeVal;<br> {$EXTERNALSYM timeval}<br> timeval = record<br> tv_sec: Longint;<br> tv_usec: Longint;<br> end;<br> TTimeVal = timeval;<br><br>const<br> {$EXTERNALSYM IOCPARM_MASK}<br> IOCPARM_MASK = $7f;<br> {$EXTERNALSYM IOC_VOID}<br> IOC_VOID = $20000000;<br> {$EXTERNALSYM IOC_OUT}<br> IOC_OUT = $40000000;<br> {$EXTERNALSYM IOC_IN}<br> IOC_IN = $80000000;<br> {$EXTERNALSYM IOC_INOUT}<br> IOC_INOUT = (IOC_IN or IOC_OUT);<br><br> {$EXTERNALSYM FIONREAD}<br> FIONREAD = IOC_OUT or { get # bytes to read }<br> ((Longint(SizeOf(Longint)) and IOCPARM_MASK) shl 16) or<br> (Longint(Byte('f')) shl 8) or 127;<br> {$EXTERNALSYM FIONBIO}<br> FIONBIO = IOC_IN or { set/clear non-blocking i/o }<br> ((Longint(SizeOf(Longint)) and IOCPARM_MASK) shl 16) or<br> (Longint(Byte('f')) shl 8) or 126;<br> {$EXTERNALSYM FIOASYNC}<br> FIOASYNC = IOC_IN or { set/clear async i/o }<br> ((Longint(SizeOf(Longint)) and IOCPARM_MASK) shl 16) or<br> (Longint(Byte('f')) shl 8) or 125;<br><br>type<br> PHostEnt = ^THostEnt;<br> {$EXTERNALSYM hostent}<br> hostent = record<br> h_name: PChar;<br> h_aliases: ^PChar;<br> h_addrtype: Smallint;<br> h_length: Smallint;<br> case Byte of<br> 0: (h_addr_list: ^PChar);<br> 1: (h_addr: ^PChar)<br> end;<br> THostEnt = hostent;<br><br> PNetEnt = ^TNetEnt;<br> {$EXTERNALSYM netent}<br> netent = record<br> n_name: PChar;<br> n_aliases: ^PChar;<br> n_addrtype: Smallint;<br> n_net: u_long;<br> end;<br> TNetEnt = netent;<br><br> PServEnt = ^TServEnt;<br> {$EXTERNALSYM servent}<br> servent = record<br> s_name: PChar;<br> s_aliases: ^PChar;<br> s_port: Word;<br> s_proto: PChar;<br> end;<br> TServEnt = servent;<br><br> PProtoEnt = ^TProtoEnt;<br> {$EXTERNALSYM protoent}<br> protoent = record<br> p_name: PChar;<br> p_aliases: ^Pchar;<br> p_proto: Smallint;<br> end;<br> TProtoEnt = protoent;<br><br>const<br><br>{ Protocols }<br><br> {$EXTERNALSYM IPPROTO_IP}<br> IPPROTO_IP = 0; { dummy for IP }<br> {$EXTERNALSYM IPPROTO_ICMP}<br> IPPROTO_ICMP = 1; { control message protocol }<br> {$EXTERNALSYM IPPROTO_IGMP}<br> IPPROTO_IGMP = 2; { group management protocol }<br> {$EXTERNALSYM IPPROTO_GGP}<br> IPPROTO_GGP = 3; { gateway^2 (deprecated) }<br> {$EXTERNALSYM IPPROTO_TCP}<br> IPPROTO_TCP = 6; { tcp }<br> {$EXTERNALSYM IPPROTO_PUP}<br> IPPROTO_PUP = 12; { pup }<br> {$EXTERNALSYM IPPROTO_UDP}<br> IPPROTO_UDP = 17; { user datagram protocol }<br> {$EXTERNALSYM IPPROTO_IDP}<br> IPPROTO_IDP = 22; { xns idp }<br> {$EXTERNALSYM IPPROTO_ND}<br> IPPROTO_ND = 77; { UNOFFICIAL net disk proto }<br><br> {$EXTERNALSYM IPPROTO_RAW}<br> IPPROTO_RAW = 255; { raw IP packet }<br> {$EXTERNALSYM IPPROTO_MAX}<br> IPPROTO_MAX = 256;<br><br>{ Port/socket numbers: network standard functions}<br><br> {$EXTERNALSYM IPPORT_ECHO}<br> IPPORT_ECHO = 7;<br> {$EXTERNALSYM IPPORT_DISCARD}<br> IPPORT_DISCARD = 9;<br> {$EXTERNALSYM IPPORT_SYSTAT}<br> IPPORT_SYSTAT = 11;<br> {$EXTERNALSYM IPPORT_DAYTIME}<br> IPPORT_DAYTIME = 13;<br> {$EXTERNALSYM IPPORT_NETSTAT}<br> IPPORT_NETSTAT = 15;<br> {$EXTERNALSYM IPPORT_FTP}<br> IPPORT_FTP = 21;<br> {$EXTERNALSYM IPPORT_TELNET}<br> IPPORT_TELNET = 23;<br> {$EXTERNALSYM IPPORT_SMTP}<br> IPPORT_SMTP = 25;<br> {$EXTERNALSYM IPPORT_TIMESERVER}<br> IPPORT_TIMESERVER = 37;<br> {$EXTERNALSYM IPPORT_NAMESERVER}<br> IPPORT_NAMESERVER = 42;<br> {$EXTERNALSYM IPPORT_WHOIS}<br> IPPORT_WHOIS = 43;<br> {$EXTERNALSYM IPPORT_MTP}<br> IPPORT_MTP = 57;<br><br>{ Port/socket numbers: host specific functions }<br><br> {$EXTERNALSYM IPPORT_TFTP}<br> IPPORT_TFTP = 69;<br> {$EXTERNALSYM IPPORT_RJE}<br> IPPORT_RJE = 77;<br> {$EXTERNALSYM IPPORT_FINGER}<br> IPPORT_FINGER = 79;<br> {$EXTERNALSYM IPPORT_TTYLINK}<br> IPPORT_TTYLINK = 87;<br> {$EXTERNALSYM IPPORT_SUPDUP}<br> IPPORT_SUPDUP = 95;<br><br>{ UNIX TCP sockets }<br><br> {$EXTERNALSYM IPPORT_EXECSERVER}<br> IPPORT_EXECSERVER = 512;<br> {$EXTERNALSYM IPPORT_LOGINSERVER}<br> IPPORT_LOGINSERVER = 513;<br> {$EXTERNALSYM IPPORT_CMDSERVER}<br> IPPORT_CMDSERVER = 514;<br> {$EXTERNALSYM IPPORT_EFSSERVER}<br> IPPORT_EFSSERVER = 520;<br><br>{ UNIX UDP sockets }<br><br> {$EXTERNALSYM IPPORT_BIFFUDP}<br> IPPORT_BIFFUDP = 512;<br> {$EXTERNALSYM IPPORT_WHOSERVER}<br> IPPORT_WHOSERVER = 513;<br> {$EXTERNALSYM IPPORT_ROUTESERVER}<br> IPPORT_ROUTESERVER = 520;<br><br>{ Ports < IPPORT_RESERVED are reserved for<br> privileged processes (e.g. root). }<br><br> {$EXTERNALSYM IPPORT_RESERVED}<br> IPPORT_RESERVED = 1024;<br><br>{ Link numbers }<br><br> {$EXTERNALSYM IMPLINK_IP}<br> IMPLINK_IP = 155;<br> {$EXTERNALSYM IMPLINK_LOWEXPER}<br> IMPLINK_LOWEXPER = 156;<br> {$EXTERNALSYM IMPLINK_HIGHEXPER}<br> IMPLINK_HIGHEXPER = 158;<br><br>type<br> {$EXTERNALSYM SunB}<br> SunB = packed record<br> s_b1, s_b2, s_b3, s_b4: u_char;<br> end;<br><br> {$EXTERNALSYM SunW}<br> SunW = packed record<br> s_w1, s_w2: u_short;<br> end;<br><br> PInAddr = ^TInAddr;<br> {$EXTERNALSYM in_addr}<br> in_addr = record<br> case integer of<br> 0: (S_un_b: SunB);<br> 1: (S_un_w: SunW);<br> 2: (S_addr: u_long);<br> end;<br> TInAddr = in_addr;<br><br> PSockAddrIn = ^TSockAddrIn;<br> {$EXTERNALSYM sockaddr_in}<br> sockaddr_in = record<br> case Integer of<br> 0: (sin_family: u_short;<br> sin_port: u_short;<br> sin_addr: TInAddr;<br> sin_zero: array[0..7] of Char);<br> 1: (sa_family: u_short;<br> sa_data: array[0..13] of Char)<br> end;<br> TSockAddrIn = sockaddr_in;<br><br>const<br> {$EXTERNALSYM INADDR_ANY}<br> INADDR_ANY = $00000000;<br> {$EXTERNALSYM INADDR_LOOPBACK}<br> INADDR_LOOPBACK = $7F000001;<br> {$EXTERNALSYM INADDR_BROADCAST}<br> INADDR_BROADCAST = -1;<br> {$EXTERNALSYM INADDR_NONE}<br> INADDR_NONE = -1;<br><br> {$EXTERNALSYM WSADESCRIPTION_LEN}<br> WSADESCRIPTION_LEN = 256;<br> {$EXTERNALSYM WSASYS_STATUS_LEN}<br> WSASYS_STATUS_LEN = 128;<br><br>type<br> PWSAData = ^TWSAData;<br> {$EXTERNALSYM WSAData}<br> WSAData = record // !!! also WSDATA<br> wVersion: Word;<br> wHighVersion: Word;<br> szDescription: array[0..WSADESCRIPTION_LEN] of Char;<br> szSystemStatus: array[0..WSASYS_STATUS_LEN] of Char;<br> iMaxSockets: Word;<br> iMaxUdpDg: Word;<br> lpVendorInfo: PChar;<br> end;<br> TWSAData = WSAData;<br><br> {$EXTERNALSYM PTransmitFileBuffers}<br> PTransmitFileBuffers = ^TTransmitFileBuffers;<br> {$EXTERNALSYM _TRANSMIT_FILE_BUFFERS}<br> _TRANSMIT_FILE_BUFFERS = record<br> Head: Pointer;<br> HeadLength: DWORD;<br> Tail: Pointer;<br> TailLength: DWORD;<br> end;<br> {$EXTERNALSYM TTransmitFileBuffers}<br> TTransmitFileBuffers = _TRANSMIT_FILE_BUFFERS;<br> {$EXTERNALSYM TRANSMIT_FILE_BUFFERS}<br> TRANSMIT_FILE_BUFFERS = _TRANSMIT_FILE_BUFFERS;<br><br><br>const<br> {$EXTERNALSYM TF_DISCONNECT}<br> TF_DISCONNECT = $01;<br> {$EXTERNALSYM TF_REUSE_SOCKET}<br> TF_REUSE_SOCKET = $02;<br> {$EXTERNALSYM TF_WRITE_BEHIND}<br> TF_WRITE_BEHIND = $04;<br><br>{ Options for use with [gs]etsockopt at the IP level. }<br><br> {$EXTERNALSYM IP_OPTIONS}<br> IP_OPTIONS = 1;<br> {$EXTERNALSYM IP_MULTICAST_IF}<br> IP_MULTICAST_IF = 2; { set/get IP multicast interface }<br> {$EXTERNALSYM IP_MULTICAST_TTL}<br> IP_MULTICAST_TTL = 3; { set/get IP multicast timetolive }<br> {$EXTERNALSYM IP_MULTICAST_LOOP}<br> IP_MULTICAST_LOOP = 4; { set/get IP multicast loopback }<br> {$EXTERNALSYM IP_ADD_MEMBERSHIP}<br> IP_ADD_MEMBERSHIP = 5; { add an IP group membership }<br> {$EXTERNALSYM IP_DROP_MEMBERSHIP}<br> IP_DROP_MEMBERSHIP = 6; { drop an IP group membership }<br> {$EXTERNALSYM IP_TTL}<br> IP_TTL = 7; { set/get IP Time To Live }<br> {$EXTERNALSYM IP_TOS}<br> IP_TOS = 8; { set/get IP Type Of Service }<br> {$EXTERNALSYM IP_DONTFRAGMENT}<br> IP_DONTFRAGMENT = 9; { set/get IP Don't Fragment flag }<br><br><br> {$EXTERNALSYM IP_DEFAULT_MULTICAST_TTL}<br> IP_DEFAULT_MULTICAST_TTL = 1; { normally limit m'casts to 1 hop }<br> {$EXTERNALSYM IP_DEFAULT_MULTICAST_LOOP}<br> IP_DEFAULT_MULTICAST_LOOP = 1; { normally hear sends if a member }<br> {$EXTERNALSYM IP_MAX_MEMBERSHIPS}<br> IP_MAX_MEMBERSHIPS = 20; { per socket; must fit in one mbuf }<br><br>{ This is used instead of -1, since the<br> TSocket type is unsigned.}<br><br> {$EXTERNALSYM INVALID_SOCKET =}<br> INVALID_SOCKET = TSocket(NOT(0));<br> {$EXTERNALSYM SOCKET_ERROR =}<br> SOCKET_ERROR = -1;<br><br>{ Types }<br><br> {$EXTERNALSYM SOCK_STREAM}<br> SOCK_STREAM = 1; { stream socket }<br> {$EXTERNALSYM SOCK_DGRAM}<br> SOCK_DGRAM = 2; { datagram socket }<br> {$EXTERNALSYM SOCK_RAW}<br> SOCK_RAW = 3; { raw-protocol interface }<br> {$EXTERNALSYM SOCK_RDM}<br> SOCK_RDM = 4; { reliably-delivered message }<br> {$EXTERNALSYM SOCK_SEQPACKET}<br> SOCK_SEQPACKET = 5; { sequenced packet stream }<br><br>{ Option flags per-socket. }<br><br> {$EXTERNALSYM SO_DEBUG}<br> SO_DEBUG = $0001; { turn on debugging info recording }<br> {$EXTERNALSYM SO_ACCEPTCONN}<br> SO_ACCEPTCONN = $0002; { socket has had listen() }<br> {$EXTERNALSYM SO_REUSEADDR}<br> SO_REUSEADDR = $0004; { allow local address reuse }<br> {$EXTERNALSYM SO_KEEPALIVE}<br> SO_KEEPALIVE = $0008; { keep connections alive }<br> {$EXTERNALSYM SO_DONTROUTE}<br> SO_DONTROUTE = $0010; { just use interface addresses }<br> {$EXTERNALSYM SO_BROADCAST}<br> SO_BROADCAST = $0020; { permit sending of broadcast msgs }<br> {$EXTERNALSYM SO_USELOOPBACK}<br> SO_USELOOPBACK = $0040; { bypass hardware when possible }<br> {$EXTERNALSYM SO_LINGER}<br> SO_LINGER = $0080; { linger on close if data present }<br> {$EXTERNALSYM SO_OOBINLINE}<br> SO_OOBINLINE = $0100; { leave received OOB data in line }<br><br> {$EXTERNALSYM SO_DONTLINGER}<br> SO_DONTLINGER = $ff7f;<br><br>{ Additional options. }<br><br> {$EXTERNALSYM SO_SNDBUF}<br> SO_SNDBUF = $1001; { send buffer size }<br> {$EXTERNALSYM SO_RCVBUF}<br> SO_RCVBUF = $1002; { receive buffer size }<br> {$EXTERNALSYM SO_SNDLOWAT}<br> SO_SNDLOWAT = $1003; { send low-water mark }<br> {$EXTERNALSYM SO_RCVLOWAT}<br> SO_RCVLOWAT = $1004; { receive low-water mark }<br> {$EXTERNALSYM SO_SNDTIMEO}<br> SO_SNDTIMEO = $1005; { send timeout }<br> {$EXTERNALSYM SO_RCVTIMEO}<br> SO_RCVTIMEO = $1006; { receive timeout }<br> {$EXTERNALSYM SO_ERROR}<br> SO_ERROR = $1007; { get error status and clear }<br> {$EXTERNALSYM SO_TYPE}<br> SO_TYPE = $1008; { get socket type }<br><br>{ Options for connect and disconnect data and options. Used only by<br> non-TCP/IP transports such as DECNet, OSI TP4, etc. }<br><br> {$EXTERNALSYM SO_CONNDATA}<br> SO_CONNDATA = $7000;<br> {$EXTERNALSYM SO_CONNOPT}<br> SO_CONNOPT = $7001;<br> {$EXTERNALSYM SO_DISCDATA}<br> SO_DISCDATA = $7002;<br> {$EXTERNALSYM SO_DISCOPT}<br> SO_DISCOPT = $7003;<br> {$EXTERNALSYM SO_CONNDATALEN}<br> SO_CONNDATALEN = $7004;<br> {$EXTERNALSYM SO_CONNOPTLEN}<br> SO_CONNOPTLEN = $7005;<br> {$EXTERNALSYM SO_DISCDATALEN}<br> SO_DISCDATALEN = $7006;<br> {$EXTERNALSYM SO_DISCOPTLEN}<br> SO_DISCOPTLEN = $7007;<br><br>{ Option for opening sockets for synchronous access. }<br><br> {$EXTERNALSYM SO_OPENTYPE}<br> SO_OPENTYPE = $7008;<br><br> {$EXTERNALSYM SO_SYNCHRONOUS_ALERT}<br> SO_SYNCHRONOUS_ALERT = $10;<br> {$EXTERNALSYM SO_SYNCHRONOUS_NONALERT}<br> SO_SYNCHRONOUS_NONALERT = $20;<br><br>{ Other NT-specific options. }<br><br> {$EXTERNALSYM SO_MAXDG}<br> SO_MAXDG = $7009;<br> {$EXTERNALSYM SO_MAXPATHDG}<br> SO_MAXPATHDG = $700A;<br> {$EXTERNALSYM SO_UPDATE_ACCEPT_CONTEXT}<br> SO_UPDATE_ACCEPT_CONTEXT = $700B;<br> {$EXTERNALSYM SO_CONNECT_TIME}<br> SO_CONNECT_TIME = $700C;<br><br>{ TCP options. }<br><br> {$EXTERNALSYM TCP_NODELAY}<br> TCP_NODELAY = $0001;<br> {$EXTERNALSYM TCP_BSDURGENT}<br> TCP_BSDURGENT = $7000;<br><br>{ Address families. }<br><br> {$EXTERNALSYM AF_UNSPEC}<br> AF_UNSPEC = 0; { unspecified }<br> {$EXTERNALSYM AF_UNIX}<br> AF_UNIX = 1; { local to host (pipes, portals) }<br> {$EXTERNALSYM AF_INET}<br> AF_INET = 2; { internetwork: UDP, TCP, etc. }<br> {$EXTERNALSYM AF_IMPLINK}<br> AF_IMPLINK = 3; { arpanet imp addresses }<br> {$EXTERNALSYM AF_PUP}<br> AF_PUP = 4; { pup protocols: e.g. BSP }<br> {$EXTERNALSYM AF_CHAOS}<br> AF_CHAOS = 5; { mit CHAOS protocols }<br> {$EXTERNALSYM AF_IPX}<br> AF_IPX = 6; { IPX and SPX }<br> {$EXTERNALSYM AF_NS}<br> AF_NS = 6; { XEROX NS protocols }<br> {$EXTERNALSYM AF_ISO}<br> AF_ISO = 7; { ISO protocols }<br> {$EXTERNALSYM AF_OSI}<br> AF_OSI = AF_ISO; { OSI is ISO }<br> {$EXTERNALSYM AF_ECMA}<br> AF_ECMA = 8; { european computer manufacturers }<br> {$EXTERNALSYM AF_DATAKIT}<br> AF_DATAKIT = 9; { datakit protocols }<br> {$EXTERNALSYM AF_CCITT}<br> AF_CCITT = 10; { CCITT protocols, X.25 etc }<br> {$EXTERNALSYM AF_SNA}<br> AF_SNA = 11; { IBM SNA }<br> {$EXTERNALSYM AF_DECnet}<br> AF_DECnet = 12; { DECnet }<br> {$EXTERNALSYM AF_DLI}<br> AF_DLI = 13; { Direct data link interface }<br> {$EXTERNALSYM AF_LAT}<br> AF_LAT = 14; { LAT }<br> {$EXTERNALSYM AF_HYLINK}<br> AF_HYLINK = 15; { NSC Hyperchannel }<br> {$EXTERNALSYM AF_APPLETALK}<br> AF_APPLETALK = 16; { AppleTalk }<br> {$EXTERNALSYM AF_NETBIOS}<br> AF_NETBIOS = 17; { NetBios-style addresses }<br> {$EXTERNALSYM AF_VOICEVIEW}<br> AF_VOICEVIEW = 18; { VoiceView }<br> {$EXTERNALSYM AF_FIREFOX}<br> AF_FIREFOX = 19; { FireFox }<br> {$EXTERNALSYM AF_UNKNOWN1}<br> AF_UNKNOWN1 = 20; { Somebody is using this! }<br> {$EXTERNALSYM AF_BAN}<br> AF_BAN = 21; { Banyan }<br><br> {$EXTERNALSYM AF_MAX}<br> AF_MAX = 22;<br><br>type<br> { Structure used by kernel to store most addresses. }<br><br> {$EXTERNALSYM PSOCKADDR}<br> PSOCKADDR = ^TSockAddr;<br> {$EXTERNALSYM TSockAddr}<br> TSockAddr = sockaddr_in;<br><br><br> { Structure used by kernel to pass protocol information in raw sockets. }<br> PSockProto = ^TSockProto;<br> {$EXTERNALSYM sockproto}<br> sockproto = record<br> sp_family: u_short;<br> sp_protocol: u_short;<br> end;<br> TSockProto = sockproto;<br><br>const<br>{ Protocol families, same as address families for now. }<br><br> {$EXTERNALSYM PF_UNSPEC}<br> PF_UNSPEC = AF_UNSPEC;<br> {$EXTERNALSYM PF_UNIX}<br> PF_UNIX = AF_UNIX;<br> {$EXTERNALSYM PF_INET}<br> PF_INET = AF_INET;<br> {$EXTERNALSYM PF_IMPLINK}<br> PF_IMPLINK = AF_IMPLINK;<br> {$EXTERNALSYM PF_PUP}<br> PF_PUP = AF_PUP;<br> {$EXTERNALSYM PF_CHAOS}<br> PF_CHAOS = AF_CHAOS;<br> {$EXTERNALSYM PF_NS}<br> PF_NS = AF_NS;<br> {$EXTERNALSYM PF_IPX}<br> PF_IPX = AF_IPX;<br> {$EXTERNALSYM PF_ISO}<br> PF_ISO = AF_ISO;<br> {$EXTERNALSYM PF_OSI}<br> PF_OSI = AF_OSI;<br> {$EXTERNALSYM PF_ECMA}<br> PF_ECMA = AF_ECMA;<br> {$EXTERNALSYM PF_DATAKIT}<br> PF_DATAKIT = AF_DATAKIT;<br> {$EXTERNALSYM PF_CCITT}<br> PF_CCITT = AF_CCITT;<br> {$EXTERNALSYM PF_SNA}<br> PF_SNA = AF_SNA;<br> {$EXTERNALSYM PF_DECnet}<br> PF_DECnet = AF_DECnet;<br> {$EXTERNALSYM PF_DLI}<br> PF_DLI = AF_DLI;<br> {$EXTERNALSYM PF_LAT}<br> PF_LAT = AF_LAT;<br> {$EXTERNALSYM PF_HYLINK}<br> PF_HYLINK = AF_HYLINK;<br> {$EXTERNALSYM PF_APPLETALK}<br> PF_APPLETALK = AF_APPLETALK;<br> {$EXTERNALSYM PF_VOICEVIEW}<br> PF_VOICEVIEW = AF_VOICEVIEW;<br> {$EXTERNALSYM PF_FIREFOX}<br> PF_FIREFOX = AF_FIREFOX;<br> {$EXTERNALSYM PF_UNKNOWN1}<br> PF_UNKNOWN1 = AF_UNKNOWN1;<br> {$EXTERNALSYM PF_BAN}<br> PF_BAN = AF_BAN;<br><br> {$EXTERNALSYM PF_MAX}<br> PF_MAX = AF_MAX;<br><br>type<br>{ Structure used for manipulating linger option. }<br> PLinger = ^TLinger;<br> {$EXTERNALSYM linger}<br> linger = record<br> l_onoff: u_short;<br> l_linger: u_short;<br> end;<br> TLinger = linger;<br><br>const<br>{ Level number for (get/set)sockopt() to apply to socket itself. }<br><br> {$EXTERNALSYM SOL_SOCKET}<br> SOL_SOCKET = $ffff; {options for socket level }<br><br>{ Maximum queue length specifiable by listen. }<br><br> {$EXTERNALSYM SOMAXCONN}<br> SOMAXCONN = 5;<br><br> {$EXTERNALSYM MSG_OOB}<br> MSG_OOB = $1; {process out-of-band data }<br> {$EXTERNALSYM MSG_PEEK}<br> MSG_PEEK = $2; {peek at incoming message }<br> {$EXTERNALSYM MSG_DONTROUTE}<br> MSG_DONTROUTE = $4; {send without using routing tables }<br><br> {$EXTERNALSYM MSG_MAXIOVLEN}<br> MSG_MAXIOVLEN = 16;<br><br> {$EXTERNALSYM MSG_PARTIAL}<br> MSG_PARTIAL = $8000; {partial send or recv for message xport }<br><br>{ Define constant based on rfc883, used by gethostbyxxxx() calls. }<br><br> {$EXTERNALSYM MAXGETHOSTSTRUCT}<br> MAXGETHOSTSTRUCT = 1024;<br><br>{ Define flags to be used with the WSAAsyncSelect() call. }<br><br> {$EXTERNALSYM FD_READ}<br> FD_READ = $01;<br> {$EXTERNALSYM FD_WRITE}<br> FD_WRITE = $02;<br> {$EXTERNALSYM FD_OOB}<br> FD_OOB = $04;<br> {$EXTERNALSYM FD_ACCEPT}<br> FD_ACCEPT = $08;<br> {$EXTERNALSYM FD_CONNECT}<br> FD_CONNECT = $10;<br> {$EXTERNALSYM FD_CLOSE}<br> FD_CLOSE = $20;<br><br>{ All Windows Sockets error constants are biased by WSABASEERR from the "normal" }<br><br> {$EXTERNALSYM WSABASEERR}<br> WSABASEERR = 10000;<br><br>{ Windows Sockets definitions of regular Microsoft C error constants }<br><br> {$EXTERNALSYM WSAEINTR}<br> WSAEINTR = (WSABASEERR+4);<br> {$EXTERNALSYM WSAEBADF}<br> WSAEBADF = (WSABASEERR+9);<br> {$EXTERNALSYM WSAEACCES}<br> WSAEACCES = (WSABASEERR+13);<br> {$EXTERNALSYM WSAEFAULT}<br> WSAEFAULT = (WSABASEERR+14);<br> {$EXTERNALSYM WSAEINVAL}<br> WSAEINVAL = (WSABASEERR+22);<br> {$EXTERNALSYM WSAEMFILE}<br> WSAEMFILE = (WSABASEERR+24);<br><br>{ Windows Sockets definitions of regular Berkeley error constants }<br><br> {$EXTERNALSYM WSAEWOULDBLOCK}<br> WSAEWOULDBLOCK = (WSABASEERR+35);<br> {$EXTERNALSYM WSAEINPROGRESS}<br> WSAEINPROGRESS = (WSABASEERR+36);<br> {$EXTERNALSYM WSAEALREADY}<br> WSAEALREADY = (WSABASEERR+37);<br> {$EXTERNALSYM WSAENOTSOCK}<br> WSAENOTSOCK = (WSABASEERR+38);<br> {$EXTERNALSYM WSAEDESTADDRREQ}<br> WSAEDESTADDRREQ = (WSABASEERR+39);<br> {$EXTERNALSYM WSAEMSGSIZE}<br> WSAEMSGSIZE = (WSABASEERR+40);<br> {$EXTERNALSYM WSAEPROTOTYPE}<br> WSAEPROTOTYPE = (WSABASEERR+41);<br> {$EXTERNALSYM WSAENOPROTOOPT}<br> WSAENOPROTOOPT = (WSABASEERR+42);<br> {$EXTERNALSYM WSAEPROTONOSUPPORT}<br> WSAEPROTONOSUPPORT = (WSABASEERR+43);<br> {$EXTERNALSYM WSAESOCKTNOSUPPORT}<br> WSAESOCKTNOSUPPORT = (WSABASEERR+44);<br> {$EXTERNALSYM WSAEOPNOTSUPP}<br> WSAEOPNOTSUPP = (WSABASEERR+45);<br> {$EXTERNALSYM WSAEPFNOSUPPORT}<br> WSAEPFNOSUPPORT = (WSABASEERR+46);<br> {$EXTERNALSYM WSAEAFNOSUPPORT}<br> WSAEAFNOSUPPORT = (WSABASEERR+47);<br> {$EXTERNALSYM WSAEADDRINUSE}<br> WSAEADDRINUSE = (WSABASEERR+48);<br> {$EXTERNALSYM WSAEADDRNOTAVAIL}<br> WSAEADDRNOTAVAIL = (WSABASEERR+49);<br> {$EXTERNALSYM WSAENETDOWN}<br> WSAENETDOWN = (WSABASEERR+50);<br> {$EXTERNALSYM WSAENETUNREACH}<br> WSAENETUNREACH = (WSABASEERR+51);<br> {$EXTERNALSYM WSAENETRESET}<br> WSAENETRESET = (WSABASEERR+52);<br> {$EXTERNALSYM WSAECONNABORTED}<br> WSAECONNABORTED = (WSABASEERR+53);<br> {$EXTERNALSYM WSAECONNRESET}<br> WSAECONNRESET = (WSABASEERR+54);<br> {$EXTERNALSYM WSAENOBUFS}<br> WSAENOBUFS = (WSABASEERR+55);<br> {$EXTERNALSYM WSAEISCONN}<br> WSAEISCONN = (WSABASEERR+56);<br> {$EXTERNALSYM WSAENOTCONN}<br> WSAENOTCONN = (WSABASEERR+57);<br> {$EXTERNALSYM WSAESHUTDOWN}<br> WSAESHUTDOWN = (WSABASEERR+58);<br> {$EXTERNALSYM WSAETOOMANYREFS}<br> WSAETOOMANYREFS = (WSABASEERR+59);<br> {$EXTERNALSYM WSAETIMEDOUT}<br> WSAETIMEDOUT = (WSABASEERR+60);<br> {$EXTERNALSYM WSAECONNREFUSED}<br> WSAECONNREFUSED = (WSABASEERR+61);<br> {$EXTERNALSYM WSAELOOP}<br> WSAELOOP = (WSABASEERR+62);<br> {$EXTERNALSYM WSAENAMETOOLONG}<br> WSAENAMETOOLONG = (WSABASEERR+63);<br> {$EXTERNALSYM WSAEHOSTDOWN}<br> WSAEHOSTDOWN = (WSABASEERR+64);<br> {$EXTERNALSYM WSAEHOSTUNREACH}<br> WSAEHOSTUNREACH = (WSABASEERR+65);<br> {$EXTERNALSYM WSAENOTEMPTY}<br> WSAENOTEMPTY = (WSABASEERR+66);<br> {$EXTERNALSYM WSAEPROCLIM}<br> WSAEPROCLIM = (WSABASEERR+67);<br> {$EXTERNALSYM WSAEUSERS}<br> WSAEUSERS = (WSABASEERR+68);<br> {$EXTERNALSYM WSAEDQUOT}<br> WSAEDQUOT = (WSABASEERR+69);<br> {$EXTERNALSYM WSAESTALE}<br> WSAESTALE = (WSABASEERR+70);<br> {$EXTERNALSYM WSAEREMOTE}<br> WSAEREMOTE = (WSABASEERR+71);<br><br> {$EXTERNALSYM WSAEDISCON}<br> WSAEDISCON = (WSABASEERR+101);<br><br>{ Extended Windows Sockets error constant definitions }<br><br> {$EXTERNALSYM WSASYSNOTREADY}<br> WSASYSNOTREADY = (WSABASEERR+91);<br> {$EXTERNALSYM WSAVERNOTSUPPORTED}<br> WSAVERNOTSUPPORTED = (WSABASEERR+92);<br> {$EXTERNALSYM WSANOTINITIALISED}<br> WSANOTINITIALISED = (WSABASEERR+93);<br><br>{ Error return codes from gethostbyname() and gethostbyaddr()<br> (when using the resolver). Note that these errors are<br> retrieved via WSAGetLastError() and must therefore follow<br> the rules for avoiding clashes with error numbers from<br> specific implementations or language run-time systems.<br> For this reason the codes are based at WSABASEERR+1001.<br> Note also that [WSA]NO_ADDRESS is defined only for<br> compatibility purposes. }<br><br>{ Authoritative Answer: Host not found }<br><br> {$EXTERNALSYM WSAHOST_NOT_FOUND}<br> WSAHOST_NOT_FOUND = (WSABASEERR+1001);<br> {$EXTERNALSYM HOST_NOT_FOUND}<br> HOST_NOT_FOUND = WSAHOST_NOT_FOUND;<br><br>{ Non-Authoritative: Host not found, or SERVERFAIL }<br><br> {$EXTERNALSYM WSATRY_AGAIN}<br> WSATRY_AGAIN = (WSABASEERR+1002);<br> {$EXTERNALSYM TRY_AGAIN}<br> TRY_AGAIN = WSATRY_AGAIN;<br><br>{ Non recoverable errors, FORMERR, REFUSED, NOTIMP }<br><br> {$EXTERNALSYM WSANO_RECOVERY}<br> WSANO_RECOVERY = (WSABASEERR+1003);<br> {$EXTERNALSYM NO_RECOVERY}<br> NO_RECOVERY = WSANO_RECOVERY;<br><br>{ Valid name, no data record of requested type }<br><br> {$EXTERNALSYM WSANO_DATA}<br> WSANO_DATA = (WSABASEERR+1004);<br> {$EXTERNALSYM NO_DATA}<br> NO_DATA = WSANO_DATA;<br><br>{ no address, look for MX record }<br><br> {$EXTERNALSYM WSANO_ADDRESS}<br> WSANO_ADDRESS = WSANO_DATA;<br> {$EXTERNALSYM NO_ADDRESS}<br> NO_ADDRESS = WSANO_ADDRESS;<br><br>{ Windows Sockets errors redefined as regular Berkeley error constants.<br> These are commented out in Windows NT to avoid conflicts with errno.h.<br> Use the WSA constants instead. }<br><br> {$EXTERNALSYM EWOULDBLOCK}<br> EWOULDBLOCK = WSAEWOULDBLOCK;<br> {$EXTERNALSYM EINPROGRESS}<br> EINPROGRESS = WSAEINPROGRESS;<br> {$EXTERNALSYM EALREADY}<br> EALREADY = WSAEALREADY;<br> {$EXTERNALSYM ENOTSOCK}<br> ENOTSOCK = WSAENOTSOCK;<br> {$EXTERNALSYM EDESTADDRREQ}<br> EDESTADDRREQ = WSAEDESTADDRREQ;<br> {$EXTERNALSYM EMSGSIZE}<br> EMSGSIZE = WSAEMSGSIZE;<br> {$EXTERNALSYM EPROTOTYPE}<br> EPROTOTYPE = WSAEPROTOTYPE;<br> {$EXTERNALSYM ENOPROTOOPT}<br> ENOPROTOOPT = WSAENOPROTOOPT;<br> {$EXTERNALSYM EPROTONOSUPPORT}<br> EPROTONOSUPPORT = WSAEPROTONOSUPPORT;<br> {$EXTERNALSYM ESOCKTNOSUPPORT}<br> ESOCKTNOSUPPORT = WSAESOCKTNOSUPPORT;<br> {$EXTERNALSYM EOPNOTSUPP}<br> EOPNOTSUPP = WSAEOPNOTSUPP;<br> {$EXTERNALSYM EPFNOSUPPORT}<br> EPFNOSUPPORT = WSAEPFNOSUPPORT;<br> {$EXTERNALSYM EAFNOSUPPORT}<br> EAFNOSUPPORT = WSAEAFNOSUPPORT;<br> {$EXTERNALSYM EADDRINUSE}<br> EADDRINUSE = WSAEADDRINUSE;<br> {$EXTERNALSYM EADDRNOTAVAIL}<br> EADDRNOTAVAIL = WSAEADDRNOTAVAIL;<br> {$EXTERNALSYM ENETDOWN}<br> ENETDOWN = WSAENETDOWN;<br> {$EXTERNALSYM ENETUNREACH}<br> ENETUNREACH = WSAENETUNREACH;<br> {$EXTERNALSYM ENETRESET}<br> ENETRESET = WSAENETRESET;<br> {$EXTERNALSYM ECONNABORTED}<br> ECONNABORTED = WSAECONNABORTED;<br> {$EXTERNALSYM ECONNRESET}<br> ECONNRESET = WSAECONNRESET;<br> {$EXTERNALSYM ENOBUFS}<br> ENOBUFS = WSAENOBUFS;<br> {$EXTERNALSYM EISCONN}<br> EISCONN = WSAEISCONN;<br> {$EXTERNALSYM ENOTCONN}<br> ENOTCONN = WSAENOTCONN;<br> {$EXTERNALSYM ESHUTDOWN}<br> ESHUTDOWN = WSAESHUTDOWN;<br> {$EXTERNALSYM ETOOMANYREFS}<br> ETOOMANYREFS = WSAETOOMANYREFS;<br> {$EXTERNALSYM ETIMEDOUT}<br> ETIMEDOUT = WSAETIMEDOUT;<br> {$EXTERNALSYM ECONNREFUSED}<br> ECONNREFUSED = WSAECONNREFUSED;<br> {$EXTERNALSYM ELOOP}<br> ELOOP = WSAELOOP;<br> {$EXTERNALSYM ENAMETOOLONG}<br> ENAMETOOLONG = WSAENAMETOOLONG;<br> {$EXTERNALSYM EHOSTDOWN}<br> EHOSTDOWN = WSAEHOSTDOWN;<br> {$EXTERNALSYM EHOSTUNREACH}<br> EHOSTUNREACH = WSAEHOSTUNREACH;<br> {$EXTERNALSYM ENOTEMPTY}<br> ENOTEMPTY = WSAENOTEMPTY;<br> {$EXTERNALSYM EPROCLIM}<br> EPROCLIM = WSAEPROCLIM;<br> {$EXTERNALSYM EUSERS}<br> EUSERS = WSAEUSERS;<br> {$EXTERNALSYM EDQUOT}<br> EDQUOT = WSAEDQUOT;<br> {$EXTERNALSYM ESTALE}<br> ESTALE = WSAESTALE;<br> {$EXTERNALSYM EREMOTE}<br> EREMOTE = WSAEREMOTE;<br><br>type<br> LPVOID = Pointer;<br> PINT = ^Integer;<br> LPINT = PINT;<br><br> SOCKADDR = TSockAddr;<br><br> LPSOCKADDR = ^sockaddr;<br> LPSERVICE_ASYNC_INFO=Pointer;<br><br> SERVICE_ADDRESS=packed record<br> dwAddressTypeWORD;<br> dwAddressFlagsWORD;<br> dwAddressLengthWORD;<br> dwPrincipalLengthWORD;<br> lpAddress:BYTE;<br> lpPrincipal:BYTE;<br> end;<br><br> SERVICE_ADDRESSES=packed record<br> dwAddressCountWORD;<br> Addresses:array [1..1] of SERVICE_ADDRESS;<br> end;<br><br> LPSERVICE_ADDRESSES=^SERVICE_ADDRESSES;<br><br> BLOB=packed record<br> cbSize:ULONG;<br> pBlobData:BYTE;<br> end;<br><br> TGUID = packed record<br> D1: LongInt;<br> D2: Word;<br> D3: Word;<br> D4: Array[0..7] of Byte;<br> end;<br> PGUID = ^TGUID;<br> LPGUID = PGUID;<br><br> SERVICE_INFO=packed record<br> lpServiceType:LPGUID;<br> lpServiceName:LPTSTR;<br> lpComment:LPTSTR;<br> lpLocale:LPTSTR;<br> dwDisplayHintWORD;<br> dwVersionWORD;<br> dwTimeWORD;<br> lpMachineName:LPTSTR;<br> lpServiceAddress:LPSERVICE_ADDRESSES;<br> ServiceSpecificInfo:BLOB;<br> end;<br><br> LPSERVICE_INFO=^SERVICE_INFO;<br><br>{ Socket function prototypes }<br><br>function EnumProtocolsA(lpiProtocols:LPINT;lpProtocolBuffer:LPVOID;lpdwBufferLength:LPDWORD):integer;stdcall;<br>function EnumProtocolsW(lpiProtocols:LPINT;lpProtocolBuffer:LPVOID;lpdwBufferLength:LPDWORD):integer;stdcall;<br>function GetAddressByNameA(dwNameSpaceWORD;lpServiceType:LPGUID;lpServiceName:LPTSTR;<br> lpiProtocols:LPINT;dwResolutionWORD;lpServiceAsyncInfo:LPSERVICE_ASYNC_INFO;<br> lpCsaddrBuffer:LPVOID;lpdwBufferLength:LPDWORD;lpAliasBuffer:LPTSTR;<br> var lpdwAliasBufferLengthWORD):integer;stdcall;<br>function GetAddressByNameW(dwNameSpaceWORD;lpServiceType:LPGUID;lpServiceName:LPTSTR;<br> lpiProtocols:LPINT;dwResolutionWORD;lpServiceAsyncInfo:LPSERVICE_ASYNC_INFO;<br> lpCsaddrBuffer:LPVOID;lpdwBufferLength:LPDWORD;lpAliasBuffer:LPTSTR;<br> var lpdwAliasBufferLengthWORD):integer;stdcall;<br>function GetNameByTypeA(lpServiceType:LPGUID;lpServiceName:LPTSTR;dwNameLengthWORD):integer;stdcall;<br>function GetNameByTypeW(lpServiceType:LPGUID;lpServiceName:LPTSTR;dwNameLengthWORD):integer;stdcall;<br>function GetServiceA(dwNameSpaceWORD;lpGuidGUID;lpServiceName:LPTSTR;dwPropertiesWORD;<br> lpBuffer:LPVOID;lpdwBufferSize:LPDWORD;lpServiceAsyncInfo:LPSERVICE_ASYNC_INFO):integer;stdcall;<br>function GetServiceW(dwNameSpaceWORD;lpGuidGUID;lpServiceName:LPTSTR;dwPropertiesWORD;<br> lpBuffer:LPVOID;lpdwBufferSize:LPDWORD;lpServiceAsyncInfo:LPSERVICE_ASYNC_INFO):integer;stdcall;<br>function GetTypeByNameA(lpServiceName:LPTSTR;lpServiceTypeGUID):integer;stdcall;<br>function GetTypeByNameW(lpServiceName:LPTSTR;lpServiceTypeGUID):integer;stdcall;<br>function MigrateWinsockConfiguration(p,q,r:integer):integer;stdcall;<br>function NPLoadNameSpaces(p,q,r:integer):integer;stdcall;<br>function SetServiceA(dwNameSpace,dwOperation,dwFlagsWORD;lpServiceInfo:LPSERVICE_INFO;<br> lpServiceAsyncInfo:LPSERVICE_ASYNC_INFO;lpdwStatusFlags:LPDWORD):integer;stdcall;<br>function SetServiceW(dwNameSpace,dwOperation,dwFlagsWORD;lpServiceInfo:LPSERVICE_INFO;<br> lpServiceAsyncInfo:LPSERVICE_ASYNC_INFO;lpdwStatusFlags:LPDWORD):integer;stdcall;<br>function dn_expand(a0,a1,a2,a3,a4:integer):integer;stdcall;<br>function inet_network(a0:integer):integer;stdcall;<br>function getnetbyname(a0:integer):integer;stdcall;<br>function rcmd(a0,a1,a2,a3,a4,a5:integer):integer;stdcall;<br>function rexec(a0,a1,a2,a3,a4,a5:integer):integer;stdcall;<br>function rresvport(a0:integer):integer;stdcall;<br>function s_perror(a0,a1:integer):integer;stdcall;<br>function sethostname(a0,a1:integer):integer;stdcall;<br><br><br><br><br>function wep:integer;stdcall;<br>function WSApSetPostRoutine(a0:integer):integer;stdcall;<br><br>{$EXTERNALSYM accept}<br>function accept(s: TSocket; addr: PSockAddr; addrlen: PInteger): TSocket; stdcall;<br>{$EXTERNALSYM bind}<br>function bind(s: TSocket; var addr: TSockAddr; namelen: Integer): Integer; stdcall;<br>{$EXTERNALSYM closesocket}<br>function closesocket(s: TSocket): Integer; stdcall;<br>{$EXTERNALSYM connect}<br>function connect(s: TSocket; var name: TSockAddr; namelen: Integer): Integer; stdcall;<br>{$EXTERNALSYM ioctlsocket}<br>function ioctlsocket(s: TSocket; cmd: DWORD; var arg: u_long): Integer; stdcall;<br>{$EXTERNALSYM getpeername}<br>function getpeername(s: TSocket; var name: TSockAddr; var namelen: Integer): Integer; stdcall;<br>{$EXTERNALSYM getsockname}<br>function getsockname(s: TSocket; var name: TSockAddr; var namelen: Integer): Integer; stdcall;<br>{$EXTERNALSYM getsockopt}<br>function getsockopt(s: TSocket; level, optname: Integer; optval: PChar; var optlen: Integer): Integer; stdcall;<br>{$EXTERNALSYM htonl}<br>function htonl(hostlong: u_long): u_long; stdcall;<br>{$EXTERNALSYM htons}<br>function htons(hostshort: u_short): u_short; stdcall;<br>{$EXTERNALSYM inet_addr}<br>function inet_addr(cp: PChar): u_long; stdcall; {PInAddr;} { TInAddr }<br>{$EXTERNALSYM inet_ntoa}<br>function inet_ntoa(inaddr: TInAddr): PChar; stdcall;<br>{$EXTERNALSYM listen}<br>function listen(s: TSocket; backlog: Integer): Integer; stdcall;<br>{$EXTERNALSYM ntohl}<br>function ntohl(netlong: u_long): u_long; stdcall;<br>{$EXTERNALSYM ntohs}<br>function ntohs(netshort: u_short): u_short; stdcall;<br>{$EXTERNALSYM recv}<br>function recv(s: TSocket; var Buf; len, flags: Integer): Integer; stdcall;<br>{$EXTERNALSYM recvfrom}<br>function recvfrom(s: TSocket; var Buf; len, flags: Integer;<br> var from: TSockAddr; var fromlen: Integer): Integer; stdcall;<br>{$EXTERNALSYM select}<br>function select(nfds: Integer; readfds, writefds, exceptfds: PFDSet;<br> timeout: PTimeVal): Longint; stdcall;<br>{$EXTERNALSYM send}<br>function send(s: TSocket; var Buf; len, flags: Integer): Integer; stdcall;<br>{$EXTERNALSYM sendto}<br>function sendto(s: TSocket; var Buf; len, flags: Integer; var addrto: TSockAddr;<br> tolen: Integer): Integer; stdcall;<br>{$EXTERNALSYM setsockopt}<br>function setsockopt(s: TSocket; level, optname: Integer; optval: PChar;<br> optlen: Integer): Integer; stdcall;<br>{$EXTERNALSYM shutdown}<br>function shutdown(s: TSocket; how: Integer): Integer; stdcall;<br>{$EXTERNALSYM socket}<br>function socket(af, Struct, protocol: Integer): TSocket; stdcall;<br>{$EXTERNALSYM gethostbyaddr}<br>function gethostbyaddr(addr: Pointer; len, Struct: Integer): PHostEnt; stdcall;<br>{$EXTERNALSYM gethostbyname}<br>function gethostbyname(name: PChar): PHostEnt; stdcall;<br>{$EXTERNALSYM gethostname}<br>function gethostname(name: PChar; len: Integer): Integer; stdcall;<br>{$EXTERNALSYM getservbyport}<br>function getservbyport(port: Integer; proto: PChar): PServEnt; stdcall;<br>{$EXTERNALSYM getservbyname}<br>function getservbyname(name, proto: PChar): PServEnt; stdcall;<br>{$EXTERNALSYM getprotobynumber}<br>function getprotobynumber(proto: Integer): PProtoEnt; stdcall;<br>{$EXTERNALSYM getprotobyname}<br>function getprotobyname(name: PChar): PProtoEnt; stdcall;<br>{$EXTERNALSYM WSAStartup}<br>function WSAStartup(wVersionRequired: word; var WSData: TWSAData): Integer; stdcall;<br>{$EXTERNALSYM WSACleanup}<br>function WSACleanup: Integer; stdcall;<br>{$EXTERNALSYM WSASetLastError}<br>procedure WSASetLastError(iError: Integer); stdcall;<br>{$EXTERNALSYM WSAGetLastError}<br>function WSAGetLastError: Integer; stdcall;<br>{$EXTERNALSYM WSAIsBlocking}<br>function WSAIsBlocking: BOOL; stdcall;<br>{$EXTERNALSYM WSAUnhookBlockingHook}<br>function WSAUnhookBlockingHook: Integer; stdcall;<br>{$EXTERNALSYM WSASetBlockingHook}<br>function WSASetBlockingHook(lpBlockFunc: TFarProc): TFarProc; stdcall;<br>{$EXTERNALSYM WSACancelBlockingCall}<br>function WSACancelBlockingCall: Integer; stdcall;<br>{$EXTERNALSYM WSAAsyncGetServByName}<br>function WSAAsyncGetServByName(HWindow: HWND; wMsg: u_int;<br> name, proto, buf: PChar; buflen: Integer): THandle; stdcall;<br>{$EXTERNALSYM WSAAsyncGetServByPort}<br>function WSAAsyncGetServByPort( HWindow: HWND; wMsg, port: u_int;<br> proto, buf: PChar; buflen: Integer): THandle; stdcall;<br>{$EXTERNALSYM WSAAsyncGetProtoByName}<br>function WSAAsyncGetProtoByName(HWindow: HWND; wMsg: u_int;<br> name, buf: PChar; buflen: Integer): THandle; stdcall;<br>{$EXTERNALSYM WSAAsyncGetProtoByNumber}<br>function WSAAsyncGetProtoByNumber(HWindow: HWND; wMsg: u_int; number: Integer;<br> buf: PChar; buflen: Integer): THandle; stdcall;<br>{$EXTERNALSYM WSAAsyncGetHostByName}<br>function WSAAsyncGetHostByName(HWindow: HWND; wMsg: u_int;<br> name, buf: PChar; buflen: Integer): THandle; stdcall;<br>{$EXTERNALSYM WSAAsyncGetHostByAddr}<br>function WSAAsyncGetHostByAddr(HWindow: HWND; wMsg: u_int; addr: PChar;<br> len, Struct: Integer; buf: PChar; buflen: Integer): THandle; stdcall;<br>{$EXTERNALSYM WSACancelAsyncRequest}<br>function WSACancelAsyncRequest(hAsyncTaskHandle: THandle): Integer; stdcall;<br>{$EXTERNALSYM WSAAsyncSelect}<br>function WSAAsyncSelect(s: TSocket; HWindow: HWND; wMsg: u_int; lEvent: Longint): Integer; stdcall;<br>{$EXTERNALSYM WSARecvEx}<br>function WSARecvEx(s: TSocket; var buf; len: Integer; var flags: Integer): Integer; stdcall;<br>{$EXTERNALSYM __WSAFDIsSet}<br>function __WSAFDIsSet(s: TSocket; var FDSet: TFDSet): Bool; stdcall;<br><br>{$EXTERNALSYM TransmitFile}<br>function TransmitFile(hSocket: TSocket; hFile: THandle; nNumberOfBytesToWrite: DWORD;<br> nNumberOfBytesPerSend: DWORD; lpOverlapped: POverlapped;<br> lpTransmitBuffers: PTransmitFileBuffers; dwReserved: DWORD): BOOL; stdcall;<br><br>{$EXTERNALSYM AcceptEx}<br>function AcceptEx(sListenSocket, sAcceptSocket: TSocket;<br> lpOutputBuffer: Pointer; dwReceiveDataLength, dwLocalAddressLength,<br> dwRemoteAddressLength: DWORD; var lpdwBytesReceived: DWORD;<br> lpOverlapped: POverlapped): BOOL; stdcall;<br><br>{$EXTERNALSYM GetAcceptExSockaddrs}<br>procedure GetAcceptExSockaddrs(lpOutputBuffer: Pointer;<br> dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength: DWORD;<br> var LocalSockaddr: TSockAddr; var LocalSockaddrLength: Integer;<br> var RemoteSockaddr: TSockAddr; var RemoteSockaddrLength: Integer); stdcall;<br><br>{$EXTERNALSYM WSAMakeSyncReply}<br>function WSAMakeSyncReply(Buflen, Error: Word): Longint;<br>{$EXTERNALSYM WSAMakeSelectReply}<br>function WSAMakeSelectReply(Event, Error: Word): Longint;<br>{$EXTERNALSYM WSAGetAsyncBuflen}<br>function WSAGetAsyncBuflen(Param: Longint): Word;<br>{$EXTERNALSYM WSAGetAsyncError}<br>function WSAGetAsyncError(Param: Longint): Word;<br>{$EXTERNALSYM WSAGetSelectEvent}<br>function WSAGetSelectEvent(Param: Longint): Word;<br>{$EXTERNALSYM WSAGetSelectError}<br>function WSAGetSelectError(Param: Longint): Word;<br><br>{$EXTERNALSYM FD_CLR}<br>procedure FD_CLR(Socket: TSocket; var FDSet: TFDSet);<br>{$EXTERNALSYM FD_ISSET}<br>function FD_ISSET(Socket: TSocket; var FDSet: TFDSet): Boolean;<br>{$EXTERNALSYM FD_SET}<br>procedure FD_SET(Socket: TSocket; var FDSet: TFDSet); // renamed due to conflict with fd_set (above)<br>{$EXTERNALSYM FD_ZERO}<br>procedure FD_ZERO(var FDSet: TFDSet);<br><br>implementation<br><br>const<br> winsocket = 'wsock32.dll';<br> MSWSOCK='mswsock.dll';<br> WINSOCK32='winsock32.dll'; ///winnt/system32/wsock32.dll<br> WINSOCK2_DLL = 'ws2_32.dll';<br><br><br>function WSAMakeSyncReply;<br>begin<br> WSAMakeSyncReply:= MakeLong(Buflen, Error);<br>end;<br><br>function WSAMakeSelectReply;<br>begin<br> WSAMakeSelectReply:= MakeLong(Event, Error);<br>end;<br><br>function WSAGetAsyncBuflen;<br>begin<br> WSAGetAsyncBuflen:= LOWORD(Param);<br>end;<br><br>function WSAGetAsyncError;<br>begin<br> WSAGetAsyncError:= HIWORD(Param);<br>end;<br><br>function WSAGetSelectEvent;<br>begin<br> WSAGetSelectEvent:= LOWORD(Param);<br>end;<br><br>function WSAGetSelectError;<br>begin<br> WSAGetSelectError:= HIWORD(Param);<br>end;<br><br>procedure FD_CLR(Socket: TSocket; var FDSet: TFDSet);<br>var<br> I: Integer;<br>begin<br> I := 0;<br> while I < FDSet.fd_count do<br> begin<br> if FDSet.fd_array = Socket then<br> begin<br> while I < FDSet.fd_count - 1 do<br> begin<br> FDSet.fd_array := FDSet.fd_array[I + 1];<br> Inc(I);<br> end;<br> Dec(FDSet.fd_count);<br> Break;<br> end;<br> Inc(I);<br> end;<br>end;<br><br>function FD_ISSET(Socket: TSocket; var FDSet: TFDSet): Boolean;<br>begin<br> Result := __WSAFDIsSet(Socket, FDSet);<br>end;<br><br>procedure FD_SET(Socket: TSocket; var FDSet: TFDSet);<br>begin<br> if FDSet.fd_count < FD_SETSIZE then<br> begin<br> FDSet.fd_array[FDSet.fd_count] := Socket;<br> Inc(FDSet.fd_count);<br> end;<br>end;<br><br>procedure FD_ZERO(var FDSet: TFDSet);<br>begin<br> FDSet.fd_count := 0;<br>end;<br><br>function EnumProtocolsA; external MSWSOCK name 'enumprotocolsa';<br>function EnumProtocolsW; external MSWSOCK name 'enumprotocolsw';<br>function GetAddressByNameA; external MSWSOCK name 'getaddressbynamea';<br>function GetAddressByNameW; external MSWSOCK name 'getaddressbynamew';<br>function GetNameByTypeA; external MSWSOCK name 'getnamebytypea';<br>function GetNameByTypeW; external MSWSOCK name 'getnamebytypew';<br>function GetServiceA; external MSWSOCK name 'getservicea';<br>function GetServiceW; external MSWSOCK name 'getservicew';<br>function GetTypeByNameA; external MSWSOCK name 'gettypebynamea';<br>function GetTypeByNameW; external MSWSOCK name 'gettypebynamew';<br>function MigrateWinsockConfiguration; external MSWSOCK name 'migratewinsockconfiguration';<br>function NPLoadNameSpaces; external MSWSOCK name 'nploadnamespaces';<br>function SetServiceA; external MSWSOCK name 'setservicea';<br>function SetServiceW; external MSWSOCK name 'setservicew';<br>function dn_expand; external MSWSOCK name 'dn_expand';<br>function inet_network; external MSWSOCK name 'inet_network';<br>function getnetbyname; external MSWSOCK name 'getnetbyname';<br>function rcmd; external MSWSOCK name 'rcmd';<br>function rexec; external MSWSOCK name 'rexec';<br>function rresvport; external MSWSOCK name 'rresvport';<br>function s_perror; external MSWSOCK name 's_perror';<br>function sethostname; external MSWSOCK name 'sethostname';<br><br>function WEP; external WINSOCK2_Dll name 'wep';<br>function WSApSetPostRoutine; external WINSOCK2_Dll name 'wsapsetpostroutine';<br><br>function accept; external winsocket name 'accept';<br>function bind; external winsocket name 'bind';<br>function closesocket; external winsocket name 'closesocket';<br>function connect; external winsocket name 'connect';<br>function getpeername; external winsocket name 'getpeername';<br>function getsockname; external winsocket name 'getsockname';<br>function getsockopt; external winsocket name 'getsockopt';<br>function htonl; external winsocket name 'htonl';<br>function htons; external winsocket name 'htons';<br>function inet_addr; external winsocket name 'inet_addr';<br>function inet_ntoa; external winsocket name 'inet_ntoa';<br>function ioctlsocket; external winsocket name 'ioctlsocket';<br>function listen; external winsocket name 'listen';<br>function ntohl; external winsocket name 'ntohl';<br>function ntohs; external winsocket name 'ntohs';<br>function recv; external winsocket name 'recv';<br>function recvfrom; external winsocket name 'recvfrom';<br>function select; external winsocket name 'select';<br>function send; external winsocket name 'send';<br>function sendto; external winsocket name 'sendto';<br>function setsockopt; external winsocket name 'setsockopt';<br>function shutdown; external winsocket name 'shutdown';<br>function socket; external winsocket name 'socket';<br><br>function gethostbyaddr; external winsocket name 'gethostbyaddr';<br>function gethostbyname; external winsocket name 'gethostbyname';<br>function getprotobyname; external winsocket name 'getprotobyname';<br>function getprotobynumber; external winsocket name 'getprotobynumber';<br>function getservbyname; external winsocket name 'getservbyname';<br>function getservbyport; external winsocket name 'getservbyport';<br>function gethostname; external winsocket name 'gethostname';<br><br>function WSAAsyncSelect; external winsocket name 'WSAAsyncSelect';<br>function WSARecvEx; external winsocket name 'WSARecvEx';<br>function WSAAsyncGetHostByAddr; external winsocket name 'WSAAsyncGetHostByAddr';<br>function WSAAsyncGetHostByName; external winsocket name 'WSAAsyncGetHostByName';<br>function WSAAsyncGetProtoByNumber; external winsocket name 'WSAAsyncGetProtoByNumber';<br>function WSAAsyncGetProtoByName; external winsocket name 'WSAAsyncGetProtoByName';<br>function WSAAsyncGetServByPort; external winsocket name 'WSAAsyncGetServByPort';<br>function WSAAsyncGetServByName; external winsocket name 'WSAAsyncGetServByName';<br>function WSACancelAsyncRequest; external winsocket name 'WSACancelAsyncRequest';<br>function WSASetBlockingHook; external winsocket name 'WSASetBlockingHook';<br>function WSAUnhookBlockingHook; external winsocket name 'WSAUnhookBlockingHook';<br>function WSAGetLastError; external winsocket name 'WSAGetLastError';<br>procedure WSASetLastError; external winsocket name 'WSASetLastError';<br>function WSACancelBlockingCall; external winsocket name 'WSACancelBlockingCall';<br>function WSAIsBlocking; external winsocket name 'WSAIsBlocking';<br>function WSAStartup; external winsocket name 'WSAStartup';<br>function WSACleanup; external winsocket name 'WSACleanup';<br>function __WSAFDIsSet; external winsocket name '__WSAFDIsSet';<br><br>function TransmitFile; external winsocket name 'TransmitFile';<br>function AcceptEx; external winsocket name 'AcceptEx';<br>procedure GetAcceptExSockaddrs; external winsocket name 'GetAcceptExSockaddrs';<br><br>end.<br><br>