코드/c/c++ DNS cache 도메인 네임 얻기 WeZZ 2012. 12. 20. 19:08 typedef struct _DNS_CACHE_ENTRY { struct _DNS_CACHE_ENTRY* next; PWSTR name; USHORT type; USHORT data_length; ULONG flag; } DNS_CACHE_ENTRY, *PDNS_CACHE_ENTRY; typedef int(WINAPI *fpDnsGetCacheDataTable)(PDNS_CACHE_ENTRY); int GetDnsCachedDomainName() { PDNS_CACHE_ENTRY entry = (PDNS_CACHE_ENTRY)malloc(sizeof(DNS_CACHE_ENTRY)); HINSTANCE h = LoadLibrary(TEXT("DNSAPI.dll")); fpDnsGetCacheDataTable DnsGetCacheDataTable = (fpDnsGetCacheDataTable)GetProcAddress(h, "DnsGetCacheDataTable"); if(DnsGetCacheDataTable(entry)) { entry = entry->next; while(entry) { printf(L"%ws : %d\n", (entry->name), (entry->type)); entry = entry->next; } } free(pEntry); FreeLibrary(h); return 0; } 저작자표시 비영리