ReactOS 0.4.15-dev-7958-gcd0bb1a
getxbyxx.c File Reference
#include <ws2_32.h>
#include <debug.h>
Include dependency graph for getxbyxx.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID WSAAPI FixList (PCHAR **List, ULONG_PTR Base)
 
VOID WSAAPI UnpackServEnt (PSERVENT Servent)
 
VOID WSAAPI UnpackHostEnt (PHOSTENT Hostent)
 
VOID WSAAPI Local_Ip4AddresstoString (IN PCHAR AddressBuffer, IN PCHAR Address)
 
VOID WSAAPI Local_Ip6AddresstoString (IN PCHAR AddressBuffer, IN PCHAR Address)
 
LPBLOB WSAAPI getxyDataEnt (IN OUT PCHAR *Results, IN DWORD Length, IN LPSTR Name, IN LPCGUID Type, IN LPSTR *NewName)
 
PHOSTENT WSAAPI gethostbyname (IN const char FAR *name)
 
PHOSTENT WSAAPI gethostbyaddr (IN const char FAR *addr, IN int len, IN int type)
 
INT WSAAPI gethostname (OUT char FAR *name, IN INT namelen)
 
PSERVENT WSAAPI getservbyport (IN int port, IN const char FAR *proto)
 
PSERVENT WSAAPI getservbyname (IN const char FAR *name, IN const char FAR *proto)
 
HANDLE WSAAPI WSAAsyncGetHostByAddr (IN HWND hWnd, IN UINT wMsg, IN CONST CHAR FAR *Address, IN INT Length, IN INT Type, OUT CHAR FAR *Buffer, IN INT BufferLength)
 
HANDLE WSAAPI WSAAsyncGetHostByName (IN HWND hWnd, IN UINT wMsg, IN CONST CHAR FAR *Name, OUT CHAR FAR *Buffer, IN INT BufferLength)
 
HANDLE WSAAPI WSAAsyncGetProtoByName (IN HWND hWnd, IN UINT wMsg, IN CONST CHAR FAR *Name, OUT CHAR FAR *Buffer, IN INT BufferLength)
 
HANDLE WSAAPI WSAAsyncGetProtoByNumber (IN HWND hWnd, IN UINT wMsg, IN INT Number, OUT CHAR FAR *Buffer, IN INT BufferLength)
 
HANDLE WSAAPI WSAAsyncGetServByName (IN HWND hWnd, IN UINT wMsg, IN CONST CHAR FAR *Name, IN CONST CHAR FAR *Protocol, OUT CHAR FAR *Buffer, IN INT BufferLength)
 
HANDLE WSAAPI WSAAsyncGetServByPort (IN HWND hWnd, IN UINT wMsg, IN INT Port, IN CONST CHAR FAR *Protocol, OUT CHAR FAR *Buffer, IN INT BufferLength)
 
INT WSAAPI WSACancelAsyncRequest (IN HANDLE hAsyncTaskHandle)
 

Variables

AFPROTOCOLS afp [2] = {{AF_INET, IPPROTO_UDP}, {AF_INET, IPPROTO_TCP}}
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file getxbyxx.c.

Function Documentation

◆ FixList()

VOID WSAAPI FixList ( PCHAR **  List,
ULONG_PTR  Base 
)

Definition at line 24 of file getxbyxx.c.

26{
27 /* Make sure it's valid */
28 if (*List)
29 {
30 PCHAR *Addr;
31
32 /* Get the right base */
33 Addr = *List = (PCHAR*)(((ULONG_PTR)*List + Base));
34
35 /* Loop the pointers */
36 while (*Addr)
37 {
38 /* Rebase them too */
39 *Addr = (PCHAR)(((ULONG_PTR)*Addr + Base));
40 Addr++;
41 }
42 }
43}
#define PCHAR
Definition: match.c:90
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2439
uint32_t ULONG_PTR
Definition: typedefs.h:65
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550

Referenced by UnpackHostEnt(), and UnpackServEnt().

◆ gethostbyaddr()

PHOSTENT WSAAPI gethostbyaddr ( IN const char FAR addr,
IN int  len,
IN int  type 
)

Definition at line 309 of file getxbyxx.c.

