mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[WKSSVC] Implement parts of NetrJoinDomain2 to join a work group
NOTE: We can not connect to a work group yet!
This commit is contained in:
parent
e85f436a50
commit
989ee70d9d
5 changed files with 108 additions and 2 deletions
|
@ -4,6 +4,7 @@ add_rpc_files(server ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/wkssvc.idl)
|
|||
spec2def(wkssvc.dll wkssvc.spec ADD_IMPORTLIB)
|
||||
|
||||
add_library(wkssvc MODULE
|
||||
domain.c
|
||||
rpcserver.c
|
||||
wkssvc.c
|
||||
wkssvc.rc
|
||||
|
|
69
base/services/wkssvc/domain.c
Normal file
69
base/services/wkssvc/domain.c
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Services
|
||||
* FILE: base/services/wkssvc/domain.c
|
||||
* PURPOSE: Workstation service
|
||||
* PROGRAMMER: Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wkssvc);
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
static
|
||||
NET_API_STATUS
|
||||
NetpSetPrimaryDomain(
|
||||
_In_ LPCWSTR lpWorkgroupName)
|
||||
{
|
||||
LSA_OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
POLICY_PRIMARY_DOMAIN_INFO PrimaryDomainInfo;
|
||||
LSA_HANDLE PolicyHandle = NULL;
|
||||
NTSTATUS Status;
|
||||
|
||||
ZeroMemory(&ObjectAttributes, sizeof(LSA_OBJECT_ATTRIBUTES));
|
||||
ObjectAttributes.Length = sizeof(LSA_OBJECT_ATTRIBUTES);
|
||||
|
||||
Status = LsaOpenPolicy(NULL,
|
||||
&ObjectAttributes,
|
||||
POLICY_TRUST_ADMIN,
|
||||
&PolicyHandle);
|
||||
if (!LSA_SUCCESS(Status))
|
||||
return LsaNtStatusToWinError(Status);
|
||||
|
||||
RtlInitUnicodeString(&PrimaryDomainInfo.Name,
|
||||
lpWorkgroupName);
|
||||
PrimaryDomainInfo.Sid = NULL;
|
||||
|
||||
Status = LsaSetInformationPolicy(PolicyHandle,
|
||||
PolicyPrimaryDomainInformation,
|
||||
&PrimaryDomainInfo);
|
||||
|
||||
LsaClose(PolicyHandle);
|
||||
|
||||
return LsaNtStatusToWinError(Status);
|
||||
}
|
||||
|
||||
|
||||
NET_API_STATUS
|
||||
NetpJoinWorkgroup(
|
||||
_In_ LPCWSTR lpWorkgroupName)
|
||||
{
|
||||
NET_API_STATUS status;
|
||||
|
||||
FIXME("NetpJoinWorkgroup(%S)\n", lpWorkgroupName);
|
||||
|
||||
status = NetpSetPrimaryDomain(lpWorkgroupName);
|
||||
if (status != NERR_Success)
|
||||
{
|
||||
ERR("NetpSetPrimaryDomain failed (Status %lu)\n", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
return NERR_Success;
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -7,14 +7,30 @@
|
|||
#include <stdarg.h>
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winerror.h>
|
||||
#include <winreg.h>
|
||||
#include <winsvc.h>
|
||||
#include <lmcons.h>
|
||||
#include <lmerr.h>
|
||||
#include <lmjoin.h>
|
||||
#include <lmserver.h>
|
||||
#include <ntsecapi.h>
|
||||
//#include <ntstatus.h>
|
||||
#include <ndk/rtlfuncs.h>
|
||||
|
||||
#include <wkssvc_s.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
|
||||
/* domain.c */
|
||||
|
||||
NET_API_STATUS
|
||||
NetpJoinWorkgroup(
|
||||
_In_ LPCWSTR WorkgroupName);
|
||||
|
||||
|
||||
/* rpcserver.c */
|
||||
|
||||
DWORD
|
||||
WINAPI
|
||||
RpcThreadRoutine(
|
||||
|
|
|
@ -395,8 +395,26 @@ NetrJoinDomain2(
|
|||
PJOINPR_ENCRYPTED_USER_PASSWORD Password,
|
||||
unsigned long Options)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return 0;
|
||||
NET_API_STATUS status;
|
||||
|
||||
FIXME("NetrJoinDomain2(%p %S %S %S %S %p 0x%lx)\n",
|
||||
RpcBindingHandle, ServerName, DomainNameParam, MachineAccountOU,
|
||||
AccountName, Password, Options);
|
||||
|
||||
if (DomainNameParam == NULL)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if (Options & NETSETUP_JOIN_DOMAIN)
|
||||
{
|
||||
FIXME("NetrJoinDomain2: NETSETUP_JOIN_DOMAIN is not supported yet!\n");
|
||||
status = ERROR_CALL_NOT_IMPLEMENTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = NetpJoinWorkgroup(DomainNameParam);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
typedef [handle] wchar_t *WKSSVC_IDENTIFY_HANDLE;
|
||||
typedef [handle] wchar_t *WKSSVC_IMPERSONATE_HANDLE;
|
||||
|
||||
cpp_quote("#ifndef _LMJOIN_H")
|
||||
typedef enum _NETSETUP_JOIN_STATUS
|
||||
{
|
||||
NetSetupUnknownStatus = 0,
|
||||
|
@ -14,6 +15,7 @@ typedef enum _NETSETUP_JOIN_STATUS
|
|||
NetSetupWorkgroupName,
|
||||
NetSetupDomainName
|
||||
} NETSETUP_JOIN_STATUS, *PNETSETUP_JOIN_STATUS;
|
||||
cpp_quote("#endif")
|
||||
|
||||
typedef enum _NETSETUP_NAME_TYPE
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue