https://git.reactos.org/?p=reactos.git;a=commitdiff;h=adceb3807e3c57ebb60b1…
commit adceb3807e3c57ebb60b128816a558785707fd38
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Wed May 29 15:35:55 2019 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Wed May 29 15:35:55 2019 +0200
[NETAPI32] Implement parts of NetGetDCName and declare some parameters optional.
---
dll/win32/netapi32/netlogon.c | 54 +++++++++++++++++++++++++++++++++++--------
dll/win32/netapi32/srvsvc.c | 14 +++++------
2 files changed, 51 insertions(+), 17 deletions(-)
diff --git a/dll/win32/netapi32/netlogon.c b/dll/win32/netapi32/netlogon.c
index 605b3eed7a..98dc5c7163 100644
--- a/dll/win32/netapi32/netlogon.c
+++ b/dll/win32/netapi32/netlogon.c
@@ -32,7 +32,7 @@ DsGetDcNameWithAccountA(
DWORD
WINAPI
DsGetDcNameWithAccountW(
- _In_ LPCWSTR ComputerName,
+ _In_opt_ LPCWSTR ComputerName,
_In_opt_ LPCWSTR AccountName,
_In_ ULONG AccountControlBits,
_In_ LPCWSTR DomainName,
@@ -713,7 +713,7 @@ NetGetAnyDCName(
_In_opt_ LPCWSTR DomainName,
_Out_ LPBYTE *BufPtr)
{
- NET_API_STATUS status;
+ NET_API_STATUS Status;
TRACE("NetGetAnyDCName(%s, %s, %p)\n",
debugstr_w(ServerName), debugstr_w(DomainName), BufPtr);
@@ -722,31 +722,65 @@ NetGetAnyDCName(
RpcTryExcept
{
- status = NetrGetAnyDCName((PWSTR)ServerName,
+ Status = NetrGetAnyDCName((PWSTR)ServerName,
(PWSTR)DomainName,
(PWSTR*)BufPtr);
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
- status = I_RpcMapWin32Status(RpcExceptionCode());
+ Status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
- return status;
+ return Status;
}
NET_API_STATUS
WINAPI
NetGetDCName(
- _In_ LPCWSTR servername,
- _In_ LPCWSTR domainname,
- _Out_ LPBYTE *bufptr)
+ _In_opt_ LPCWSTR ServerName,
+ _In_opt_ LPCWSTR DomainName,
+ _Out_ LPBYTE *BufPtr)
{
+ PDOMAIN_CONTROLLER_INFOW pDomainControllerInfo = NULL;
+ NET_API_STATUS Status;
+
FIXME("NetGetDCName(%s, %s, %p)\n",
- debugstr_w(servername), debugstr_w(domainname), bufptr);
+ debugstr_w(ServerName), debugstr_w(DomainName), BufPtr);
+
+ if (ServerName == NULL || *ServerName == UNICODE_NULL)
+ {
+ Status = DsGetDcNameWithAccountW(NULL,
+ NULL,
+ 0,
+ DomainName,
+ NULL,
+ NULL,
+ 0, //???
+ &pDomainControllerInfo);
+ if (Status != NERR_Success)
+ goto done;
+
+ Status =
NetApiBufferAllocate((wcslen(pDomainControllerInfo->DomainControllerName) + 1) *
sizeof(WCHAR),
+ (PVOID*)BufPtr);
+ if (Status != NERR_Success)
+ goto done;
+
+ wcscpy((PWSTR)*BufPtr,
+ pDomainControllerInfo->DomainControllerName);
+ }
+ else
+ {
+ FIXME("Not implemented yet!\n");
+ Status = NERR_DCNotFound;
+ }
- return NERR_DCNotFound;
+done:
+ if (pDomainControllerInfo != NULL)
+ NetApiBufferFree(pDomainControllerInfo);
+
+ return Status;
}
diff --git a/dll/win32/netapi32/srvsvc.c b/dll/win32/netapi32/srvsvc.c
index 680082da20..79a58fc83b 100644
--- a/dll/win32/netapi32/srvsvc.c
+++ b/dll/win32/netapi32/srvsvc.c
@@ -610,9 +610,9 @@ NetServerTransportEnum(
NET_API_STATUS
WINAPI
NetSessionDel(
- _In_ LMSTR servername,
- _In_ LMSTR UncClientName,
- _In_ LMSTR username)
+ _In_opt_ LMSTR servername,
+ _In_opt_ LMSTR UncClientName,
+ _In_opt_ LMSTR username)
{
NET_API_STATUS status;
@@ -638,9 +638,9 @@ NetSessionDel(
NET_API_STATUS
WINAPI
NetSessionEnum(
- _In_ LMSTR servername,
- _In_ LMSTR UncClientName,
- _In_ LMSTR username,
+ _In_opt_ LMSTR servername,
+ _In_opt_ LMSTR UncClientName,
+ _In_opt_ LMSTR username,
_In_ DWORD level,
_Out_ LPBYTE *bufptr,
_In_ DWORD prefmaxlen,
@@ -759,7 +759,7 @@ NetSessionEnum(
NET_API_STATUS
WINAPI
NetSessionGetInfo(
- _In_ LMSTR servername,
+ _In_opt_ LMSTR servername,
_In_ LMSTR UncClientName,
_In_ LMSTR username,
_In_ DWORD level,