source: trunk/ab5.0/ablib/src/api_winsock2.sbp @ 604

Last change on this file since 604 was 604, checked in by OverTaker, 15 years ago

Controlがコンパイルできなくなっていたエラーを修整。
ついでにsockaddr_in6,in6_addrの宣言追加。

File size: 70.9 KB
Line 
1#ifndef _WINSOCK2API_
2#define _WINSOCK2API_
3#define _WINSOCKAPI_
4
5Const WINSOCK_VERSION = MAKEWORD(2, 2)
6
7TypeDef SOCKET = ULONG_PTR
8
9Const FD_SETSIZE = 64
10
11Type fd_set
12    fd_count As DWord
13    fd_array[ELM(FD_SETSIZE)] As SOCKET
14End Type
15
16Declare Function __WSAFDIsSet Lib "ws2_32" (fd As SOCKET, ByRef set As fd_set) As Long
17
18Sub FD_CLR(fd As SOCKET, ByRef set As fd_set)
19    Dim i As DWord
20    With set
21        For i = 0 To .fd_count
22            If .fd_array[i] = fd Then
23                While i < .fd_count - 1
24                    .fd_array[i] = .fd_array[i + 1]
25                WEnd
26                .fd_count--
27                Exit For
28            End If
29        Next
30    End With
31End Sub
32
33Sub FD_SET(fd As SOCKET, ByRef set As fd_set)
34    Dim i As DWord
35    With set
36        For i = 0 To ELM(.fd_count)
37            If .fd_array[i] = fd Then
38                Exit Sub
39            End If
40        Next
41        If i = .fd_count Then
42            If .fd_count < FD_SETSIZE Then
43                .fd_array[i] = fd
44                .fd_count++
45            End If
46        End If
47    End With
48End Sub
49
50Sub FD_ZERO(ByRef set As fd_set)
51    set.fd_count = 0
52End Sub
53
54Const FD_ISSET(fd, set) = __WSAFDIsSet(fd, set)
55
56Type timeval
57    tv_sec As  Long
58    tv_usec As  Long
59End Type
60
61' Operations on timevals.
62Function timerisset(ByRef tvp As timeval) As BOOL
63    Return tvp.tv_sec Or tvp.tv_usec
64End Function
65
66/*
67#define timercmp(tvp, uvp, cmp) \
68        ((tvp)->tv_sec cmp (uvp)->tv_sec || \
69         (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
70*/
71
72Sub timerclear(ByRef tvp As timeval)
73    tvp.tv_sec = 0
74    tvp.tv_usec = 0
75End Sub
76
77' Commands for ioctlsocket(),  taken from the BSD file fcntl.h.
78Const IOCPARM_MASK = &h7f
79Const IOC_VOID = &h20000000
80Const IOC_OUT = &h40000000
81Const IOC_IN = &h80000000
82Const IOC_INOUT= (IOC_IN Or IOC_OUT)
83
84Const _IO(x ,y) = (IOC_VOID Or (x << 8) Or y)
85
86Const _IOR(x, y, size) = (IOC_OUT Or ((size And IOCPARM_MASK) << 16) Or ((x) << 8) Or (y))
87
88Const _IOW(x, y, size) = (IOC_IN Or ((size And IOCPARM_MASK) << 16) Or ((x) << 8) Or (y))
89
90Const FIONREAD = _IOR(&h66,127, SizeOf (DWord)) '&h66は'f'
91Const FIONBIO = _IOW(&h66,126, SizeOf (DWord))
92Const FIOASYNC = _IOW(&h66,125, SizeOf (DWord))
93
94' Socket I/O Controls
95Const SIOCSHIWAT = _IOW(&h73, 0, SizeOf (DWord)) '&h73は's'
96Const SIOCGHIWAT = _IOR(&h73, 1, SizeOf (DWord))
97Const SIOCSLOWAT = _IOW(&h73, 2, SizeOf (DWord))
98Const SIOCGLOWAT = _IOR(&h73, 3, SizeOf (DWord))
99Const SIOCATMARK = _IOR(&h73, 7, SizeOf (DWord))
100
101
102Type /*Class*/ hostent
103'Public
104    h_name As *Byte
105    h_aliases As **Byte
106    h_addrtype As Integer
107    h_lengt As Integer
108    h_addr_list As **Byte
109/*
110    Function h_addr() As *Byte
111        Return h_addr_list[0]
112    End Function
113
114    Sub h_addr(l As *Byte)
115        h_addr_list[0] = i
116    End Sub
117*/
118End Type 'Class
119
120Type netent
121    n_name As *Byte
122    n_aliases As **Byte
123    n_addrtyp As Integer
124    n_net As DWord
125End Type
126
127Type servent
128    s_name As *Byte
129    s_aliases As **Byte
130#ifdef _WIN64
131    s_proto As *Byte
132    s_port As Integer
133#else
134    s_port As Integer
135    s_proto As *Byte
136#endif
137End Type
138
139Type protoent
140    p_name As *Byte
141    p_aliases As **Byte
142    p_proto As Integer
143End Type
144
145' Protocols
146Const IPPROTO_IP = 0
147Const IPPROTO_HOPOPTS = 0
148Const IPPROTO_ICMP = 1
149Const IPPROTO_IGMP = 2
150Const IPPROTO_GGP = 3
151Const IPPROTO_IPV4 = 4
152Const IPPROTO_TCP = 6
153Const IPPROTO_PUP = 12
154Const IPPROTO_UDP = 17
155Const IPPROTO_IDP = 22
156Const IPPROTO_IPV6 = 41
157Const IPPROTO_ROUTING = 43
158Const IPPROTO_FRAGMENT = 44
159Const IPPROTO_ESP = 50
160Const IPPROTO_AH = 51
161Const IPPROTO_ICMPV6 = 58
162Const IPPROTO_NONE = 59
163Const IPPROTO_DSTOPTS = 60
164Const IPPROTO_ND = 77
165Const IPPROTO_ICLFXBM = 78
166
167Const IPPROTO_RAW = 255
168Const IPPROTO_MAX = 256
169
170' Port/socket numbers: network standard functions
171Const IPPORT_ECHO = 7
172Const IPPORT_DISCARD = 9
173Const IPPORT_SYSTAT = 11
174Const IPPORT_DAYTIME = 13
175Const IPPORT_NETSTAT = 15
176Const IPPORT_FTP = 21
177Const IPPORT_TELNET = 23
178Const IPPORT_SMTP = 25
179Const IPPORT_TIMESERVER = 37
180Const IPPORT_NAMESERVER = 42
181Const IPPORT_WHOIS = 43
182Const IPPORT_MTP = 57
183
184' Port/socket numbers: host specific functions
185Const IPPORT_TFTP = 69
186Const IPPORT_RJE = 77
187Const IPPORT_FINGER = 79
188Const IPPORT_TTYLINK = 87
189Const IPPORT_SUPDUP = 95
190
191' UNIX TCP sockets
192Const IPPORT_EXECSERVER = 512
193Const IPPORT_LOGINSERVER = 513
194Const IPPORT_CMDSERVER = 514
195Const IPPORT_EFSSERVER = 520
196
197' UNIX UDP sockets
198Const IPPORT_BIFFUDP = 512
199Const IPPORT_WHOSERVER = 513
200Const IPPORT_ROUTESERVER = 520
201' 520+1 also used
202
203' Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root).
204Const IPPORT_RESERVED = 1024
205
206' Link numbers
207Const IMPLINK_IP = 155
208Const IMPLINK_LOWEXPER = 156
209Const IMPLINK_HIGHEXPER = 158
210
211' Internet address (old style... should be updated)
212Type /*Class*/ in_addr
213'Public
214/*
215    Union S_un
216        S_un_b As Type
217            s_b1 As Byte
218            s_b2 As Byte
219            s_b3 As Byte
220            s_b4 As Byte
221        End Type
222        S_un_w As Type
223            s_w1 As Word
224            s_w2 As Word
225        End Type
226        S_addr As DWord
227    End Union
228*/
229    s_addr As DWord
230/*
231    Function s_host() As Byte
232        Return GetByte(VarPtr(s_addr) + 1)
233    End Function
234
235    Sub s_host(h As Byte)
236        Return SetByte(VarPtr(s_addr) + 2, h)
237    End Sub
238
239    Function s_net() As Byte
240        Return GetByte(VarPtr(s_addr) + 0)
241    End Function
242
243    Sub s_net(n As Byte)
244        Return SetByte(VarPtr(s_addr) + 0, n)
245    End Sub
246
247    Function s_imp() As Word
248        Return GetWord(VarPtr(s_addr) + 1)
249    End Function
250
251    Sub s_imp(i As Word)
252        Return SetWord(VarPtr(s_addr) + 1, i)
253    End Sub
254
255    Function s_impno() As Byte
256        Return GetByte(VarPtr(s_addr) + 3)
257    End Function
258
259    Sub s_impno(i As Byte)
260        Return SetByte(VarPtr(s_addr) + 3, i)
261    End Sub
262
263    Function s_lh() As Byte
264        Return GetByte(VarPtr(s_addr) + 2)
265    End Function
266
267    Sub s_lh(l As Byte)
268        Return SetByte(VarPtr(s_addr) + 2, l)
269    End Sub
270*/
271End Type 'Class
272
273Type in6_addr
274    s6_addr[ELM(16)] As Byte
275End Type
276
277Const IN_CLASSA(i) = (((i) As DWord And &h80000000) = 0)
278Const IN_CLASSA_NET = &hff000000
279Const IN_CLASSA_NSHIFT = 24
280Const IN_CLASSA_HOST = &h00ffffff
281Const IN_CLASSA_MAX = 128
282
283Const IN_CLASSB(i) = (((i) As DWord & &hc0000000) = &h80000000)
284Const IN_CLASSB_NET= &hffff0000
285Const IN_CLASSB_NSHIFT = 16
286Const IN_CLASSB_HOST = &h0000ffff
287Const IN_CLASSB_MAX = 65536
288
289Const IN_CLASSC(i) = (((i) As DWord And &he0000000) = &hc0000000)
290Const IN_CLASSC_NET = &hffffff00
291Const IN_CLASSC_NSHIFT = 8
292Const IN_CLASSC_HOST = &h000000ff
293
294Const IN_CLASSD(i) = (((i) As DWord And &hf0000000) = &he0000000)
295Const IN_CLASSD_NET  = &hf0000000
296Const IN_CLASSD_NSHIFT = 28
297Const IN_CLASSD_HOST = &h0fffffff
298Const IN_MULTICAST(i) = IN_CLASSD(i)
299
300Const INADDR_ANY = &h00000000 As DWord
301Const INADDR_LOOPBACK = &h7f000001
302Const INADDR_BROADCAST = &hffffffff As DWord
303Const INADDR_NONE = &hffffffff
304
305Const ADDR_ANY = INADDR_ANY
306
307' Socket address, internet style.
308Type sockaddr_in
309    sin_family As Integer
310    sin_port As Word
311    sin_addr As in_addr
312    sin_zero[ELM(8)] As Byte
313End Type
314
315Type sockaddr_in6
316    sin6_family As Word
317    sin6_port As Word
318    sin6_flowinfo As DWord
319    sin6_addr As in6_addr
320    sin6_scope_id As DWord
321End Type
322
323Const WSADESCRIPTION_LEN = 256
324Const WSASYS_STATUS_LEN = 128
325
326Type WSADATA
327    wVersion As Word
328    wHighVersion As Word
329#ifdef _WIN64
330    iMaxSockets As Word
331    iMaxUdpDg As Word
332    lpVendorInfo As *Byte
333    szDescription[WSADESCRIPTION_LEN] As Byte
334    szSystemStatus[WSASYS_STATUS_LEN] As Byte
335#else
336    szDescription[WSADESCRIPTION_LEN] As Byte
337    szSystemStatus[WSASYS_STATUS_LEN] As Byte
338    iMaxSockets As Word
339    iMaxUdpDg As Word
340    lpVendorInfo As *Byte
341#endif
342End Type
343
344TypeDef LPWSADATA = *WSADATA
345
346' Definitions related to sockets: types, address families, options,  taken from the BSD file sys/socket.h.
347
348Const INVALID_SOCKET = (Not 0) As ULONG_PTR
349Const SOCKET_ERROR = (-1)
350
351Const FROM_PROTOCOL_INFO = (-1)
352
353' Types
354Const SOCK_STREAM = 1
355Const SOCK_DGRAM = 2
356Const SOCK_RAW = 3
357Const SOCK_RDM = 4
358Const SOCK_SEQPACKET = 5
359
360' Option flags per-socket.
361Const SO_DEBUG = &h0001
362Const SO_ACCEPTCONN = &h0002
363Const SO_REUSEADDR = &h0004
364Const SO_KEEPALIVE = &h0008
365Const SO_DONTROUTE = &h0010
366Const SO_BROADCAST = &h0020
367Const SO_USELOOPBACK = &h0040
368Const SO_LINGER = &h0080
369Const SO_OOBINLINE = &h0100
370
371Const SO_DONTLINGER = ((Not SO_LINGER) As Long)
372Const SO_EXCLUSIVEADDRUSE = ((Not SO_REUSEADDR) As Long)
373
374' Additional options.
375Const SO_SNDBUF = &h1001
376Const SO_RCVBUF = &h1002
377Const SO_SNDLOWAT = &h1003
378Const SO_RCVLOWAT = &h1004
379Const SO_SNDTIMEO = &h1005
380Const SO_RCVTIMEO = &h1006
381Const SO_ERROR = &h1007
382Const SO_TYPE = &h1008
383
384' WinSock 2 extension -- new options
385Const SO_GROUP_ID = &h2001
386Const SO_GROUP_PRIORITY = &h2002
387Const SO_MAX_MSG_SIZE = &h2003
388Const SO_PROTOCOL_INFOA = &h2004
389Const SO_PROTOCOL_INFOW = &h2005
390#ifdef UNICODE
391Const SO_PROTOCOL_INFO = SO_PROTOCOL_INFOW
392#else
393Const SO_PROTOCOL_INFO = SO_PROTOCOL_INFOA
394#endif /* UNICODE */
395Const PVD_CONFIG = &h3001
396Const SO_CONDITIONAL_ACCEPT = &h3002
397
398' TCP options.
399Const TCP_NODELAY = &h0001
400
401' Address families.
402Const AF_UNSPEC = 0
403Const AF_UNIX = 1
404Const AF_INET = 2
405Const AF_IMPLINK = 3
406Const AF_PUP = 4
407Const AF_CHAOS = 5
408Const AF_NS = 6
409Const AF_IPX = AF_NS
410Const AF_ISO = 7
411Const AF_OSI = AF_ISO
412Const AF_ECMA = 8
413Const AF_DATAKIT = 9
414Const AF_CCITT = 10
415Const AF_SNA = 11
416Const AF_DECnet = 12
417Const AF_DLI = 13
418Const AF_LAT = 14
419Const AF_HYLINK = 15
420Const AF_APPLETALK = 16
421Const AF_NETBIOS = 17
422Const AF_VOICEVIEW = 18
423Const AF_FIREFOX = 19
424Const AF_UNKNOWN1 = 20
425Const AF_BAN = 21
426Const AF_ATM = 22
427Const AF_INET6 = 23
428Const AF_CLUSTER = 24
429Const AF_12844 = 25
430Const AF_IRDA = 26
431Const AF_NETDES = 28
432
433Const AF_TCNPROCESS = 29
434Const AF_TCNMESSAGE = 30
435Const AF_ICLFXBM = 31
436
437Const AF_MAX = 32
438
439' Structure used by kernel to store most addresses.
440Type sockaddr
441    sa_family As Word
442    sa_data[ELM(14)] As Byte
443End Type
444
445' Portable socket structure (RFC 2553).
446
447' Desired design of maximum size and alignment.
448' These are implementation specific.
449Const _SS_MAXSIZE = 128 ' Maximum size.
450Const _SS_ALIGNSIZE = (SizeOf (Int64)) 'Desired alignment.
451
452' Definitions used for sockaddr_storage structure paddings design.
453Const _SS_PAD1SIZE = (_SS_ALIGNSIZE - SizeOf (Integer))
454Const _SS_PAD2SIZE = (_SS_MAXSIZE - (SizeOf (Integer) + _SS_PAD1SIZE + _SS_ALIGNSIZE))
455
456Type sockaddr_storage
457    ss_family As Integer
458    __ss_pad1[ELM(_SS_PAD1SIZE)] As Byte
459    __ss_align As Int64
460    __ss_pad2[ELM(_SS_PAD2SIZE)] As Byte
461End Type
462
463Type sockproto
464    sp_family As Word
465    sp_protocol As Word
466End Type
467
468' Protocol families, same as address families for now.
469Const PF_UNSPEC = AF_UNSPEC
470Const PF_UNIX = AF_UNIX
471Const PF_INET = AF_INET
472Const PF_IMPLINK = AF_IMPLINK
473Const PF_PUP = AF_PUP
474Const PF_CHAOS = AF_CHAOS
475Const PF_NS = AF_NS
476Const PF_IPX = AF_IPX
477Const PF_ISO = AF_ISO
478Const PF_OSI = AF_OSI
479Const PF_ECMA = AF_ECMA
480Const PF_DATAKIT = AF_DATAKIT
481Const PF_CCITT = AF_CCITT
482Const PF_SNA = AF_SNA
483Const PF_DECnet = AF_DECnet
484Const PF_DLI = AF_DLI
485Const PF_LAT = AF_LAT
486Const PF_HYLINK = AF_HYLINK
487Const PF_APPLETALK = AF_APPLETALK
488Const PF_VOICEVIEW = AF_VOICEVIEW
489Const PF_FIREFOX = AF_FIREFOX
490Const PF_UNKNOWN1 = AF_UNKNOWN1
491Const PF_BAN = AF_BAN
492Const PF_ATM = AF_ATM
493Const PF_INET6 = AF_INET6
494
495Const PF_MAX = AF_MAX
496
497' Structure used for manipulating linger option.
498Type linger
499    l_onoff As Word
500    l_linger As Word
501End Type
502
503' Level number for (get/set)sockopt() to apply to socket itself.
504Const SOL_SOCKET = &hffff
505
506' Maximum queue length specifiable by listen.
507Const SOMAXCONN = &h7fffffff
508
509Const MSG_OOB = &h1
510Const MSG_PEEK = &h2
511Const MSG_DONTROUTE = &h4
512Const MSG_WAITALL = &h8
513
514Const MSG_PARTIAL = &h8000
515
516' WinSock 2 extension -- new flags for WSASend(), WSASendTo(), WSARecv() and
517'                          WSARecvFrom()
518Const MSG_INTERRUPT = &h10
519
520Const MSG_MAXIOVLEN = 16
521
522' Define constant based on rfc883, used by gethostbyxxxx() calls.
523Const MAXGETHOSTSTRUCT = 1024
524
525' WinSock 2 extension -- bit values and indices for FD_XXX network events
526Const FD_READ_BIT = 0
527Const FD_READ = (1 << FD_READ_BIT)
528
529Const FD_WRITE_BIT = 1
530Const FD_WRITE = (1 << FD_WRITE_BIT)
531
532Const FD_OOB_BIT = 2
533Const FD_OOB = (1 << FD_OOB_BIT)
534
535Const FD_ACCEPT_BIT = 3
536Const FD_ACCEPT = (1 << FD_ACCEPT_BIT)
537
538Const FD_CONNECT_BIT = 4
539Const FD_CONNECT = (1 << FD_CONNECT_BIT)
540
541Const FD_CLOSE_BIT = 5
542Const FD_CLOSE = (1 << FD_CLOSE_BIT)
543
544Const FD_QOS_BIT = 6
545Const FD_QOS = (1 << FD_QOS_BIT)
546
547Const FD_GROUP_QOS_BIT = 7
548Const FD_GROUP_QOS = (1 << FD_GROUP_QOS_BIT)
549
550Const FD_ROUTING_INTERFACE_CHANGE_BIT = 8
551Const FD_ROUTING_INTERFACE_CHANGE = (1 << FD_ROUTING_INTERFACE_CHANGE_BIT)
552
553Const FD_ADDRESS_LIST_CHANGE_BIT = 9
554Const FD_ADDRESS_LIST_CHANGE = (1 << FD_ADDRESS_LIST_CHANGE_BIT)
555
556Const FD_MAX_EVENTS = 10
557Const FD_ALL_EVENTS = ((1 << FD_MAX_EVENTS) - 1)
558
559#require <api_winerror.sbp>
560
561' Compatibility macros.
562
563'Const h_errno = WSAGetLastError()
564Const HOST_NOT_FOUND = WSAHOST_NOT_FOUND
565Const TRY_AGAIN = WSATRY_AGAIN
566Const NO_RECOVERY = WSANO_RECOVERY
567Const NO_DATA = WSANO_DATA
568Const WSANO_ADDRESS = WSANO_DATA
569Const NO_ADDRESS = WSANO_ADDRESS
570
571' WinSock 2 extension -- new error codes and type definition
572
573'#ifdef _WIN32
574
575TypeDef WSAEVENT = HANDLE
576TypeDef LPWSAEVENT = *HANDLE
577TypeDef WSAOVERLAPPED = OVERLAPPED
578TypeDef LPWSAOVERLAPPED = *OVERLAPPED
579
580Const WSA_IO_PENDING = (ERROR_IO_PENDING)
581Const WSA_IO_INCOMPLETE = (ERROR_IO_INCOMPLETE)
582Const WSA_INVALID_HANDLE = (ERROR_INVALID_HANDLE)
583Const WSA_INVALID_PARAMETER = (ERROR_INVALID_PARAMETER)
584Const WSA_NOT_ENOUGH_MEMORY = (ERROR_NOT_ENOUGH_MEMORY)
585Const WSA_OPERATION_ABORTED = (ERROR_OPERATION_ABORTED)
586
587Const WSA_INVALID_EVENT = (0 As WSAEVENT)
588Const WSA_MAXIMUM_WAIT_EVENTS = (MAXIMUM_WAIT_OBJECTS)
589Const WSA_WAIT_FAILED = (WAIT_FAILED)
590Const WSA_WAIT_EVENT_0 = (WAIT_OBJECT_0)
591Const WSA_WAIT_IO_COMPLETION = (WAIT_IO_COMPLETION)
592Const WSA_WAIT_TIMEOUT = (WAIT_TIMEOUT)
593Const WSA_INFINITE = (INFINITE)
594
595'#elif defined _WIN16
596'#endif
597
598Type WSABUF
599    len As DWord
600    buf As *Byte
601End Type
602TypeDef LPWSABUF = *WSABUF
603
604#require <qos.ab>
605
606Type QOS 'struct _QualityOfService
607    SendingFlowspec As FLOWSPEC
608    ReceivingFlowspec As FLOWSPEC
609    ProviderSpecific As WSABUF
610End Type
611TypeDef LPQOS = *QOS
612
613' WinSock 2 extension -- manifest constants for return values of the condition function
614Const CF_ACCEPT = &h0000
615Const CF_REJECT = &h0001
616Const CF_DEFER = &h0002
617
618' WinSock 2 extension -- manifest constants for shutdown()
619Const SD_RECEIVE = &h00
620Const SD_SEND = &h01
621Const SD_BOTH = &h02
622
623' WinSock 2 extension -- data type and manifest constants for socket groups
624TypeDef GROUP = DWord
625
626Const SG_UNCONSTRAINED_GROUP = &h01
627Const SG_CONSTRAINED_GROUP = &h02
628
629' WinSock 2 extension -- data type for WSAEnumNetworkEvents()
630Type WSANETWORKEVENTS
631    lNetworkEvents As Long
632    iErrorCode[ELM(FD_MAX_EVENTS)] As Long
633End Type
634TypeDef LPWSANETWORKEVENTS = *WSANETWORKEVENTS
635
636' WinSock 2 extension -- WSAPROTOCOL_INFO structure and associated
637' manifest constants
638
639Const MAX_PROTOCOL_CHAIN = 7
640
641Const BASE_PROTOCOL = 1
642Const LAYERED_PROTOCOL = 0
643
644Type WSAPROTOCOLCHAIN
645    ChainLen As Long
646    ChainEntries[ELM(MAX_PROTOCOL_CHAIN)] As DWord
647End Type
648TypeDef LPWSAPROTOCOLCHAIN = *WSAPROTOCOLCHAIN
649
650Const WSAPROTOCOL_LEN = 255
651
652Type WSAPROTOCOL_INFOA
653    dwServiceFlags1 As DWord
654    dwServiceFlags2 As DWord
655    dwServiceFlags3 As DWord
656    dwServiceFlags4 As DWord
657    dwProviderFlags As DWord
658    ProviderId As GUID
659    dwCatalogEntryId As DWord
660    ProtocolChain As WSAPROTOCOLCHAIN
661    iVersion As Long
662    iAddressFamily As Long
663    iMaxSockAddr As Long
664    iMinSockAddr As Long
665    iSocketType As Long
666    iProtocol As Long
667    iProtocolMaxOffset As Long
668    iNetworkByteOrder As Long
669    iSecurityScheme As Long
670    dwMessageSize As DWord
671    dwProviderReserved As DWord
672    szProtocol[WSAPROTOCOL_LEN] As Byte
673End Type
674TypeDef LPWSAPROTOCOL_INFOA = *WSAPROTOCOL_INFOA
675
676Type WSAPROTOCOL_INFOW
677    dwServiceFlags1 As DWord
678    dwServiceFlags2 As DWord
679    dwServiceFlags3 As DWord
680    dwServiceFlags4 As DWord
681    dwProviderFlags As DWord
682    ProviderId As GUID
683    dwCatalogEntryId As DWord
684    ProtocolChain As WSAPROTOCOLCHAIN
685    iVersion As Long
686    iAddressFamily As Long
687    iMaxSockAddr As Long
688    iMinSockAddr As Long
689    iSocketType As Long
690    iProtocol As Long
691    iProtocolMaxOffset As Long
692    iNetworkByteOrder As Long
693    iSecurityScheme As Long
694    dwMessageSize As DWord
695    dwProviderReserved As DWord
696    szProtocol[WSAPROTOCOL_LEN] As WCHAR
697End Type
698TypeDef LPWSAPROTOCOL_INFOW = *WSAPROTOCOL_INFOW
699
700#ifdef UNICODE
701TypeDef WSAPROTOCOL_INFO = WSAPROTOCOL_INFOW
702TypeDef LPWSAPROTOCOL_INFO = LPWSAPROTOCOL_INFOW
703#else
704TypeDef WSAPROTOCOL_INFO = WSAPROTOCOL_INFOA
705TypeDef LPWSAPROTOCOL_INFO = LPWSAPROTOCOL_INFOA
706#endif
707
708' Flag bit definitions for dwProviderFlags
709Const PFL_MULTIPLE_PROTO_ENTRIES = &h00000001
710Const PFL_RECOMMENDED_PROTO_ENTRY = &h00000002
711Const PFL_HIDDEN = &h00000004
712Const PFL_MATCHES_PROTOCOL_ZERO = &h00000008
713
714' Flag bit definitions for dwServiceFlags1
715Const XP1_CONNECTIONLESS = &h00000001
716Const XP1_GUARANTEED_DELIVERY = &h00000002
717Const XP1_GUARANTEED_ORDER = &h00000004
718Const XP1_MESSAGE_ORIENTED = &h00000008
719Const XP1_PSEUDO_STREAM = &h00000010
720Const XP1_GRACEFUL_CLOSE = &h00000020
721Const XP1_EXPEDITED_DATA = &h00000040
722Const XP1_CONNECT_DATA = &h00000080
723Const XP1_DISCONNECT_DATA = &h00000100
724Const XP1_SUPPORT_BROADCAST = &h00000200
725Const XP1_SUPPORT_MULTIPOINT = &h00000400
726Const XP1_MULTIPOINT_CONTROL_PLANE = &h00000800
727Const XP1_MULTIPOINT_DATA_PLANE = &h00001000
728Const XP1_QOS_SUPPORTED = &h00002000
729Const XP1_INTERRUPT = &h00004000
730Const XP1_UNI_SEND = &h00008000
731Const XP1_UNI_RECV = &h00010000
732Const XP1_IFS_HANDLES = &h00020000
733Const XP1_PARTIAL_MESSAGE = &h00040000
734
735Const BIGENDIAN = &h0000
736Const LITTLEENDIAN = &h0001
737
738Const SECURITY_PROTOCOL_NONE = &h0000
739
740' WinSock 2 extension -- manifest constants for WSAJoinLeaf()
741Const JL_SENDER_ONLY = &h01
742Const JL_RECEIVER_ONLY = &h02
743Const JL_BOTH = &h04
744
745' WinSock 2 extension -- manifest constants for WSASocket()
746Const WSA_FLAG_OVERLAPPED = &h01
747Const WSA_FLAG_MULTIPOINT_C_ROOT = &h02
748Const WSA_FLAG_MULTIPOINT_C_LEAF = &h04
749Const WSA_FLAG_MULTIPOINT_D_ROOT = &h08
750Const WSA_FLAG_MULTIPOINT_D_LEAF = &h10
751
752' WinSock 2 extension -- manifest constants for WSAIoctl()
753Const IOC_UNIX = &h00000000
754Const IOC_WS2 = &h08000000
755Const IOC_PROTOCOL = &h10000000
756Const IOC_VENDOR = &h18000000
757
758Const _WSAIO(x, y) = (IOC_VOID Or (x) Or (y))
759Const _WSAIOR(x, y) = (IOC_OUT Or (x) Or (y))
760Const _WSAIOW(x, y) = (IOC_IN Or (x) Or (y))
761Const _WSAIORW(x, y) = (IOC_INOUT Or (x) Or (y))
762
763Const SIO_ASSOCIATE_HANDLE = _WSAIOW(IOC_WS2, 1)
764Const SIO_ENABLE_CIRCULAR_QUEUEING = _WSAIO(IOC_WS2, 2)
765Const SIO_FIND_ROUTE = _WSAIOR(IOC_WS2, 3)
766Const SIO_FLUSH = _WSAIO(IOC_WS2, 4)
767Const SIO_GET_BROADCAST_ADDRESS = _WSAIOR(IOC_WS2, 5)
768Const SIO_GET_EXTENSION_FUNCTION_POINTER = _WSAIORW(IOC_WS2, 6)
769Const SIO_GET_QOS = _WSAIORW(IOC_WS2, 7)
770Const SIO_GET_GROUP_QOS = _WSAIORW(IOC_WS2, 8)
771Const SIO_MULTIPOINT_LOOPBACK = _WSAIOW(IOC_WS2, 9)
772Const SIO_MULTICAST_SCOPE = _WSAIOW(IOC_WS2, 10)
773Const SIO_SET_QOS = _WSAIOW(IOC_WS2, 11)
774Const SIO_SET_GROUP_QOS = _WSAIOW(IOC_WS2, 12)
775Const SIO_TRANSLATE_HANDLE = _WSAIORW(IOC_WS2, 13)
776Const SIO_ROUTING_INTERFACE_QUERY = _WSAIORW(IOC_WS2, 20)
777Const SIO_ROUTING_INTERFACE_CHANGE = _WSAIOW(IOC_WS2, 21)
778Const SIO_ADDRESS_LIST_QUERY = _WSAIOR(IOC_WS2, 22)
779Const SIO_ADDRESS_LIST_CHANGE = _WSAIO(IOC_WS2, 23)
780Const SIO_QUERY_TARGET_PNP_HANDLE = _WSAIOR(IOC_WS2, 24)
781Const SIO_ADDRESS_LIST_SORT = _WSAIORW(IOC_WS2, 25)
782
783' WinSock 2 extensions -- data types for the condition function in
784' WSAAccept() and overlapped I/O completion routine.
785
786TypeDef LPCONDITIONPROC = *Function(
787    ByRef CallerId As WSABUF,
788    ByRef CallerData As WSABUF,
789    ByRef lpSQOS As QOS,
790    ByRef lpGQOS As QOS,
791    ByRef lpCalleeId As WSABUF,
792    ByRef lpCalleeData As WSABUF,
793    ByRef g As GROUP,
794    dwCallbackData As ULONG_PTR
795) As Long
796
797TypeDef LPWSAOVERLAPPED_COMPLETION_ROUTINE = *Sub(
798    dwError As DWord,
799    cbTransferred As DWord,
800    ByRef Overlapped As WSAOVERLAPPED,
801    dwFlags As DWord)
802
803' WinSock 2 extension -- manifest constants and associated structures
804' for WSANSPIoctl()
805Const SIO_NSP_NOTIFY_CHANGE = _WSAIOW(IOC_WS2, 25)
806
807Const Enum WSACOMPLETIONTYPE
808    NSP_NOTIFY_IMMEDIATELY = 0
809    NSP_NOTIFY_HWND
810    NSP_NOTIFY_EVENT
811    NSP_NOTIFY_PORT
812    NSP_NOTIFY_APC
813End Enum
814
815TypeDef PWSACOMPLETIONTYPE = *WSACOMPLETIONTYPE
816TypeDef LPWSACOMPLETIONTYPE = *WSACOMPLETIONTYPE
817
818Type _System_WinSock_WSACOMPLETION_WINDOWMESSAGE
819    hWnd As HWND
820    uMsg As DWord
821    context As WPARAM
822End Type
823
824Type _System_WinSock_WSACOMPLETION_EVENT
825    lpOverlapped As LPWSAOVERLAPPED
826End Type
827
828Type _System_WinSock_WSACOMPLETION_APC
829    lpOverlapped As LPWSAOVERLAPPED
830    lpfnCompletionProc As LPWSAOVERLAPPED_COMPLETION_ROUTINE
831End Type
832
833Type _System_WinSock_WSACOMPLETION_PORT
834    lpOverlapped As LPWSAOVERLAPPED
835    hPort As HANDLE
836    Key As ULONG_PTR
837End Type
838
839Type /*Class*/ WSACOMPLETION
840'Public
841    Type_ As WSACOMPLETIONTYPE
842/*
843    Parameters As Union
844        WindowMessage As _System_WinSock_WSACOMPLETION_WINDOWMESSAGE
845        Event As _System_WinSock_WSACOMPLETION_EVENT
846        Apc As _System_WinSock_WSACOMPLETION_APC
847        Port As _System_WinSock_WSACOMPLETION_PORT
848    End Union
849*/
850    Port As _System_WinSock_WSACOMPLETION_PORT
851/*
852    Function WindowMessage() As _System_WinSock_WSACOMPLETION_WINDOWMESSAGE
853        Dim p As *_System_WinSock_WSACOMPLETION_WINDOWMESSAGE
854        p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_WINDOWMESSAGE
855        Return p[0]
856    End Function
857
858    Sub WindowMessage(w As _System_WinSock_WSACOMPLETION_WINDOWMESSAGE)
859        Dim p As *_System_WinSock_WSACOMPLETION_WINDOWMESSAGE
860        p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_WINDOWMESSAGE
861        p[0] = w
862    End Sub
863
864    Function Event() As _System_WinSock_WSACOMPLETION_EVENT
865        Dim p As *_System_WinSock_WSACOMPLETION_EVENT
866        p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_EVENT
867        Return p[0]
868    End Function
869
870    Sub Event(e As _System_WinSock_WSACOMPLETION_EVENT)
871        Dim p As *_System_WinSock_WSACOMPLETION_EVENT
872        p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_EVENT
873        p[0] = e
874    End Sub
875
876    Function Apc() As _System_WinSock_WSACOMPLETION_APC
877        Dim p As *_System_WinSock_WSACOMPLETION_APC
878        p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_APC
879        Return p[0]
880    End Function
881
882    Sub Apc(a As _System_WinSock_WSACOMPLETION_APC)
883        Dim p As *_System_WinSock_WSACOMPLETION_APC
884        p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_APC
885        p[0] = a
886    End Sub
887/*
888    Function Port() As _System_WinSock_WSACOMPLETION_PORT
889        Dim p As *_System_WinSock_WSACOMPLETION_PORT
890        p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_PORT
891        Return p[0]
892    End Function
893
894    Sub Port(p As _System_WinSock_WSACOMPLETION_PORT)
895        Dim p As *_System_WinSock_WSACOMPLETION_PORT
896        p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_PORT
897        p[0] = p
898    End Sub
899*/
900End Type 'Class
901
902TypeDef PWSACOMPLETION = *WSACOMPLETION
903TypeDef LPWSACOMPLETION = *WSACOMPLETION
904
905' WinSock 2 extension -- manifest constants for SIO_TRANSLATE_HANDLE ioctl
906Const TH_NETDEV = &h00000001
907Const TH_TAPI = &h00000002
908
909TypeDef SOCKADDR = sockaddr
910TypeDef PSOCKADDR = *sockaddr
911TypeDef LPSOCKADDR = *sockaddr
912
913TypeDef SOCKADDR_STORAGE = sockaddr_storage
914TypeDef PSOCKADDR_STORAGE = *sockaddr_storage
915TypeDef LPSOCKADDR_STORAGE = *sockaddr_storage
916
917' Manifest constants and type definitions related to name resolution and
918' registration (RNR) API
919
920Type BLOB
921    cbSize As DWord
922#ifdef MIDL_PASS
923    [size_is(cbSize)] pBlobData As *Byte
924#else
925    pBlobData As *Byte
926#endif
927End Type
928TypeDef LPBLOB = *BLOB
929
930' Service Install Flags
931Const SERVICE_MULTIPLE = (&h00000001)
932
933' Name Spaces
934
935Const NS_ALL = (0)
936
937Const NS_SAP = (1)
938Const NS_NDS = (2)
939Const NS_PEER_BROWSE = (3)
940Const NS_SLP = (5)
941Const NS_DHCP = (6)
942
943Const NS_TCPIP_LOCAL = (10)
944Const NS_TCPIP_HOSTS = (11)
945Const NS_DNS = (12)
946Const NS_NETBT = (13)
947Const NS_WINS = (14)
948Const NS_NLA = (15)
949
950Const NS_NBP = (20)
951
952Const NS_MS = (30)
953Const NS_STDA = (31)
954Const NS_NTDS = (32)
955
956Const NS_X500 = (40)
957Const NS_NIS = (41)
958Const NS_NISPLUS = (42)
959
960Const NS_WRQ = (50)
961
962Const NS_NETDES = (60)
963
964' Resolution flags for WSAGetAddressByName().
965Const RES_UNUSED_1 = (&h00000001)
966Const RES_FLUSH_CACHE = (&h00000002)
967Const RES_SERVICE = (&h00000004)
968
969' Well known value names for Service Types
970
971'Const SERVICE_TYPE_VALUE_IPXPORTA = "IpxSocket"
972'Const SERVICE_TYPE_VALUE_IPXPORTW = L"IpxSocket"
973'Const SERVICE_TYPE_VALUE_SAPIDA = "SapId"
974'Const SERVICE_TYPE_VALUE_SAPIDW = L"SapId"
975
976'Const SERVICE_TYPE_VALUE_TCPPORTA = "TcpPort"
977'Const SERVICE_TYPE_VALUE_TCPPORTW = L"TcpPort"
978
979'Const SERVICE_TYPE_VALUE_UDPPORTA = "UdpPort"
980'Const SERVICE_TYPE_VALUE_UDPPORTW = L"UdpPort"
981
982'Const SERVICE_TYPE_VALUE_OBJECTIDA = "ObjectId"
983'Const SERVICE_TYPE_VALUE_OBJECTIDW = L"ObjectId"
984/*
985#ifdef UNICODE
986Const SERVICE_TYPE_VALUE_SAPID = SERVICE_TYPE_VALUE_SAPIDW
987Const SERVICE_TYPE_VALUE_TCPPORT = SERVICE_TYPE_VALUE_TCPPORTW
988Const SERVICE_TYPE_VALUE_UDPPORT = SERVICE_TYPE_VALUE_UDPPORTW
989Const SERVICE_TYPE_VALUE_OBJECTID = SERVICE_TYPE_VALUE_OBJECTIDW
990#else
991Const SERVICE_TYPE_VALUE_SAPID = SERVICE_TYPE_VALUE_SAPIDA
992Const SERVICE_TYPE_VALUE_TCPPORT = SERVICE_TYPE_VALUE_TCPPORTA
993Const SERVICE_TYPE_VALUE_UDPPORT = SERVICE_TYPE_VALUE_UDPPORTA
994Const SERVICE_TYPE_VALUE_OBJECTID = SERVICE_TYPE_VALUE_OBJECTIDA
995#endif
996*/
997Const SERVICE_TYPE_VALUE_IPXPORT = "IpxSocket"
998Const SERVICE_TYPE_VALUE_SAPID = "SapId"
999Const SERVICE_TYPE_VALUE_TCPPORT = "TcpPort"
1000Const SERVICE_TYPE_VALUE_UDPPORT = "UdpPort"
1001Const SERVICE_TYPE_VALUE_OBJECTID = "ObjectId"
1002
1003' SockAddr Information
1004Type SOCKET_ADDRESS
1005    lpSockaddr As LPSOCKADDR
1006    iSockaddrLength As Long
1007End Type
1008TypeDef PSOCKET_ADDRESS = *SOCKET_ADDRESS
1009TypeDef LPSOCKET_ADDRESS = *SOCKET_ADDRESS
1010
1011' CSAddr Information
1012Type CSADDR_INFO
1013    LocalAddr As SOCKET_ADDRESS
1014    RemoteAddr As SOCKET_ADDRESS
1015    iSocketType As Long
1016    iProtocol As Long
1017End Type
1018TypeDef PCSADDR_INFO = *CSADDR_INFO
1019TypeDef LPCSADDR_INFO = *CSADDR_INFO
1020
1021' Address list returned via SIO_ADDRESS_LIST_QUERY
1022Type SOCKET_ADDRESS_LIST
1023    iAddressCount As Long
1024    Address[ELM(1)] As SOCKET_ADDRESS
1025End Type
1026TypeDef LPSOCKET_ADDRESS_LIST = *SOCKET_ADDRESS_LIST
1027
1028' Address Family/Protocol Tuples
1029Type AFPROTOCOLS
1030    iAddressFamily As Long
1031    iProtocol As Long
1032End Type
1033TypeDef PAFPROTOCOLS = *AFPROTOCOLS
1034TypeDef LPAFPROTOCOLS = *AFPROTOCOLS
1035
1036' Client Query API Typedefs
1037
1038' The comparators
1039Const Enum WSAECOMPARATOR
1040    COMP_EQUAL = 0
1041    COMP_NOTLESS
1042End Enum
1043TypeDef PWSAECOMPARATOR = *WSAECOMPARATOR
1044TypeDef LPWSAECOMPARATOR = *WSAECOMPARATOR
1045
1046Type WSAVERSION
1047    dwVersion As DWord
1048    ecHow As WSAECOMPARATOR
1049End Type
1050TypeDef PWSAVERSION = *WSAVERSION
1051TypeDef LPWSAVERSION = *WSAVERSION
1052
1053Type WSAQUERYSETA
1054    dwSize As DWord
1055    lpszServiceInstanceName As LPSTR
1056    lpServiceClassId As *GUID
1057    lpVersion As LPWSAVERSION
1058    lpszComment As LPSTR
1059    dwNameSpace As DWord
1060    lpNSProviderId As *GUID
1061    lpszContext As LPSTR
1062    dwNumberOfProtocols As DWord
1063    lpafpProtocols As LPAFPROTOCOLS
1064    lpszQueryString As LPSTR
1065    dwNumberOfCsAddrs As DWord
1066    lpcsaBuffer As LPCSADDR_INFO
1067    dwOutputFlags As DWord
1068    lpBlob As LPBLOB
1069End Type
1070TypeDef PWSAQUERYSETA = *WSAQUERYSETA
1071TypeDef LPWSAQUERYSETA = *WSAQUERYSETA
1072
1073Type WSAQUERYSETW
1074    dwSize As DWord
1075    lpszServiceInstanceName As LPWSTR
1076    lpServiceClassId As *GUID
1077    lpVersion As LPWSAVERSION
1078    lpszComment As LPWSTR
1079    dwNameSpace As DWord
1080    lpNSProviderId As *GUID
1081    lpszContext As LPWSTR
1082    dwNumberOfProtocols As DWord
1083    lpafpProtocols As LPAFPROTOCOLS
1084    lpszQueryString As LPWSTR
1085    dwNumberOfCsAddrs As DWord
1086    lpcsaBuffer As LPCSADDR_INFO
1087    dwOutputFlags As DWord
1088    lpBlob As LPBLOB
1089End Type
1090TypeDef PWSAQUERYSETW = *WSAQUERYSETW
1091TypeDef LPWSAQUERYSETW = *WSAQUERYSETW
1092
1093#ifdef UNICODE
1094TypeDef WSAQUERYSET = WSAQUERYSETW
1095TypeDef PWSAQUERYSET = PWSAQUERYSETW
1096TypeDef LPWSAQUERYSET = LPWSAQUERYSETW
1097#else
1098TypeDef WSAQUERYSET = WSAQUERYSETA
1099TypeDef PWSAQUERYSET = PWSAQUERYSETA
1100TypeDef LPWSAQUERYSET = LPWSAQUERYSETA
1101#endif
1102
1103Const LUP_DEEP = &h0001
1104Const LUP_CONTAINERS = &h0002
1105Const LUP_NOCONTAINERS = &h0004
1106Const LUP_NEAREST = &h0008
1107Const LUP_RETURN_NAME = &h0010
1108Const LUP_RETURN_TYPE = &h0020
1109Const LUP_RETURN_VERSION = &h0040
1110Const LUP_RETURN_COMMENT = &h0080
1111Const LUP_RETURN_ADDR = &h0100
1112Const LUP_RETURN_BLOB = &h0200
1113Const LUP_RETURN_ALIASES = &h0400
1114Const LUP_RETURN_QUERY_STRING = &h0800
1115Const LUP_RETURN_ALL = &h0FF0
1116Const LUP_RES_SERVICE = &h8000
1117
1118Const LUP_FLUSHCACHE = &h1000
1119Const LUP_FLUSHPREVIOUS = &h2000
1120
1121' Return flags
1122Const RESULT_IS_ALIAS = &h0001
1123Const RESULT_IS_ADDED = &h0010
1124Const RESULT_IS_CHANGED = &h0020
1125Const RESULT_IS_DELETED = &h0040
1126
1127' Service Address Registration and Deregistration Data Types.
1128
1129Const Enum WSAESETSERVICEOP
1130    RNRSERVICE_REGISTER = 0
1131    RNRSERVICE_DEREGISTER
1132    RNRSERVICE_DELETE
1133End Enum
1134TypeDef PWSAESETSERVICEOP = *WSAESETSERVICEOP
1135TypeDef LPWSAESETSERVICEOP = *WSAESETSERVICEOP
1136
1137' Service Installation/Removal Data Types.
1138
1139Type WSANSCLASSINFOA
1140    lpszName As LPSTR
1141    dwNameSpace As DWord
1142    dwValueType As DWord
1143    dwValueSize As DWord
1144    lpValue As VoidPtr
1145End Type
1146TypeDef PWSANSCLASSINFOA = *WSANSCLASSINFOA
1147TypeDef LPWSANSCLASSINFOA = *WSANSCLASSINFOA
1148
1149Type WSANSCLASSINFOW
1150    lpszName As LPWSTR
1151    dwNameSpace As DWord
1152    dwValueType As DWord
1153    dwValueSize As DWord
1154    lpValue As VoidPtr
1155End Type
1156TypeDef PWSANSCLASSINFOW = *WSANSCLASSINFOW
1157TypeDef LPWSANSCLASSINFOW = *WSANSCLASSINFOW
1158
1159#ifdef UNICODE
1160TypeDef WSANSCLASSINFO = WSANSCLASSINFOW
1161TypeDef PWSANSCLASSINFO = PWSANSCLASSINFOW
1162TypeDef LPWSANSCLASSINFO = LPWSANSCLASSINFOW
1163#else
1164TypeDef WSANSCLASSINFO = WSANSCLASSINFOA
1165TypeDef PWSANSCLASSINFO = PWSANSCLASSINFOA
1166TypeDef LPWSANSCLASSINFO = LPWSANSCLASSINFOA
1167#endif
1168
1169Type WSASERVICECLASSINFOA
1170    lpServiceClassId As *GUID
1171    lpszServiceClassName As LPSTR
1172    dwCount As DWord
1173    lpClassInfos As LPWSANSCLASSINFOA
1174End Type
1175TypeDef PWSASERVICECLASSINFOA = *WSASERVICECLASSINFOA
1176TypeDef LPWSASERVICECLASSINFOA = *WSASERVICECLASSINFOA
1177
1178Type WSASERVICECLASSINFOW
1179    lpServiceClassId As *GUID
1180    lpszServiceClassName As LPWSTR
1181    dwCount As DWord
1182    lpClassInfos As LPWSANSCLASSINFOA
1183End Type
1184TypeDef PWSASERVICECLASSINFOW = *WSASERVICECLASSINFOW
1185TypeDef LPWSASERVICECLASSINFOW = *WSASERVICECLASSINFOW
1186
1187#ifdef UNICODE
1188TypeDef WSASERVICECLASSINFO = WSASERVICECLASSINFOW
1189TypeDef PWSASERVICECLASSINFO = PWSASERVICECLASSINFOW
1190TypeDef LPWSASERVICECLASSINFO = LPWSASERVICECLASSINFOW
1191#else
1192TypeDef WSASERVICECLASSINFO = WSASERVICECLASSINFOA
1193TypeDef PWSASERVICECLASSINFO = PWSASERVICECLASSINFOA
1194TypeDef LPWSASERVICECLASSINFO = LPWSASERVICECLASSINFOA
1195#endif
1196
1197Type WSANAMESPACE_INFOA
1198    NSProviderId As GUID
1199    dwNameSpace As DWord
1200    fActive As BOOL
1201    dwVersion As DWord
1202    lpszIdentifier As LPSTR
1203End Type
1204TypeDef PWSANAMESPACE_INFOA = *WSANAMESPACE_INFOA
1205TypeDef LPWSANAMESPACE_INFOA = *WSANAMESPACE_INFOA
1206
1207Type WSANAMESPACE_INFOW
1208    NSProviderId As GUID
1209    dwNameSpace As DWord
1210    fActive As BOOL
1211    dwVersion As DWord
1212    lpszIdentifier As LPWSTR
1213End Type
1214TypeDef PWSANAMESPACE_INFOW = *WSANAMESPACE_INFOW
1215TypeDef LPWSANAMESPACE_INFOW = *WSANAMESPACE_INFOW
1216
1217#ifdef UNICODE
1218TypeDef WSANAMESPACE_INFO = WSANAMESPACE_INFOW
1219TypeDef PWSANAMESPACE_INFO = PWSANAMESPACE_INFOW
1220TypeDef LPWSANAMESPACE_INFO = LPWSANAMESPACE_INFOW
1221#else
1222TypeDef WSANAMESPACE_INFO = WSANAMESPACE_INFOA
1223TypeDef PWSANAMESPACE_INFO = PWSANAMESPACE_INFOA
1224TypeDef LPWSANAMESPACE_INFO = LPWSANAMESPACE_INFOA
1225#endif
1226
1227' Socket function prototypes
1228
1229#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1230Declare Function accept Lib "ws2_32" (s As SOCKET, ByRef addr As sockaddr, ByRef addrlen As Long) As SOCKET
1231#endif
1232
1233#ifdef INCL_WINSOCK_API_TYPEDEFS
1234TypeDef LPFN_ACCEPT = *Function(s As SOCKET, ByRef addr As sockaddr, ByRef addrlen As Long) As SOCKET
1235#endif
1236
1237#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1238Declare Function bind Lib "ws2_32" (s As SOCKET, ByRef name As sockaddr, addrlen As Long) As Long
1239#endif
1240
1241#ifdef INCL_WINSOCK_API_TYPEDEFS
1242TypeDef LPFN_BIND = *Function(s As SOCKET, ByRef name As sockaddr, addrlen As Long) As Long
1243#endif
1244
1245#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1246Declare Function closesocket Lib "ws2_32" (s As SOCKET) As Long
1247#endif
1248
1249#ifdef INCL_WINSOCK_API_TYPEDEFS
1250TypeDef LPFN_CLOSESOCKET = *Function(s As SOCKET) As Long
1251#endif
1252
1253#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1254Declare Function connect Lib "ws2_32" (s As SOCKET, ByRef name As sockaddr, namelen As Long) As Long
1255#endif
1256
1257#ifdef INCL_WINSOCK_API_TYPEDEFS
1258TypeDef LPFN_CONNECT = *Function(s As SOCKET, ByRef name As sockaddr, namelen As Long) As Long
1259#endif
1260
1261#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1262Declare Function ioctlsocket Lib "ws2_32" (s As SOCKET, cmd As Long, ByRef argp As DWord) As Long
1263#endif
1264
1265#ifdef INCL_WINSOCK_API_TYPEDEFS
1266TypeDef LPFN_IOCTLSOCKET = *Function(s As SOCKET, cmd As Long, ByRef argp As DWord) As Long
1267#endif
1268
1269#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1270Declare Function getpeername Lib "ws2_32" (s As SOCKET, ByRef name As sockaddr, ByRef namelen As Long) As Long
1271#endif
1272
1273#ifdef INCL_WINSOCK_API_TYPEDEFS
1274TypeDef LPFN_GETPEERNAME = *Function(s As SOCKET, ByRef name As sockaddr, ByRef namelen As Long) As Long
1275#endif
1276
1277#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1278Declare Function getsockname Lib "ws2_32" (s As SOCKET, ByRef name As sockaddr, ByRef namelen As Long) As Long
1279#endif
1280
1281#ifdef INCL_WINSOCK_API_TYPEDEFS
1282TypeDef LPFN_GETSOCKNAME = *Function(s As SOCKET, ByRef name As sockaddr, ByRef namelen As Long) As Long
1283#endif
1284
1285#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1286Declare Function getsockopt Lib "ws2_32" (s As SOCKET, level As Long, optname As Long, optval As *Byte, ByRef optlen As Long) As Long
1287#endif
1288
1289#ifdef INCL_WINSOCK_API_TYPEDEFS
1290TypeDef LPFN_GETSOCKOPT = *Function(s As SOCKET, level As Long, optname As Long, optval As *Byte, ByRef optlen As Long) As Long
1291#endif
1292
1293#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1294Declare Function htonl Lib "ws2_32" (hostlong As DWord) As DWord
1295#endif
1296
1297#ifdef INCL_WINSOCK_API_TYPEDEFS
1298TypeDef LPFN_HTONL = *Function(hostlong As DWord) As DWord
1299#endif
1300
1301#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1302Declare Function htons Lib "ws2_32" (hostshort As Word) As Word
1303#endif
1304
1305#ifdef INCL_WINSOCK_API_TYPEDEFS
1306TypeDef LPFN_HTONS = *Function(hostshort As Word) As Word
1307#endif
1308
1309#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1310Declare Function inet_addr Lib "ws2_32" (cp As *Byte) As DWord
1311#endif
1312
1313#ifdef INCL_WINSOCK_API_TYPEDEFS
1314TypeDef LPFN_INET_ADDR = *Function(cp As *Byte) As DWord
1315#endif
1316
1317#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1318Declare Function inet_ntoa Lib "ws2_32" (in As DWord /*in_addr*/ ) As *Byte
1319#endif
1320
1321#ifdef INCL_WINSOCK_API_TYPEDEFS
1322TypeDef LPFN_INET_NTOA = *Function(in As in_addr) As *Byte
1323#endif
1324
1325#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1326Declare Function listen Lib "ws2_32" (s As SOCKET, backlog As Long) As Long
1327#endif
1328
1329#ifdef INCL_WINSOCK_API_TYPEDEFS
1330TypeDef LPFN_LISTEN = *Function(s As SOCKET, backlog As Long) As Long
1331#endif
1332
1333#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1334Declare Function ntohl Lib "ws2_32" (netlong As DWord) As DWord
1335#endif
1336
1337#ifdef INCL_WINSOCK_API_TYPEDEFS
1338TypeDef LPFN_NTOHL = *Function(netlong As DWord) As DWord
1339#endif
1340
1341#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1342Declare Function ntohs Lib "ws2_32" (netshort As Word) As Word
1343#endif
1344
1345#ifdef INCL_WINSOCK_API_TYPEDEFS
1346TypeDef LPFN_NTOHS = *Function(netshort As Word) As Word
1347#endif
1348
1349#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1350Declare Function recv Lib "ws2_32" (s As SOCKET, buf As *Byte, len As Long, flags As Long) As Long
1351#endif
1352
1353#ifdef INCL_WINSOCK_API_TYPEDEFS
1354TypeDef LPFN_RECV = *Function(s As SOCKET, buf As *Byte, len As Long, flags As Long) As Long
1355#endif
1356
1357#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1358Declare Function recvfrom Lib "ws2_32" (s As SOCKET, buf As *Byte, len As Long, flags As Long, ByRef from As sockaddr, ByRef fromlen As Long) As Long
1359#endif
1360
1361#ifdef INCL_WINSOCK_API_TYPEDEFS
1362TypeDef LPFN_RECVFROM = *Function(s As SOCKET, buf As *Byte, len As Long, flags As Long, ByRef from As sockaddr, ByRef fromlen As Long) As Long
1363#endif
1364
1365#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1366Declare Function select Lib "ws2_32" (nfds As Long, ByRef readfds As fd_set, ByRef writefds As fd_set, ByRef exceptfds As fd_set, ByRef timeout As timeval) As Long
1367#endif
1368
1369#ifdef INCL_WINSOCK_API_TYPEDEFS
1370TypeDef LPFN_SELECT = *Function(nfds As Long, ByRef readfds As fd_set, ByRef writefds As fd_set, ByRef exceptfds As fd_set, ByRef timeout As timeval) As Long
1371#endif
1372
1373#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1374Declare Function send Lib "ws2_32" (s As SOCKET, buf As *Byte, len As Long, flags As Long) As Long
1375#endif
1376
1377#ifdef INCL_WINSOCK_API_TYPEDEFS
1378TypeDef LPFN_SEND = *Function(s As SOCKET, buf As *Byte, len As Long, flags As Long) As Long
1379#endif
1380
1381#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1382Declare Function sendto Lib "ws2_32" (s As SOCKET, buf As *Byte, len As Long, flags As Long, ByRef to_ As sockaddr, tolen As Long) As Long
1383#endif
1384
1385#ifdef INCL_WINSOCK_API_TYPEDEFS
1386TypeDef LPFN_SENDTO = *Function(s As SOCKET, buf As *Byte, len As Long, flags As Long, ByRef to_ As sockaddr, tolen As Long) As Long
1387#endif
1388
1389#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1390Declare Function setsockopt Lib "ws2_32" (s As SOCKET, level As Long, optname As Long, optval As *Byte, optlen As Long) As Long
1391#endif
1392
1393#ifdef INCL_WINSOCK_API_TYPEDEFS
1394TypeDef LPFN_SETSOCKOPT = *Function(s As SOCKET, level As Long, optname As Long, optval As *Byte, optlen As Long) As Long
1395#endif
1396
1397#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1398Declare Function shutdown Lib "ws2_32" (s As SOCKET, how As Long) As Long
1399#endif
1400
1401#ifdef INCL_WINSOCK_API_TYPEDEFS
1402TypeDef LPFN_SHUTDOWN = *Function(s As SOCKET, how As Long) As Long
1403#endif
1404
1405#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1406Declare Function socket Lib "ws2_32" (af As Long, type_ As Long, protocol As Long) As SOCKET
1407#endif
1408
1409#ifdef INCL_WINSOCK_API_TYPEDEFS
1410TypeDef LPFN_SOCKET = *Function(af As Long, type_ As Long, protocol As Long) As SOCKET
1411#endif
1412
1413' Database function prototypes
1414
1415#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1416Declare Function gethostbyaddr Lib "ws2_32" (addr As PCSTR, len As Long, type_ As Long) As *hostent
1417#endif
1418
1419#ifdef INCL_WINSOCK_API_TYPEDEFS
1420TypeDef LPFN_GETHOSTBYADDR = *Function(addr As PCSTR, len As Long, type_ As Long) As *hostent
1421#endif
1422
1423#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1424Declare Function gethostbyname Lib "ws2_32" (name As PCSTR) As *hostent
1425#endif
1426
1427#ifdef INCL_WINSOCK_API_TYPEDEFS
1428TypeDef LPFN_GETHOSTBYNAME = *Function(name As PCSTR) As *hostent
1429#endif
1430
1431#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1432Declare Function gethostname Lib "ws2_32" (name As PCSTR, namelen As Long) As Long
1433#endif
1434
1435#ifdef INCL_WINSOCK_API_TYPEDEFS
1436TypeDef LPFN_GETHOSTNAME = *Function(name As PCSTR, namelen As Long) As Long
1437#endif
1438
1439#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1440Declare Function getservbyport Lib "ws2_32" (port As Long, proto As PCSTR) As *servent
1441#endif
1442
1443#ifdef INCL_WINSOCK_API_TYPEDEFS
1444TypeDef LPFN_GETSERVBYPORT = *Function(port As Long, proto As PCSTR) As *servent
1445#endif
1446
1447#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1448Declare Function getservbyname Lib "ws2_32" (name As PCSTR, proto As PCSTR) As *servent
1449#endif
1450
1451#ifdef INCL_WINSOCK_API_TYPEDEFS
1452TypeDef LPFN_GETSERVBYNAME = *Function(name As PCSTR, proto As PCSTR) As *servent
1453#endif
1454
1455#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1456Declare Function getprotobynumber Lib "ws2_32" (number As Long) As *protoent
1457#endif
1458
1459#ifdef INCL_WINSOCK_API_TYPEDEFS
1460TypeDef LPFN_GETPROTOBYNUMBER = *Function(number As Long) As *protoent
1461#endif
1462
1463#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1464Declare Function getprotobyname Lib "ws2_32" (name As PCSTR) As *protoent
1465#endif
1466
1467#ifdef INCL_WINSOCK_API_TYPEDEFS
1468TypeDef LPFN_GETPROTOBYNAME = (name As PCSTR) As *protoent
1469#endif
1470
1471' Microsoft Windows Extension function prototypes
1472
1473#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1474Declare Function WSAStartup Lib "ws2_32" (wVersionRequested As Word, ByRef WSAData As WSADATA) As Long
1475#endif
1476
1477#ifdef INCL_WINSOCK_API_TYPEDEFS
1478TypeDef LPFN_WSASTARTUP = *Function(wVersionRequested As Word, ByRef WSAData As WSADATA) As Long
1479#endif
1480
1481#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1482Declare Function WSACleanup Lib "ws2_32" () As Long
1483#endif
1484
1485#ifdef INCL_WINSOCK_API_TYPEDEFS
1486TypeDef LPFN_WSACLEANUP = *Function() As Long
1487#endif
1488
1489#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1490Declare Sub WSASetLastError Lib "ws2_32" (iError As Long)
1491#endif
1492
1493#ifdef INCL_WINSOCK_API_TYPEDEFS
1494TypeDef LPFN_WSASETLASTERROR = *Sub(iError As Long)
1495#endif
1496
1497#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1498Declare Function WSAGetLastError Lib "ws2_32" () As Long
1499#endif
1500
1501#ifdef INCL_WINSOCK_API_TYPEDEFS
1502TypeDef LPFN_WSAGETLASTERROR = *Function() As Long
1503#endif
1504
1505#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1506Declare Function WSAIsBlocking Lib "ws2_32" () As BOOL
1507#endif
1508
1509#ifdef INCL_WINSOCK_API_TYPEDEFS
1510TypeDef LPFN_WSAISBLOCKING = *Function() As BOOL
1511#endif
1512
1513#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1514Declare Function WSAUnhookBlockingHook Lib "ws2_32" () As Long
1515#endif
1516
1517#ifdef INCL_WINSOCK_API_TYPEDEFS
1518TypeDef LPFN_WSAUNHOOKBLOCKINGHOOK = *Function() As Long
1519#endif
1520
1521#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1522Declare Function WSASetBlockingHook Lib "ws2_32" (lpBlockFunc As FARPROC) As FARPROC
1523
1524#endif
1525
1526#ifdef INCL_WINSOCK_API_TYPEDEFS
1527TypeDef LPFN_WSASETBLOCKINGHOOK = *Function(lpBlockFunc As FARPROC) As FARPROC
1528#endif
1529
1530#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1531Declare Function WSACancelBlockingCall Lib "ws2_32" () As Long
1532#endif
1533
1534#ifdef INCL_WINSOCK_API_TYPEDEFS
1535TypeDef LPFN_WSACANCELBLOCKINGCALL = *Function() As Long
1536#endif
1537
1538#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1539Declare Function WSAAsyncGetServByName Lib "ws2_32" (hwnd As HWND, msg As DWord, name As PCSTR, proto As PCSTR, buf As *Byte, buflen As Long) As HANDLE
1540#endif
1541
1542#ifdef INCL_WINSOCK_API_TYPEDEFS
1543TypeDef LPFN_WSAASYNCGETSERVBYNAME = *Function(hwnd As HWND, msg As DWord, name As PCSTR, proto As PCSTR, buf As *Byte, buflen As Long) As HANDLE
1544#endif
1545
1546#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1547Declare Function WSAAsyncGetServByPort Lib "ws2_32" (hwnd As HWND, msg As DWord, port As Long, proto As PCSTR, buf As *Byte, buflen As Long) As HANDLE
1548#endif
1549
1550#ifdef INCL_WINSOCK_API_TYPEDEFS
1551TypeDef LPFN_WSAASYNCGETSERVBYPORT = *Function(hwnd As HWND, msg As DWord, port As Long, proto As PCSTR, buf As *Byte, buflen As Long) As HANDLE
1552#endif
1553
1554#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1555Declare Function WSAAsyncGetProtoByName Lib "ws2_32" (hwnd As HWND, msg As DWord, name As PCSTR, buf As *Byte, buflen As Long) As HANDLE
1556#endif
1557
1558#ifdef INCL_WINSOCK_API_TYPEDEFS
1559TypeDef LPFN_WSAASYNCGETPROTOBYNAME = *Function(hwnd As HWND, msg As DWord, name As PCSTR, buf As *Byte, buflen As Long) As HANDLE
1560#endif
1561
1562#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1563Declare Function WSAAsyncGetProtoByNumber Lib "ws2_32" (hwnd As HWND, msg As DWord, number As Long, buf As *Byte, buflen As Long) As HANDLE
1564#endif
1565
1566#ifdef INCL_WINSOCK_API_TYPEDEFS
1567TypeDef LPFN_WSAASYNCGETPROTOBYNUMBER = *Function(hwnd As HWND, msg As DWord, number As Long, buf As *Byte, buflen As Long) As HANDLE
1568#endif
1569
1570#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1571Declare Function WSAAsyncGetHostByName Lib "ws2_32" (hwnd As HWND, msg As DWord, name As PCSTR, buf As *Byte, buflen As Long) As HANDLE
1572#endif
1573
1574#ifdef INCL_WINSOCK_API_TYPEDEFS
1575TypeDef LPFN_WSAASYNCGETHOSTBYNAME = *Function(hwnd As HWND, msg As DWord, name As PCSTR, buf As *Byte, buflen As Long) As HANDLE
1576#endif
1577
1578#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1579Declare Function WSAAsyncGetHostByAddr Lib "ws2_32" (hwnd As HWND, msg As DWord, addr As PCSTR, len As Long, type_ As Long, buf As *Byte, buflen As Long) As HANDLE
1580#endif
1581
1582#ifdef INCL_WINSOCK_API_TYPEDEFS
1583TypeDef LPFN_WSAASYNCGETHOSTBYADDR = *Function(hwnd As HWND, msg As DWord, addr As PCSTR, len As Long, type_ As Long, buf As *Byte, buflen As Long) As HANDLE
1584#endif
1585
1586#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1587Declare Function WSACancelAsyncRequest Lib "ws2_32" (hAsyncTaskHandle As HANDLE) As Long
1588#endif
1589
1590#ifdef INCL_WINSOCK_API_TYPEDEFS
1591TypeDef LPFN_WSACANCELASYNCREQUEST = *Function(hAsyncTaskHandle As HANDLE) As Long
1592#endif
1593
1594#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1595Declare Function WSAAsyncSelect Lib "ws2_32" (s As SOCKET, hwnd As HWND, msg As DWord, Event As Long) As Long
1596#endif
1597
1598#ifdef INCL_WINSOCK_API_TYPEDEFS
1599TypeDef LPFN_WSAASYNCSELECT = *Function(s As SOCKET, hwnd As HWND, msg As DWord, Event As Long) As Long
1600#endif
1601
1602/* WinSock 2 API new function prototypes */
1603
1604#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1605Declare Function WSAAccept Lib "ws2_32" (s As SOCKET, ByRef addr As sockaddr, ByRef addrlen As Long, lpfnCondition As LPCONDITIONPROC, CallbackData As ULONG_PTR) As SOCKET
1606#endif
1607
1608#ifdef INCL_WINSOCK_API_TYPEDEFS
1609TypeDef LPFN_WSAACCEPT = *Function(s As SOCKET, ByRef addr As sockaddr, ByRef addrlen As Long, lpfnCondition As LPCONDITIONPROC, CallbackData As ULONG_PTR) As SOCKET
1610#endif
1611
1612#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1613Declare Function WSACloseEvent Lib "ws2_32" (hEvent As WSAEVENT) As BOOL
1614#endif
1615
1616#ifdef INCL_WINSOCK_API_TYPEDEFS
1617TypeDef LPFN_WSACLOSEEVENT = *Function(hEvent As WSAEVENT) As BOOL
1618#endif
1619
1620#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1621Declare Function WSAConnect Lib "ws2_32" (s As SOCKET, ByRef name As sockaddr, namelen As Long, ByRef CallerData As WSABUF, ByRef CalleeData As WSABUF, ByRef SQOS As QOS, ByRef GQOS As QOS) As Long
1622#endif
1623
1624#ifdef INCL_WINSOCK_API_TYPEDEFS
1625TypeDef LPFN_WSACONNECT = *Functions As SOCKET, ByRef name As sockaddr, namelen As Long, ByRef CallerData As WSABUF, ByRef CalleeData As WSABUF, ByRef SQOS As QOS, ByRef GQOS As QOS) As Long
1626#endif
1627
1628#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1629Declare Function WSACreateEvent Lib "ws2_32" () As WSAEVENT
1630#endif
1631
1632#ifdef INCL_WINSOCK_API_TYPEDEFS
1633TypeDef LPFN_WSACREATEEVENT = *Function() As WSAEVENT
1634#endif
1635
1636#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1637Declare Function WSADuplicateSocketA Lib "ws2_32" (s As SOCKET, ProcessId As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOA) As Long
1638Declare Function WSADuplicateSocketW Lib "ws2_32" (s As SOCKET, ProcessId As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOW) As Long
1639#ifdef UNICODE
1640Declare Function WSADuplicateSocket Lib "ws2_32" Alias "WSADuplicateSocketW" (s As SOCKET, ProcessId As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFO) As Long
1641#else
1642Declare Function WSADuplicateSocket Lib "ws2_32" Alias "WSADuplicateSocketA" (s As SOCKET, ProcessId As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFO) As Long
1643#endif
1644#endif
1645
1646#ifdef INCL_WINSOCK_API_TYPEDEFS
1647TypeDef LPFN_WSADUPLICATESOCKETA = *Function(s As SOCKET, ProcessId As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOA) As Long
1648TypeDef LPFN_WSADUPLICATESOCKETW = *Function(s As SOCKET, ProcessId As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOW) As Long
1649#ifdef UNICODE
1650TypeDef LPFN_WSADUPLICATESOCKET = LPFN_WSADUPLICATESOCKETW
1651#else
1652TypeDef LPFN_WSADUPLICATESOCKET = LPFN_WSADUPLICATESOCKETA
1653#endif
1654#endif
1655
1656#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1657Declare Function WSAEnumNetworkEvents Lib "ws2_32" (s As SOCKET, hEventObject As WSAEVENT, ByRef NetworkEvents As WSANETWORKEVENTS) As Long
1658#endif
1659
1660#ifdef INCL_WINSOCK_API_TYPEDEFS
1661TypeDef LPFN_WSAENUMNETWORKEVENTS = *Function(s As SOCKET, hEventObject As WSAEVENT, ByRef NetworkEvents As WSANETWORKEVENTS) As Long
1662#endif
1663
1664#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1665Declare Function WSAEnumProtocolsA Lib "ws2_32" (Protocols As *Long, ByRef ProtocolBuffer As WSAPROTOCOL_INFOA, ByRef BufferLength As DWord) As Long
1666Declare Function WSAEnumProtocolsW Lib "ws2_32" (Protocols As *Long, ByRef ProtocolBuffer As WSAPROTOCOL_INFOW, ByRef BufferLength As DWord) As Long
1667#ifdef UNICODE
1668Declare Function WSAEnumProtocols Lib "ws2_32" Alias "WSAEnumProtocolsW" (Protocols As *Long, ByRef ProtocolBuffer As WSAPROTOCOL_INFO, ByRef BufferLength As DWord) As Long
1669#else
1670Declare Function WSAEnumProtocols Lib "ws2_32" Alias "WSAEnumProtocolsA" (Protocols As *Long, ByRef ProtocolBuffer As WSAPROTOCOL_INFO, ByRef BufferLength As DWord) As Long
1671#endif
1672#endif
1673
1674#ifdef INCL_WINSOCK_API_TYPEDEFS
1675TypeDef LPFN_WSAENUMPROTOCOLSA = *Function(Protocols As *Long, ByRef ProtocolBuffer As WSAPROTOCOL_INFOA, ByRef BufferLength As DWord) As Long
1676TypeDef LPFN_WSAENUMPROTOCOLSW = *Function(Protocols As *Long, ByRef ProtocolBuffer As WSAPROTOCOL_INFOW, ByRef BufferLength As DWord) As Long
1677#ifdef UNICODE
1678TypeDef LPFN_WSAENUMPROTOCOLS = LPFN_WSAENUMPROTOCOLSW
1679#else
1680TypeDef LPFN_WSAENUMPROTOCOLS = LPFN_WSAENUMPROTOCOLSA
1681#endif
1682#endif
1683
1684#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1685Declare Function WSAEventSelect Lib "ws2_32" (s As SOCKET, hEventObject As WSAEVENT, NetworkEvents As Long) As Long
1686#endif
1687
1688#ifdef INCL_WINSOCK_API_TYPEDEFS
1689TypeDef LPFN_WSAEVENTSELECT = *Function(s As SOCKET, hEventObject As WSAEVENT, NetworkEvents As Long) As Long
1690#endif
1691
1692#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1693Declare Function WSAGetOverlappedResult Lib "ws2_32" (s As SOCKET, ByRef Overlapped As WSAOVERLAPPED, ByRef cbTransfer As DWord, Wait As BOOL, ByRef Flags As DWord) As BOOL
1694#endif
1695
1696#ifdef INCL_WINSOCK_API_TYPEDEFS
1697TypeDef LPFN_WSAGETOVERLAPPEDRESULT = *Function(s As SOCKET, ByRef Overlapped As WSAOVERLAPPED, ByRef cbTransfer As DWord, Wait As BOOL, ByRef Flags As DWord) As BOOL
1698#endif
1699
1700#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1701Declare Function WSAGetQOSByName Lib "ws2_32" (s As SOCKET, ByRef QOSName As WSABUF, ByRef qos As QOS) As BOOL
1702#endif
1703
1704#ifdef INCL_WINSOCK_API_TYPEDEFS
1705TypeDef LPFN_WSAGETQOSBYNAME = *Function(s As SOCKET, ByRef QOSName As WSABUF, ByRef qos As QOS) As BOOL
1706#endif
1707
1708#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1709Declare Function WSAHtonl Lib "ws2_32" (s As SOCKET, hostlong As DWord, ByRef netlong As DWord) As Long
1710#endif
1711
1712#ifdef INCL_WINSOCK_API_TYPEDEFS
1713TypeDef LPFN_WSAHTONL = *Function(s As SOCKET, hostlong As DWord, ByRef netlong As DWord) As Long
1714#endif
1715
1716#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1717Declare Function WSAHtons Lib "ws2_32" (s As SOCKET, hostshort As Word, ByRef netshort As Word) As Long
1718#endif
1719
1720#ifdef INCL_WINSOCK_API_TYPEDEFS
1721TypeDef LPFN_WSAHTONS = *Function(s As SOCKET, hostshort As Word, ByRef netshort As Word) As Long
1722#endif
1723
1724#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1725Declare Function WSAIoctl Lib "ws2_32" (s As SOCKET, IoControlCode As DWord, pvInBuffer As VoidPtr, cbInBuffer As DWord, pvOutBuffer As VoidPtr, cbOutBuffer As DWord,
1726    ByRef cbBytesReturned As DWord, ByRef Overlapped As WSAOVERLAPPED, pCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
1727#endif
1728
1729#ifdef INCL_WINSOCK_API_TYPEDEFS
1730TypeDef LPFN_WSAIOCTL = *Function(s As SOCKET, IoControlCode As DWord, pvInBuffer As VoidPtr, cbInBuffer As DWord, pvOutBuffer As VoidPtr, cbOutBuffer As DWord,
1731    ByRef cbBytesReturned As DWord, ByRef Overlapped As WSAOVERLAPPED, pCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
1732#endif
1733
1734#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1735Declare Function WSAJoinLeaf Lib "ws2_32" (s As SOCKET, ByRef name As sockaddr, namelen As Long, ByRef CallerData As WSABUF, ByRef CalleeData As WSABUF,
1736    ByRef SQOS As QOS, ByRef GQOS AS QOS, Flags As DWord) As SOCKET
1737#endif
1738
1739#ifdef INCL_WINSOCK_API_TYPEDEFS
1740TypeDef LPFN_WSAJOINLEAF = *Function(s As SOCKET, ByRef name As sockaddr, namelen As Long, ByRef CallerData As WSABUF, ByRef CalleeData As WSABUF,
1741    ByRef SQOS As QOS, ByRef GQOS AS QOS, Flags As DWord) As SOCKET
1742#endif
1743
1744#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1745Declare Function WSANtohl Lib "ws2_32" (s As SOCKET, netlong As DWord, ByRef hostlong As DWord) As Long
1746#endif
1747
1748#ifdef INCL_WINSOCK_API_TYPEDEFS
1749TypeDef LPFN_WSANTOHL = *Function(s As SOCKET, netlong As DWord, ByRef hostlong As DWord) As Long
1750#endif
1751
1752#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1753Declare Function WSANtohs Lib "ws2_32" (s As SOCKET, netshort As Word, ByRef hostshort As Word) As Long
1754#endif
1755
1756#ifdef INCL_WINSOCK_API_TYPEDEFS
1757TypeDef LPFN_WSANTOHS = *Function(s As SOCKET, netshort As Word, ByRef hostshort As Word) As Long
1758#endif
1759
1760#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1761Declare Function WSARecv Lib "ws2_32" (s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesRecvd As DWord, ByRef Flags As DWord,
1762    ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
1763#endif
1764
1765#ifdef INCL_WINSOCK_API_TYPEDEFS
1766TypeDef LPFN_WSARECV = *Function(s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesRecvd As DWord, ByRef Flags As DWord,
1767    ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
1768#endif
1769
1770#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1771Declare Function WSARecvDisconnect Lib "ws2_32" (s As SOCKET, ByRef InboundDisconnectData As WSABUF) As Long
1772#endif
1773
1774#ifdef INCL_WINSOCK_API_TYPEDEFS
1775TypeDef LPFN_WSARECVDISCONNECT = *Function(s As SOCKET, ByRef InboundDisconnectData As WSABUF) As Long
1776#endif
1777
1778#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1779Declare Function WSARecvFrom Lib "ws2_32" (s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesRecvd As DWord, ByRef Flags As DWord,
1780    ByRef From As sockaddr, ByRef Fromlen As Long, ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
1781#endif
1782
1783#ifdef INCL_WINSOCK_API_TYPEDEFS
1784TypeDef LPFN_WSARECVFROM = *Function(s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesRecvd As DWord, ByRef Flags As DWord,
1785    ByRef From As sockaddr, ByRef Fromlen As Long, ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
1786#endif
1787
1788#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1789Declare Function WSAResetEvent Lib "ws2_32" (hEvent As WSAEVENT) As BOOL
1790#endif
1791
1792#ifdef INCL_WINSOCK_API_TYPEDEFS
1793TypeDef LPFN_WSARESETEVENT = *Function(hEvent As WSAEVENT) As BOOL
1794#endif
1795
1796#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1797Declare Function WSASend Lib "ws2_32" (s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesSent As DWord, ByRef Flags As DWord,
1798    ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
1799#endif
1800
1801#ifdef INCL_WINSOCK_API_TYPEDEFS
1802TypeDef LPFN_WSASEND = *Function(s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesSent As DWord, ByRef Flags As DWord,
1803    ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
1804#endif
1805
1806#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1807Declare Function WSASendDisconnect Lib "ws2_32" (s As SOCKET, ByRef OutboundDisconnectData As WSABUF) As Long
1808#endif
1809
1810#ifdef INCL_WINSOCK_API_TYPEDEFS
1811TypeDef LPFN_WSASENDDISCONNECT = *Function(s As SOCKET, ByRef OutboundDisconnectData As WSABUF) As Long
1812#endif
1813
1814#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1815Declare Function WSASendTo Lib "ws2_32" (s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesSent As DWord, ByRef Flags As DWord,
1816    ByRef To_ As sockaddr, ToLen As Long, ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
1817#endif
1818
1819#ifdef INCL_WINSOCK_API_TYPEDEFS
1820TypeDef LPFN_WSASENDTO = *Function(s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesSent As DWord, ByRef Flags As DWord,
1821    ByRef To_ As sockaddr, ToLen As Long, ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
1822#endif
1823
1824#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1825Declare Function WSASetEvent Lib "ws2_32" (hEvent As WSAEVENT) As BOOL
1826#endif
1827
1828#ifdef INCL_WINSOCK_API_TYPEDEFS
1829TypeDef LPFN_WSASETEVENT = *Function(hEvent As WSAEVENT) As BOOL
1830#endif
1831
1832#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1833Declare Function WSASocketA Lib "ws2_32" (af As Long, type_ As Long, protocol As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOA, g As GROUP, Flags As DWord) As SOCKET
1834Declare Function WSASocketW Lib "ws2_32" (af As Long, type_ As Long, protocol As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOW, g As GROUP, Flags As DWord) As SOCKET
1835#ifdef UNICODE
1836Declare Function WSASocket Lib "ws2_32" Alias "WSASocketW" (af As Long, type_ As Long, protocol As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFO, g As GROUP, Flags As DWord) As SOCKET
1837#else
1838Declare Function WSASocket Lib "ws2_32" Alias "WSASocketA" (af As Long, type_ As Long, protocol As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFO, g As GROUP, Flags As DWord) As SOCKET
1839#endif
1840#endif
1841
1842#ifdef INCL_WINSOCK_API_TYPEDEFS
1843TypeDef LPFN_WSASOCKETA = *Function(af As Long, type_ As Long, protocol As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOA, g As GROUP, Flags As DWord) As SOCKET
1844TypeDef LPFN_WSASOCKETW = *Function(af As Long, type_ As Long, protocol As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOW, g As GROUP, Flags As DWord) As SOCKET
1845#ifdef UNICODE
1846TypeDef LPFN_WSASOCKET = LPFN_WSASOCKETW
1847#else
1848TypeDef LPFN_WSASOCKET = LPFN_WSASOCKETA
1849#endif
1850#endif
1851
1852#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1853Declare Function WSAWaitForMultipleEvents Lib "ws2_32" (cEvents As DWord, phEvents As *WSAEVENT, WaitAll As BOOL, Timeout As DWord, Alertable As BOOL) As DWord
1854#endif
1855
1856#ifdef INCL_WINSOCK_API_TYPEDEFS
1857TypeDef LPFN_WSAWAITFORMULTIPLEEVENTS = *Function(cEvents As DWord, phEvents As *WSAEVENT, WaitAll As BOOL, Timeout As DWord, Alertable As BOOL) As DWord
1858#endif
1859
1860#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1861Declare Function WSAAddressToStringA Lib "ws2_32" (ByRef saAddress As SOCKADDR, AddressLength As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOA,
1862    AddressString As PSTR, ByRef dwAddressStringLength As DWord) As Long
1863Declare Function WSAAddressToStringW Lib "ws2_32" (ByRef saAddress As SOCKADDR, AddressLength As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOA,
1864    AddressString As PWSTR, ByRef dwAddressStringLength As DWord) As Long
1865#ifdef UNICODE
1866Declare Function WSAAddressToString Lib "ws2_32" Alias "WSAAddressToStringW" (ByRef saAddress As SOCKADDR, AddressLength As DWord,
1867    ByRef ProtocolInfo As WSAPROTOCOL_INFO, AddressString As PSTR, ByRef dwAddressStringLength As DWord) As Long
1868#else
1869Declare Function WSAAddressToString Lib "ws2_32" Alias "WSAAddressToStringA" (ByRef saAddress As SOCKADDR, AddressLength As DWord,
1870    ByRef ProtocolInfo As WSAPROTOCOL_INFO, AddressString As PSTR, ByRef dwAddressStringLength As DWord) As Long
1871#endif
1872#endif
1873
1874#ifdef INCL_WINSOCK_API_TYPEDEFS
1875TypeDef LPFN_WSAADDRESSTOSTRINGA = *Function(ByRef saAddress As SOCKADDR, AddressLength As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOA,
1876    AddressString As PSTR, ByRef dwAddressStringLength As DWord) As Long
1877TypeDef LPFN_WSAADDRESSTOSTRINGW = *Function(ByRef saAddress As SOCKADDR, AddressLength As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOA,
1878    AddressString As PWSTR, ByRef dwAddressStringLength As DWord) As Long
1879#ifdef UNICODE
1880TypeDef LPFN_WSAADDRESSTOSTRING = LPFN_WSAADDRESSTOSTRINGW
1881#else
1882TypeDef LPFN_WSAADDRESSTOSTRING = LPFN_WSAADDRESSTOSTRINGA
1883#endif
1884#endif
1885
1886#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1887Declare Function WSAStringToAddressA Lib "ws2_32" (AddressString As PSTR, AddressFamily As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOA,
1888    ByRef Address As SOCKADDR, ByRef AddressLength As Long) As Long
1889Declare Function WSAStringToAddressW Lib "ws2_32" (AddressString As PWSTR, AddressFamily As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOW,
1890    ByRef Address As SOCKADDR, ByRef AddressLength As Long) As Long
1891#ifdef UNICODE
1892Declare Function WSAStringToAddress Lib "ws2_32" Alias "WSAStringToAddressW" (AddressString As PSTR, AddressFamily As Long,
1893    ByRef ProtocolInfo As WSAPROTOCOL_INFO, ByRef Address As SOCKADDR, ByRef AddressLength As Long) As Long
1894#else
1895Declare Function WSAStringToAddress Lib "ws2_32" Alias "WSAStringToAddressA" (AddressString As PSTR, AddressFamily As Long,
1896    ByRef ProtocolInfo As WSAPROTOCOL_INFO, ByRef Address As SOCKADDR, ByRef AddressLength As Long) As Long
1897#endif
1898#endif
1899
1900#ifdef INCL_WINSOCK_API_TYPEDEFS
1901TypeDef LPFN_WSASTRINGTOADDRESSA = *Function(AddressString As PSTR, AddressFamily As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOA,
1902    ByRef Address As SOCKADDR, ByRef AddressLength As Long) As Long
1903TypeDef LPFN_WSASTRINGTOADDRESSW = *Function(AddressString As PWSTR, AddressFamily As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOW,
1904    ByRef Address As SOCKADDR, ByRef AddressLength As Long) As Long
1905#ifdef UNICODE
1906TypeDef LPFN_WSASTRINGTOADDRESS = LPFN_WSASTRINGTOADDRESSW
1907#else
1908TypeDef LPFN_WSASTRINGTOADDRESS = LPFN_WSASTRINGTOADDRESSA
1909#endif
1910#endif
1911
1912' Registration and Name Resolution API functions
1913#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1914Declare Function WSALookupServiceBeginA Lib "ws2_32" (ByRef qsRestrictions As WSAQUERYSETA, ControlFlags As DWord, ByRef hLookup As HANDLE) As Long
1915Declare Function WSALookupServiceBeginW Lib "ws2_32" (ByRef qsRestrictions As WSAQUERYSETW, ControlFlags As DWord, ByRef hLookup As HANDLE) As Long
1916#ifdef UNICODE
1917Declare Function WSALookupServiceBegin Lib "ws2_32" Alias "WSALookupServiceBeginW" (ByRef qsRestrictions As WSAQUERYSET, ControlFlags As DWord, ByRef hLookup As HANDLE) As Long
1918#else
1919Declare Function WSALookupServiceBegin Lib "ws2_32" Alias "WSALookupServiceBeginA" (ByRef qsRestrictions As WSAQUERYSET, ControlFlags As DWord, ByRef hLookup As HANDLE) As Long
1920#endif
1921#endif
1922
1923#ifdef INCL_WINSOCK_API_TYPEDEFS
1924TypeDef LPFN_WSALOOKUPSERVICEBEGINA = *Function(ByRef qsRestrictions As WSAQUERYSETA, ControlFlags As DWord, ByRef hLookup As HANDLE) As Long
1925TypeDef LPFN_WSALOOKUPSERVICEBEGINW = *Function(ByRef qsRestrictions As WSAQUERYSETW, ControlFlags As DWord, ByRef hLookup As HANDLE) As Long
1926#ifdef UNICODE
1927TypeDef LPFN_WSALOOKUPSERVICEBEGIN = LPFN_WSALOOKUPSERVICEBEGINW
1928#else
1929TypeDef LPFN_WSALOOKUPSERVICEBEGIN = LPFN_WSALOOKUPSERVICEBEGINA
1930#endif
1931#endif
1932
1933#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1934Declare Function WSALookupServiceNextA Lib "ws2_32" (hLookup As HANDLE, ControlFlags As DWord, ByRef BufferLength As DWord, ByRef qsResults As WSAQUERYSETA) As Long
1935Declare Function WSALookupServiceNextW Lib "ws2_32" (hLookup As HANDLE, ControlFlags As DWord, ByRef BufferLength As DWord, ByRef qsResults As WSAQUERYSETW) As Long
1936#ifdef UNICODE
1937Declare Function WSALookupServiceNext Lib "ws2_32" Alias "WSALookupServiceNextW" (hLookup As HANDLE, ControlFlags As DWord, ByRef BufferLength As DWord, ByRef qsResults As WSAQUERYSET) As Long
1938#else
1939Declare Function WSALookupServiceNext Lib "ws2_32" Alias "WSALookupServiceNextA" (hLookup As HANDLE, ControlFlags As DWord, ByRef BufferLength As DWord, ByRef qsResults As WSAQUERYSET) As Long
1940#endif
1941#endif
1942
1943#ifdef INCL_WINSOCK_API_TYPEDEFS
1944TypeDef LPFN_WSALOOKUPSERVICENEXTA = *FunctionhLookup As HANDLE, ControlFlags As DWord, ByRef BufferLength As DWord, ByRef qsResults As WSAQUERYSETA) As Long
1945TypeDef LPFN_WSALOOKUPSERVICENEXTW = *FunctionhLookup As HANDLE, ControlFlags As DWord, ByRef BufferLength As DWord, ByRef qsResults As WSAQUERYSETW) As Long
1946#ifdef UNICODE
1947TypeDef LPFN_WSALOOKUPSERVICENEXT = LPFN_WSALOOKUPSERVICENEXTW
1948#else
1949TypeDef LPFN_WSALOOKUPSERVICENEXT = LPFN_WSALOOKUPSERVICENEXTA
1950#endif
1951#endif
1952
1953#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1954Declare Function WSANSPIoctl Lib "ws2_32" (hLookup As HANDLE, ControlCode As DWord, pvInBuffer As VoidPtr, cbInBuffer As DWord,
1955    pvOutBuffer As VoidPtr, cbOutBuffer As DWord, ByRef cbBytesReturned As DWord, ByRef Completion As WSACOMPLETION) As Long
1956#endif
1957
1958#ifdef INCL_WINSOCK_API_TYPEDEFS
1959TypeDef LPFN_WSANSPIOCTL = *Function(hLookup As HANDLE, ControlCode As DWord, pvInBuffer As VoidPtr, cbInBuffer As DWord,
1960    pvOutBuffer As VoidPtr, cbOutBuffer As DWord, ByRef cbBytesReturned As DWord, ByRef Completion As WSACOMPLETION) As Long
1961#endif
1962
1963#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1964Declare Function WSALookupServiceEnd Lib "ws2_32" (hLookup As HANDLE) As Long
1965#endif
1966
1967#ifdef INCL_WINSOCK_API_TYPEDEFS
1968TypeDef LPFN_WSALOOKUPSERVICEEND = *Function(hLookup As HANDLE) As Long
1969#endif
1970
1971#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1972Declare Function WSAInstallServiceClassA Lib "ws2_32" (ByRef ServiceClassInfo As WSASERVICECLASSINFOA) As Long
1973Declare Function WSAInstallServiceClassW Lib "ws2_32" (ByRef ServiceClassInfo As WSASERVICECLASSINFOW) As Long
1974#ifdef UNICODE
1975Declare Function WSAInstallServiceClass Lib "ws2_32" Alias "WSAInstallServiceClassW" (ByRef ServiceClassInfo As WSASERVICECLASSINFO) As Long
1976#else
1977Declare Function WSAInstallServiceClass Lib "ws2_32" Alias "WSAInstallServiceClassA" (ByRef ServiceClassInfo As WSASERVICECLASSINFO) As Long
1978#endif
1979#endif
1980
1981#ifdef INCL_WINSOCK_API_TYPEDEFS
1982TypeDef LPFN_WSAINSTALLSERVICECLASSA = *Function(ByRef ServiceClassInfo As WSASERVICECLASSINFOA) As Long
1983TypeDef LPFN_WSAINSTALLSERVICECLASSW = *Function(ByRef ServiceClassInfo As WSASERVICECLASSINFOW) As Long
1984#ifdef UNICODE
1985TypeDef LPFN_WSAINSTALLSERVICECLASS = LPFN_WSAINSTALLSERVICECLASSW
1986#else
1987TypeDef LPFN_WSAINSTALLSERVICECLASS = LPFN_WSAINSTALLSERVICECLASSA
1988#endif
1989#endif
1990
1991#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
1992Declare Function WSARemoveServiceClass Lib "ws2_32" (ByRef ServiceClassId As GUID) As Long
1993#endif
1994
1995#ifdef INCL_WINSOCK_API_TYPEDEFS
1996TypeDef LPFN_WSAREMOVESERVICECLASS = *Function(ByRef ServiceClassId As GUID) As Long
1997#endif
1998
1999#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
2000Declare Function WSAGetServiceClassInfoA Lib "ws2_32" (ByRef ProviderId As GUID, ByRef ServiceClassId As GUID, ByRef BufSize As DWord, ByRef ServiceClassInfo As WSASERVICECLASSINFOA) As Long
2001Declare Function WSAGetServiceClassInfoW Lib "ws2_32" (ByRef ProviderId As GUID, ByRef ServiceClassId As GUID, ByRef BufSize As DWord, ByRef ServiceClassInfo As WSASERVICECLASSINFOW) As Long
2002#ifdef UNICODE
2003Declare Function WSAGetServiceClassInfo Lib "ws2_32" Alias "WSAGetServiceClassInfoW" (ByRef ProviderId As GUID, ByRef ServiceClassId As GUID, ByRef BufSize As DWord, ByRef ServiceClassInfo As WSASERVICECLASSINFO) As Long
2004#else
2005Declare Function WSAGetServiceClassInfo Lib "ws2_32" Alias "WSAGetServiceClassInfoA" (ByRef ProviderId As GUID, ByRef ServiceClassId As GUID, ByRef BufSize As DWord, ByRef ServiceClassInfo As WSASERVICECLASSINFO) As Long
2006#endif
2007#endif
2008
2009#ifdef INCL_WINSOCK_API_TYPEDEFS
2010TypeDef LPFN_WSAGETSERVICECLASSINFOA = *Function(ByRef ProviderId As GUID, ByRef ServiceClassId As GUID, ByRef BufSize As DWord, ByRef ServiceClassInfo As WSASERVICECLASSINFOA) As Long
2011TypeDef LPFN_WSAGETSERVICECLASSINFOW = *Function(ByRef ProviderId As GUID, ByRef ServiceClassId As GUID, ByRef BufSize As DWord, ByRef ServiceClassInfo As WSASERVICECLASSINFOW) As Long
2012#ifdef UNICODE
2013TypeDef LPFN_WSAGETSERVICECLASSINFO = LPFN_WSAGETSERVICECLASSINFOW
2014#else
2015TypeDef LPFN_WSAGETSERVICECLASSINFO = LPFN_WSAGETSERVICECLASSINFOA
2016#endif
2017#endif
2018
2019#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
2020Declare Function WSAEnumNameSpaceProvidersA Lib "ws2_32" (ByRef BufferLength As DWord, ByRef nspBuffer As WSANAMESPACE_INFOA) As Long
2021Declare Function WSAEnumNameSpaceProvidersW Lib "ws2_32" (ByRef BufferLength As DWord, ByRef nspBuffer As WSANAMESPACE_INFOW) As Long
2022#ifdef UNICODE
2023Declare Function WSAEnumNameSpaceProviders Lib "ws2_32" Alias "WSAEnumNameSpaceProvidersW" (ByRef BufferLength As DWord, ByRef nspBuffer As WSANAMESPACE_INFO) As Long
2024#else
2025Declare Function WSAEnumNameSpaceProviders Lib "ws2_32" Alias "WSAEnumNameSpaceProvidersA" (ByRef BufferLength As DWord, ByRef nspBuffer As WSANAMESPACE_INFO) As Long
2026#endif
2027#endif
2028
2029#ifdef INCL_WINSOCK_API_TYPEDEFS
2030TypeDef LPFN_WSAENUMNAMESPACEPROVIDERSA = *Function(ByRef BufferLength As DWord, ByRef nspBuffer As WSANAMESPACE_INFOA) As Long
2031TypeDef LPFN_WSAENUMNAMESPACEPROVIDERSW = *Function(ByRef BufferLength As DWord, ByRef nspBuffer As WSANAMESPACE_INFOW) As Long
2032#ifdef UNICODE
2033TypeDef LPFN_WSAENUMNAMESPACEPROVIDERS = LPFN_WSAENUMNAMESPACEPROVIDERSW
2034#else
2035TypeDef LPFN_WSAENUMNAMESPACEPROVIDERS = LPFN_WSAENUMNAMESPACEPROVIDERSA
2036#endif
2037#endif
2038
2039#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
2040Declare Function WSAGetServiceClassNameByClassIdA Lib "ws2_32" (ByRef ServiceClassId As GUID, ServiceClassName As PSTR, ByRef BufferLength As DWord) As Long
2041Declare Function WSAGetServiceClassNameByClassIdW Lib "ws2_32" (ByRef ServiceClassId As GUID, ServiceClassName As PWSTR, ByRef BufferLength As DWord) As Long
2042#ifdef UNICODE
2043Declare Function WSAGetServiceClassNameByClassId Lib "ws2_32" Alias "WSAGetServiceClassNameByClassIdW" (ByRef ServiceClassId As GUID, ServiceClassName As PWSTR, ByRef BufferLength As DWord) As Long
2044#else
2045Declare Function WSAGetServiceClassNameByClassId Lib "ws2_32" Alias "WSAGetServiceClassNameByClassIdA" (ByRef ServiceClassId As GUID, ServiceClassName As PSTR, ByRef BufferLength As DWord) As Long
2046#endif
2047#endif
2048
2049#ifdef INCL_WINSOCK_API_TYPEDEFS
2050TypeDef LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA = *Function(ByRef ServiceClassId As GUID, ServiceClassName As PSTR, ByRef BufferLength As DWord) As Long
2051TypeDef LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW = *Function(ByRef ServiceClassId As GUID, ServiceClassName As PWSTR, ByRef BufferLength As DWord) As Long
2052#ifdef UNICODE
2053TypeDef LPFN_WSAGETSERVICECLASSNAMEBYCLASSID = LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW
2054#else
2055TypeDef LPFN_WSAGETSERVICECLASSNAMEBYCLASSID = LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA
2056#endif
2057#endif
2058
2059#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
2060Declare Function WSASetServiceA Lib "ws2_32" (ByRef qsRegInfo As WSAQUERYSETA, essoperation As WSAESETSERVICEOP, ControlFlags As DWord) As Long
2061Declare Function WSASetServiceW Lib "ws2_32" (ByRef qsRegInfo As WSAQUERYSETW, essoperation As WSAESETSERVICEOP, ControlFlags As DWord) As Long
2062#ifdef UNICODE
2063Declare Function WSASetService Lib "ws2_32" Alias "WSASetServiceW" (ByRef qsRegInfo As WSAQUERYSET, essoperation As WSAESETSERVICEOP, ControlFlags As DWord) As Long
2064#else
2065Declare Function WSASetService Lib "ws2_32" Alias "WSASetServiceA" (ByRef qsRegInfo As WSAQUERYSET, essoperation As WSAESETSERVICEOP, ControlFlags As DWord) As Long
2066#endif
2067#endif
2068
2069#ifdef INCL_WINSOCK_API_TYPEDEFS
2070TypeDef LPFN_WSASETSERVICEA = *Function(ByRef qsRegInfo As WSAQUERYSETA, essoperation As WSAESETSERVICEOP, ControlFlags As DWord) As Long
2071TypeDef LPFN_WSASETSERVICEW = *Function(ByRef qsRegInfo As WSAQUERYSETW, essoperation As WSAESETSERVICEOP, ControlFlags As DWord) As Long
2072#ifdef UNICODE
2073TypeDef LPFN_WSASETSERVICE = LPFN_WSASETSERVICEW
2074#else
2075TypeDef LPFN_WSASETSERVICE = LPFN_WSASETSERVICEA
2076#endif
2077#endif
2078
2079#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
2080Declare Function WSAProviderConfigChange Lib "ws2_32" (ByRef NotificationHandle As HANDLE, ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
2081#endif
2082
2083#ifdef INCL_WINSOCK_API_TYPEDEFS
2084TypeDef LPFN_WSAPROVIDERCONFIGCHANGE = *Function(ByRef NotificationHandle As HANDLE, ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
2085#endif
2086
2087' Microsoft Windows Extended data types
2088TypeDef SOCKADDR_IN = sockaddr_in
2089TypeDef PSOCKADDR_IN = *sockaddr_in
2090TypeDef LPSOCKADDR_IN = *sockaddr_in
2091
2092TypeDef LINGER = linger
2093TypeDef PLINGER = *linger
2094TypeDef LPLINGER = *linger
2095
2096TypeDef IN_ADDR = in_addr
2097TypeDef PIN_ADDR = *in_addr
2098TypeDef LPIN_ADDR = *in_addr
2099
2100TypeDef FD_SET = fd_set
2101TypeDef PFD_SET = *fd_set
2102TypeDef LPFD_SET = *fd_set
2103
2104TypeDef HOSTENT = hostent
2105TypeDef PHOSTENT = *hostent
2106TypeDef LPHOSTENT = *hostent
2107
2108TypeDef SERVENT = servent
2109TypeDef PSERVENT = *servent
2110TypeDef LPSERVENT = *servent
2111
2112TypeDef PROTOENT = protoent
2113TypeDef PPROTOENT = *protoent
2114TypeDef LPPROTOENT = *protoent
2115
2116TypeDef TIMEVAL = timeval
2117TypeDef PTIMEVAL = *timeval
2118TypeDef LPTIMEVAL = *timeval
2119
2120' Windows message parameter composition and decomposition macros.
2121Const WSAMAKEASYNCREPLY(buflen, error) = MAKELONG(buflen, error)
2122Const WSAMAKESELECTREPLY(event, error) = MAKELONG(event, error)
2123Const WSAGETASYNCBUFLEN(lParam) = LOWORD(lParam)
2124Const WSAGETASYNCERROR(lParam) = HIWORD(lParam)
2125Const WSAGETSELECTEVENT(lParam) = LOWORD(lParam)
2126Const WSAGETSELECTERROR(lParam) = HIWORD(lParam)
2127
2128'#ifdef IPV6STRICT
2129'#require <wsipv6ok.ab>
2130'#endif
2131
2132#endif
Note: See TracBrowser for help on using the repository browser.