[NETAPI32] Implement parts of NetGetDCName and declare some parameters optional.

This commit is contained in:
Eric Kohl 2019-05-29 15:35:55 +02:00
parent 78600cf223
commit adceb3807e
2 changed files with 52 additions and 18 deletions

View file

@ -32,7 +32,7 @@ DsGetDcNameWithAccountA(
DWORD DWORD
WINAPI WINAPI
DsGetDcNameWithAccountW( DsGetDcNameWithAccountW(
_In_ LPCWSTR ComputerName, _In_opt_ LPCWSTR ComputerName,
_In_opt_ LPCWSTR AccountName, _In_opt_ LPCWSTR AccountName,
_In_ ULONG AccountControlBits, _In_ ULONG AccountControlBits,
_In_ LPCWSTR DomainName, _In_ LPCWSTR DomainName,
@ -713,7 +713,7 @@ NetGetAnyDCName(
_In_opt_ LPCWSTR DomainName, _In_opt_ LPCWSTR DomainName,
_Out_ LPBYTE *BufPtr) _Out_ LPBYTE *BufPtr)
{ {
NET_API_STATUS status; NET_API_STATUS Status;
TRACE("NetGetAnyDCName(%s, %s, %p)\n", TRACE("NetGetAnyDCName(%s, %s, %p)\n",
debugstr_w(ServerName), debugstr_w(DomainName), BufPtr); debugstr_w(ServerName), debugstr_w(DomainName), BufPtr);
@ -722,31 +722,65 @@ NetGetAnyDCName(
RpcTryExcept RpcTryExcept
{ {
status = NetrGetAnyDCName((PWSTR)ServerName, Status = NetrGetAnyDCName((PWSTR)ServerName,
(PWSTR)DomainName, (PWSTR)DomainName,
(PWSTR*)BufPtr); (PWSTR*)BufPtr);
} }
RpcExcept(EXCEPTION_EXECUTE_HANDLER) RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{ {
status = I_RpcMapWin32Status(RpcExceptionCode()); Status = I_RpcMapWin32Status(RpcExceptionCode());
} }
RpcEndExcept; RpcEndExcept;
return status; return Status;
} }
NET_API_STATUS NET_API_STATUS
WINAPI WINAPI
NetGetDCName( NetGetDCName(
_In_ LPCWSTR servername, _In_opt_ LPCWSTR ServerName,
_In_ LPCWSTR domainname, _In_opt_ LPCWSTR DomainName,
_Out_ LPBYTE *bufptr) _Out_ LPBYTE *BufPtr)
{ {
FIXME("NetGetDCName(%s, %s, %p)\n", PDOMAIN_CONTROLLER_INFOW pDomainControllerInfo = NULL;
debugstr_w(servername), debugstr_w(domainname), bufptr); NET_API_STATUS Status;
return NERR_DCNotFound; FIXME("NetGetDCName(%s, %s, %p)\n",
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;
}
done:
if (pDomainControllerInfo != NULL)
NetApiBufferFree(pDomainControllerInfo);
return Status;
} }

View file

@ -610,9 +610,9 @@ NetServerTransportEnum(
NET_API_STATUS NET_API_STATUS
WINAPI WINAPI
NetSessionDel( NetSessionDel(
_In_ LMSTR servername, _In_opt_ LMSTR servername,
_In_ LMSTR UncClientName, _In_opt_ LMSTR UncClientName,
_In_ LMSTR username) _In_opt_ LMSTR username)
{ {
NET_API_STATUS status; NET_API_STATUS status;
@ -638,9 +638,9 @@ NetSessionDel(
NET_API_STATUS NET_API_STATUS
WINAPI WINAPI
NetSessionEnum( NetSessionEnum(
_In_ LMSTR servername, _In_opt_ LMSTR servername,
_In_ LMSTR UncClientName, _In_opt_ LMSTR UncClientName,
_In_ LMSTR username, _In_opt_ LMSTR username,
_In_ DWORD level, _In_ DWORD level,
_Out_ LPBYTE *bufptr, _Out_ LPBYTE *bufptr,
_In_ DWORD prefmaxlen, _In_ DWORD prefmaxlen,
@ -759,7 +759,7 @@ NetSessionEnum(
NET_API_STATUS NET_API_STATUS
WINAPI WINAPI
NetSessionGetInfo( NetSessionGetInfo(
_In_ LMSTR servername, _In_opt_ LMSTR servername,
_In_ LMSTR UncClientName, _In_ LMSTR UncClientName,
_In_ LMSTR username, _In_ LMSTR username,
_In_ DWORD level, _In_ DWORD level,