mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:23:05 +00:00
[DNSAPI][DNSRSLVR] Implement DnsGetCacheDataTable()
This commit is contained in:
parent
6499cf9e1a
commit
6c7878f35e
7 changed files with 124 additions and 14 deletions
|
@ -203,3 +203,60 @@ DnsIntCacheAddEntry(PDNS_RECORDW Record)
|
||||||
/* Release the cache */
|
/* Release the cache */
|
||||||
DnsCacheUnlock();
|
DnsCacheUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DNS_STATUS
|
||||||
|
DnsIntCacheGetEntries(
|
||||||
|
_Out_ DNS_CACHE_ENTRY **ppCacheEntries)
|
||||||
|
{
|
||||||
|
PRESOLVER_CACHE_ENTRY CacheEntry;
|
||||||
|
PLIST_ENTRY NextEntry;
|
||||||
|
PDNS_CACHE_ENTRY pLastEntry = NULL, pNewEntry;
|
||||||
|
|
||||||
|
/* Lock the cache */
|
||||||
|
DnsCacheLock();
|
||||||
|
|
||||||
|
*ppCacheEntries = NULL;
|
||||||
|
|
||||||
|
NextEntry = DnsCache.RecordList.Flink;
|
||||||
|
while (NextEntry != &DnsCache.RecordList)
|
||||||
|
{
|
||||||
|
/* Get the Current Entry */
|
||||||
|
CacheEntry = CONTAINING_RECORD(NextEntry, RESOLVER_CACHE_ENTRY, CacheLink);
|
||||||
|
|
||||||
|
DPRINT("1 %S %lu\n", CacheEntry->Record->pName, CacheEntry->Record->wType);
|
||||||
|
if (CacheEntry->Record->pNext)
|
||||||
|
{
|
||||||
|
DPRINT("2 %S %lu\n", CacheEntry->Record->pNext->pName, CacheEntry->Record->pNext->wType);
|
||||||
|
}
|
||||||
|
|
||||||
|
pNewEntry = midl_user_allocate(sizeof(DNS_CACHE_ENTRY));
|
||||||
|
if (pNewEntry == NULL)
|
||||||
|
{
|
||||||
|
return ERROR_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
pNewEntry->pszName = midl_user_allocate((wcslen(CacheEntry->Record->pName) + 1) * sizeof(WCHAR));
|
||||||
|
if (pNewEntry->pszName == NULL)
|
||||||
|
{
|
||||||
|
return ERROR_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
wcscpy(pNewEntry->pszName, CacheEntry->Record->pName);
|
||||||
|
pNewEntry->wType1 = CacheEntry->Record->wType;
|
||||||
|
pNewEntry->wType2 = 0;
|
||||||
|
pNewEntry->wFlags = 0;
|
||||||
|
|
||||||
|
if (pLastEntry == NULL)
|
||||||
|
*ppCacheEntries = pNewEntry;
|
||||||
|
else
|
||||||
|
pLastEntry->pNext = pNewEntry;
|
||||||
|
pLastEntry = pNewEntry;
|
||||||
|
|
||||||
|
NextEntry = NextEntry->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release the cache */
|
||||||
|
DnsCacheUnlock();
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
|
@ -54,6 +54,9 @@ DnsIntCacheGetEntryByName(
|
||||||
VOID DnsIntCacheAddEntry(PDNS_RECORDW Record);
|
VOID DnsIntCacheAddEntry(PDNS_RECORDW Record);
|
||||||
BOOL DnsIntCacheRemoveEntryByName(LPCWSTR Name);
|
BOOL DnsIntCacheRemoveEntryByName(LPCWSTR Name);
|
||||||
|
|
||||||
|
DNS_STATUS
|
||||||
|
DnsIntCacheGetEntries(
|
||||||
|
_Out_ DNS_CACHE_ENTRY **ppCacheEntries);
|
||||||
|
|
||||||
|
|
||||||
/* hostsfile.c */
|
/* hostsfile.c */
|
||||||
|
|
|
@ -41,6 +41,21 @@ RpcThreadRoutine(LPVOID lpParameter)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Function: 0x00 */
|
||||||
|
DWORD
|
||||||
|
__stdcall
|
||||||
|
CRrReadCache(
|
||||||
|
_In_ DNSRSLVR_HANDLE pwszServerName,
|
||||||
|
_Out_ DNS_CACHE_ENTRY **ppCacheEntries)
|
||||||
|
{
|
||||||
|
DPRINT("CRrReadCache(%S %p)\n",
|
||||||
|
pwszServerName, ppCacheEntries);
|
||||||
|
|
||||||
|
return DnsIntCacheGetEntries(ppCacheEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Function: 0x04 */
|
/* Function: 0x04 */
|
||||||
DWORD
|
DWORD
|
||||||
__stdcall
|
__stdcall
|
||||||
|
@ -54,6 +69,7 @@ R_ResolverFlushCache(
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Function: 0x07 */
|
/* Function: 0x07 */
|
||||||
DWORD
|
DWORD
|
||||||
__stdcall
|
__stdcall
|
||||||
|
|
|
@ -896,6 +896,41 @@ DnsFlushResolverCache(VOID)
|
||||||
return (Status == ERROR_SUCCESS);
|
return (Status == ERROR_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
|
DnsGetCacheDataTable(
|
||||||
|
_Out_ PDNS_CACHE_ENTRY *DnsCache)
|
||||||
|
{
|
||||||
|
DNS_STATUS Status = ERROR_SUCCESS;
|
||||||
|
PDNS_CACHE_ENTRY CacheEntries = NULL;
|
||||||
|
|
||||||
|
if (DnsCache == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
RpcTryExcept
|
||||||
|
{
|
||||||
|
Status = CRrReadCache(NULL,
|
||||||
|
&CacheEntries);
|
||||||
|
DPRINT("CRrReadCache() returned %lu\n", Status);
|
||||||
|
}
|
||||||
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Status = RpcExceptionCode();
|
||||||
|
DPRINT1("Exception returned %lu\n", Status);
|
||||||
|
}
|
||||||
|
RpcEndExcept;
|
||||||
|
|
||||||
|
if (Status != ERROR_SUCCESS)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (CacheEntries == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
*DnsCache = CacheEntries;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
WINAPI
|
WINAPI
|
||||||
GetCurrentTimeInSeconds(VOID)
|
GetCurrentTimeInSeconds(VOID)
|
||||||
|
|
|
@ -266,15 +266,6 @@ DnsGetBufferLengthForStringCopy()
|
||||||
return ERROR_OUTOFMEMORY;
|
return ERROR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
|
||||||
WINAPI
|
|
||||||
DnsGetCacheDataTable(
|
|
||||||
_Out_ PDNS_CACHE_ENTRY *DnsCache)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
DNS_STATUS WINAPI
|
DNS_STATUS WINAPI
|
||||||
DnsGetDnsServerList()
|
DnsGetDnsServerList()
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,11 @@ typedef [handle, string] LPWSTR DNSRSLVR_HANDLE;
|
||||||
interface DnsResolver
|
interface DnsResolver
|
||||||
{
|
{
|
||||||
/* Function: 0x00 */
|
/* Function: 0x00 */
|
||||||
/* CRrReadCache */
|
DWORD
|
||||||
|
__stdcall
|
||||||
|
CRrReadCache(
|
||||||
|
[in, unique, string] DNSRSLVR_HANDLE pwszServerName,
|
||||||
|
[out] DNS_CACHE_ENTRY **ppCacheEntries);
|
||||||
|
|
||||||
/* Function: 0x01 */
|
/* Function: 0x01 */
|
||||||
/* CRrReadCacheEntry */
|
/* CRrReadCacheEntry */
|
||||||
|
|
|
@ -8,7 +8,11 @@ extern "C" {
|
||||||
typedef struct _DNS_CACHE_ENTRY
|
typedef struct _DNS_CACHE_ENTRY
|
||||||
{
|
{
|
||||||
struct _DNS_CACHE_ENTRY *pNext; /* Pointer to next entry */
|
struct _DNS_CACHE_ENTRY *pNext; /* Pointer to next entry */
|
||||||
|
#if defined(__midl) || defined(__WIDL__)
|
||||||
|
[string] PWSTR pszName; /* DNS Record Name */
|
||||||
|
#else
|
||||||
PWSTR pszName; /* DNS Record Name */
|
PWSTR pszName; /* DNS Record Name */
|
||||||
|
#endif
|
||||||
unsigned short wType1; /* DNS Record Type 1 */
|
unsigned short wType1; /* DNS Record Type 1 */
|
||||||
unsigned short wType2; /* DNS Record Type 2 */
|
unsigned short wType2; /* DNS Record Type 2 */
|
||||||
unsigned short wFlags; /* DNS Record Flags */
|
unsigned short wFlags; /* DNS Record Flags */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue