* COPYRIGHT: Copyright 2009 Lucas Suggs <lucas.suggs@gmail.com>
*/
-#include <windows.h>
-#include <windns.h>
-#include <winsock2.h>
-#include <tchar.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <iphlpapi.h>
#include "nslookup.h"
STATE State;
BOOL bOk = FALSE;
/* Makes things easier when parsing the response packet. */
- UCHAR Header1, Header2;
USHORT NumQuestions;
- USHORT NumAnswers;
- USHORT NumAuthority;
- USHORT NumAdditional;
USHORT Type;
if( (strlen( pAddr ) + 1) > 255 ) return FALSE;
if( !bOk ) goto cleanup;
/* Start parsing the received packet. */
- Header1 = RecBuffer[2];
- Header2 = RecBuffer[3];
NumQuestions = ntohs( ((PSHORT)&RecBuffer[4])[0] );
- NumAnswers = ntohs( ((PSHORT)&RecBuffer[6])[0] );
- NumAuthority = ntohs( ((PUSHORT)&RecBuffer[8])[0] );
- NumAdditional = ntohs( ((PUSHORT)&RecBuffer[10])[0] );
k = 12;
BOOL bOk = FALSE;
/* Makes things easier when parsing the response packet. */
- UCHAR Header1, Header2;
+ UCHAR Header2;
USHORT NumQuestions;
USHORT NumAnswers;
USHORT NumAuthority;
- USHORT NumAdditional;
USHORT Type;
if( (strlen( pAddr ) + 1) > 255 ) return;
((PSHORT)&Buffer[i])[0] = htons( ClassNametoClassID( State.Class ) );
/* Ship off the request to the DNS server. */
- bOk = SendRequest( Buffer,
+ bOk = SendRequest( Buffer,
BufferLength,
RecBuffer,
&RecBufferLength );
if( !bOk ) goto cleanup;
/* Start parsing the received packet. */
- Header1 = RecBuffer[2];
Header2 = RecBuffer[3];
NumQuestions = ntohs( ((PSHORT)&RecBuffer[4])[0] );
NumAnswers = ntohs( ((PSHORT)&RecBuffer[6])[0] );
NumAuthority = ntohs( ((PUSHORT)&RecBuffer[8])[0] );
- NumAdditional = ntohs( ((PUSHORT)&RecBuffer[10])[0] );
Type = 0;
/* Check the RCODE for failure. */
RtlZeroMemory( State.DefaultServer, 256 );
RtlZeroMemory( State.DefaultServerAddress, 16 );
- strncpy( State.root, DEFAULT_ROOT, strlen( DEFAULT_ROOT ) );
+ memcpy( State.root, DEFAULT_ROOT, sizeof(DEFAULT_ROOT) );
/* We don't know how long of a buffer it will want to return. So we'll
pass an empty one now and let it fail only once, instead of guessing. */