312{
313 CHAR AddressBuffer[100];
314 PHOSTENT Hostent;
315 LPBLOB Blob;
316 CHAR ResultsBuffer[RNR_BUFFER_SIZE];
317 PCHAR Results = ResultsBuffer;
321 DPRINT("gethostbyaddr: %s\n", addr);
322
323 /* Enter prolog */
325 {
326 /* Leave now */
328 return NULL;
329 }
330
331 /* Check for valid address pointer */
332 if (!addr)
333 {
334 /* Fail */
336 return NULL;
337 }
338
339 /* Check which type it is */
340 if (type == AF_INET)
341 {
342 /* Use IPV4 Address to String */
343 Local_Ip4AddresstoString(AddressBuffer, (PCHAR)addr);
344 }
345 else if (type == AF_INET6)
346 {
347 /* Use IPV6 Address to String */
348 Local_Ip6AddresstoString(AddressBuffer, (PCHAR)addr);
349 }
350 else
351 {
352 /* Invalid address type; fail */
354 return NULL;
355 }
356
357 /* Get the Hostname in a Blob Structure */
358 Blob = getxyDataEnt(&Results,
360 AddressBuffer,
362 0);
363
364 /* Check if we got a blob */
365 if (Blob)
366 {
367 /* Copy the blob to our buffer and convert it */
368 Hostent = WsThreadBlobToHostent(Thread, Blob);
369
370 /* Unpack the hostent */
371 if (Hostent) UnpackHostEnt(Hostent);
372 }
373 else
374 {
375 /* We failed, so zero it out */
376 Hostent = NULL;
377
378 /* Normalize the error message */
380 {
382 }
383 }
384
385 /* Check if we received a newly allocated buffer; free it. */
386 if (Results != ResultsBuffer) HeapFree(WsSockHeap, 0, Results);
387
388 /* Return the hostent */
389 return Hostent;
390}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define SetLastError(x)
Definition: compat.h:752
#define HeapFree(x, y, z)
Definition: compat.h:735
#define AF_INET
Definition: tcpip.h:117
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
VOID WSAAPI UnpackHostEnt(PHOSTENT Hostent)
Definition: getxbyxx.c:61
LPBLOB WSAAPI getxyDataEnt(IN OUT PCHAR *Results, IN DWORD Length, IN LPSTR Name, IN LPCGUID Type, IN LPSTR *NewName)
Definition: getxbyxx.c:103
VOID WSAAPI Local_Ip4AddresstoString(IN PCHAR AddressBuffer, IN PCHAR Address)
Definition: getxbyxx.c:75
VOID WSAAPI Local_Ip6AddresstoString(IN PCHAR AddressBuffer, IN PCHAR Address)
Definition: getxbyxx.c:88
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum const GLvoid * addr
Definition: glext.h:9621
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define RNR_BUFFER_SIZE
Definition: nsp_dns.h:25
const GUID DECLSPEC_SELECTANY AddressGuid
Definition: nsp_dns.h:18
#define DPRINT
Definition: sndvol32.h:71
Definition: nspapi.h:57
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WSAEINVAL
Definition: winerror.h:1946
#define WSAHOST_NOT_FOUND
Definition: winerror.h:2000
#define WSASERVICE_NOT_FOUND
Definition: winerror.h:1995
#define AF_INET6
Definition: winsock.h:369
PHOSTENT WSAAPI WsThreadBlobToHostent(IN PWSTHREAD Thread, IN LPBLOB Blob)
Definition: dthread.c:316
HANDLE WsSockHeap
Definition: dllmain.c:21
INT WSAAPI WsApiProlog(OUT PWSPROCESS *Process, OUT PWSTHREAD *Thread)
Definition: wsautil.c:91
char CHAR
Definition: xmlstorage.h:175

Referenced by AddrToAddrStr(), GetHostEntry(), WsAsyncGetHost(), and WspiapiLegacyGetNameInfo().

◆ gethostbyname()

PHOSTENT WSAAPI gethostbyname ( IN const char FAR name)

Definition at line 221 of file getxbyxx.c.

222{
223 PHOSTENT Hostent;
224 LPBLOB Blob;
226 CHAR ResultsBuffer[RNR_BUFFER_SIZE];
227 PCHAR Results = ResultsBuffer;
228 CHAR szLocalName[MAX_HOSTNAME_LEN];
229 PCHAR pszName;
232 DPRINT("gethostbyname: %s\n", name);
233
234 /* Enter prolog */
236 {
237 /* Leave now */
239 return NULL;
240 }
241
242 /* Check if no name was given */
243 if (!name || !*name)
244 {
245 /* This means we should do a local lookup first */
246 if (gethostname(szLocalName, MAX_HOSTNAME_LEN) != NO_ERROR) return(NULL);
247 pszName = szLocalName;
248 }
249 else
250 {
251 /* Use the name tha twas given to us */
252 pszName = (PCHAR)name;
253 }
254
255 /* Get the Hostname in a Blob Structure */
256 Blob = getxyDataEnt(&Results,
258 pszName,
260 0);
261
262 /* Check if we didn't get a blob, or if we got an empty name */
263 if (!(Blob) && (!(name) || !(*name)))
264 {
265 /* Try a new query */
266 Blob = getxyDataEnt(&Results,
268 NULL,
270 0);
271 }
272
273 /* Check if we got a blob */
274 if (Blob)
275 {
276 /* Copy the blob to our buffer and convert it */
277 Hostent = WsThreadBlobToHostent(Thread, Blob);
278
279 /* Unpack the hostent */
280 if (Hostent) UnpackHostEnt(Hostent);
281 }
282 else
283 {
284 /* We failed, so zero it out */
285 Hostent = NULL;
286
287 /* Normalize the error message */
289 {
291 }
292 }
293
294 /* Check if we received a newly allocated buffer; free it. */
295 if (Results != ResultsBuffer) HeapFree(WsSockHeap, 0, Results);
296
297 /* Notify RAS Auto-dial helper */
298 if (Hostent) WSNoteSuccessfulHostentLookup(name, *Hostent->h_addr);
299
300 /* Return the hostent */
301 return Hostent;
302}
#define NO_ERROR
Definition: dderror.h:5
INT WSAAPI gethostname(OUT char FAR *name, IN INT namelen)
Definition: getxbyxx.c:397
#define MAX_HOSTNAME_LEN
Definition: iptypes.h:30
const GUID DECLSPEC_SELECTANY HostAddrByNameGuid
Definition: nsp_dns.h:19
Definition: name.c:39
VOID WINAPI WSNoteSuccessfulHostentLookup(IN CONST CHAR FAR *Name, IN CONST ULONG Address)
Definition: winsock.c:119

Referenced by AddrStrToAddr(), Telnet::Connect(), ConnectToReactOSWebsite(), do_host_lookup(), get_server(), GetHostByName(), GetHostEntry(), GetOurHostName(), getrpcport(), hookup(), init_logger_addr(), InitConnection(), IsWinsockInitialized(), main(), NetBTinetResolve(), netfinger(), open_http(), QueryDNS(), Setup(), START_TEST(), tcp_connect(), test_communication(), test_gethostbyname(), test_WithoutWSAStartup(), test_WithWSAStartup(), write_packet(), WsAsyncGetHost(), and WspiapiQueryDNS().

◆ gethostname()

INT WSAAPI gethostname ( OUT char FAR name,
IN INT  namelen 
)

Definition at line 397 of file getxbyxx.c.

399{
400 PCHAR Name = NULL;
401 CHAR ResultsBuffer[RNR_BUFFER_SIZE];
402 PCHAR Results = ResultsBuffer;
403 DPRINT("gethostname: %p\n", name);
404
405 if (!name || namelen < 1)
406 {
408 return SOCKET_ERROR;
409 }
410 /* Get the Hostname in a String */
411 /* getxyDataEnt does not return blob for HostnameGuid */
413 if (Name)
414 {
415 /* Copy it */
417 }
418
419 /* Check if we received a newly allocated buffer; free it. */
420 if (Results != ResultsBuffer) HeapFree(WsSockHeap, 0, Results);
421
422 /* Return success */
423 return ERROR_SUCCESS;
424}
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
GLint namelen
Definition: glext.h:7232
const GUID DECLSPEC_SELECTANY HostnameGuid
Definition: nsp_dns.h:17
#define WSAEFAULT
Definition: winerror.h:1945
#define SOCKET_ERROR
Definition: winsock.h:333

Referenced by authunix_create_default(), create_new_rpc_auth(), get_username_and_hostname(), gethostbyname(), GetIpHostName(), GetOurHostName(), host2netname(), main(), nfs41_rpc_clnt_create(), ruserpass(), START_TEST(), and UserLoginThread().

◆ getservbyname()

PSERVENT WSAAPI getservbyname ( IN const char FAR name,
IN const char FAR proto 
)

Definition at line 500 of file getxbyxx.c.

502{
503 PSERVENT Servent;
504 LPBLOB Blob;
505 CHAR ResultsBuffer[RNR_BUFFER_SIZE];
506 PCHAR Results = ResultsBuffer;
511 DPRINT("getservbyname: %s\n", name);
512
513 /* Enter prolog */
515 {
516 /* Leave now */
518 return NULL;
519 }
520
521 /* No protocol specified */
522 if (!proto) proto = "";
523
524 /* Allocate buffer for it */
526 if (!PortName)
527 {
528 /* Fail */
530 return NULL;
531 }
532
533 /* Put it into the right syntax */
534 sprintf(PortName, "%s/%s", name, proto);
535
536 /* Get the Service in a Blob */
537 Blob = getxyDataEnt(&Results, RNR_BUFFER_SIZE, PortName, &IANAGuid, 0);
538
539 /* Free the string we sent */
541
542 /* Check if we got a blob */
543 if (Blob)
544 {
545 /* Copy the blob to our buffer and convert it */
546 Servent = WsThreadBlobToServent(Thread, Blob);
547
548 /* Unpack the hostent */
549 if (Servent) UnpackServEnt(Servent);
550 }
551 else
552 {
553 /* We failed, so zero it out */
554 Servent = 0;
555 }
556
557 /* Check if we received a newly allocated buffer; free it. */
558 if (Results != ResultsBuffer) HeapFree(WsSockHeap, 0, Results);
559
560 /* Return the hostent */
561 return Servent;
562}
static UNICODE_STRING PortName
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define HeapAlloc
Definition: compat.h:733
VOID WSAAPI UnpackServEnt(PSERVENT Servent)
Definition: getxbyxx.c:47
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const GUID DECLSPEC_SELECTANY IANAGuid
Definition: nsp_dns.h:20
#define WSA_NOT_ENOUGH_MEMORY
Definition: winsock2.h:620
PSERVENT WSAAPI WsThreadBlobToServent(IN PWSTHREAD Thread, IN LPBLOB Blob)
Definition: dthread.c:349

Referenced by Telnet::Connect(), FTPInitLibrary(), GetAddrInfoW(), main(), netfinger(), rtime(), ServiceNameToPortNumber(), START_TEST(), WsAsyncGetServ(), and WspiapiLegacyGetAddrInfo().

◆ getservbyport()

PSERVENT WSAAPI getservbyport ( IN int  port,
IN const char FAR proto 
)

Definition at line 431 of file getxbyxx.c.

433{
434 PSERVENT Servent;
435 LPBLOB Blob;
436 CHAR ResultsBuffer[RNR_BUFFER_SIZE];
437 PCHAR Results = ResultsBuffer;
442 DPRINT("getservbyport: %s\n", proto);
443
444 /* Enter prolog */
446 {
447 /* Leave now */
449 return NULL;
450 }
451
452 /* No protocol specified */
453 if (!proto) proto = "";
454
455 /* Allocate memory for the port name */
456 PortName = HeapAlloc(WsSockHeap, 0, strlen(proto) + 1 + 1 + 5);
457 if (!PortName)
458 {
459 /* Fail */
461 return NULL;
462 }
463
464 /* Put it into the right syntax */
465 sprintf(PortName, "%d/%s", (ntohs(port) & 0xffff), proto);
466
467 /* Get the Service in a Blob */
468 Blob = getxyDataEnt(&Results, RNR_BUFFER_SIZE, PortName, &IANAGuid, 0);
469
470 /* Free the string we sent */
472
473 /* Check if we got a blob */
474 if (Blob)
475 {
476 /* Copy the blob to our buffer and convert it */
477 Servent = WsThreadBlobToServent(Thread, Blob);
478
479 /* Unpack the hostent */
480 if (Servent) UnpackServEnt(Servent);
481 }
482 else
483 {
484 /* We failed, so zero it out */
485 Servent = 0;
486 }
487
488 /* Check if we received a newly allocated buffer; free it. */
489 if (Results != ResultsBuffer) HeapFree(WsSockHeap, 0, Results);
490
491 /* Return the hostent */
492 return Servent;
493}
USHORT port
Definition: uri.c:228
#define ntohs(x)
Definition: module.h:210

Referenced by AddrToAddrStr(), GetPortName(), START_TEST(), WsAsyncGetServ(), and WspiapiLegacyGetNameInfo().

◆ getxyDataEnt()

LPBLOB WSAAPI getxyDataEnt ( IN OUT PCHAR Results,
IN DWORD  Length,
IN LPSTR  Name,
IN LPCGUID  Type,
IN LPSTR NewName 
)

Definition at line 103 of file getxbyxx.c.

108{
109 PWSAQUERYSETA WsaQuery = (PWSAQUERYSETA)*Results;
112 HANDLE RnRHandle;
113 LPBLOB Blob = NULL;
114 PVOID NewResults = NULL;
115 DWORD dwControlFlags = LUP_RETURN_NAME;
116
117 /* Assume empty return name */
118 if (NewName) *NewName = NULL;
119
120 /* Set up the Winsock Service Query */
121 RtlZeroMemory(WsaQuery, sizeof(*WsaQuery));
122 WsaQuery->dwSize = sizeof(*WsaQuery);
123 WsaQuery->lpszServiceInstanceName = Name;
124 WsaQuery->lpServiceClassId = (LPGUID)Type;
125 WsaQuery->dwNameSpace = NS_ALL;
126 WsaQuery->dwNumberOfProtocols = sizeof(afp)/sizeof(afp[0]);
127 WsaQuery->lpafpProtocols = afp;
128
130 dwControlFlags |= LUP_RETURN_BLOB;
131
132 /* Send the Query Request to find a Service */
134 dwControlFlags,
135 &RnRHandle);
136
138 {
139 while (TRUE)
140 {
141 /* Service was found, send the real query */
143 0,
144 &NewLength,
145 WsaQuery);
146
147 /* Return the information requested */
149 {
150 /* Get the Blob and check if we have one */
151 Blob = WsaQuery->lpBlob;
152 if (Blob)
153 {
154 /* Did they want the name back? */
155 if (NewName) *NewName = WsaQuery->lpszServiceInstanceName;
156 }
157 else
158 {
159 /* Check if this was a Hostname lookup */
161 {
162 /* Return the name anyways */
163 if (NewName) *NewName = WsaQuery->lpszServiceInstanceName;
164 }
165 else
166 {
167 /* We don't have a blob, sorry */
169 }
170 }
171 }
172 else
173 {
174 /* WSALookupServiceEnd will set its own error, so save ours */
176
177 /* Check if we failed because of missing buffer space */
179 {
180 /* Allocate a new buffer */
181 NewResults = HeapAlloc(WsSockHeap, 0, Length);
182 if (NewResults)
183 {
184 /* Tell the caller his new buffer */
185 *Results = NewResults;
186
187 /* Update the WSA Query's location */
188 WsaQuery = (PWSAQUERYSETA)NewResults;
189
190 /* Loop again */
191 continue;
192 }
193 else
194 {
195 /* No memory to allocate the new buffer */
197 }
198 }
199 }
200
201 /* Finish the Query Request */
202 WSALookupServiceEnd(RnRHandle);
203
204 /* Now set the Last Error */
206
207 /* Leave the loop */
208 break;
209 }
210 }
211
212 /* Return the blob */
213 return Blob;
214}
static USHORT USHORT * NewLength
Type
Definition: Type.h:7
struct NameRec_ * Name
Definition: cdprocs.h:460
#define TRUE
Definition: types.h:120
unsigned long DWORD
Definition: ntddk_ex.h:95
AFPROTOCOLS afp[2]
Definition: getxbyxx.c:18
#define NS_ALL
Definition: nspapi.h:8
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
GUID * LPGUID
Definition: guiddef.h:81
INT WSAAPI WSALookupServiceEnd(IN HANDLE hLookup)
Definition: rnr.c:202
INT WSAAPI WSALookupServiceNextA(IN HANDLE hLookup, IN DWORD dwControlFlags, IN OUT LPDWORD lpdwBufferLength, OUT LPWSAQUERYSETA lpqsResults)
Definition: rnr.c:444
INT WSAAPI WSALookupServiceBeginA(IN LPWSAQUERYSETA lpqsRestrictions, IN DWORD dwControlFlags, OUT LPHANDLE lphLookup)
Definition: rnr.c:245
LPGUID lpServiceClassId
Definition: winsock2.h:804
LPBLOB lpBlob
Definition: winsock2.h:816
DWORD dwSize
Definition: winsock2.h:802
DWORD dwNumberOfProtocols
Definition: winsock2.h:810
DWORD dwNameSpace
Definition: winsock2.h:807
LPSTR lpszServiceInstanceName
Definition: winsock2.h:803
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define WSANO_DATA
Definition: winerror.h:2003
struct _WSAQuerySetA * PWSAQUERYSETA
#define LUP_RETURN_BLOB
Definition: winsock2.h:519
#define LUP_RETURN_NAME
Definition: winsock2.h:514
_In_ PUNICODE_STRING NewName
Definition: zwfuncs.h:1203

Referenced by gethostbyaddr(), gethostbyname(), gethostname(), getservbyname(), and getservbyport().

◆ Local_Ip4AddresstoString()

VOID WSAAPI Local_Ip4AddresstoString ( IN PCHAR  AddressBuffer,
IN PCHAR  Address 
)

Definition at line 75 of file getxbyxx.c.

77{
78 /* Convert the address into IPv4 format */
79 sprintf(AddressBuffer, "%u.%u.%u.%u",
80 ((unsigned)Address[0] & 0xff),
81 ((unsigned)Address[1] & 0xff),
82 ((unsigned)Address[2] & 0xff),
83 ((unsigned)Address[3] & 0xff));
84}
static WCHAR Address[46]
Definition: ping.c:68

Referenced by gethostbyaddr().

◆ Local_Ip6AddresstoString()

VOID WSAAPI Local_Ip6AddresstoString ( IN PCHAR  AddressBuffer,
IN PCHAR  Address 
)

Definition at line 88 of file getxbyxx.c.

90{
91 DWORD i;
92
93 /* Convert the address into IPv6 format */
94 for (i = 0; i < 8; i++)
95 {
96 sprintf(AddressBuffer, "%x:",
97 ((unsigned)Address[0] & 0xff));
98 }
99}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by gethostbyaddr().

◆ UnpackHostEnt()

VOID WSAAPI UnpackHostEnt ( PHOSTENT  Hostent)

Definition at line 61 of file getxbyxx.c.

62{
63 ULONG_PTR HostentPtr = (ULONG_PTR)Hostent;
64
65 /* Convert the Name Offset to a Pointer */
66 if (Hostent->h_name) Hostent->h_name = (PCHAR)(Hostent->h_name + HostentPtr);
67
68 /* Convert all the List Offsets to Pointers */
69 FixList(&Hostent->h_aliases, HostentPtr);
70 FixList(&Hostent->h_addr_list, HostentPtr);
71}
#define ULONG_PTR
Definition: config.h:101
VOID WSAAPI FixList(PCHAR **List, ULONG_PTR Base)
Definition: getxbyxx.c:24
char * h_name
Definition: winsock.h:134
char ** h_aliases
Definition: winsock.h:135
char ** h_addr_list
Definition: winsock.h:138

