[dnsapi][dnsrslvr] Implement DnsFlushResolverCacheEntry_A/_UTF8/_W

This commit is contained in:
Eric Kohl 2021-05-24 14:43:30 +02:00
parent b232efe12a
commit 894cc4ac0c
7 changed files with 177 additions and 27 deletions

View file

@ -101,6 +101,51 @@ DnsIntCacheFlush(
return ERROR_SUCCESS;
}
DNS_STATUS
DnsIntFlushCacheEntry(
_In_ LPCWSTR pszName,
_In_ WORD wType)
{
PLIST_ENTRY Entry, NextEntry;
PRESOLVER_CACHE_ENTRY CacheEntry;
DPRINT("DnsIntFlushCacheEntry(%S %x)\n", pszName, wType);
/* Lock the cache */
DnsCacheLock();
/* Loop every entry */
Entry = DnsCache.RecordList.Flink;
while (Entry != &DnsCache.RecordList)
{
NextEntry = Entry->Flink;
/* Get this entry */
CacheEntry = CONTAINING_RECORD(Entry, RESOLVER_CACHE_ENTRY, CacheLink);
/* Remove it from the list */
if ((_wcsicmp(CacheEntry->Record->pName, pszName) == 0) &&
(CacheEntry->bHostsFileEntry == FALSE))
{
if ((wType == DNS_TYPE_ANY) ||
(CacheEntry->Record->wType == wType))
{
DnsIntCacheRemoveEntryItem(CacheEntry);
}
}
/* Move to the next entry */
Entry = NextEntry;
}
/* Unlock the cache */
DnsCacheUnlock();
return ERROR_SUCCESS;
}
DNS_STATUS
DnsIntCacheGetEntryByName(
LPCWSTR Name,

View file

@ -52,6 +52,11 @@ DNS_STATUS
DnsIntCacheFlush(
_In_ ULONG ulFlags);
DNS_STATUS
DnsIntFlushCacheEntry(
_In_ LPCWSTR pszName,
_In_ WORD wType);
DNS_STATUS
DnsIntCacheGetEntryByName(
LPCWSTR Name,

View file

@ -60,15 +60,33 @@ CRrReadCache(
DWORD
__stdcall
R_ResolverFlushCache(
_In_ DNSRSLVR_HANDLE pwszServerName)
_In_ DNSRSLVR_HANDLE pszServerName)
{
DPRINT("R_ResolverFlushCache(%S)\n",
pwszServerName);
pszServerName);
return DnsIntCacheFlush(CACHE_FLUSH_NON_HOSTS_FILE_ENTRIES);
}
/* Function: 0x05 */
DWORD
__stdcall
R_ResolverFlushCacheEntry(
_In_ DNSRSLVR_HANDLE pszServerName,
_In_ LPCWSTR pszName,
_In_ WORD wType)
{
DPRINT("R_ResolverFlushCacheEntry(%S %S %x)\n",
pszServerName, pszName, wType);
if (pszName == NULL)
return ERROR_INVALID_PARAMETER;
return DnsIntFlushCacheEntry(pszName, wType);
}
/* Function: 0x07 */
DWORD
__stdcall