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
7 * PROGRAMMERS: Eric Kohl
11 #include "dssetup_s.h"
12 #include "resources.h"
16 LsaIFree_LSAPR_POLICY_INFORMATION(IN POLICY_INFORMATION_CLASS InformationClass
,
17 IN PLSAPR_POLICY_INFORMATION PolicyInformation
);
19 /* GLOBALS *****************************************************************/
26 Status
= RpcServerRegisterIf(dssetup_v0_0_s_ifspec
,
29 if (Status
!= RPC_S_OK
)
31 WARN("RpcServerRegisterIf() failed (Status %lx)\n", Status
);
40 PDSROLER_PRIMARY_DOMAIN_INFORMATION
*DomainInfo
)
42 LSAPR_OBJECT_ATTRIBUTES ObjectAttributes
;
43 PDSROLER_PRIMARY_DOMAIN_INFO_BASIC Buffer
;
44 PLSAPR_POLICY_INFORMATION PolicyInfo
;
45 LSA_HANDLE PolicyHandle
;
49 ZeroMemory(&ObjectAttributes
, sizeof(ObjectAttributes
));
50 Status
= LsarOpenPolicy(NULL
,
52 POLICY_VIEW_LOCAL_INFORMATION
,
54 if (!NT_SUCCESS(Status
))
56 TRACE("LsarOpenPolicyFailed with NT status %x\n",
57 LsaNtStatusToWinError(Status
));
58 return ERROR_OUTOFMEMORY
;
61 Status
= LsarQueryInformationPolicy(PolicyHandle
,
62 PolicyAccountDomainInformation
,
64 LsarClose(PolicyHandle
);
65 if (!NT_SUCCESS(Status
))
67 TRACE("LsarQueryInformationPolicy with NT status %x\n",
68 LsaNtStatusToWinError(Status
));
69 return ERROR_OUTOFMEMORY
;
72 Size
= sizeof(DSROLER_PRIMARY_DOMAIN_INFO_BASIC
) +
73 PolicyInfo
->PolicyAccountDomainInfo
.DomainName
.Length
+ sizeof(WCHAR
);
75 Buffer
= midl_user_allocate(Size
);
78 LsaIFree_LSAPR_POLICY_INFORMATION(PolicyAccountDomainInformation
,
80 return ERROR_OUTOFMEMORY
;
83 Buffer
->MachineRole
= DsRole_RoleStandaloneWorkstation
;
84 Buffer
->DomainNameFlat
= (LPWSTR
)((LPBYTE
)Buffer
+
85 sizeof(DSROLER_PRIMARY_DOMAIN_INFO_BASIC
));
86 wcscpy(Buffer
->DomainNameFlat
, PolicyInfo
->PolicyAccountDomainInfo
.DomainName
.Buffer
);
88 LsaIFree_LSAPR_POLICY_INFORMATION(PolicyAccountDomainInformation
,
91 *DomainInfo
= (PDSROLER_PRIMARY_DOMAIN_INFORMATION
)Buffer
;
99 DsRolepGetUpdateStatus(
100 PDSROLER_PRIMARY_DOMAIN_INFORMATION
*DomainInfo
)
102 PDSROLE_UPGRADE_STATUS_INFO Buffer
;
104 Buffer
= midl_user_allocate(sizeof(DSROLE_UPGRADE_STATUS_INFO
));
106 return ERROR_OUTOFMEMORY
;
108 Buffer
->OperationState
= 0;
109 Buffer
->PreviousServerState
= 0;
111 *DomainInfo
= (PDSROLER_PRIMARY_DOMAIN_INFORMATION
)Buffer
;
113 return ERROR_SUCCESS
;
119 DsRolepGetOperationState(
120 PDSROLER_PRIMARY_DOMAIN_INFORMATION
*DomainInfo
)
122 PDSROLE_OPERATION_STATE_INFO Buffer
;
124 Buffer
= midl_user_allocate(sizeof(DSROLE_OPERATION_STATE_INFO
));
126 return ERROR_OUTOFMEMORY
;
128 Buffer
->OperationState
= DsRoleOperationIdle
;
130 *DomainInfo
= (PDSROLER_PRIMARY_DOMAIN_INFORMATION
)Buffer
;
132 return ERROR_SUCCESS
;
138 DsRolerGetPrimaryDomainInformation(
140 DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel
,
141 PDSROLER_PRIMARY_DOMAIN_INFORMATION
*DomainInfo
)
145 TRACE("DsRolerGetPrimaryDomainInformation(%p, %d, %p)\n",
146 hBinding
, InfoLevel
, DomainInfo
);
150 case DsRolePrimaryDomainInfoBasic
:
151 ret
= DsRolepGetBasicInfo(DomainInfo
);
154 case DsRoleUpgradeStatus
:
155 ret
= DsRolepGetUpdateStatus(DomainInfo
);
158 case DsRoleOperationState
:
159 ret
= DsRolepGetOperationState(DomainInfo
);
163 ret
= ERROR_CALL_NOT_IMPLEMENTED
;