DNS_STATUS status;               //Return value of  DnsQuery_A() function.
    PDNS_RECORD pDnsRecord; 
 int assignBuffLenght;
 assignBuffLenght=(sizeof(DNS_RECORD))*Max;
 pDnsRecord=(DNS_RECORD*)malloc(assignBuffLenght);
 memset(pDnsRecord,0,assignBuffLenght);
 if (WSAStartup(MAKEWORD(2,1),&wsaData)) //调用Windows Sockets DLL
 { 
  printf("Winsock无法初始化!\n");
  WSACleanup();
 
 }
 
 memset(hostname, 0, 256);
 iRet = gethostname(hostname, sizeof(hostname));
 if(iRet != 0 )
 {
  printf( "get hostname error:%d\n", iRet);
 }
 printf("%s\n", hostname);
 LPSTR pOwnerName=hostname;
// Calling function DnsQuery to query Host or PTR records   
    status = DnsQuery(pOwnerName,                 //Pointer to OwnerName. 
                        DNS_TYPE_A,                      //Type of the record to be queried.
                        DNS_QUERY_STANDARD,     // Bypasses the resolver cache on the lookup. 
                        NULL,                   //Contains DNS server IP address.
                        &pDnsRecord,                //Resource record that contains the response.
                        NULL);                     //Reserved for future use.
//  printf("The host name is %s  \n",(pDnsRecord->Data.PTR.pNameHost));
 while(pDnsRecord){
   printf("The host name is  %s \n",pDnsRecord->pName);
   printf("the type is %d \n",pDnsRecord->wType);
   printf("the lenght of data is %d \n", pDnsRecord->wDataLength);
   printf(" the time to live is  %d \n", pDnsRecord-> dwTtl);
   printf("the lenght of data id %d \n", pDnsRecord-> dwReserved);
pDnsRecord=pDnsRecord->pNext;
 }
 
 
printf("dnsCache print over");
}
else
{
printf("ilegal code");
}
}
void DoFlushDns(bool){
printf("relizing config/flushdns!");
}
