ReactOS  0.4.14-dev-317-g96040ec
dssetup.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: Local Security Authority (LSA) Server
4  * FILE: reactos/dll/win32/lsasrv/dssetup.c
5  * PURPOSE: Directory Service setup functions
6  *
7  * PROGRAMMERS: Eric Kohl
8  */
9 
10 #include "lsasrv.h"
11 #include "dssetup_s.h"
12 #include "resources.h"
13 
14 VOID
15 NTAPI
17  IN PLSAPR_POLICY_INFORMATION PolicyInformation);
18 
19 /* GLOBALS *****************************************************************/
20 
21 VOID
23 {
25 
26  Status = RpcServerRegisterIf(dssetup_v0_0_s_ifspec,
27  NULL,
28  NULL);
29  if (Status != RPC_S_OK)
30  {
31  WARN("RpcServerRegisterIf() failed (Status %lx)\n", Status);
32  return;
33  }
34 }
35 
36 
37 static
41 {
44  PLSAPR_POLICY_INFORMATION PolicyInfo;
45  LSA_HANDLE PolicyHandle;
46  ULONG Size;
48 
53  &PolicyHandle);
54  if (!NT_SUCCESS(Status))
55  {
56  TRACE("LsarOpenPolicyFailed with NT status %x\n",
58  return ERROR_OUTOFMEMORY;
59  }
60 
61  Status = LsarQueryInformationPolicy(PolicyHandle,
63  &PolicyInfo);
64  LsarClose(&PolicyHandle);
65  if (!NT_SUCCESS(Status))
66  {
67  TRACE("LsarQueryInformationPolicy with NT status %x\n",
69  return ERROR_OUTOFMEMORY;
70  }
71 
73  PolicyInfo->PolicyAccountDomainInfo.DomainName.Length + sizeof(WCHAR);
74 
76  if (Buffer == NULL)
77  {
79  PolicyInfo);
80  return ERROR_OUTOFMEMORY;
81  }
82 
84  Buffer->DomainNameFlat = (LPWSTR)((LPBYTE)Buffer +
86  wcscpy(Buffer->DomainNameFlat, PolicyInfo->PolicyAccountDomainInfo.DomainName.Buffer);
87 
89  PolicyInfo);
90 
92 
93  return ERROR_SUCCESS;
94 }
95 
96 
97 static
101 {
103 
105  if (Buffer == NULL)
106  return ERROR_OUTOFMEMORY;
107 
108  Buffer->OperationState = 0;
109  Buffer->PreviousServerState = 0;
110 
112 
113  return ERROR_SUCCESS;
114 }
115 
116 
117 static
121 {
123 
125  if (Buffer == NULL)
126  return ERROR_OUTOFMEMORY;
127 
128  Buffer->OperationState = DsRoleOperationIdle;
129 
131 
132  return ERROR_SUCCESS;
133 }
134 
135 
136 DWORD
137 WINAPI
142 {
144 
145  TRACE("DsRolerGetPrimaryDomainInformation(%p, %d, %p)\n",
146  hBinding, InfoLevel, DomainInfo);
147 
148  switch (InfoLevel)
149  {
151  ret = DsRolepGetBasicInfo(DomainInfo);
152  break;
153 
154  case DsRoleUpgradeStatus:
155  ret = DsRolepGetUpdateStatus(DomainInfo);
156  break;
157 
159  ret = DsRolepGetOperationState(DomainInfo);
160  break;
161 
162  default:
164  }
165 
166  return ret;
167 }
168 
169 /* EOF */
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define IN
Definition: typedefs.h:38
RPC_UNICODE_STRING DomainName
Definition: msv1_0.h:277
#define ERROR_SUCCESS
Definition: deptool.c:10
handle_t hBinding
Definition: ctx_c.c:54
#define midl_user_allocate
Definition: rpc.h:44
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
#define WARN(fmt,...)
Definition: debug.h:111
LONG NTSTATUS
Definition: precomp.h:26
enum _DSROLE_PRIMARY_DOMAIN_INFO_LEVEL DSROLE_PRIMARY_DOMAIN_INFO_LEVEL
static NET_API_STATUS DsRolepGetOperationState(PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
Definition: dssetup.c:119
LSAPR_POLICY_ACCOUNT_DOM_INFO PolicyAccountDomainInfo
Definition: msv1_0.h:307
VOID NTAPI LsaIFree_LSAPR_POLICY_INFORMATION(IN POLICY_INFORMATION_CLASS InformationClass, IN PLSAPR_POLICY_INFORMATION PolicyInformation)
Definition: lsasrv.c:51
long RPC_STATUS
Definition: rpc.h:52
unsigned char * LPBYTE
Definition: typedefs.h:52
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
union _DSROLER_PRIMARY_DOMAIN_INFORMATION * PDSROLER_PRIMARY_DOMAIN_INFORMATION
DWORD WINAPI DsRolerGetPrimaryDomainInformation(handle_t hBinding, DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel, PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
Definition: dssetup.c:138
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
NTSTATUS WINAPI LsarQueryInformationPolicy(LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: lsarpc.c:531
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
ULONG WINAPI LsaNtStatusToWinError(IN NTSTATUS Status)
Definition: lsa.c:1129
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _DSROLER_PRIMARY_DOMAIN_INFO_BASIC DSROLER_PRIMARY_DOMAIN_INFO_BASIC
#define WINAPI
Definition: msvc.h:8
enum _POLICY_INFORMATION_CLASS POLICY_INFORMATION_CLASS
unsigned long DWORD
Definition: ntddk_ex.h:95
RPC_STATUS WINAPI RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
Definition: rpc_server.c:1123
NTSTATUS WINAPI LsarClose(LSAPR_HANDLE *ObjectHandle)
Definition: lsarpc.c:125
int ret
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned short Length
Definition: msv1_0.h:53
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
VOID DsSetupInit(VOID)
Definition: dssetup.c:22
static NET_API_STATUS DsRolepGetUpdateStatus(PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
Definition: dssetup.c:99
static NET_API_STATUS DsRolepGetBasicInfo(PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo)
Definition: dssetup.c:39
NTSTATUS WINAPI LsarOpenPolicy(LPWSTR SystemName, PLSAPR_OBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *PolicyHandle)
Definition: lsarpc.c:495
unsigned int ULONG
Definition: retypes.h:1
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1714
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define RPC_S_OK
Definition: rpcnterr.h:22
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
wchar_t * Buffer
Definition: msv1_0.h:55