#include <stdarg.h>
#include <windef.h>
#include <winsock2.h>
#include <tchar.h>
#include <stdio.h>
Go to the source code of this file.
|
BOOL | SendRequest (PCHAR pInBuffer, ULONG InBufferLength, PCHAR pOutBuffer, PULONG pOutBufferLength) |
|
int | ExtractName (PCHAR pBuffer, PCHAR pOutput, USHORT Offset, UCHAR Limit) |
|
void | ReverseIP (PCHAR pIP, PCHAR pReturn) |
|
BOOL | IsValidIP (PCHAR pInput) |
|
int | ExtractIP (PCHAR pBuffer, PCHAR pOutput, USHORT Offset) |
|
void | PrintD2 (PCHAR pBuffer, DWORD BufferLength) |
|
void | PrintDebug (PCHAR pBuffer, DWORD BufferLength) |
|
PCHAR | OpcodeIDtoOpcodeName (UCHAR Opcode) |
|
PCHAR | RCodeIDtoRCodeName (UCHAR RCode) |
|
PCHAR | TypeIDtoTypeName (USHORT TypeID) |
|
USHORT | TypeNametoTypeID (PCHAR TypeName) |
|
PCHAR | ClassIDtoClassName (USHORT ClassID) |
|
USHORT | ClassNametoClassID (PCHAR ClassName) |
|
◆ _INC_WINDOWS
◆ ARPA_SIG
#define ARPA_SIG ".in-addr.arpa" |
◆ CLASS_ANY
◆ CLASS_IN
◆ ClassAny
◆ ClassIN
◆ DEFAULT_ROOT
#define DEFAULT_ROOT "A.ROOT-SERVERS.NET." |
◆ OPCODE_IQUERY
◆ OPCODE_QUERY
◆ OPCODE_STATUS
◆ OpcodeIQuery
◆ OpcodeQuery
◆ OpcodeReserved
#define OpcodeReserved "RESERVED" |
◆ OpcodeStatus
◆ RCODE_FAILURE
◆ RCODE_FORMERR
◆ RCODE_NOERROR
◆ RCODE_NOTIMP
◆ RCODE_NXDOMAIN
◆ RCODE_REFUSED
◆ RCodeFAILURE
#define RCodeFAILURE "FAILURE" |
◆ RCodeFORMERR
#define RCodeFORMERR "FORMERR" |
◆ RCodeNOERROR
#define RCodeNOERROR "NOERROR" |
◆ RCodeNOTIMP
◆ RCodeNXDOMAIN
#define RCodeNXDOMAIN "NXDOMAIN" |
◆ RCodeREFUSED
#define RCodeREFUSED "REFUSED" |
◆ RCodeReserved
#define RCodeReserved "RESERVED" |
◆ TYPE_A
◆ TYPE_ANY
◆ TYPE_CNAME
◆ TYPE_MX
◆ TYPE_NS
◆ TYPE_PTR
◆ TYPE_SOA
◆ TYPE_WKS
◆ TypeA
◆ TypeAAAA
◆ TypeAny
◆ TypeBoth
◆ TypeCNAME
◆ TypeMX
◆ TypeNS
◆ TypePTR
◆ TypeSOA
◆ TypeSRV
◆ WIN32_NO_STATUS
◆ PSTATE
◆ STATE
◆ ClassIDtoClassName()
Definition at line 833 of file utility.c.
834{
835 switch( ClassID )
836 {
839
842
843 default:
844 return "Unknown";
845 }
846}
Referenced by PrintD2(), and PrintDebug().
◆ ClassNametoClassID()
Definition at line 848 of file utility.c.
849{
852
853 return 0;
854}
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Referenced by PerformLookup().
◆ ExtractIP()
Definition at line 397 of file utility.c.
398{
399 int c = 0,
l = 0,
i = 0,
v = 0;
400
402
406
409
413
416
420
423
427
430
432
434}
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
#define sprintf(buf, format,...)
_In_ ULONG _In_ ULONG Offset
Referenced by PerformInternalLookup(), PerformLookup(), and PrintDebug().
◆ ExtractName()
Definition at line 343 of file utility.c.
344{
345 int c = 0,
d = 0,
i = 0,
j = 0,
k = 0,
l = 0,
m = 0;
346
348
349
352
354 {
358
360 {
365 }
366 else
367 {
368 for(
j = 0;
j <
l;
j += 1 )
369 {
371
376 }
377
379
381
384 }
385 };
386
388 {
390 }
391
393
395}
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 GLint GLint j
_In_ LONG _In_ LONG Limit
Referenced by PerformInternalLookup(), PerformLookup(), PrintD2(), and PrintDebug().
◆ IsValidIP()
◆ OpcodeIDtoOpcodeName()
◆ PrintD2()
Definition at line 436 of file utility.c.
437{
439 UCHAR Header1, Header2;
440 USHORT NumQuestions, NumAnswers, NumAuthority, NumAdditional;
444
447
450
453
456
459
462
465
469 _tprintf(
_T(
" opcode = %s, id = %d, rcode = %s\n"),
473
475 if( Header1 & 0x01 )
_tprintf(
_T(
", want recursion") );
477
479 " authority records = %d, additional = %d\n\n"),
480 (int)NumQuestions,
481 (int)NumAnswers,
482 (int)NumAuthority,
483 (int)NumAdditional );
484
485 if( NumQuestions )
486 {
488
489 for(
k = 0;
k < NumQuestions;
k += 1 )
490 {
492
494
497
500
504 }
505 }
506
508}
PCHAR TypeIDtoTypeName(USHORT TypeID)
PCHAR RCodeIDtoRCodeName(UCHAR RCode)
PCHAR OpcodeIDtoOpcodeName(UCHAR Opcode)
int ExtractName(PCHAR pBuffer, PCHAR pOutput, USHORT Offset, UCHAR Limit)
PCHAR ClassIDtoClassName(USHORT ClassID)
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Referenced by SendRequest().
◆ PrintDebug()
Definition at line 510 of file utility.c.
511{
513 UCHAR Header1, Header2;
514 USHORT NumQuestions, NumAnswers, NumAuthority, NumAdditional;
518 int d = 0,
i = 0,
k = 0;
519
522
525
528
531
534
537
540
544 _tprintf(
_T(
" opcode = %s, id = %d, rcode = %s\n"),
546 (int)ResponseID,
548
550 if( Header1 & 0x01 )
_tprintf(
_T(
", want recursion") );
551 if( Header2 & 0x80 )
_tprintf(
_T(
", recursion avail.") );
553
554 _tprintf(
_T(
" questions = %d, answers = %d, "
555 "authority records = %d, additional = %d\n\n"),
556 (int)NumQuestions,
557 (int)NumAnswers,
558 (int)NumAuthority,
559 (int)NumAdditional );
560
561 if( NumQuestions )
562 {
564
565 for(
k = 0;
k < NumQuestions;
k += 1 )
566 {
568
570
573
576
580 }
581 }
582
583 if( NumAnswers )
584 {
586
587 for(
k = 0;
k < NumAnswers;
k += 1 )
588 {
590
591
593
595
596
599
602
605
608
609 _tprintf(
_T(
" type = %s, class = %s, dlen = %d\n"),
613
614
616 {
618
620 }
621 else
622 {
624
626 }
627
629 }
630 }
631
632 if( NumAuthority )
633 {
635
636 for(
k = 0;
k < NumAuthority;
k += 1 )
637 {
638
640
642
643
646
649
652
655
656 _tprintf(
_T(
" type = %s, class = %s, dlen = %d\n"),
660
661
663 {
664
666
668
670 }
672 {
674
675
677
679
680
682
684
685
692 }
693 }
694 }
695
696 if( NumAdditional )
697 {
699
700 for(
k = 0;
k < NumAdditional;
k += 1 )
701 {
702
704
706
707
710
713
716
719
720 _tprintf(
_T(
" type = %s, class = %s, dlen = %d\n"),
724
725
727 {
728
730
732
734 }
735 }
736 }
737
739}
int ExtractIP(PCHAR pBuffer, PCHAR pOutput, USHORT Offset)
Referenced by SendRequest().
◆ RCodeIDtoRCodeName()
Definition at line 759 of file utility.c.
760{
761 switch( RCode & 0x0F )
762 {
765
768
771
774
777
780
781 default:
783 }
784}
Referenced by PrintD2(), and PrintDebug().
◆ ReverseIP()
Definition at line 249 of file utility.c.
250{
254
257
258
259
260
261
262 for( ;
i > 0;
i -= 1 )
if(
'.' == pIP[
i] )
break;
263
266
269
272
273
274 for( ;
i > 0;
i -= 1 )
if(
'.' == pIP[
i] )
break;
275
278
281
284
285
286 for( ;
i > 0;
i -= 1 )
if(
'.' == pIP[
i] )
break;
287
290
293
296
297
298 for( ;
i > 0;
i -= 1 );
299
302
304}
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Referenced by PerformInternalLookup(), and PerformLookup().
◆ SendRequest()
Definition at line 11 of file utility.c.
15{
21 int SendAddrLen = sizeof(SendAddr);
22
26
27
29
30
32
33
35
38
39
43
44
48
49
51
52
54 pInBuffer,
55 InBufferLength,
56 0,
58 sizeof(RecAddr) );
60 {
62 {
64 _tprintf(
_T(
"sendto() failed with WSANOTINITIALIZED\n") );
65 break;
67 _tprintf(
_T(
"sendto() failed with WSAENETDOWN\n") );
68 break;
70 _tprintf(
_T(
"sendto() failed with WSAEACCES\n") );
71 break;
73 _tprintf(
_T(
"sendto() failed with WSAEINVAL\n") );
74 break;
76 _tprintf(
_T(
"sendto() failed with WSAEINTR\n") );
77 break;
79 _tprintf(
_T(
"sendto() failed with WSAEINPROGRESS\n") );
80 break;
82 _tprintf(
_T(
"sendto() failed with WSAEFAULT\n") );
83 break;
85 _tprintf(
_T(
"sendto() failed with WSAENETRESET\n") );
86 break;
88 _tprintf(
_T(
"sendto() failed with WSAENOBUFS\n") );
89 break;
91 _tprintf(
_T(
"sendto() failed with WSAENOTCONN\n") );
92 break;
94 _tprintf(
_T(
"sendto() failed with WSAENOTSOCK\n") );
95 break;
97 _tprintf(
_T(
"sendto() failed with WSAEOPNOTSUPP\n") );
98 break;
100 _tprintf(
_T(
"sendto() failed with WSAESHUTDOWN\n") );
101 break;
103 _tprintf(
_T(
"sendto() failed with WSAEWOULDBLOCK\n") );
104 break;
106 _tprintf(
_T(
"sendto() failed with WSAEMSGSIZE\n") );
107 break;
109 _tprintf(
_T(
"sendto() failed with WSAEHOSTUNREACH\n") );
110 break;
112 _tprintf(
_T(
"sendto() failed with WSAECONNABORTED\n") );
113 break;
115 _tprintf(
_T(
"sendto() failed with WSAECONNRESET\n") );
116 break;
118 _tprintf(
_T(
"sendto() failed with WSAEADDRNOTAVAIL\n") );
119 break;
121 _tprintf(
_T(
"sendto() failed with WSAEAFNOSUPPORT\n") );
122 break;
124 _tprintf(
_T(
"sendto() failed with WSAEDESTADDRREQ\n") );
125 break;
127 _tprintf(
_T(
"sendto() failed with WSAENETUNREACH\n") );
128 break;
130 _tprintf(
_T(
"sendto() failed with WSAETIMEDOUT\n") );
131 break;
132 default:
133 _tprintf(
_T(
"sendto() failed with unknown error\n") );
134 }
135
138 }
139
141
142 while( bWait )
143 {
144
146 pOutBuffer,
147 *pOutBufferLength,
148 0,
150 &SendAddrLen );
152 {
154 {
156 _tprintf(
_T(
"recvfrom() failed with WSANOTINITIALIZED\n") );
157 break;
159 _tprintf(
_T(
"recvfrom() failed with WSAENETDOWN\n") );
160 break;
162 _tprintf(
_T(
"recvfrom() failed with WSAEACCES\n") );
163 break;
165 _tprintf(
_T(
"recvfrom() failed with WSAEINVAL\n") );
166 break;
168 _tprintf(
_T(
"recvfrom() failed with WSAEINTR\n") );
169 break;
171 _tprintf(
_T(
"recvfrom() failed with WSAEINPROGRESS\n") );
172 break;
174 _tprintf(
_T(
"recvfrom() failed with WSAEFAULT\n") );
175 break;
177 _tprintf(
_T(
"recvfrom() failed with WSAENETRESET\n") );
178 break;
180 _tprintf(
_T(
"recvfrom() failed with WSAENOBUFS\n") );
181 break;
183 _tprintf(
_T(
"recvfrom() failed with WSAENOTCONN\n") );
184 break;
186 _tprintf(
_T(
"recvfrom() failed with WSAENOTSOCK\n") );
187 break;
189 _tprintf(
_T(
"recvfrom() failed with WSAEOPNOTSUPP\n") );
190 break;
192 _tprintf(
_T(
"recvfrom() failed with WSAESHUTDOWN\n") );
193 break;
195 _tprintf(
_T(
"recvfrom() failed with WSAEWOULDBLOCK\n") );
196 break;
198 _tprintf(
_T(
"recvfrom() failed with WSAEMSGSIZE\n") );
199 break;
201 _tprintf(
_T(
"recvfrom() failed with WSAEHOSTUNREACH\n") );
202 break;
204 _tprintf(
_T(
"recvfrom() failed with WSAECONNABORTED\n") );
205 break;
207 _tprintf(
_T(
"recvfrom() failed with WSAECONNRESET\n") );
208 break;
210 _tprintf(
_T(
"recvfrom() failed with WSAEADDRNOTAVAIL\n") );
211 break;
213 _tprintf(
_T(
"recvfrom() failed with WSAEAFNOSUPPORT\n") );
214 break;
216 _tprintf(
_T(
"recvfrom() failed with WSAEDESTADDRREQ\n") );
217 break;
219 _tprintf(
_T(
"recvfrom() failed with WSAENETUNREACH\n") );
220 break;
222 _tprintf(
_T(
"recvfrom() failed with WSAETIMEDOUT\n") );
223 break;
224 default:
225 _tprintf(
_T(
"recvfrom() failed with unknown error\n") );
226 }
227
230 }
231
233
235 }
236
237
239
240
242
243
244 *pOutBufferLength =
j;
245
247}
void PrintDebug(PCHAR pBuffer, DWORD BufferLength)
void PrintD2(PCHAR pBuffer, DWORD BufferLength)
INT WSAAPI recvfrom(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags, OUT LPSOCKADDR from, IN OUT INT FAR *fromlen)
INT WSAAPI sendto(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags, IN CONST struct sockaddr *to, IN INT tolen)
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
#define RtlZeroMemory(Destination, Length)
#define WSANOTINITIALISED
int PASCAL FAR WSAGetLastError(void)
Referenced by AddrFileFree(), PerformInternalLookup(), and PerformLookup().
◆ TypeIDtoTypeName()
Definition at line 786 of file utility.c.
787{
788 switch( TypeID )
789 {
792
795
798
801
804
807
810
813
814 default:
815 return "Unknown";
816 }
817}
Referenced by PrintD2(), and PrintDebug().
◆ TypeNametoTypeID()
◆ ProcessHeap
◆ State