// JP opened flex table

Click to See Complete Forum and Search --> : I need a hand with DnsQuery


NoTime2Wait
January 14th, 2008, 01:23 AM
hello guys,

I am trying to make a dnsquery to check if the server has RecursionAvailable enabled.


here is the code:


#include <windows.h>
#include <windns.h>
#include <iostream>
#include <string>

using namespace std;
main()
{
string ddomain = "find.com";
PDNS_RECORD pDns = NULL;
int errorcode;

if ( (errorcode= DnsQuery_A( ddomain.c_str(), DNS_TYPE_A, DNS_QUERY_STANDARD, NULL, &pDns, NULL )) == NOERROR) {


}

}


the information I am looking for is stored in _DNS_HEADER structure:

typedef struct _DNS_HEADER {
WORD Xid;
BYTE RecursionDesired;
BYTE Truncation;
BYTE Authoritative;
BYTE Opcode;
BYTE IsResponse;
BYTE ResponseCode;
BYTE Reserved;
BYTE RecursionAvailable;//<--- I need this
WORD QuestionCount;
WORD AnswerCount;
WORD NameServerCount;
WORD AdditionalCount;
} DNS_HEADER,
*PDNS_HEADER;


How do I extract RecursionAvailable?

thank you very much.

//JP added flex table