Referenced by gethostbyaddr(), and gethostbyname().

◆ UnpackServEnt()

VOID WSAAPI UnpackServEnt ( PSERVENT  Servent)

Definition at line 47 of file getxbyxx.c.

48{
49 ULONG_PTR ServentPtr = (ULONG_PTR)Servent;
50
51 /* Convert all the List Offsets to Pointers */
52 FixList(&Servent->s_aliases, ServentPtr);
53
54 /* Convert the Name and Protocol Offsets to Pointers */
55 Servent->s_name = (PCHAR)(Servent->s_name + ServentPtr);
56 Servent->s_proto = (PCHAR)(Servent->s_proto + ServentPtr);
57}
char * s_name
Definition: winsock.h:159
char * s_proto
Definition: winsock.h:166
char ** s_aliases
Definition: winsock.h:160

Referenced by getservbyname(), and getservbyport().

◆ WSAAsyncGetHostByAddr()

HANDLE WSAAPI WSAAsyncGetHostByAddr ( IN HWND  hWnd,
IN UINT  wMsg,
IN CONST CHAR FAR Address,
IN INT  Length,
IN INT  Type,
OUT CHAR FAR Buffer,
IN INT  BufferLength 
)

Definition at line 569 of file getxbyxx.c.

576{
577 HANDLE TaskHandle;
580 PVOID AddressCopy;
581 PWSASYNCBLOCK AsyncBlock;
583 DPRINT("WSAAsyncGetHostByAddr: %lx, %lx, %s\n", hWnd, wMsg, Address);
584
585 /* Enter prolog */
587 {
588 /* Leave now */
590 return NULL;
591 }
592
593 /* Initialize the Async Thread */
595 {
596 /* Fail */
598 return NULL;
599 }
600
601 /* Allocate an async block */
602 if (!(AsyncBlock = WsAsyncAllocateBlock(Length)))
603 {
604 /* Fail */
606 return NULL;
607 }
608
609 /* Make a copy of the address */
610 AddressCopy = AsyncBlock + 1;
611 RtlMoveMemory(AddressCopy, Address, Length);
612
613 /* Initialize the Async Block */
614 AsyncBlock->Operation = WsAsyncGetHostByAddr;
615 AsyncBlock->GetHost.hWnd = hWnd;
616 AsyncBlock->GetHost.wMsg = wMsg;
617 AsyncBlock->GetHost.ByWhat = AddressCopy;
618 AsyncBlock->GetHost.Length = Length;
619 AsyncBlock->GetHost.Type = Type;
620 AsyncBlock->GetHost.Buffer = Buffer;
621 AsyncBlock->GetHost.BufferLength = BufferLength;
622
623 /* Save the task handle and queue the request */
624 TaskHandle = AsyncBlock->TaskHandle;
625 WsAsyncQueueRequest(AsyncBlock);
626
627 /* Return the task handle */
628 return TaskHandle;
629}
HWND hWnd
Definition: settings.c:17
Definition: bufpool.h:45
struct _WSASYNCBLOCK::@601::@603 GetHost
WSASYNCOPS Operation
Definition: ws2_32p.h:28
HANDLE TaskHandle
Definition: ws2_32p.h:27
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
#define WSAENOBUFS
Definition: winerror.h:1968
@ WsAsyncGetHostByAddr
Definition: ws2_32p.h:15
VOID WSAAPI WsAsyncQueueRequest(IN PWSASYNCBLOCK AsyncBlock)
Definition: async.c:919
PWSASYNCBLOCK WSAAPI WsAsyncAllocateBlock(IN SIZE_T ExtraLength)
Definition: async.c:439
BOOL WSAAPI WsAsyncCheckAndInitThread(VOID)
Definition: async.c:832

◆ WSAAsyncGetHostByName()

HANDLE WSAAPI WSAAsyncGetHostByName ( IN HWND  hWnd,
IN UINT  wMsg,
IN CONST CHAR FAR Name,
OUT CHAR FAR Buffer,
IN INT  BufferLength 
)

Definition at line 636 of file getxbyxx.c.

