mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[NETAPI32][WKSSVC] Implement NetGetJoinInformation using the workstation service
This commit is contained in:
parent
d2540090d3
commit
7908e2e41f
5 changed files with 71 additions and 26 deletions
|
@ -66,4 +66,63 @@ NetpJoinWorkgroup(
|
|||
return NERR_Success;
|
||||
}
|
||||
|
||||
|
||||
NET_API_STATUS
|
||||
NetpGetJoinInformation(
|
||||
LPWSTR *NameBuffer,
|
||||
PNETSETUP_JOIN_STATUS BufferType)
|
||||
{
|
||||
LSA_OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
PPOLICY_PRIMARY_DOMAIN_INFO PrimaryDomainInfo = NULL;
|
||||
LSA_HANDLE PolicyHandle = NULL;
|
||||
NTSTATUS Status;
|
||||
|
||||
*BufferType = NetSetupUnknownStatus;
|
||||
*NameBuffer = NULL;
|
||||
|
||||
ZeroMemory(&ObjectAttributes, sizeof(LSA_OBJECT_ATTRIBUTES));
|
||||
ObjectAttributes.Length = sizeof(LSA_OBJECT_ATTRIBUTES);
|
||||
|
||||
Status = LsaOpenPolicy(NULL,
|
||||
&ObjectAttributes,
|
||||
POLICY_VIEW_LOCAL_INFORMATION,
|
||||
&PolicyHandle);
|
||||
if (!LSA_SUCCESS(Status))
|
||||
return LsaNtStatusToWinError(Status);
|
||||
|
||||
Status = LsaQueryInformationPolicy(PolicyHandle,
|
||||
PolicyPrimaryDomainInformation,
|
||||
(PVOID*)&PrimaryDomainInfo);
|
||||
if (LSA_SUCCESS(Status))
|
||||
{
|
||||
TRACE("Sid: %p\n", PrimaryDomainInfo->Sid);
|
||||
TRACE("Name: %S\n", PrimaryDomainInfo->Name.Buffer);
|
||||
|
||||
if (PrimaryDomainInfo->Name.Length > 0)
|
||||
{
|
||||
if (PrimaryDomainInfo->Sid != NULL)
|
||||
*BufferType = NetSetupDomainName;
|
||||
else
|
||||
*BufferType = NetSetupWorkgroupName;
|
||||
|
||||
*NameBuffer = midl_user_allocate(PrimaryDomainInfo->Name.Length + sizeof(WCHAR));
|
||||
if (*NameBuffer)
|
||||
wcscpy(*NameBuffer, PrimaryDomainInfo->Name.Buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
*BufferType = NetSetupUnjoined;
|
||||
}
|
||||
|
||||
if (PrimaryDomainInfo->Sid)
|
||||
LsaFreeMemory(PrimaryDomainInfo->Sid);
|
||||
|
||||
LsaFreeMemory(PrimaryDomainInfo);
|
||||
}
|
||||
|
||||
LsaClose(PolicyHandle);
|
||||
|
||||
return LsaNtStatusToWinError(Status);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -28,6 +28,11 @@ NET_API_STATUS
|
|||
NetpJoinWorkgroup(
|
||||
_In_ LPCWSTR WorkgroupName);
|
||||
|
||||
NET_API_STATUS
|
||||
NetpGetJoinInformation(
|
||||
LPWSTR *NameBuffer,
|
||||
PNETSETUP_JOIN_STATUS BufferType);
|
||||
|
||||
|
||||
/* rpcserver.c */
|
||||
|
||||
|
|
|
@ -364,12 +364,14 @@ NetrGetJoinInformation(
|
|||
wchar_t **NameBuffer,
|
||||
PNETSETUP_JOIN_STATUS BufferType)
|
||||
{
|
||||
TRACE("NetrGetJoinInformation()\n");
|
||||
TRACE("NetrGetJoinInformation(%p %p %p)\n",
|
||||
ServerName, NameBuffer, BufferType);
|
||||
|
||||
*NameBuffer = NULL;
|
||||
*BufferType = NetSetupUnjoined;
|
||||
if (NameBuffer == NULL)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
return NERR_Success;
|
||||
return NetpGetJoinInformation(NameBuffer,
|
||||
BufferType);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -552,22 +552,3 @@ NET_API_STATUS WINAPI NetWkstaGetInfo( LMSTR servername, DWORD level,
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* NetGetJoinInformation (NETAPI32.@)
|
||||
*/
|
||||
NET_API_STATUS NET_API_FUNCTION NetGetJoinInformation(
|
||||
LPCWSTR Server,
|
||||
LPWSTR *Name,
|
||||
PNETSETUP_JOIN_STATUS type)
|
||||
{
|
||||
FIXME("Stub %s %p %p\n", wine_dbgstr_w(Server), Name, type);
|
||||
|
||||
if (Name == NULL || type == NULL)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
*Name = NULL;
|
||||
*type = NetSetupUnknownStatus;
|
||||
|
||||
return NERR_Success;
|
||||
}
|
||||
|
|
|
@ -312,7 +312,6 @@ NetEnumerateComputerNames(
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
NET_API_STATUS
|
||||
WINAPI
|
||||
NetGetJoinInformation(
|
||||
|
@ -342,7 +341,6 @@ NetGetJoinInformation(
|
|||
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
NET_API_STATUS
|
||||
|
@ -594,7 +592,7 @@ NetSetPrimaryComputerName(
|
|||
NET_API_STATUS
|
||||
WINAPI
|
||||
NetUnjoinDomain(
|
||||
_In_ LPCWSTR lpServer,
|
||||
_In_opt_ LPCWSTR lpServer,
|
||||
_In_opt_ LPCWSTR lpAccount,
|
||||
_In_opt_ LPCWSTR lpPassword,
|
||||
_In_ DWORD fUnjoinOptions)
|
||||
|
|
Loading…
Reference in a new issue