diff --git a/reactos/dll/win32/netapi32/CMakeLists.txt b/reactos/dll/win32/netapi32/CMakeLists.txt index 150492322af..ab995a75b62 100644 --- a/reactos/dll/win32/netapi32/CMakeLists.txt +++ b/reactos/dll/win32/netapi32/CMakeLists.txt @@ -9,6 +9,7 @@ add_rpc_files(client ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/atsvc.idl ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/browser.idl ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/dssetup.idl + ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/netlogon.idl ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/srvsvc.idl ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/wkssvc.idl) @@ -37,6 +38,7 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/atsvc_c.c ${CMAKE_CURRENT_BINARY_DIR}/browser_c.c ${CMAKE_CURRENT_BINARY_DIR}/dssetup_c.c + ${CMAKE_CURRENT_BINARY_DIR}/netlogon_c.c ${CMAKE_CURRENT_BINARY_DIR}/srvsvc_c.c ${CMAKE_CURRENT_BINARY_DIR}/wkssvc_c.c) diff --git a/reactos/dll/win32/netapi32/netlogon.c b/reactos/dll/win32/netapi32/netlogon.c index 4315c56def8..1385d028b5c 100644 --- a/reactos/dll/win32/netapi32/netlogon.c +++ b/reactos/dll/win32/netapi32/netlogon.c @@ -9,11 +9,68 @@ /* INCLUDES ******************************************************************/ #include "netapi32.h" +#include +#include "netlogon_c.h" WINE_DEFAULT_DEBUG_CHANNEL(netapi32); /* FUNCTIONS *****************************************************************/ +handle_t __RPC_USER +LOGONSRV_HANDLE_bind(LOGONSRV_HANDLE pszSystemName) +{ + handle_t hBinding = NULL; + LPWSTR pszStringBinding; + RPC_STATUS status; + + TRACE("LOGONSRV_HANDLE_bind() called\n"); + + status = RpcStringBindingComposeW(NULL, + L"ncacn_np", + pszSystemName, + L"\\pipe\\netlogon", + NULL, + &pszStringBinding); + if (status) + { + TRACE("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) + { + TRACE("RpcBindingFromStringBinding returned 0x%x\n", status); + } + + status = RpcStringFreeW(&pszStringBinding); + if (status) + { +// TRACE("RpcStringFree returned 0x%x\n", status); + } + + return hBinding; +} + + +void __RPC_USER +LOGONSRV_HANDLE_unbind(LOGONSRV_HANDLE pszSystemName, + handle_t hBinding) +{ + RPC_STATUS status; + + TRACE("LOGONSRV_HANDLE_unbind() called\n"); + + status = RpcBindingFree(&hBinding); + if (status) + { + TRACE("RpcBindingFree returned 0x%x\n", status); + } +} + + NTSTATUS WINAPI NetEnumerateTrustedDomains( @@ -30,14 +87,30 @@ NetEnumerateTrustedDomains( NET_API_STATUS WINAPI NetGetAnyDCName( - _In_ LPCWSTR servername, - _In_ LPCWSTR domainname, - _Out_ LPBYTE *bufptr) + _In_opt_ LPCWSTR ServerName, + _In_opt_ LPCWSTR DomainName, + _Out_ LPBYTE *BufPtr) { - FIXME("NetGetAnyDCName(%s, %s, %p)\n", - debugstr_w(servername), debugstr_w(domainname), bufptr); + NET_API_STATUS status; - return ERROR_NO_LOGON_SERVERS; + TRACE("NetGetAnyDCName(%s, %s, %p)\n", + debugstr_w(ServerName), debugstr_w(DomainName), BufPtr); + + *BufPtr = NULL; + + RpcTryExcept + { + status = NetrGetAnyDCName((PWSTR)ServerName, + (PWSTR)DomainName, + (PWSTR*)BufPtr); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; } diff --git a/reactos/sdk/include/reactos/idl/netlogon.idl b/reactos/sdk/include/reactos/idl/netlogon.idl index e595024d6ce..0ad99a24a72 100644 --- a/reactos/sdk/include/reactos/idl/netlogon.idl +++ b/reactos/sdk/include/reactos/idl/netlogon.idl @@ -978,10 +978,11 @@ cpp_quote("#endif") [ uuid(12345678-1234-ABCD-EF00-01234567CFFB), version(1.0), + pointer_default(unique), #ifdef __midl ms_union, #endif - pointer_default(unique) + endpoint("ncacn_np:[\\pipe\\netlogon]") #ifndef __midl ,implicit_handle(handle_t hBinding) #endif