- Update to r53061
[reactos.git] / base / applications / network / nslookup / nslookup.c
index 993ab04..fc94274 100644 (file)
@@ -6,13 +6,6 @@
  * 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;
@@ -90,11 +83,7 @@ BOOL PerformInternalLookup( PCHAR pAddr, PCHAR pResult )
     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;
@@ -198,12 +187,7 @@ BOOL PerformInternalLookup( PCHAR pAddr, PCHAR pResult )
     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;
 
@@ -257,11 +241,10 @@ void PerformLookup( PCHAR pAddr )
     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;
@@ -368,19 +351,17 @@ void PerformLookup( PCHAR pAddr )
     ((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. */
@@ -803,7 +784,7 @@ int main( int argc, char* argv[] )
     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. */