mirror of
https://github.com/reactos/reactos.git
synced 2025-05-07 02:41:22 +00:00
[DNSAPI] Add the Resolver Service RPC client code and implement DnsFlushResolverCache()
Patch by Peter Hater and Christoph von Wittich. Slightly modified by me. CORE-12159
This commit is contained in:
parent
d49d7b3282
commit
b79246c534
5 changed files with 108 additions and 10 deletions
|
@ -1,9 +1,12 @@
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
include
|
include
|
||||||
|
${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl
|
||||||
${REACTOS_SOURCE_DIR}/sdk/lib/3rdparty/adns/src
|
${REACTOS_SOURCE_DIR}/sdk/lib/3rdparty/adns/src
|
||||||
${REACTOS_SOURCE_DIR}/sdk/lib/3rdparty/adns/adns_win32)
|
${REACTOS_SOURCE_DIR}/sdk/lib/3rdparty/adns/adns_win32)
|
||||||
|
|
||||||
|
add_rpc_files(client ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/dnsrslvr.idl)
|
||||||
|
|
||||||
add_definitions(-DADNS_JGAA_WIN32 -D_CRT_NO_POSIX_ERROR_CODES)
|
add_definitions(-DADNS_JGAA_WIN32 -D_CRT_NO_POSIX_ERROR_CODES)
|
||||||
spec2def(dnsapi.dll dnsapi.spec ADD_IMPORTLIB)
|
spec2def(dnsapi.dll dnsapi.spec ADD_IMPORTLIB)
|
||||||
|
|
||||||
|
@ -14,8 +17,10 @@ list(APPEND SOURCE
|
||||||
dnsapi/names.c
|
dnsapi/names.c
|
||||||
dnsapi/query.c
|
dnsapi/query.c
|
||||||
dnsapi/record.c
|
dnsapi/record.c
|
||||||
|
dnsapi/rpc.c
|
||||||
dnsapi/stubs.c
|
dnsapi/stubs.c
|
||||||
dnsapi/precomp.h)
|
dnsapi/precomp.h
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/dnsrslvr_c.c)
|
||||||
|
|
||||||
add_library(dnsapi MODULE
|
add_library(dnsapi MODULE
|
||||||
${SOURCE}
|
${SOURCE}
|
||||||
|
@ -23,7 +28,7 @@ add_library(dnsapi MODULE
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/dnsapi.def)
|
${CMAKE_CURRENT_BINARY_DIR}/dnsapi.def)
|
||||||
|
|
||||||
set_module_type(dnsapi win32dll)
|
set_module_type(dnsapi win32dll)
|
||||||
target_link_libraries(dnsapi adns)
|
target_link_libraries(dnsapi adns ${PSEH_LIB})
|
||||||
add_importlibs(dnsapi advapi32 user32 ws2_32 iphlpapi msvcrt kernel32 ntdll)
|
add_importlibs(dnsapi advapi32 rpcrt4 user32 ws2_32 iphlpapi msvcrt kernel32 ntdll)
|
||||||
add_pch(dnsapi dnsapi/precomp.h SOURCE)
|
add_pch(dnsapi dnsapi/precomp.h SOURCE)
|
||||||
add_cd_file(TARGET dnsapi DESTINATION reactos/system32 FOR all)
|
add_cd_file(TARGET dnsapi DESTINATION reactos/system32 FOR all)
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#define NTOS_MODE_USER
|
#define NTOS_MODE_USER
|
||||||
#include <ndk/rtlfuncs.h>
|
#include <ndk/rtlfuncs.h>
|
||||||
|
|
||||||
|
#include <dnsrslvr_c.h>
|
||||||
|
|
||||||
/* Internal DNSAPI Headers */
|
/* Internal DNSAPI Headers */
|
||||||
#include <internal/windns.h>
|
#include <internal/windns.h>
|
||||||
|
|
||||||
|
|
|
@ -1072,3 +1072,26 @@ DnsIntFreeRecordList(PDNS_RECORD ToDelete)
|
||||||
ToDelete = next;
|
ToDelete = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
|
DnsFlushResolverCache(VOID)
|
||||||
|
{
|
||||||
|
DNS_STATUS Status = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
DPRINT("DnsFlushResolverCache()\n");
|
||||||
|
|
||||||
|
RpcTryExcept
|
||||||
|
{
|
||||||
|
Status = R_ResolverFlushCache(NULL);
|
||||||
|
DPRINT("R_ResolverFlushCache() returned %lu\n", Status);
|
||||||
|
}
|
||||||
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Status = RpcExceptionCode();
|
||||||
|
DPRINT("Exception returned %lu\n", Status);
|
||||||
|
}
|
||||||
|
RpcEndExcept;
|
||||||
|
|
||||||
|
return (Status == ERROR_SUCCESS);
|
||||||
|
}
|
||||||
|
|
75
dll/win32/dnsapi/dnsapi/rpc.c
Normal file
75
dll/win32/dnsapi/dnsapi/rpc.c
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
#define WIN32_NO_STATUS
|
||||||
|
#define _INC_WINDOWS
|
||||||
|
#define COM_NO_WINDOWS_H
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <windef.h>
|
||||||
|
#include <winbase.h>
|
||||||
|
#include <dnsrslvr_c.h>
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
handle_t __RPC_USER
|
||||||
|
DNSRSLVR_HANDLE_bind(DNSRSLVR_HANDLE pszMachineName)
|
||||||
|
{
|
||||||
|
handle_t hBinding = NULL;
|
||||||
|
LPWSTR pszStringBinding;
|
||||||
|
RPC_STATUS Status;
|
||||||
|
|
||||||
|
DPRINT1("DNSRSLVR_HANDLE_bind(%S)\n", pszMachineName);
|
||||||
|
|
||||||
|
Status = RpcStringBindingComposeW(NULL,
|
||||||
|
L"ncalrpc",
|
||||||
|
pszMachineName,
|
||||||
|
L"DNSResolver",
|
||||||
|
NULL,
|
||||||
|
&pszStringBinding);
|
||||||
|
if (Status != RPC_S_OK)
|
||||||
|
{
|
||||||
|
DPRINT1("RpcStringBindingCompose returned 0x%x\n", Status);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the binding handle that will be used to bind to the server. */
|
||||||
|
Status = RpcBindingFromStringBindingW(pszStringBinding,
|
||||||
|
&hBinding);
|
||||||
|
if (Status != RPC_S_OK)
|
||||||
|
{
|
||||||
|
DPRINT1("RpcBindingFromStringBinding returned 0x%x\n", Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = RpcStringFreeW(&pszStringBinding);
|
||||||
|
if (Status != RPC_S_OK)
|
||||||
|
{
|
||||||
|
DPRINT1("RpcStringFree returned 0x%x\n", Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hBinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
void __RPC_USER
|
||||||
|
DNSRSLVR_HANDLE_unbind(DNSRSLVR_HANDLE pszMachineName,
|
||||||
|
handle_t hBinding)
|
||||||
|
{
|
||||||
|
RPC_STATUS Status;
|
||||||
|
|
||||||
|
DPRINT("DNSRSLVR_HANDLE_unbind(%S)\n", pszMachineName);
|
||||||
|
|
||||||
|
Status = RpcBindingFree(&hBinding);
|
||||||
|
if (Status != RPC_S_OK)
|
||||||
|
{
|
||||||
|
DPRINT1("RpcBindingFree returned 0x%x\n", Status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void __RPC_FAR * __RPC_USER
|
||||||
|
midl_user_allocate(SIZE_T len)
|
||||||
|
{
|
||||||
|
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __RPC_USER
|
||||||
|
midl_user_free(void __RPC_FAR * ptr)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, ptr);
|
||||||
|
}
|
|
@ -216,13 +216,6 @@ DnsFindAuthoritativeZone()
|
||||||
return ERROR_OUTOFMEMORY;
|
return ERROR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
|
||||||
DnsFlushResolverCache(VOID)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL WINAPI
|
||||||
DnsFlushResolverCacheEntry_A(PCSTR entry)
|
DnsFlushResolverCacheEntry_A(PCSTR entry)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue