Removed some unnecessary #includes and dll dependencies.
[wine/multimedia.git] / dlls / winsock / async.c
blob18f48c9fd78e4967f0c20e0234636eaed790e598
1 /* Async WINSOCK DNS services
2 *
3 * (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka.
4 * (C) 1999 Marcus Meissner
6 * NOTE: If you make any changes to fix a particular app, make sure
7 * they don't break something else like Netscape or telnet and ftp
8 * clients and servers (www.winsite.com got a lot of those).
9 *
10 * FIXME:
11 * - Add WSACancel* and correct handle management. (works rather well for
12 * now without it.)
13 * - Verify & Check all calls for correctness
14 * (currently only WSAGetHostByName*, WSAGetServByPort* calls)
15 * - Check error returns.
16 * - mirc/mirc32 Finger @linux.kernel.org sometimes fails in threaded mode.
17 * (not sure why)
18 * - This implementation did ignore the "NOTE:" section above (since the
19 * whole stuff did not work anyway to other changes).
22 #include "config.h"
24 #include <string.h>
25 #include <sys/types.h>
26 #ifdef HAVE_SYS_IPC_H
27 # include <sys/ipc.h>
28 #endif
29 #include <sys/ioctl.h>
30 #ifdef HAVE_SYS_FILIO_H
31 # include <sys/filio.h>
32 #endif
33 #if defined(__svr4__)
34 #include <sys/ioccom.h>
35 #ifdef HAVE_SYS_SOCKIO_H
36 # include <sys/sockio.h>
37 #endif
38 #endif
40 #if defined(__EMX__)
41 # include <sys/so_ioctl.h>
42 #endif
44 #ifdef HAVE_SYS_PARAM_H
45 # include <sys/param.h>
46 #endif
48 #ifdef HAVE_SYS_MSG_H
49 # include <sys/msg.h>
50 #endif
51 #ifdef HAVE_SYS_WAIT_H
52 #include <sys/wait.h>
53 #endif
54 #ifdef HAVE_SYS_SOCKET_H
55 #include <sys/socket.h>
56 #endif
57 #ifdef HAVE_NETINET_IN_H
58 # include <netinet/in.h>
59 #endif
60 #ifdef HAVE_ARPA_INET_H
61 # include <arpa/inet.h>
62 #endif
63 #include <ctype.h>
64 #include <fcntl.h>
65 #include <errno.h>
66 #ifdef HAVE_SYS_ERRNO_H
67 #include <sys/errno.h>
68 #endif
69 #include <netdb.h>
70 #include <unistd.h>
71 #include <stdlib.h>
72 #ifdef HAVE_ARPA_NAMESER_H
73 # include <arpa/nameser.h>
74 #endif
75 #ifdef HAVE_RESOLV_H
76 # include <resolv.h>
77 #endif
79 #include "wine/winbase16.h"
80 #include "wingdi.h"
81 #include "winuser.h"
82 #include "winsock2.h"
83 #include "wine/winsock16.h"
84 #include "winnt.h"
85 #include "heap.h"
86 #include "task.h"
87 #include "ldt.h"
88 #include "wine/port.h"
89 #include "debugtools.h"
91 DEFAULT_DEBUG_CHANNEL(winsock);
93 /* protoptypes of some functions in socket.c
95 UINT16 wsaErrno(void);
96 UINT16 wsaHerrno(void);
98 #define AQ_WIN16 0x00
99 #define AQ_WIN32 0x04
100 #define HB_WIN32(hb) (hb->flags & AQ_WIN32)
101 #define AQ_NUMBER 0x00
102 #define AQ_NAME 0x08
103 #define AQ_COPYPTR1 0x10
104 #define AQ_DUPLOWPTR1 0x20
105 #define AQ_MASKPTR1 0x30
106 #define AQ_COPYPTR2 0x40
107 #define AQ_DUPLOWPTR2 0x80
108 #define AQ_MASKPTR2 0xC0
110 #define AQ_GETHOST 0
111 #define AQ_GETPROTO 1
112 #define AQ_GETSERV 2
113 #define AQ_GETMASK 3
115 /* ----------------------------------- helper functions - */
117 static int list_size(char** l, int item_size)
119 int i,j = 0;
120 if(l)
121 { for(i=0;l[i];i++)
122 j += (item_size) ? item_size : strlen(l[i]) + 1;
123 j += (i + 1) * sizeof(char*); }
124 return j;
127 static int list_dup(char** l_src, char* ref, char* base, int item_size)
129 /* base is either either equal to ref or 0 or SEGPTR */
131 char* p = ref;
132 char** l_to = (char**)ref;
133 int i,j,k;
135 for(j=0;l_src[j];j++) ;
136 p += (j + 1) * sizeof(char*);
137 for(i=0;i<j;i++)
138 { l_to[i] = base + (p - ref);
139 k = ( item_size ) ? item_size : strlen(l_src[i]) + 1;
140 memcpy(p, l_src[i], k); p += k; }
141 l_to[i] = NULL;
142 return (p - ref);
145 /* ----- hostent */
147 static int hostent_size(struct hostent* p_he)
149 int size = 0;
150 if( p_he )
151 { size = sizeof(struct hostent);
152 size += strlen(p_he->h_name) + 1;
153 size += list_size(p_he->h_aliases, 0);
154 size += list_size(p_he->h_addr_list, p_he->h_length ); }
155 return size;
158 /* Copy hostent to p_to, fix up inside pointers using p_base (different for
159 * Win16 (linear vs. segmented). Return -neededsize on overrun.
161 static int WS_copy_he(char *p_to,char *p_base,int t_size,struct hostent* p_he, int flag)
163 char* p_name,*p_aliases,*p_addr,*p;
164 struct ws_hostent16 *p_to16 = (struct ws_hostent16*)p_to;
165 struct ws_hostent32 *p_to32 = (struct ws_hostent32*)p_to;
166 int size = hostent_size(p_he) +
168 (flag & AQ_WIN16) ? sizeof(struct ws_hostent16) : sizeof(struct ws_hostent32)
169 - sizeof(struct hostent)
172 if (t_size < size)
173 return -size;
174 p = p_to;
175 p += (flag & AQ_WIN16) ?
176 sizeof(struct ws_hostent16) : sizeof(struct ws_hostent32);
177 p_name = p;
178 strcpy(p, p_he->h_name); p += strlen(p) + 1;
179 p_aliases = p;
180 p += list_dup(p_he->h_aliases, p, p_base + (p - (char*)p_to), 0);
181 p_addr = p;
182 list_dup(p_he->h_addr_list, p, p_base + (p - (char*)p_to), p_he->h_length);
184 if (flag & AQ_WIN16)
186 p_to16->h_addrtype = (INT16)p_he->h_addrtype;
187 p_to16->h_length = (INT16)p_he->h_length;
188 p_to16->h_name = (SEGPTR)(p_base + (p_name - p_to));
189 p_to16->h_aliases = (SEGPTR)(p_base + (p_aliases - p_to));
190 p_to16->h_addr_list = (SEGPTR)(p_base + (p_addr - p_to));
192 else
194 p_to32->h_addrtype = p_he->h_addrtype;
195 p_to32->h_length = p_he->h_length;
196 p_to32->h_name = (p_base + (p_name - p_to));
197 p_to32->h_aliases = (char **)(p_base + (p_aliases - p_to));
198 p_to32->h_addr_list = (char **)(p_base + (p_addr - p_to));
201 return size;
204 /* ----- protoent */
206 static int protoent_size(struct protoent* p_pe)
208 int size = 0;
209 if( p_pe )
210 { size = sizeof(struct protoent);
211 size += strlen(p_pe->p_name) + 1;
212 size += list_size(p_pe->p_aliases, 0); }
213 return size;
216 /* Copy protoent to p_to, fix up inside pointers using p_base (different for
217 * Win16 (linear vs. segmented). Return -neededsize on overrun.
219 static int WS_copy_pe(char *p_to,char *p_base,int t_size,struct protoent* p_pe, int flag)
221 char* p_name,*p_aliases,*p;
222 struct ws_protoent16 *p_to16 = (struct ws_protoent16*)p_to;
223 struct ws_protoent32 *p_to32 = (struct ws_protoent32*)p_to;
224 int size = protoent_size(p_pe) +
226 (flag & AQ_WIN16) ? sizeof(struct ws_protoent16) : sizeof(struct ws_protoent32)
227 - sizeof(struct protoent)
230 if (t_size < size)
231 return -size;
232 p = p_to;
233 p += (flag & AQ_WIN16) ?
234 sizeof(struct ws_protoent16) : sizeof(struct ws_protoent32);
235 p_name = p;
236 strcpy(p, p_pe->p_name); p += strlen(p) + 1;
237 p_aliases = p;
238 list_dup(p_pe->p_aliases, p, p_base + (p - (char*)p_to), 0);
240 if (flag & AQ_WIN16)
242 p_to16->p_proto = (INT16)p_pe->p_proto;
243 p_to16->p_name = (SEGPTR)(p_base) + (p_name - p_to);
244 p_to16->p_aliases = (SEGPTR)((p_base) + (p_aliases - p_to));
246 else
248 p_to32->p_proto = p_pe->p_proto;
249 p_to32->p_name = (p_base) + (p_name - p_to);
250 p_to32->p_aliases = (char **)((p_base) + (p_aliases - p_to));
253 return size;
256 /* ----- servent */
258 static int servent_size(struct servent* p_se)
260 int size = 0;
261 if( p_se ) {
262 size += sizeof(struct servent);
263 size += strlen(p_se->s_proto) + strlen(p_se->s_name) + 2;
264 size += list_size(p_se->s_aliases, 0);
266 return size;
269 /* Copy servent to p_to, fix up inside pointers using p_base (different for
270 * Win16 (linear vs. segmented). Return -neededsize on overrun.
271 * Take care of different Win16/Win32 servent structs (packing !)
273 static int WS_copy_se(char *p_to,char *p_base,int t_size,struct servent* p_se, int flag)
275 char* p_name,*p_aliases,*p_proto,*p;
276 struct ws_servent16 *p_to16 = (struct ws_servent16*)p_to;
277 struct ws_servent32 *p_to32 = (struct ws_servent32*)p_to;
278 int size = servent_size(p_se) +
280 (flag & AQ_WIN16) ? sizeof(struct ws_servent16) : sizeof(struct ws_servent32)
281 - sizeof(struct servent)
284 if (t_size < size)
285 return -size;
286 p = p_to;
287 p += (flag & AQ_WIN16) ?
288 sizeof(struct ws_servent16) : sizeof(struct ws_servent32);
289 p_name = p;
290 strcpy(p, p_se->s_name); p += strlen(p) + 1;
291 p_proto = p;
292 strcpy(p, p_se->s_proto); p += strlen(p) + 1;
293 p_aliases = p;
294 list_dup(p_se->s_aliases, p, p_base + (p - p_to), 0);
296 if (flag & AQ_WIN16)
298 p_to16->s_port = (INT16)p_se->s_port;
299 p_to16->s_name = (SEGPTR)(p_base + (p_name - p_to));
300 p_to16->s_proto = (SEGPTR)(p_base + (p_proto - p_to));
301 p_to16->s_aliases = (SEGPTR)(p_base + (p_aliases - p_to));
303 else
305 p_to32->s_port = p_se->s_port;
306 p_to32->s_name = (p_base + (p_name - p_to));
307 p_to32->s_proto = (p_base + (p_proto - p_to));
308 p_to32->s_aliases = (char **)(p_base + (p_aliases - p_to));
311 return size;
314 static HANDLE __ws_async_handle = 0xdead;
316 /* Generic async query struct. we use symbolic names for the different queries
317 * for readability.
319 typedef struct _async_query {
320 HWND16 hWnd;
321 UINT16 uMsg;
322 LPCSTR ptr1;
323 #define host_name ptr1
324 #define host_addr ptr1
325 #define serv_name ptr1
326 #define proto_name ptr1
327 LPCSTR ptr2;
328 #define serv_proto ptr2
329 int int1;
330 #define host_len int1
331 #define proto_number int1
332 #define serv_port int1
333 int int2;
334 #define host_type int2
335 SEGPTR sbuf;
336 INT16 sbuflen;
338 HANDLE16 async_handle;
339 int flags;
340 int qt;
341 char xbuf[1];
342 } async_query;
345 /****************************************************************************
346 * The async query function.
348 * It is either called as a thread startup routine or directly. It has
349 * to free the passed arg from the process heap and PostMessageA the async
350 * result or the error code.
352 * FIXME:
353 * - errorhandling not verified.
355 static DWORD WINAPI _async_queryfun(LPVOID arg) {
356 async_query *aq = (async_query*)arg;
357 int size = 0;
358 WORD fail = 0;
359 char *targetptr = (HB_WIN32(aq)?(char*)aq->sbuf:(char*)PTR_SEG_TO_LIN(aq->sbuf));
361 switch (aq->flags & AQ_GETMASK) {
362 case AQ_GETHOST: {
363 struct hostent *he;
364 char *copy_hostent = targetptr;
366 he = (aq->flags & AQ_NAME) ?
367 gethostbyname(aq->host_name):
368 gethostbyaddr(aq->host_addr,aq->host_len,aq->host_type);
369 if (he) {
370 size = WS_copy_he(copy_hostent,(char*)aq->sbuf,aq->sbuflen,he,aq->flags);
371 if (size < 0) {
372 fail = WSAENOBUFS;
373 size = -size;
375 } else {
376 fail = ((h_errno < 0) ? wsaErrno() : wsaHerrno());
379 break;
380 case AQ_GETPROTO: {
381 struct protoent *pe;
382 char *copy_protoent = targetptr;
383 pe = (aq->flags & AQ_NAME)?
384 getprotobyname(aq->proto_name) :
385 getprotobynumber(aq->proto_number);
386 if (pe) {
387 size = WS_copy_pe(copy_protoent,(char*)aq->sbuf,aq->sbuflen,pe,aq->flags);
388 if (size < 0) {
389 fail = WSAENOBUFS;
390 size = -size;
392 } else {
393 if (aq->flags & AQ_NAME)
394 MESSAGE("protocol %s not found; You might want to add "
395 "this to /etc/protocols\n", debugstr_a(aq->proto_name) );
396 else
397 MESSAGE("protocol number %d not found; You might want to add "
398 "this to /etc/protocols\n", aq->proto_number );
399 fail = WSANO_DATA;
402 break;
403 case AQ_GETSERV: {
404 struct servent *se;
405 char *copy_servent = targetptr;
406 se = (aq->flags & AQ_NAME)?
407 getservbyname(aq->serv_name,aq->serv_proto) :
408 getservbyport(aq->serv_port,aq->serv_proto);
409 if (se) {
410 size = WS_copy_se(copy_servent,(char*)aq->sbuf,aq->sbuflen,se,aq->flags);
411 if (size < 0) {
412 fail = WSAENOBUFS;
413 size = -size;
415 } else {
416 if (aq->flags & AQ_NAME)
417 MESSAGE("service %s protocol %s not found; You might want to add "
418 "this to /etc/services\n", debugstr_a(aq->serv_name) ,
419 aq->serv_proto ? debugstr_a(aq->serv_proto ):"*");
420 else
421 MESSAGE("service on port %d protocol %s not found; You might want to add "
422 "this to /etc/services\n", aq->serv_port,
423 aq->serv_proto ? debugstr_a(aq->serv_proto ):"*");
424 fail = WSANO_DATA;
427 break;
429 PostMessageA(aq->hWnd,aq->uMsg,aq->async_handle,size|(fail<<16));
430 HeapFree(GetProcessHeap(),0,arg);
431 return 0;
434 /****************************************************************************
435 * The main async help function.
437 * It either starts a thread or just calls the function directly for platforms
438 * with no thread support. This relies on the fact that PostMessage() does
439 * not actually call the windowproc before the function returns.
441 static HANDLE16 __WSAsyncDBQuery(
442 HWND hWnd, UINT uMsg,INT int1,LPCSTR ptr1, INT int2, LPCSTR ptr2,
443 void *sbuf, INT sbuflen, UINT flags
446 async_query* aq;
447 char* pto;
448 LPCSTR pfm;
449 int xbuflen = 0;
451 /* allocate buffer to copy protocol- and service name to */
452 /* note: this is done in the calling thread so we can return */
453 /* a decent error code if the Alloc fails */
455 switch (flags & AQ_MASKPTR1) {
456 case 0: break;
457 case AQ_COPYPTR1: xbuflen += int1; break;
458 case AQ_DUPLOWPTR1: xbuflen += strlen(ptr1) + 1; break;
461 switch (flags & AQ_MASKPTR2) {
462 case 0: break;
463 case AQ_COPYPTR2: xbuflen += int2; break;
464 case AQ_DUPLOWPTR2: xbuflen += strlen(ptr2) + 1; break;
467 if(!(aq = HeapAlloc(GetProcessHeap(),0,sizeof(async_query) + xbuflen))) {
468 SetLastError(WSAEWOULDBLOCK); /* insufficient resources */
469 return 0;
472 pto = aq->xbuf;
473 if (ptr1) switch (flags & AQ_MASKPTR1) {
474 case 0: break;
475 case AQ_COPYPTR1: memcpy(pto, ptr1, int1); ptr1 = pto; pto += int1; break;
476 case AQ_DUPLOWPTR1: pfm = ptr1; ptr1 = pto; do *pto++ = tolower(*pfm); while (*pfm++); break;
478 if (ptr2) switch (flags & AQ_MASKPTR2) {
479 case 0: break;
480 case AQ_COPYPTR2: memcpy(pto, ptr2, int2); ptr2 = pto; pto += int2; break;
481 case AQ_DUPLOWPTR2: pfm = ptr2; ptr2 = pto; do *pto++ = tolower(*pfm); while (*pfm++); break;
484 aq->hWnd = hWnd;
485 aq->uMsg = uMsg;
486 aq->int1 = int1;
487 aq->ptr1 = ptr1;
488 aq->int2 = int2;
489 aq->ptr2 = ptr2;
490 aq->async_handle = ++__ws_async_handle;
491 aq->flags = flags;
492 aq->sbuf = (SEGPTR)sbuf;
493 aq->sbuflen = sbuflen;
495 #if 1
496 if (CreateThread(NULL,0,_async_queryfun,aq,0,NULL) == INVALID_HANDLE_VALUE)
497 #endif
498 _async_queryfun(aq);
499 return __ws_async_handle;
503 /***********************************************************************
504 * WSAAsyncGetHostByAddr() (WINSOCK.102)
506 HANDLE16 WINAPI WSAAsyncGetHostByAddr16(HWND16 hWnd, UINT16 uMsg, LPCSTR addr,
507 INT16 len, INT16 type, SEGPTR sbuf, INT16 buflen)
509 TRACE("hwnd %04x, msg %04x, addr %08x[%i]\n",
510 hWnd, uMsg, (unsigned)addr , len );
511 return __WSAsyncDBQuery(hWnd,uMsg,len,addr,type,NULL,(void*)sbuf,buflen,
512 AQ_NUMBER|AQ_COPYPTR1|AQ_WIN16|AQ_GETHOST);
515 /***********************************************************************
516 * WSAAsyncGetHostByAddr() (WSOCK32.102)
518 HANDLE WINAPI WSAAsyncGetHostByAddr(HWND hWnd, UINT uMsg, LPCSTR addr,
519 INT len, INT type, LPSTR sbuf, INT buflen)
521 TRACE("hwnd %04x, msg %04x, addr %08x[%i]\n",
522 hWnd, uMsg, (unsigned)addr , len );
523 return __WSAsyncDBQuery(hWnd,uMsg,len,addr,type,NULL,sbuf,buflen,
524 AQ_NUMBER|AQ_COPYPTR1|AQ_WIN32|AQ_GETHOST);
527 /***********************************************************************
528 * WSAAsyncGetHostByName() (WINSOCK.103)
530 HANDLE16 WINAPI WSAAsyncGetHostByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name,
531 SEGPTR sbuf, INT16 buflen)
533 TRACE("hwnd %04x, msg %04x, host %s, buffer %i\n",
534 hWnd, uMsg, (name)?name:"<null>", (int)buflen );
535 return __WSAsyncDBQuery(hWnd,uMsg,0,name,0,NULL,(void*)sbuf,buflen,
536 AQ_NAME|AQ_DUPLOWPTR1|AQ_WIN16|AQ_GETHOST);
539 /***********************************************************************
540 * WSAAsyncGetHostByName() (WSOCK32.103)
542 HANDLE WINAPI WSAAsyncGetHostByName(HWND hWnd, UINT uMsg, LPCSTR name,
543 LPSTR sbuf, INT buflen)
545 TRACE("hwnd %04x, msg %08x, host %s, buffer %i\n",
546 (HWND16)hWnd, uMsg, (name)?name:"<null>", (int)buflen );
547 return __WSAsyncDBQuery(hWnd,uMsg,0,name,0,NULL,sbuf,buflen,
548 AQ_NAME|AQ_DUPLOWPTR1|AQ_WIN32|AQ_GETHOST);
551 /***********************************************************************
552 * WSAAsyncGetProtoByName() (WINSOCK.105)
554 HANDLE16 WINAPI WSAAsyncGetProtoByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name,
555 SEGPTR sbuf, INT16 buflen)
557 TRACE("hwnd %04x, msg %08x, protocol %s\n",
558 (HWND16)hWnd, uMsg, (name)?name:"<null>" );
559 return __WSAsyncDBQuery(hWnd,uMsg,0,name,0,NULL,(void*)sbuf,buflen,
560 AQ_NAME|AQ_DUPLOWPTR1|AQ_WIN16|AQ_GETPROTO);
563 /***********************************************************************
564 * WSAAsyncGetProtoByName() (WSOCK32.105)
566 HANDLE WINAPI WSAAsyncGetProtoByName(HWND hWnd, UINT uMsg, LPCSTR name,
567 LPSTR sbuf, INT buflen)
569 TRACE("hwnd %04x, msg %08x, protocol %s\n",
570 (HWND16)hWnd, uMsg, (name)?name:"<null>" );
571 return __WSAsyncDBQuery(hWnd,uMsg,0,name,0,NULL,sbuf,buflen,
572 AQ_NAME|AQ_DUPLOWPTR1|AQ_WIN32|AQ_GETPROTO);
576 /***********************************************************************
577 * WSAAsyncGetProtoByNumber() (WINSOCK.104)
579 HANDLE16 WINAPI WSAAsyncGetProtoByNumber16(HWND16 hWnd,UINT16 uMsg,INT16 number,
580 SEGPTR sbuf, INT16 buflen)
582 TRACE("hwnd %04x, msg %04x, num %i\n", hWnd, uMsg, number );
583 return __WSAsyncDBQuery(hWnd,uMsg,number,NULL,0,NULL,(void*)sbuf,buflen,
584 AQ_GETPROTO|AQ_NUMBER|AQ_WIN16);
587 /***********************************************************************
588 * WSAAsyncGetProtoByNumber() (WSOCK32.104)
590 HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND hWnd, UINT uMsg, INT number,
591 LPSTR sbuf, INT buflen)
593 TRACE("hwnd %04x, msg %04x, num %i\n", hWnd, uMsg, number );
594 return __WSAsyncDBQuery(hWnd,uMsg,number,NULL,0,NULL,sbuf,buflen,
595 AQ_GETPROTO|AQ_NUMBER|AQ_WIN32);
598 /***********************************************************************
599 * WSAAsyncGetServByName() (WINSOCK.107)
601 HANDLE16 WINAPI WSAAsyncGetServByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name,
602 LPCSTR proto, SEGPTR sbuf, INT16 buflen)
604 TRACE("hwnd %04x, msg %04x, name %s, proto %s\n",
605 hWnd, uMsg, (name)?name:"<null>", (proto)?proto:"<null>");
606 return __WSAsyncDBQuery(hWnd,uMsg,0,name,0,proto,(void*)sbuf,buflen,
607 AQ_GETSERV|AQ_NAME|AQ_DUPLOWPTR1|AQ_DUPLOWPTR2|AQ_WIN16);
610 /***********************************************************************
611 * WSAAsyncGetServByName() (WSOCK32.107)
613 HANDLE WINAPI WSAAsyncGetServByName(HWND hWnd, UINT uMsg, LPCSTR name,
614 LPCSTR proto, LPSTR sbuf, INT buflen)
616 TRACE("hwnd %04x, msg %04x, name %s, proto %s\n",
617 hWnd, uMsg, (name)?name:"<null>", (proto)?proto:"<null>");
618 return __WSAsyncDBQuery(hWnd,uMsg,0,name,0,proto,sbuf,buflen,
619 AQ_GETSERV|AQ_NAME|AQ_DUPLOWPTR1|AQ_DUPLOWPTR2|AQ_WIN32);
622 /***********************************************************************
623 * WSAAsyncGetServByPort() (WINSOCK.106)
625 HANDLE16 WINAPI WSAAsyncGetServByPort16(HWND16 hWnd, UINT16 uMsg, INT16 port,
626 LPCSTR proto, SEGPTR sbuf, INT16 buflen)
628 TRACE("hwnd %04x, msg %04x, port %i, proto %s\n",
629 hWnd, uMsg, port, (proto)?proto:"<null>" );
630 return __WSAsyncDBQuery(hWnd,uMsg,port,NULL,0,proto,(void*)sbuf,buflen,
631 AQ_GETSERV|AQ_NUMBER|AQ_DUPLOWPTR2|AQ_WIN16);
634 /***********************************************************************
635 * WSAAsyncGetServByPort() (WSOCK32.106)
637 HANDLE WINAPI WSAAsyncGetServByPort(HWND hWnd, UINT uMsg, INT port,
638 LPCSTR proto, LPSTR sbuf, INT buflen)
640 TRACE("hwnd %04x, msg %04x, port %i, proto %s\n",
641 hWnd, uMsg, port, (proto)?proto:"<null>" );
642 return __WSAsyncDBQuery(hWnd,uMsg,port,NULL,0,proto,sbuf,buflen,
643 AQ_GETSERV|AQ_NUMBER|AQ_DUPLOWPTR2|AQ_WIN32);
646 /***********************************************************************
647 * WSACancelAsyncRequest() (WINSOCK.108)(WSOCK32.109)
649 INT WINAPI WSACancelAsyncRequest(HANDLE hAsyncTaskHandle)
651 FIXME("(%08x),stub\n", hAsyncTaskHandle);
652 return 0;
655 INT16 WINAPI WSACancelAsyncRequest16(HANDLE16 hAsyncTaskHandle)
657 return (HANDLE16)WSACancelAsyncRequest((HANDLE)hAsyncTaskHandle);