mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[dnsapi][dnsrslvr] Implement DnsFlushResolverCacheEntry_A/_UTF8/_W
This commit is contained in:
parent
b232efe12a
commit
894cc4ac0c
7 changed files with 177 additions and 27 deletions
|
@ -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,
|
||||
|
|
|
@ -52,6 +52,11 @@ DNS_STATUS
|
|||
DnsIntCacheFlush(
|
||||
_In_ ULONG ulFlags);
|
||||
|
||||
DNS_STATUS
|
||||
DnsIntFlushCacheEntry(
|
||||
_In_ LPCWSTR pszName,
|
||||
_In_ WORD wType);
|
||||
|
||||
DNS_STATUS
|
||||
DnsIntCacheGetEntryByName(
|
||||
LPCWSTR Name,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
@ stdcall DnsFindAuthoritativeZone()
|
||||
@ stdcall DnsFlushResolverCache()
|
||||
@ stdcall DnsFlushResolverCacheEntry_A(str)
|
||||
@ stdcall DnsFlushResolverCacheEntry_UTF8()
|
||||
@ stdcall DnsFlushResolverCacheEntry_W()
|
||||
@ stdcall DnsFlushResolverCacheEntry_UTF8(str)
|
||||
@ stdcall DnsFlushResolverCacheEntry_W(wstr)
|
||||
@ stdcall DnsFree(ptr long)
|
||||
@ stdcall DnsFreeAdapterInformation()
|
||||
@ stub DnsFreeConfigStructure
|
||||
|
|
|
@ -951,6 +951,105 @@ DnsFlushResolverCache(VOID)
|
|||
return (Status == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
DnsFlushResolverCacheEntry_A(
|
||||
_In_ LPCSTR pszEntry)
|
||||
{
|
||||
DNS_STATUS Status = ERROR_SUCCESS;
|
||||
LPWSTR pszUnicodeEntry;
|
||||
|
||||
DPRINT1("DnsFlushResolverCacheEntry_A(%s)\n", pszEntry);
|
||||
|
||||
if (pszEntry == NULL)
|
||||
return FALSE;
|
||||
|
||||
pszUnicodeEntry = DnsCToW(pszEntry);
|
||||
if (pszUnicodeEntry == NULL)
|
||||
return FALSE;
|
||||
|
||||
RpcTryExcept
|
||||
{
|
||||
Status = R_ResolverFlushCacheEntry(NULL, pszUnicodeEntry, DNS_TYPE_ANY);
|
||||
DPRINT("R_ResolverFlushCacheEntry() returned %lu\n", Status);
|
||||
}
|
||||
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Status = RpcExceptionCode();
|
||||
DPRINT("Exception returned %lu\n", Status);
|
||||
}
|
||||
RpcEndExcept;
|
||||
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, pszUnicodeEntry);
|
||||
|
||||
return (Status == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
DnsFlushResolverCacheEntry_UTF8(
|
||||
_In_ LPCSTR pszEntry)
|
||||
{
|
||||
DNS_STATUS Status = ERROR_SUCCESS;
|
||||
LPWSTR pszUnicodeEntry;
|
||||
|
||||
DPRINT1("DnsFlushResolverCacheEntry_UTF8(%s)\n", pszEntry);
|
||||
|
||||
if (pszEntry == NULL)
|
||||
return FALSE;
|
||||
|
||||
pszUnicodeEntry = DnsCToW(pszEntry);
|
||||
if (pszUnicodeEntry == NULL)
|
||||
return FALSE;
|
||||
|
||||
RpcTryExcept
|
||||
{
|
||||
Status = R_ResolverFlushCacheEntry(NULL, pszUnicodeEntry, DNS_TYPE_ANY);
|
||||
DPRINT("R_ResolverFlushCacheEntry() returned %lu\n", Status);
|
||||
}
|
||||
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Status = RpcExceptionCode();
|
||||
DPRINT("Exception returned %lu\n", Status);
|
||||
}
|
||||
RpcEndExcept;
|
||||
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, pszUnicodeEntry);
|
||||
|
||||
return (Status == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
DnsFlushResolverCacheEntry_W(
|
||||
_In_ LPCWSTR pszEntry)
|
||||
{
|
||||
DNS_STATUS Status = ERROR_SUCCESS;
|
||||
|
||||
DPRINT1("DnsFlushResolverCacheEntry_W(%S)\n", pszEntry);
|
||||
|
||||
if (pszEntry == NULL)
|
||||
return FALSE;
|
||||
|
||||
RpcTryExcept
|
||||
{
|
||||
Status = R_ResolverFlushCacheEntry(NULL, pszEntry, DNS_TYPE_ANY);
|
||||
DPRINT("R_ResolverFlushCacheEntry() returned %lu\n", Status);
|
||||
}
|
||||
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Status = RpcExceptionCode();
|
||||
DPRINT("Exception returned %lu\n", Status);
|
||||
}
|
||||
RpcEndExcept;
|
||||
|
||||
return (Status == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
DnsGetCacheDataTable(
|
||||
|
|
|
@ -216,28 +216,6 @@ DnsFindAuthoritativeZone()
|
|||
return ERROR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
DnsFlushResolverCacheEntry_A(PCSTR entry)
|
||||
{
|
||||
DPRINT1("DnsFlushResolverCacheEntry_A(%s) is stubplemented.\n", entry);
|
||||
if (!entry) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DNS_STATUS WINAPI
|
||||
DnsFlushResolverCacheEntry_UTF8()
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return ERROR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
DNS_STATUS WINAPI
|
||||
DnsFlushResolverCacheEntry_W()
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return ERROR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
DNS_STATUS WINAPI
|
||||
DnsFreeAdapterInformation()
|
||||
{
|
||||
|
|
|
@ -50,7 +50,12 @@ interface DnsResolver
|
|||
[in, unique, string] DNSRSLVR_HANDLE pwszServerName);
|
||||
|
||||
/* Function: 0x05 */
|
||||
/* R_ResolverFlushCacheEntry */
|
||||
DWORD
|
||||
__stdcall
|
||||
R_ResolverFlushCacheEntry(
|
||||
[in, unique, string] DNSRSLVR_HANDLE pwszServerName,
|
||||
[in, string] LPCWSTR pszName,
|
||||
[in] WORD wType);
|
||||
|
||||
/* Function: 0x06 */
|
||||
/* R_ResolverRegisterCluster */
|
||||
|
|
Loading…
Reference in a new issue