Hi folks,
I'm writing a simple DNS application that query DNS server for different type of DNS type such as A, NS MX, SOA and so on. At the beginning, everything started well. Sent query for A type record of a domain and got the reply, same for NS and PTR. But when I got to the implementation of SOA type, I got stuck with the type of error that was given.
Compiling the project works fine but when tries to run it I got this error.
"Unhandled exception at 0x6a2b984f(msvcr90.dll)in MyProject.exe:
0xC0000005: Access violation reading location 0x77cf1939"
Using a debugger, I'm able to step through to find the line of code that’s coursing the problem. Below is the snippet part of the program:
if (m_type == "SOA" ){wType = DNS_TYPE_SOA;}
case DNS_TYPE_SOA:
cstrFullDetails.Format(" SOA %s nameserv: %s", pDnsRecord->pName,
DnsRecord->Data.SOA.pNamePrimaryServer);
cstrFullDetails.Format("admin: %s", pDnsRecord->Data.SOA.pNameAdministrator);
cstrFullDetails.Format("serial: %s", pDnsRecord->Data.SOA.dwSerialNo);
cstrFullDetails.Format("refresh: %s", pDnsRecord->Data.SOA.dwRefresh);
cstrFullDetails.Format("ttl: %s", pDnsRecord->Data.SOA.dwDefaultTtl);
cstrFullDetails.Format("expire: %s", pDnsRecord->Data.SOA.dwExpire);
cstrFullDetails.Format("retry: %s", pDnsRecord->Data.SOA.dwRetry);
break;
The error popped out when the program tries to execute the line of code underlined. I'm stuck and don’t know what next to do to resolve this. And just to point out, the file that it point to when click on break is “output.c” which is locked and embedded in Visual Studio 2008. Someone please help...
Thanks in advance.