Author: ekohl
Date: Mon Jun 26 22:08:37 2017
New Revision: 75212
URL:
http://svn.reactos.org/svn/reactos?rev=75212&view=rev
Log:
[NETAPI32]
- Add netlogon RPC binding code.
- Implement NetGetAnyDCName. This function calls its counterpart in the netlogon service.
Modified:
trunk/reactos/dll/win32/netapi32/CMakeLists.txt
trunk/reactos/dll/win32/netapi32/netlogon.c
trunk/reactos/sdk/include/reactos/idl/netlogon.idl
Modified: trunk/reactos/dll/win32/netapi32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/CMakeLi…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/CMakeLists.txt [iso-8859-1] Mon Jun 26 22:08:37 2017
@@ -9,6 +9,7 @@
${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 @@
${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)
Modified: trunk/reactos/dll/win32/netapi32/netlogon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netlogo…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/netlogon.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/netlogon.c [iso-8859-1] Mon Jun 26 22:08:37 2017
@@ -9,10 +9,67 @@
/* INCLUDES ******************************************************************/
#include "netapi32.h"
+#include <rpc.h>
+#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
@@ -30,14 +87,30 @@
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;
}
Modified: trunk/reactos/sdk/include/reactos/idl/netlogon.idl
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/idl/ne…
==============================================================================
--- trunk/reactos/sdk/include/reactos/idl/netlogon.idl [iso-8859-1] (original)
+++ trunk/reactos/sdk/include/reactos/idl/netlogon.idl [iso-8859-1] Mon Jun 26 22:08:37
2017
@@ -978,10 +978,11 @@
[
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