1 | /* $Id: protocol.cpp,v 1.2 2002-03-09 16:07:11 achimha Exp $ */
|
---|
2 | /*
|
---|
3 | * based on Windows Sockets 1.1 specs
|
---|
4 | * (ftp.microsoft.com:/Advsys/winsock/spec11/WINSOCK.TXT)
|
---|
5 | *
|
---|
6 | * (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka.
|
---|
7 | *
|
---|
8 | * NOTE: If you make any changes to fix a particular app, make sure
|
---|
9 | * they don't break something else like Netscape or telnet and ftp
|
---|
10 | * clients and servers (www.winsite.com got a lot of those).
|
---|
11 | *
|
---|
12 | * NOTE 2: Many winsock structs such as servent, hostent, protoent, ...
|
---|
13 | * are used with 1-byte alignment for Win16 programs and 4-byte alignment
|
---|
14 | * for Win32 programs in winsock.h. winsock2.h uses forced 4-byte alignment.
|
---|
15 | * So we have non-forced (just as MSDN) ws_XXXXent (winsock.h), 4-byte forced
|
---|
16 | * ws_XXXXent32 (winsock2.h) and 1-byte forced ws_XXXXent16 (winsock16.h).
|
---|
17 | */
|
---|
18 |
|
---|
19 |
|
---|
20 | /*****************************************************************************
|
---|
21 | * Includes *
|
---|
22 | *****************************************************************************/
|
---|
23 |
|
---|
24 | #include <odin.h>
|
---|
25 | #include <winsock2.h>
|
---|
26 | #include <debugtools.h>
|
---|
27 | #include <odinwrap.h>
|
---|
28 | #include <wchar.h>
|
---|
29 |
|
---|
30 | //#include "nspapi.h"
|
---|
31 |
|
---|
32 | ODINDEBUGCHANNEL(WS2_32-PROTOCOL)
|
---|
33 |
|
---|
34 |
|
---|
35 | #ifdef __WIN32OS2__
|
---|
36 | #define WS_IPPROTO_TCP IPPROTO_TCP
|
---|
37 | #define WS_IPPROTO_UDP IPPROTO_UDP
|
---|
38 | #define WS_AF_NETBIOS AF_NETBIOS
|
---|
39 | #define WS_AF_INET AF_INET
|
---|
40 | #define strlenW lstrlenW
|
---|
41 | #define strcpyW lstrcpyW
|
---|
42 | #define strncpyW lstrcpynW
|
---|
43 |
|
---|
44 | #define WS_IPPROTO_NETBIOS_MAGIC 0x4e455442
|
---|
45 |
|
---|
46 | #endif
|
---|
47 |
|
---|
48 |
|
---|
49 | /***
|
---|
50 | * Predefined protocol structures for the known protocols
|
---|
51 | * for OS/2
|
---|
52 | ***/
|
---|
53 |
|
---|
54 | #define myDEFINE_GUID(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
---|
55 | { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
|
---|
56 |
|
---|
57 |
|
---|
58 | static WSAPROTOCOL_INFOW sProtocol_TcpIp =
|
---|
59 | {
|
---|
60 | 0x20066, // XP_FRAGMENTATION | XP_EXPEDITED_DATA | XP_GRACEFUL_CLOSE | XP_GUARANTEED_ORDER | XP_GUARANTEED_DELIVERY,
|
---|
61 | 0, // service flags
|
---|
62 | 0,
|
---|
63 | 0,
|
---|
64 | 0x00000008, // provider flags
|
---|
65 | myDEFINE_GUID(0xe70f1aa0, 0xab8b, 0x11cf, 0x8c, 0xa3, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92),
|
---|
66 | 0x000003e9, // catalog entry ID
|
---|
67 | {0x00000001,}, // protocol chain
|
---|
68 | 0, // version
|
---|
69 | WS_AF_INET, // address family
|
---|
70 | 0, // max sock addr
|
---|
71 | 0, // min sock addr
|
---|
72 | SOCK_STREAM, // socket type
|
---|
73 | WS_IPPROTO_TCP, // protocol
|
---|
74 | 0, // protocol max. offset
|
---|
75 | 0, // network byte order
|
---|
76 | 0, // security scheme
|
---|
77 | 0, // message size
|
---|
78 | 0, // provider reserved
|
---|
79 | 'M','S','A','F','D',' ','T','c','p','I','p',' ','[','T','C','P','/','I','P',']',']'
|
---|
80 | };
|
---|
81 |
|
---|
82 |
|
---|
83 | static WSAPROTOCOL_INFOW sProtocol_UdpIp =
|
---|
84 | {
|
---|
85 | 0x20609, // XP_FRAGMENTATION | XP_SUPPORTS_BROADCAST | XP_SUPPORTS_MULTICAST | XP_MESSAGE_ORIENTED | XP_CONNECTIONLESS
|
---|
86 | 0, // service flags
|
---|
87 | 0,
|
---|
88 | 0,
|
---|
89 | 0x00000008, // provider flags
|
---|
90 | myDEFINE_GUID(0xe70f1aa0, 0xab8b, 0x11cf, 0x8c, 0xa3, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92),
|
---|
91 | 0x000003ea, // catalog entry ID
|
---|
92 | {0x00000001,}, // protocol chain
|
---|
93 | 0, // version
|
---|
94 | WS_AF_INET, // address family
|
---|
95 | 0, // max sock addr
|
---|
96 | 0, // min sock addr
|
---|
97 | SOCK_DGRAM, // socket type
|
---|
98 | WS_IPPROTO_UDP, // protocol
|
---|
99 | 0, // protocol max. offset
|
---|
100 | 0, // network byte order
|
---|
101 | 0, // security scheme
|
---|
102 | 65467, // message size
|
---|
103 | 0, // provider reserved
|
---|
104 | 'M','S','A','F','D',' ','T','c','p','I','p',' ','[','U','D','P','/','I','P',']',']'
|
---|
105 | };
|
---|
106 |
|
---|
107 |
|
---|
108 | static WSAPROTOCOL_INFOW sProtocol_NetBtSeq =
|
---|
109 | {
|
---|
110 | 0x2000e,
|
---|
111 | 0, // service flags
|
---|
112 | 0,
|
---|
113 | 0,
|
---|
114 | 0x00000008, // provider flags
|
---|
115 | myDEFINE_GUID(0x8d5f1830, 0xc273, 0x11cf, 0x95, 0xc8, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92),
|
---|
116 | 0x000003ee, // catalog entry ID
|
---|
117 | {0x00000001,}, // protocol chain
|
---|
118 | 0, // version
|
---|
119 | WS_AF_NETBIOS, // address family
|
---|
120 | 0, // max sock addr
|
---|
121 | 0, // min sock addr
|
---|
122 | SOCK_SEQPACKET, // socket type
|
---|
123 | WS_IPPROTO_NETBIOS_MAGIC, // protocol (encoded LANA Number)
|
---|
124 | 0, // protocol max. offset
|
---|
125 | 0, // network byte order
|
---|
126 | 0, // security scheme
|
---|
127 | 64000, // message size
|
---|
128 | 0, // provider reserved
|
---|
129 |
|
---|
130 | // is completed dynamically,
|
---|
131 | // Note: "NetBT" is a signature string, don't change it.
|
---|
132 | 'M','S','A','F','D',' ','N','e','t','B','I','O','S',' ',
|
---|
133 | '[','\\','D','e','v','i','c','e','\\','N','e','t','B','T',
|
---|
134 | '_','T','c','p','i','p','%','l','s',' ','S','E','Q','P','A',
|
---|
135 | 'C','K','E','T',' ','%','d'
|
---|
136 | };
|
---|
137 |
|
---|
138 |
|
---|
139 | static WSAPROTOCOL_INFOW sProtocol_NetBtDgram =
|
---|
140 | {
|
---|
141 | 0x20209,
|
---|
142 | 0, // service flags
|
---|
143 | 0,
|
---|
144 | 0,
|
---|
145 | 0x00000008, // provider flags
|
---|
146 | myDEFINE_GUID(0x8d5f1830, 0xc273, 0x11cf, 0x95, 0xc8, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92),
|
---|
147 | 0x000003ea, // catalog entry ID
|
---|
148 | {0x00000001,}, // protocol chain
|
---|
149 | 0, // version
|
---|
150 | WS_AF_NETBIOS, // address family
|
---|
151 | 0, // max sock addr
|
---|
152 | 0, // min sock addr
|
---|
153 | SOCK_DGRAM, // socket type
|
---|
154 | WS_IPPROTO_NETBIOS_MAGIC, // protocol (encoded LANA Number)
|
---|
155 | 0, // protocol max. offset
|
---|
156 | 0, // network byte order
|
---|
157 | 0, // security scheme
|
---|
158 | 64000, // message size
|
---|
159 | 0, // provider reserved
|
---|
160 |
|
---|
161 | // is completed dynamically,
|
---|
162 | // Note: "NetBT" is a signature string, don't change it.
|
---|
163 | 'M','S','A','F','D',' ','N','e','t','B','I','O','S',' ',
|
---|
164 | '[','\\','D','e','v','i','c','e','\\','N','e','t','B','T',
|
---|
165 | '_','T','c','p','i','p','%','l','s',' ','D','A','T','A','G',
|
---|
166 | 'R','A','M',' ','%','d'
|
---|
167 | };
|
---|
168 |
|
---|
169 |
|
---|
170 | /*
|
---|
171 | * descriptor structure for a LAN adapter
|
---|
172 | */
|
---|
173 | typedef struct _LANAdapter
|
---|
174 | {
|
---|
175 | ULONG LANA; // Lan adapter number
|
---|
176 | ULONG encLANA; // Win32 "encoded" LAN Adapter number
|
---|
177 | // LANA encoded LANA
|
---|
178 | // ------ ------------
|
---|
179 | // 0 0x80000000
|
---|
180 | // 1 -1
|
---|
181 | // 2 -2
|
---|
182 | // ... ...
|
---|
183 | LPWSTR lpszGUID; // GUID of adapter driver
|
---|
184 | } LANADAPTER, *PLANADAPTER;
|
---|
185 |
|
---|
186 |
|
---|
187 | static LANADAPTER LANAdapter_0 =
|
---|
188 | {
|
---|
189 | 0, // LAN adapter number 0
|
---|
190 | 0x80000000, // corresponding to adapter 0:
|
---|
191 | // myDEFINE_GUID(0xe125fc45, 0x8a8c, 0x4aef, 0xad, 0xc2, 0xe2, 0x51, 0xc2, 0x82, 0x7c, 0x8f)
|
---|
192 | // manual specification of GUID saves StringFromCLSID call and OLE32 linkage
|
---|
193 | (LPWSTR)L"{E125FC45-8A8C-4AEF-ADC2-E251C2827C8F}"
|
---|
194 | };
|
---|
195 |
|
---|
196 |
|
---|
197 | typedef struct _ProtocolBinding
|
---|
198 | {
|
---|
199 | LANADAPTER* pLANA;
|
---|
200 | WSAPROTOCOL_INFOW * pProtocol;
|
---|
201 | } PROTOCOLBINDING, *PPROTOCOLBINDING;
|
---|
202 |
|
---|
203 |
|
---|
204 | // this is our sample, static binding setup
|
---|
205 | // To do: determine this dynamically in i_WSAEnumInitialize
|
---|
206 | static PROTOCOLBINDING arrBindingInfo[] =
|
---|
207 | {
|
---|
208 | { &LANAdapter_0, &sProtocol_TcpIp },
|
---|
209 | { &LANAdapter_0, &sProtocol_UdpIp },
|
---|
210 | { &LANAdapter_0, &sProtocol_NetBtSeq },
|
---|
211 | { &LANAdapter_0, &sProtocol_NetBtDgram },
|
---|
212 | NULL
|
---|
213 | };
|
---|
214 |
|
---|
215 |
|
---|
216 | /*****************************************************************************
|
---|
217 | * Name : static int i_WSAEnumInitialize
|
---|
218 | * Purpose : access Protocol Manager and obtain binding information,
|
---|
219 | * in case this fails a standard setup is returned
|
---|
220 | * Parameters:
|
---|
221 | * Variables :
|
---|
222 | * Result :
|
---|
223 | * Remark :
|
---|
224 | * Status :
|
---|
225 | *
|
---|
226 | * Author : Patrick Haller [2002-03-04]
|
---|
227 | *****************************************************************************/
|
---|
228 |
|
---|
229 | static int i_WSAEnumInitialize(void)
|
---|
230 | {
|
---|
231 | // 1 - open protman$
|
---|
232 | // 2 - obtain binding information
|
---|
233 | // 3 - close protman$
|
---|
234 | // 4 - parse and analyse binding info
|
---|
235 | // and build ready-to-eat WSAEnumProtocol pieces
|
---|
236 | return 0;
|
---|
237 | }
|
---|
238 |
|
---|
239 |
|
---|
240 |
|
---|
241 | /*****************************************************************************
|
---|
242 | * WSOCK32_WSAEnterSingleProtocol [internal]
|
---|
243 | *
|
---|
244 | * enters the protocol informations of one given protocol into the
|
---|
245 | * given buffer. If the given buffer is too small only the required size for
|
---|
246 | * the protocols are returned.
|
---|
247 | *
|
---|
248 | * RETURNS
|
---|
249 | * The number of protocols entered into the buffer
|
---|
250 | *
|
---|
251 | * BUGS
|
---|
252 | * - only implemented for IPX, SPX, SPXII, TCP, UDP
|
---|
253 | * - there is no check that the operating system supports the returned
|
---|
254 | * protocols
|
---|
255 | */
|
---|
256 |
|
---|
257 | // Note @@@PH 2002-03-04
|
---|
258 | // - we currently do not determine if a specified protocol is really installed,
|
---|
259 | // but return a "standard configuration" for adapter 0 instead.
|
---|
260 | static INT WSOCK32_WSAEnterSingleProtocol(PPROTOCOLBINDING pBinding,
|
---|
261 | DWORD dwCatalogID,
|
---|
262 | WSAPROTOCOL_INFOA* lpBuffer,
|
---|
263 | LPDWORD lpSize,
|
---|
264 | BOOL unicode)
|
---|
265 | {
|
---|
266 | DWORD dwLength = 0;
|
---|
267 | DWORD dwOldSize = *lpSize;
|
---|
268 | INT iAnz = 1;
|
---|
269 | WCHAR *lpProtName = NULL;
|
---|
270 | BOOL flagDoCopy = TRUE;
|
---|
271 | WCHAR szBuf[256];
|
---|
272 |
|
---|
273 |
|
---|
274 | if (FALSE == unicode)
|
---|
275 | *lpSize = sizeof( WSAPROTOCOL_INFOA );
|
---|
276 | else
|
---|
277 | *lpSize = sizeof( WSAPROTOCOL_INFOW );
|
---|
278 |
|
---|
279 | if ( !lpBuffer || !*lpSize || (*lpSize > dwOldSize))
|
---|
280 | flagDoCopy = FALSE;
|
---|
281 |
|
---|
282 | // copy the information
|
---|
283 | if (flagDoCopy)
|
---|
284 | {
|
---|
285 | memcpy(lpBuffer, (const void*)pBinding->pProtocol, *lpSize );
|
---|
286 | lpProtName = pBinding->pProtocol->szProtocol;
|
---|
287 |
|
---|
288 | // for NETBIOS protocols, recalculate the name
|
---|
289 | if( WS_AF_NETBIOS == pBinding->pProtocol->iAddressFamily)
|
---|
290 | {
|
---|
291 | // recalculate LANA -> iProtocol
|
---|
292 | lpBuffer->iProtocol = pBinding->pLANA->encLANA;
|
---|
293 |
|
---|
294 | swprintf((wchar_t*)szBuf,
|
---|
295 | 256, // sizeof szBuf
|
---|
296 | (const wchar_t*)pBinding->pProtocol->szProtocol,
|
---|
297 | pBinding->pLANA->lpszGUID,
|
---|
298 | pBinding->pLANA->LANA);
|
---|
299 |
|
---|
300 | lpProtName = szBuf;
|
---|
301 | }
|
---|
302 |
|
---|
303 | // set catalog entry ID
|
---|
304 | lpBuffer->dwCatalogEntryId = dwCatalogID;
|
---|
305 |
|
---|
306 | // convert and copy the name
|
---|
307 | if (unicode)
|
---|
308 | strncpyW( (LPWSTR)lpBuffer->szProtocol, lpProtName, WSAPROTOCOL_LEN);
|
---|
309 | else
|
---|
310 | WideCharToMultiByte( CP_ACP, 0, lpProtName, -1, lpBuffer->szProtocol,
|
---|
311 | WSAPROTOCOL_LEN, NULL, NULL);
|
---|
312 | }
|
---|
313 | else
|
---|
314 | iAnz = 0;
|
---|
315 |
|
---|
316 | return iAnz;
|
---|
317 | }
|
---|
318 |
|
---|
319 |
|
---|
320 | /*****************************************************************************
|
---|
321 | * WSOCK32_EnumProtocol [internal]
|
---|
322 | *
|
---|
323 | * Enters the information about installed protocols into a given buffer
|
---|
324 | *
|
---|
325 | * RETURNS
|
---|
326 | * SOCKET_ERROR if the buffer is to small for the requested protocol infos
|
---|
327 | * on success the number of protocols inside the buffer
|
---|
328 | *
|
---|
329 | * NOTE
|
---|
330 | * NT4SP5 does not return SPX if lpiProtocols == NULL
|
---|
331 | *
|
---|
332 | * BUGS
|
---|
333 | * - NT4SP5 returns in addition these list of NETBIOS protocols
|
---|
334 | * (address family 17), each entry two times one for socket type 2 and 5
|
---|
335 | *
|
---|
336 | * iProtocol lpProtocol
|
---|
337 | * 0x80000000 \Device\NwlnkNb
|
---|
338 | * 0xfffffffa \Device\NetBT_CBENT7
|
---|
339 | * 0xfffffffb \Device\Nbf_CBENT7
|
---|
340 | * 0xfffffffc \Device\NetBT_NdisWan5
|
---|
341 | * 0xfffffffd \Device\NetBT_El9202
|
---|
342 | * 0xfffffffe \Device\Nbf_El9202
|
---|
343 | * 0xffffffff \Device\Nbf_NdisWan4
|
---|
344 | *
|
---|
345 | * - there is no check that the operating system supports the returned
|
---|
346 | * protocols
|
---|
347 | */
|
---|
348 | static INT WSOCK32_EnumProtocol( LPINT lpiProtocols,
|
---|
349 | WSAPROTOCOL_INFOA* lpBuffer,
|
---|
350 | LPDWORD lpdwLength,
|
---|
351 | BOOL unicode)
|
---|
352 | {
|
---|
353 | DWORD dwCurSize,
|
---|
354 | dwOldSize = *lpdwLength;
|
---|
355 | DWORD dwSpaceTaken = 0;
|
---|
356 | INT anz = 0;
|
---|
357 | INT rc;
|
---|
358 | DWORD dwCatalogID = 1;
|
---|
359 |
|
---|
360 | PPROTOCOLBINDING pBinding = arrBindingInfo;
|
---|
361 | LPINT lpIter;
|
---|
362 |
|
---|
363 | *lpdwLength = 0;
|
---|
364 |
|
---|
365 | // iterate over all available protocol bindings
|
---|
366 | for(;
|
---|
367 | pBinding->pLANA != NULL;
|
---|
368 | pBinding++)
|
---|
369 | {
|
---|
370 | // keep identical catalog IDs everywhere
|
---|
371 | dwCatalogID++;
|
---|
372 |
|
---|
373 | // check if the current protocol is in the "selection list"
|
---|
374 | if (lpiProtocols != NULL)
|
---|
375 | {
|
---|
376 | BOOL fFound = FALSE;
|
---|
377 |
|
---|
378 | for (lpIter = lpiProtocols;
|
---|
379 | *lpIter;
|
---|
380 | lpIter++)
|
---|
381 | {
|
---|
382 | if (pBinding->pProtocol->iProtocol == *lpIter)
|
---|
383 | {
|
---|
384 | fFound = TRUE;
|
---|
385 | break;
|
---|
386 | }
|
---|
387 | }
|
---|
388 |
|
---|
389 | // don't add this protocol entry
|
---|
390 | if (!fFound)
|
---|
391 | continue;
|
---|
392 | }
|
---|
393 |
|
---|
394 |
|
---|
395 | // ok, add the current protocol to the list
|
---|
396 |
|
---|
397 | // calculate how much space is left
|
---|
398 | dwCurSize = dwOldSize - dwSpaceTaken;
|
---|
399 |
|
---|
400 | // determine how much space this will take up
|
---|
401 | rc = WSOCK32_WSAEnterSingleProtocol( pBinding, dwCatalogID, &lpBuffer[ anz ], &dwCurSize, unicode);
|
---|
402 | if (rc > 0)
|
---|
403 | {
|
---|
404 | // update pointers if protocol was added
|
---|
405 | anz += rc;
|
---|
406 | dwSpaceTaken += dwCurSize;
|
---|
407 | }
|
---|
408 |
|
---|
409 | // deliver the number of bytes required to hold ALL information
|
---|
410 | *lpdwLength += dwCurSize;
|
---|
411 | }
|
---|
412 |
|
---|
413 |
|
---|
414 | // returncode for signalling "more data"
|
---|
415 | if (dwOldSize < *lpdwLength)
|
---|
416 | anz = SOCKET_ERROR;
|
---|
417 |
|
---|
418 | return anz;
|
---|
419 | }
|
---|
420 |
|
---|
421 |
|
---|
422 |
|
---|
423 | /*****************************************************************************
|
---|
424 | * Name : int WSAEnumProtocolsA
|
---|
425 | * Purpose : retrieves binding information on protocols and adapters
|
---|
426 | * Parameters: lpiProtocols
|
---|
427 | * [in] Null-terminated array of iProtocol values. This
|
---|
428 | * parameter is optional; if lpiProtocols is NULL, information
|
---|
429 | * on all available protocols is returned. Otherwise,
|
---|
430 | * information is retrieved only for those protocols listed in
|
---|
431 | * the array.
|
---|
432 | * lpProtocolBuffer
|
---|
433 | * [out] Buffer that is filled with WSAPROTOCOL_INFOA structures.
|
---|
434 | * lpdwBufferLength
|
---|
435 | * [in, out] On input, the count of bytes in the
|
---|
436 | * lpProtocolBuffer buffer passed to WSAEnumProtocols. On
|
---|
437 | * output, the minimum buffer size that can be passed to
|
---|
438 | * WSAEnumProtocols to retrieve all the requested information.
|
---|
439 | * This routine has no ability to enumerate over multiple calls;
|
---|
440 | * the passed-in buffer must be large enough to hold all entries
|
---|
441 | * in order for the routine to succeed. This reduces the
|
---|
442 | * complexity of the API and should not pose a problem because
|
---|
443 | * the number of protocols loaded on a computer is typically
|
---|
444 | * small.
|
---|
445 | * Variables :
|
---|
446 | * Result : If no error occurs, WSAEnumProtocols returns the number of
|
---|
447 | * protocols to be reported. Otherwise, a value of SOCKET_ERROR
|
---|
448 | * is returned and a specific error code can be retrieved by
|
---|
449 | * calling WSAGetLastError.
|
---|
450 | * Remark :
|
---|
451 | * Status : UNTESTED
|
---|
452 | *
|
---|
453 | * Author : Patrick Haller [2002-03-01]
|
---|
454 | *****************************************************************************/
|
---|
455 |
|
---|
456 | ODINFUNCTION3(int, WSAEnumProtocolsA, LPINT, lpiProtocols,
|
---|
457 | LPWSAPROTOCOL_INFOA, lpProtocolBuffer,
|
---|
458 | LPDWORD, lpdwBufferLength)
|
---|
459 | {
|
---|
460 | dprintf(("NOT COMPLETELY IMPLEMENTED"));
|
---|
461 |
|
---|
462 | return WSOCK32_EnumProtocol(lpiProtocols,
|
---|
463 | lpProtocolBuffer,
|
---|
464 | lpdwBufferLength,
|
---|
465 | FALSE);
|
---|
466 | }
|
---|
467 |
|
---|
468 |
|
---|
469 | /*****************************************************************************
|
---|
470 | * Name : int WSAEnumProtocolsW
|
---|
471 | * Purpose : retrieves binding information on protocols and adapters
|
---|
472 | * Parameters: lpiProtocols
|
---|
473 | * [in] Null-terminated array of iProtocol values. This
|
---|
474 | * parameter is optional; if lpiProtocols is NULL, information
|
---|
475 | * on all available protocols is returned. Otherwise,
|
---|
476 | * information is retrieved only for those protocols listed in
|
---|
477 | * the array.
|
---|
478 | * lpProtocolBuffer
|
---|
479 | * [out] Buffer that is filled with WSAPROTOCOL_INFOW structures.
|
---|
480 | * lpdwBufferLength
|
---|
481 | * [in, out] On input, the count of bytes in the
|
---|
482 | * lpProtocolBuffer buffer passed to WSAEnumProtocols. On
|
---|
483 | * output, the minimum buffer size that can be passed to
|
---|
484 | * WSAEnumProtocols to retrieve all the requested information.
|
---|
485 | * This routine has no ability to enumerate over multiple calls;
|
---|
486 | * the passed-in buffer must be large enough to hold all entries
|
---|
487 | * in order for the routine to succeed. This reduces the
|
---|
488 | * complexity of the API and should not pose a problem because
|
---|
489 | * the number of protocols loaded on a computer is typically
|
---|
490 | * small.
|
---|
491 | * Variables :
|
---|
492 | * Result : If no error occurs, WSAEnumProtocols returns the number of
|
---|
493 | * protocols to be reported. Otherwise, a value of SOCKET_ERROR
|
---|
494 | * is returned and a specific error code can be retrieved by
|
---|
495 | * calling WSAGetLastError.
|
---|
496 | * Remark :
|
---|
497 | * Status : UNTESTED
|
---|
498 | *
|
---|
499 | * Author : Patrick Haller [2002-03-01]
|
---|
500 | *****************************************************************************/
|
---|
501 |
|
---|
502 | ODINFUNCTION3(int, WSAEnumProtocolsW, LPINT, lpiProtocols,
|
---|
503 | LPWSAPROTOCOL_INFOW, lpProtocolBuffer,
|
---|
504 | LPDWORD, lpdwBufferLength)
|
---|
505 | {
|
---|
506 | dprintf(("NOT COMPLETELY IMPLEMENTED"));
|
---|
507 |
|
---|
508 | return WSOCK32_EnumProtocol(lpiProtocols,
|
---|
509 | (LPWSAPROTOCOL_INFOA)lpProtocolBuffer,
|
---|
510 | lpdwBufferLength,
|
---|
511 | TRUE);
|
---|
512 | }
|
---|
513 | //******************************************************************************
|
---|
514 | //******************************************************************************
|
---|