[NETAPI32]

- Add netlogon RPC binding code.
- Implement NetGetAnyDCName. This function calls its counterpart in the netlogon service.

svn path=/trunk/; revision=75212
This commit is contained in:
Eric Kohl 2017-06-26 22:08:37 +00:00
parent 0706d8cb47
commit 4c3c7daba6
3 changed files with 83 additions and 7 deletions

View file

@ -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)

View file

@ -9,11 +9,68 @@
/* 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
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;
}

View file

@ -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