641{
642 HANDLE TaskHandle;
645 PWSASYNCBLOCK AsyncBlock;
647 PVOID NameCopy;
648 DPRINT("WSAAsyncGetProtoByNumber: %lx, %lx, %s\n", hWnd, wMsg, Name);
649
650 /* Enter prolog */
652 {
653 /* Leave now */
655 return NULL;
656 }
657
658 /* Initialize the Async Thread */
660 {
661 /* Fail */
663 return NULL;
664 }
665
666 /* Allocate an async block */
667 if (!(AsyncBlock = WsAsyncAllocateBlock(strlen(Name) + sizeof(CHAR))))
668 {
669 /* Fail */
671 return NULL;
672 }
673
674 /* Make a copy of the address */
675 NameCopy = AsyncBlock + 1;
676 strcpy(NameCopy, Name);
677
678 /* Initialize the Async Block */
679 AsyncBlock->Operation = WsAsyncGetHostByName;
680 AsyncBlock->GetHost.hWnd = hWnd;
681 AsyncBlock->GetHost.wMsg = wMsg;
682 AsyncBlock->GetHost.ByWhat = NameCopy;
683 AsyncBlock->GetHost.Buffer = Buffer;
684 AsyncBlock->GetHost.BufferLength = BufferLength;
685
686 /* Save the task handle and queue the request */
687 TaskHandle = AsyncBlock->TaskHandle;
688 WsAsyncQueueRequest(AsyncBlock);
689
690 /* Return the task handle */
691 return TaskHandle;
692}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
@ WsAsyncGetHostByName
Definition: ws2_32p.h:16

◆ WSAAsyncGetProtoByName()

HANDLE WSAAPI WSAAsyncGetProtoByName ( IN HWND  hWnd,
IN UINT  wMsg,
IN CONST CHAR FAR Name,
OUT CHAR FAR Buffer,
IN INT  BufferLength 
)

Definition at line 699 of file getxbyxx.c.

704{
705 HANDLE TaskHandle;
708 PWSASYNCBLOCK AsyncBlock;
710 PVOID NameCopy;
711 DPRINT("WSAAsyncGetProtoByName: %lx, %lx, %s\n", hWnd, wMsg, Name);
712
713 /* Enter prolog */
715 {
716 /* Leave now */
718 return NULL;
719 }
720
721 /* Initialize the Async Thread */
723 {
724 /* Fail */
726 return NULL;
727 }
728
729 /* Allocate an async block */
730 if (!(AsyncBlock = WsAsyncAllocateBlock(strlen(Name) + sizeof(CHAR))))
731 {
732 /* Fail */
734 return NULL;
735 }
736
737 /* Make a copy of the address */
738 NameCopy = AsyncBlock + 1;
739 strcpy(NameCopy, Name);
740
741 /* Initialize the Async Block */
742 AsyncBlock->Operation = WsAsyncGetProtoByName;
743 AsyncBlock->GetProto.hWnd = hWnd;
744 AsyncBlock->GetProto.wMsg = wMsg;
745 AsyncBlock->GetProto.ByWhat = NameCopy;
746 AsyncBlock->GetProto.Buffer = Buffer;
747 AsyncBlock->GetProto.BufferLength = BufferLength;
748
749 /* Save the task handle and queue the request */
750 TaskHandle = AsyncBlock->TaskHandle;
751 WsAsyncQueueRequest(AsyncBlock);
752
753 /* Return the task handle */
754 return TaskHandle;
755}
struct _WSASYNCBLOCK::@601::@604 GetProto
@ WsAsyncGetProtoByName
Definition: ws2_32p.h:17

◆ WSAAsyncGetProtoByNumber()

HANDLE WSAAPI WSAAsyncGetProtoByNumber ( IN HWND  hWnd,
IN UINT  wMsg,
IN INT  Number,
OUT CHAR FAR Buffer,
IN INT  BufferLength 
)

Definition at line 762 of file getxbyxx.c.

767{
768 HANDLE TaskHandle;
771 PWSASYNCBLOCK AsyncBlock;
773 DPRINT("WSAAsyncGetProtoByNumber: %lx, %lx, %lx\n", hWnd, wMsg, Number);
774
775 /* Enter prolog */
777 {
778 /* Leave now */
780 return NULL;
781 }
782
783 /* Initialize the Async Thread */
785 {
786 /* Fail */
788 return NULL;
789 }
790
791 /* Allocate an async block */
792 if (!(AsyncBlock = WsAsyncAllocateBlock(0)))
793 {
794 /* Fail */
796 return NULL;
797 }
798
799 /* Initialize the Async Block */
801 AsyncBlock->GetProto.hWnd = hWnd;
802 AsyncBlock->GetProto.wMsg = wMsg;
803 AsyncBlock->GetProto.ByWhat = UlongToPtr(Number);
804 AsyncBlock->GetProto.Buffer = Buffer;
805 AsyncBlock->GetProto.BufferLength = BufferLength;
806
807 /* Save the task handle and queue the request */
808 TaskHandle = AsyncBlock->TaskHandle;
809 WsAsyncQueueRequest(AsyncBlock);
810
811 /* Return the task handle */
812 return TaskHandle;
813}
#define UlongToPtr(u)
Definition: config.h:106
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:207
@ WsAsyncGetProtoByNumber
Definition: ws2_32p.h:18

◆ WSAAsyncGetServByName()

HANDLE WSAAPI WSAAsyncGetServByName ( IN HWND  hWnd,
IN UINT  wMsg,
IN CONST CHAR FAR Name,
IN CONST CHAR FAR Protocol,
OUT CHAR FAR Buffer,
IN INT  BufferLength 
)

Definition at line 820 of file getxbyxx.c.

826{
827 HANDLE TaskHandle;
830 PWSASYNCBLOCK AsyncBlock;
832 PVOID NameCopy;
833 DPRINT("WSAAsyncGetProtoByNumber: %lx, %lx, %s\n", hWnd, wMsg, Name);
834
835 /* Enter prolog */
837 {
838 /* Leave now */
840 return NULL;
841 }
842
843 /* Initialize the Async Thread */
845 {
846 /* Fail */
848 return NULL;
849 }
850
851 /* Allocate an async block */
852 if (!(AsyncBlock = WsAsyncAllocateBlock(strlen(Name) + sizeof(CHAR))))
853 {
854 /* Fail */
856 return NULL;
857 }
858
859 /* Make a copy of the address */
860 NameCopy = AsyncBlock + 1;
861 strcpy(NameCopy, Name);
862
863 /* Initialize the Async Block */
864 AsyncBlock->Operation = WsAsyncGetProtoByName;
865 AsyncBlock->GetServ.hWnd = hWnd;
866 AsyncBlock->GetServ.wMsg = wMsg;
867 AsyncBlock->GetServ.ByWhat = NameCopy;
868 AsyncBlock->GetServ.Protocol = (PCHAR)Protocol;
869 AsyncBlock->GetServ.Buffer = Buffer;
870 AsyncBlock->GetServ.BufferLength = BufferLength;
871
872 /* Save the task handle and queue the request */
873 TaskHandle = AsyncBlock->TaskHandle;
874 WsAsyncQueueRequest(AsyncBlock);
875
876 /* Return the task handle */
877 return TaskHandle;
878}
struct _WSASYNCBLOCK::@601::@605 GetServ

◆ WSAAsyncGetServByPort()

HANDLE WSAAPI WSAAsyncGetServByPort ( IN HWND  hWnd,
IN UINT  wMsg,
IN INT  Port,
IN CONST CHAR FAR Protocol,
OUT CHAR FAR Buffer,
IN INT  BufferLength 
)

Definition at line 885 of file getxbyxx.c.

891{
892 HANDLE TaskHandle;
895 PWSASYNCBLOCK AsyncBlock;
897 DPRINT("WSAAsyncGetProtoByNumber: %lx, %lx, %lx\n", hWnd, wMsg, Port);
898
899 /* Enter prolog */
901 {
902 /* Leave now */
904 return NULL;
905 }
906
907 /* Initialize the Async Thread */
909 {
910 /* Fail */
912 return NULL;
913 }
914
915 /* Allocate an async block */
916 if (!(AsyncBlock = WsAsyncAllocateBlock(0)))
917 {
918 /* Fail */
920 return NULL;
921 }
922
923 /* Initialize the Async Block */
924 AsyncBlock->Operation = WsAsyncGetServByPort;
925 AsyncBlock->GetServ.hWnd = hWnd;
926 AsyncBlock->GetServ.wMsg = wMsg;
927 AsyncBlock->GetServ.ByWhat = UlongToPtr(Port);
928 AsyncBlock->GetServ.Protocol = (PCHAR)Protocol;
929 AsyncBlock->GetServ.Buffer = Buffer;
930 AsyncBlock->GetServ.BufferLength = BufferLength;
931
932 /* Save the task handle and queue the request */
933 TaskHandle = AsyncBlock->TaskHandle;
934 WsAsyncQueueRequest(AsyncBlock);
935
936 /* Return the task handle */
937 return TaskHandle;
938}
CPPORT Port[4]
Definition: headless.c:35
@ WsAsyncGetServByPort
Definition: ws2_32p.h:20

◆ WSACancelAsyncRequest()

INT WSAAPI WSACancelAsyncRequest ( IN HANDLE  hAsyncTaskHandle)

Definition at line 945 of file getxbyxx.c.

946{
950 DPRINT("WSACancelAsyncRequest: %lx\n", hAsyncTaskHandle);
951
952 /* Enter prolog */
954 {
955 /* Call the Async code */
956 ErrorCode = WsAsyncCancelRequest(hAsyncTaskHandle);
957
958 /* Return */
960 }
961
962 /* Fail */
964 return SOCKET_ERROR;
965}
INT WSAAPI WsAsyncCancelRequest(IN HANDLE TaskHandle)
Definition: async.c:936

Variable Documentation

◆ afp

Definition at line 18 of file getxbyxx.c.

Referenced by getxyDataEnt().