67375f0156b8ace618f513487cfee8d1a81ba3bc
[reactos.git] / reactos / dll / win32 / lsasrv / lsarpc.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: Local Security Authority (LSA) Server
4 * FILE: reactos/dll/win32/lsasrv/lsarpc.h
5 * PURPOSE: RPC interface functions
6 *
7 * PROGRAMMERS: Eric Kohl
8 */
9
10 /* INCLUDES ****************************************************************/
11
12 #include "lsasrv.h"
13
14 WINE_DEFAULT_DEBUG_CHANNEL(lsasrv);
15
16
17 /* GLOBALS *****************************************************************/
18
19 static RTL_CRITICAL_SECTION PolicyHandleTableLock;
20
21
22 /* FUNCTIONS ***************************************************************/
23
24 VOID
25 LsarStartRpcServer(VOID)
26 {
27 RPC_STATUS Status;
28
29 RtlInitializeCriticalSection(&PolicyHandleTableLock);
30
31 TRACE("LsarStartRpcServer() called\n");
32
33 Status = RpcServerUseProtseqEpW(L"ncacn_np",
34 10,
35 L"\\pipe\\lsarpc",
36 NULL);
37 if (Status != RPC_S_OK)
38 {
39 WARN("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
40 return;
41 }
42
43 Status = RpcServerRegisterIf(lsarpc_v0_0_s_ifspec,
44 NULL,
45 NULL);
46 if (Status != RPC_S_OK)
47 {
48 WARN("RpcServerRegisterIf() failed (Status %lx)\n", Status);
49 return;
50 }
51
52 Status = RpcServerListen(1, 20, TRUE);
53 if (Status != RPC_S_OK)
54 {
55 WARN("RpcServerListen() failed (Status %lx)\n", Status);
56 return;
57 }
58
59 TRACE("LsarStartRpcServer() done\n");
60 }
61
62
63 void __RPC_USER LSAPR_HANDLE_rundown(LSAPR_HANDLE hHandle)
64 {
65
66 }
67
68
69 /* Function 0 */
70 NTSTATUS WINAPI LsarClose(
71 LSAPR_HANDLE *ObjectHandle)
72 {
73 PLSA_DB_OBJECT DbObject;
74 NTSTATUS Status = STATUS_SUCCESS;
75
76 TRACE("0x%p\n", ObjectHandle);
77
78 // RtlEnterCriticalSection(&PolicyHandleTableLock);
79
80 Status = LsapValidateDbObject(*ObjectHandle,
81 LsaDbIgnoreObject,
82 0,
83 &DbObject);
84 if (Status == STATUS_SUCCESS)
85 {
86 Status = LsapCloseDbObject(DbObject);
87 *ObjectHandle = NULL;
88 }
89
90 // RtlLeaveCriticalSection(&PolicyHandleTableLock);
91
92 return Status;
93 }
94
95
96 /* Function 1 */
97 NTSTATUS WINAPI LsarDelete(
98 LSAPR_HANDLE ObjectHandle)
99 {
100 /* Deprecated */
101 return STATUS_NOT_SUPPORTED;
102 }
103
104
105 /* Function 2 */
106 NTSTATUS WINAPI LsarEnumeratePrivileges(
107 LSAPR_HANDLE PolicyHandle,
108 DWORD *EnumerationContext,
109 PLSAPR_PRIVILEGE_ENUM_BUFFER EnumerationBuffer,
110 DWORD PreferedMaximumLength)
111 {
112 PLSA_DB_OBJECT PolicyObject;
113 NTSTATUS Status;
114
115 TRACE("LsarEnumeratePrivileges(%p %p %p %lu)\n",
116 PolicyHandle, EnumerationContext, EnumerationBuffer,
117 PreferedMaximumLength);
118
119 Status = LsapValidateDbObject(PolicyHandle,
120 LsaDbPolicyObject,
121 POLICY_VIEW_LOCAL_INFORMATION,
122 &PolicyObject);
123 if (!NT_SUCCESS(Status))
124 return Status;
125
126 if (EnumerationContext == NULL)
127 return STATUS_INVALID_PARAMETER;
128
129 return LsarpEnumeratePrivileges(EnumerationContext,
130 EnumerationBuffer,
131 PreferedMaximumLength);
132 }
133
134
135 /* Function 3 */
136 NTSTATUS WINAPI LsarQuerySecurityObject(
137 LSAPR_HANDLE ObjectHandle,
138 SECURITY_INFORMATION SecurityInformation,
139 PLSAPR_SR_SECURITY_DESCRIPTOR *SecurityDescriptor)
140 {
141 PLSA_DB_OBJECT DbObject = NULL;
142 PSECURITY_DESCRIPTOR RelativeSd = NULL;
143 PLSAPR_SR_SECURITY_DESCRIPTOR SdData = NULL;
144 ACCESS_MASK DesiredAccess = 0;
145 ULONG RelativeSdSize = 0;
146 NTSTATUS Status;
147
148 if (SecurityDescriptor == NULL)
149 return STATUS_INVALID_PARAMETER;
150
151 if ((SecurityInformation & OWNER_SECURITY_INFORMATION) ||
152 (SecurityInformation & GROUP_SECURITY_INFORMATION) ||
153 (SecurityInformation & DACL_SECURITY_INFORMATION))
154 DesiredAccess |= READ_CONTROL;
155
156 if (SecurityInformation & SACL_SECURITY_INFORMATION)
157 DesiredAccess |= ACCESS_SYSTEM_SECURITY;
158
159 /* Validate the ObjectHandle */
160 Status = LsapValidateDbObject(ObjectHandle,
161 LsaDbIgnoreObject,
162 DesiredAccess,
163 &DbObject);
164 if (!NT_SUCCESS(Status))
165 return Status;
166
167 /* Get the size of the SD */
168 Status = LsapGetObjectAttribute(DbObject,
169 L"SecDesc",
170 NULL,
171 &RelativeSdSize);
172 if (!NT_SUCCESS(Status))
173 return Status;
174
175 /* Allocate a buffer for the SD */
176 RelativeSd = MIDL_user_allocate(RelativeSdSize);
177 if (RelativeSd == NULL)
178 return STATUS_INSUFFICIENT_RESOURCES;
179
180 /* Get the SD */
181 Status = LsapGetObjectAttribute(DbObject,
182 L"SecDesc",
183 RelativeSd,
184 &RelativeSdSize);
185 if (!NT_SUCCESS(Status))
186 goto done;
187
188 /*
189 * FIXME: Invalidate the SD information that was not requested.
190 * (see SecurityInformation)
191 */
192
193 /* Allocate the SD data buffer */
194 SdData = MIDL_user_allocate(sizeof(LSAPR_SR_SECURITY_DESCRIPTOR));
195 if (SdData == NULL)
196 {
197 Status = STATUS_INSUFFICIENT_RESOURCES;
198 goto done;
199 }
200
201 /* Fill the SD data buffer and return it to the caller */
202 SdData->Length = RelativeSdSize;
203 SdData->SecurityDescriptor = (PBYTE)RelativeSd;
204
205 *SecurityDescriptor = SdData;
206
207 done:
208 if (!NT_SUCCESS(Status))
209 {
210 if (RelativeSd != NULL)
211 MIDL_user_free(RelativeSd);
212 }
213
214 return Status;
215 }
216
217
218 /* Function 4 */
219 NTSTATUS WINAPI LsarSetSecurityObject(
220 LSAPR_HANDLE ObjectHandle,
221 SECURITY_INFORMATION SecurityInformation,
222 PLSAPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor)
223 {
224 UNIMPLEMENTED;
225 return STATUS_NOT_IMPLEMENTED;
226 }
227
228
229 /* Function 5 */
230 NTSTATUS WINAPI LsarChangePassword(
231 handle_t IDL_handle,
232 PRPC_UNICODE_STRING String1,
233 PRPC_UNICODE_STRING String2,
234 PRPC_UNICODE_STRING String3,
235 PRPC_UNICODE_STRING String4,
236 PRPC_UNICODE_STRING String5)
237 {
238 /* Deprecated */
239 return STATUS_NOT_IMPLEMENTED;
240 }
241
242
243 /* Function 6 */
244 NTSTATUS WINAPI LsarOpenPolicy(
245 LPWSTR SystemName,
246 PLSAPR_OBJECT_ATTRIBUTES ObjectAttributes,
247 ACCESS_MASK DesiredAccess,
248 LSAPR_HANDLE *PolicyHandle)
249 {
250 PLSA_DB_OBJECT PolicyObject;
251 NTSTATUS Status;
252
253 TRACE("LsarOpenPolicy called!\n");
254
255 RtlEnterCriticalSection(&PolicyHandleTableLock);
256
257 Status = LsapOpenDbObject(NULL,
258 NULL,
259 L"Policy",
260 LsaDbPolicyObject,
261 DesiredAccess,
262 &PolicyObject);
263
264 RtlLeaveCriticalSection(&PolicyHandleTableLock);
265
266 if (NT_SUCCESS(Status))
267 *PolicyHandle = (LSAPR_HANDLE)PolicyObject;
268
269 TRACE("LsarOpenPolicy done!\n");
270
271 return Status;
272 }
273
274
275 /* Function 7 */
276 NTSTATUS WINAPI LsarQueryInformationPolicy(
277 LSAPR_HANDLE PolicyHandle,
278 POLICY_INFORMATION_CLASS InformationClass,
279 PLSAPR_POLICY_INFORMATION *PolicyInformation)
280 {
281 PLSA_DB_OBJECT PolicyObject;
282 ACCESS_MASK DesiredAccess = 0;
283 NTSTATUS Status;
284
285 TRACE("LsarQueryInformationPolicy(%p,0x%08x,%p)\n",
286 PolicyHandle, InformationClass, PolicyInformation);
287
288 if (PolicyInformation)
289 {
290 TRACE("*PolicyInformation %p\n", *PolicyInformation);
291 }
292
293 switch (InformationClass)
294 {
295 case PolicyAuditLogInformation:
296 case PolicyAuditEventsInformation:
297 case PolicyAuditFullQueryInformation:
298 DesiredAccess = POLICY_VIEW_AUDIT_INFORMATION;
299 break;
300
301 case PolicyPrimaryDomainInformation:
302 case PolicyAccountDomainInformation:
303 case PolicyLsaServerRoleInformation:
304 case PolicyReplicaSourceInformation:
305 case PolicyDefaultQuotaInformation:
306 case PolicyModificationInformation:
307 case PolicyDnsDomainInformation:
308 case PolicyDnsDomainInformationInt:
309 case PolicyLocalAccountDomainInformation:
310 DesiredAccess = POLICY_VIEW_LOCAL_INFORMATION;
311 break;
312
313 case PolicyPdAccountInformation:
314 DesiredAccess = POLICY_GET_PRIVATE_INFORMATION;
315 break;
316
317 default:
318 ERR("Invalid InformationClass!\n");
319 return STATUS_INVALID_PARAMETER;
320 }
321
322 Status = LsapValidateDbObject(PolicyHandle,
323 LsaDbPolicyObject,
324 DesiredAccess,
325 &PolicyObject);
326 if (!NT_SUCCESS(Status))
327 return Status;
328
329 switch (InformationClass)
330 {
331 case PolicyAuditLogInformation: /* 1 */
332 Status = LsarQueryAuditLog(PolicyObject,
333 PolicyInformation);
334 break;
335
336 case PolicyAuditEventsInformation: /* 2 */
337 Status = LsarQueryAuditEvents(PolicyObject,
338 PolicyInformation);
339 break;
340
341 case PolicyPrimaryDomainInformation: /* 3 */
342 Status = LsarQueryPrimaryDomain(PolicyObject,
343 PolicyInformation);
344 break;
345
346 case PolicyPdAccountInformation: /* 4 */
347 Status = LsarQueryPdAccount(PolicyObject,
348 PolicyInformation);
349 break;
350
351 case PolicyAccountDomainInformation: /* 5 */
352 Status = LsarQueryAccountDomain(PolicyObject,
353 PolicyInformation);
354 break;
355
356 case PolicyLsaServerRoleInformation: /* 6 */
357 Status = LsarQueryServerRole(PolicyObject,
358 PolicyInformation);
359 break;
360
361 case PolicyReplicaSourceInformation: /* 7 */
362 Status = LsarQueryReplicaSource(PolicyObject,
363 PolicyInformation);
364 break;
365
366 case PolicyDefaultQuotaInformation: /* 8 */
367 Status = LsarQueryDefaultQuota(PolicyObject,
368 PolicyInformation);
369 break;
370
371 case PolicyModificationInformation: /* 9 */
372 Status = LsarQueryModification(PolicyObject,
373 PolicyInformation);
374 break;
375
376 case PolicyAuditFullQueryInformation: /* 11 (0xB) */
377 Status = LsarQueryAuditFull(PolicyObject,
378 PolicyInformation);
379 break;
380
381 case PolicyDnsDomainInformation: /* 12 (0xC) */
382 Status = LsarQueryDnsDomain(PolicyObject,
383 PolicyInformation);
384 break;
385
386 case PolicyDnsDomainInformationInt: /* 13 (0xD) */
387 Status = LsarQueryDnsDomainInt(PolicyObject,
388 PolicyInformation);
389 break;
390
391 case PolicyLocalAccountDomainInformation: /* 14 (0xE) */
392 Status = LsarQueryLocalAccountDomain(PolicyObject,
393 PolicyInformation);
394 break;
395
396 default:
397 ERR("Invalid InformationClass!\n");
398 Status = STATUS_INVALID_PARAMETER;
399 }
400
401 return Status;
402 }
403
404
405 /* Function 8 */
406 NTSTATUS WINAPI LsarSetInformationPolicy(
407 LSAPR_HANDLE PolicyHandle,
408 POLICY_INFORMATION_CLASS InformationClass,
409 PLSAPR_POLICY_INFORMATION PolicyInformation)
410 {
411 PLSA_DB_OBJECT PolicyObject;
412 ACCESS_MASK DesiredAccess = 0;
413 NTSTATUS Status;
414
415 TRACE("LsarSetInformationPolicy(%p,0x%08x,%p)\n",
416 PolicyHandle, InformationClass, PolicyInformation);
417
418 if (PolicyInformation)
419 {
420 TRACE("*PolicyInformation %p\n", *PolicyInformation);
421 }
422
423 switch (InformationClass)
424 {
425 case PolicyAuditLogInformation:
426 case PolicyAuditFullSetInformation:
427 DesiredAccess = POLICY_AUDIT_LOG_ADMIN;
428 break;
429
430 case PolicyAuditEventsInformation:
431 DesiredAccess = POLICY_SET_AUDIT_REQUIREMENTS;
432 break;
433
434 case PolicyPrimaryDomainInformation:
435 case PolicyAccountDomainInformation:
436 case PolicyDnsDomainInformation:
437 case PolicyDnsDomainInformationInt:
438 case PolicyLocalAccountDomainInformation:
439 DesiredAccess = POLICY_TRUST_ADMIN;
440 break;
441
442 case PolicyLsaServerRoleInformation:
443 case PolicyReplicaSourceInformation:
444 DesiredAccess = POLICY_SERVER_ADMIN;
445 break;
446
447 case PolicyDefaultQuotaInformation:
448 DesiredAccess = POLICY_SET_DEFAULT_QUOTA_LIMITS;
449 break;
450
451 default:
452 ERR("Invalid InformationClass!\n");
453 return STATUS_INVALID_PARAMETER;
454 }
455
456 Status = LsapValidateDbObject(PolicyHandle,
457 LsaDbPolicyObject,
458 DesiredAccess,
459 &PolicyObject);
460 if (!NT_SUCCESS(Status))
461 return Status;
462
463 switch (InformationClass)
464 {
465 case PolicyAuditLogInformation: /* 1 */
466 Status = LsarSetAuditLog(PolicyObject,
467 (PPOLICY_AUDIT_LOG_INFO)PolicyInformation);
468 break;
469
470 case PolicyAuditEventsInformation: /* 2 */
471 Status = LsarSetAuditEvents(PolicyObject,
472 (PLSAPR_POLICY_AUDIT_EVENTS_INFO)PolicyInformation);
473 break;
474
475 case PolicyPrimaryDomainInformation: /* 3 */
476 Status = LsarSetPrimaryDomain(PolicyObject,
477 (PLSAPR_POLICY_PRIMARY_DOM_INFO)PolicyInformation);
478 break;
479
480 case PolicyAccountDomainInformation: /* 5 */
481 Status = LsarSetAccountDomain(PolicyObject,
482 (PLSAPR_POLICY_ACCOUNT_DOM_INFO)PolicyInformation);
483 break;
484
485 case PolicyLsaServerRoleInformation: /* 6 */
486 Status = LsarSetServerRole(PolicyObject,
487 (PPOLICY_LSA_SERVER_ROLE_INFO)PolicyInformation);
488 break;
489
490 case PolicyReplicaSourceInformation: /* 7 */
491 Status = LsarSetReplicaSource(PolicyObject,
492 (PPOLICY_LSA_REPLICA_SRCE_INFO)PolicyInformation);
493 break;
494
495 case PolicyDefaultQuotaInformation: /* 8 */
496 Status = LsarSetDefaultQuota(PolicyObject,
497 (PPOLICY_DEFAULT_QUOTA_INFO)PolicyInformation);
498 break;
499
500 case PolicyModificationInformation: /* 9 */
501 Status = LsarSetModification(PolicyObject,
502 (PPOLICY_MODIFICATION_INFO)PolicyInformation);
503 break;
504
505 case PolicyAuditFullSetInformation: /* 10 (0xA) */
506 Status = LsarSetAuditFull(PolicyObject,
507 (PPOLICY_AUDIT_FULL_QUERY_INFO)PolicyInformation);
508 break;
509
510 case PolicyDnsDomainInformation: /* 12 (0xC) */
511 Status = LsarSetDnsDomain(PolicyObject,
512 (PLSAPR_POLICY_DNS_DOMAIN_INFO)PolicyInformation);
513 break;
514
515 case PolicyDnsDomainInformationInt: /* 13 (0xD) */
516 Status = LsarSetDnsDomainInt(PolicyObject,
517 (PLSAPR_POLICY_DNS_DOMAIN_INFO)PolicyInformation);
518 break;
519
520 case PolicyLocalAccountDomainInformation: /* 14 (0xE) */
521 Status = LsarSetLocalAccountDomain(PolicyObject,
522 (PLSAPR_POLICY_ACCOUNT_DOM_INFO)PolicyInformation);
523 break;
524
525 default:
526 Status = STATUS_INVALID_PARAMETER;
527 break;
528 }
529
530 return Status;
531 }
532
533
534 /* Function 9 */
535 NTSTATUS WINAPI LsarClearAuditLog(
536 LSAPR_HANDLE ObjectHandle)
537 {
538 /* Deprecated */
539 return STATUS_NOT_IMPLEMENTED;
540 }
541
542
543 /* Function 10 */
544 NTSTATUS WINAPI LsarCreateAccount(
545 LSAPR_HANDLE PolicyHandle,
546 PRPC_SID AccountSid,
547 ACCESS_MASK DesiredAccess,
548 LSAPR_HANDLE *AccountHandle)
549 {
550 PLSA_DB_OBJECT PolicyObject;
551 PLSA_DB_OBJECT AccountObject = NULL;
552 LPWSTR SidString = NULL;
553 PSECURITY_DESCRIPTOR AccountSd = NULL;
554 ULONG AccountSdSize;
555 NTSTATUS Status = STATUS_SUCCESS;
556
557 /* Validate the AccountSid */
558 if (!RtlValidSid(AccountSid))
559 return STATUS_INVALID_PARAMETER;
560
561 /* Validate the PolicyHandle */
562 Status = LsapValidateDbObject(PolicyHandle,
563 LsaDbPolicyObject,
564 POLICY_CREATE_ACCOUNT,
565 &PolicyObject);
566 if (!NT_SUCCESS(Status))
567 {
568 ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
569 return Status;
570 }
571
572 /* Create SID string */
573 if (!ConvertSidToStringSid((PSID)AccountSid,
574 &SidString))
575 {
576 ERR("ConvertSidToStringSid failed\n");
577 Status = STATUS_INVALID_PARAMETER;
578 goto done;
579 }
580
581 /* Create a security descriptor for the account */
582 Status = LsapCreateAccountSd(&AccountSd,
583 &AccountSdSize);
584 if (!NT_SUCCESS(Status))
585 {
586 ERR("LsapCreateAccountSd returned 0x%08lx\n", Status);
587 return Status;
588 }
589
590 /* Create the Account object */
591 Status = LsapCreateDbObject(PolicyObject,
592 L"Accounts",
593 SidString,
594 LsaDbAccountObject,
595 DesiredAccess,
596 &AccountObject);
597 if (!NT_SUCCESS(Status))
598 {
599 ERR("LsapCreateDbObject failed (Status 0x%08lx)\n", Status);
600 goto done;
601 }
602
603 /* Set the Sid attribute */
604 Status = LsapSetObjectAttribute(AccountObject,
605 L"Sid",
606 (PVOID)AccountSid,
607 GetLengthSid(AccountSid));
608 if (!NT_SUCCESS(Status))
609 goto done;
610
611 /* Set the SecDesc attribute */
612 Status = LsapSetObjectAttribute(AccountObject,
613 L"SecDesc",
614 AccountSd,
615 AccountSdSize);
616
617 done:
618 if (SidString != NULL)
619 LocalFree(SidString);
620
621 if (AccountSd != NULL)
622 RtlFreeHeap(RtlGetProcessHeap(), 0, AccountSd);
623
624 if (!NT_SUCCESS(Status))
625 {
626 if (AccountObject != NULL)
627 LsapCloseDbObject(AccountObject);
628 }
629 else
630 {
631 *AccountHandle = (LSAPR_HANDLE)AccountObject;
632 }
633
634 return STATUS_SUCCESS;
635 }
636
637
638 /* Function 11 */
639 NTSTATUS WINAPI LsarEnumerateAccounts(
640 LSAPR_HANDLE PolicyHandle,
641 DWORD *EnumerationContext,
642 PLSAPR_ACCOUNT_ENUM_BUFFER EnumerationBuffer,
643 DWORD PreferedMaximumLength)
644 {
645 LSAPR_ACCOUNT_ENUM_BUFFER EnumBuffer = {0, NULL};
646 PLSA_DB_OBJECT PolicyObject = NULL;
647 WCHAR AccountKeyName[64];
648 HANDLE AccountsKeyHandle = NULL;
649 HANDLE AccountKeyHandle;
650 HANDLE SidKeyHandle;
651 ULONG EnumIndex;
652 ULONG EnumCount;
653 ULONG RequiredLength;
654 ULONG DataLength;
655 ULONG i;
656 NTSTATUS Status = STATUS_SUCCESS;
657
658 TRACE("(%p %p %p %lu)\n", PolicyHandle, EnumerationContext,
659 EnumerationBuffer, PreferedMaximumLength);
660
661 if (EnumerationContext == NULL ||
662 EnumerationBuffer == NULL)
663 return STATUS_INVALID_PARAMETER;
664
665 EnumerationBuffer->EntriesRead = 0;
666 EnumerationBuffer->Information = NULL;
667
668 /* Validate the PolicyHandle */
669 Status = LsapValidateDbObject(PolicyHandle,
670 LsaDbPolicyObject,
671 POLICY_VIEW_LOCAL_INFORMATION,
672 &PolicyObject);
673 if (!NT_SUCCESS(Status))
674 {
675 ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
676 return Status;
677 }
678
679 Status = LsapRegOpenKey(PolicyObject->KeyHandle,
680 L"Accounts",
681 KEY_READ,
682 &AccountsKeyHandle);
683 if (!NT_SUCCESS(Status))
684 return Status;
685
686 EnumIndex = *EnumerationContext;
687 EnumCount = 0;
688 RequiredLength = 0;
689
690 while (TRUE)
691 {
692 Status = LsapRegEnumerateSubKey(AccountsKeyHandle,
693 EnumIndex,
694 64 * sizeof(WCHAR),
695 AccountKeyName);
696 if (!NT_SUCCESS(Status))
697 break;
698
699 TRACE("EnumIndex: %lu\n", EnumIndex);
700 TRACE("Account key name: %S\n", AccountKeyName);
701
702 Status = LsapRegOpenKey(AccountsKeyHandle,
703 AccountKeyName,
704 KEY_READ,
705 &AccountKeyHandle);
706 TRACE("LsapRegOpenKey returned %08lX\n", Status);
707 if (NT_SUCCESS(Status))
708 {
709 Status = LsapRegOpenKey(AccountKeyHandle,
710 L"Sid",
711 KEY_READ,
712 &SidKeyHandle);
713 TRACE("LsapRegOpenKey returned %08lX\n", Status);
714 if (NT_SUCCESS(Status))
715 {
716 DataLength = 0;
717 Status = LsapRegQueryValue(SidKeyHandle,
718 NULL,
719 NULL,
720 NULL,
721 &DataLength);
722 TRACE("LsapRegQueryValue returned %08lX\n", Status);
723 if (NT_SUCCESS(Status))
724 {
725 TRACE("Data length: %lu\n", DataLength);
726
727 if ((RequiredLength + DataLength + sizeof(LSAPR_ACCOUNT_INFORMATION)) > PreferedMaximumLength)
728 break;
729
730 RequiredLength += (DataLength + sizeof(LSAPR_ACCOUNT_INFORMATION));
731 EnumCount++;
732 }
733
734 LsapRegCloseKey(SidKeyHandle);
735 }
736
737 LsapRegCloseKey(AccountKeyHandle);
738 }
739
740 EnumIndex++;
741 }
742
743 TRACE("EnumCount: %lu\n", EnumCount);
744 TRACE("RequiredLength: %lu\n", RequiredLength);
745
746 EnumBuffer.EntriesRead = EnumCount;
747 EnumBuffer.Information = midl_user_allocate(EnumCount * sizeof(LSAPR_ACCOUNT_INFORMATION));
748 if (EnumBuffer.Information == NULL)
749 {
750 Status = STATUS_INSUFFICIENT_RESOURCES;
751 goto done;
752 }
753
754 EnumIndex = *EnumerationContext;
755 for (i = 0; i < EnumCount; i++, EnumIndex++)
756 {
757 Status = LsapRegEnumerateSubKey(AccountsKeyHandle,
758 EnumIndex,
759 64 * sizeof(WCHAR),
760 AccountKeyName);
761 if (!NT_SUCCESS(Status))
762 break;
763
764 TRACE("EnumIndex: %lu\n", EnumIndex);
765 TRACE("Account key name: %S\n", AccountKeyName);
766
767 Status = LsapRegOpenKey(AccountsKeyHandle,
768 AccountKeyName,
769 KEY_READ,
770 &AccountKeyHandle);
771 TRACE("LsapRegOpenKey returned %08lX\n", Status);
772 if (NT_SUCCESS(Status))
773 {
774 Status = LsapRegOpenKey(AccountKeyHandle,
775 L"Sid",
776 KEY_READ,
777 &SidKeyHandle);
778 TRACE("LsapRegOpenKey returned %08lX\n", Status);
779 if (NT_SUCCESS(Status))
780 {
781 DataLength = 0;
782 Status = LsapRegQueryValue(SidKeyHandle,
783 NULL,
784 NULL,
785 NULL,
786 &DataLength);
787 TRACE("LsapRegQueryValue returned %08lX\n", Status);
788 if (NT_SUCCESS(Status))
789 {
790 EnumBuffer.Information[i].Sid = midl_user_allocate(DataLength);
791 if (EnumBuffer.Information[i].Sid == NULL)
792 {
793 LsapRegCloseKey(AccountKeyHandle);
794 Status = STATUS_INSUFFICIENT_RESOURCES;
795 goto done;
796 }
797
798 Status = LsapRegQueryValue(SidKeyHandle,
799 NULL,
800 NULL,
801 EnumBuffer.Information[i].Sid,
802 &DataLength);
803 TRACE("SampRegQueryValue returned %08lX\n", Status);
804 }
805
806 LsapRegCloseKey(SidKeyHandle);
807 }
808
809 LsapRegCloseKey(AccountKeyHandle);
810
811 if (!NT_SUCCESS(Status))
812 goto done;
813 }
814 }
815
816 if (NT_SUCCESS(Status))
817 {
818 *EnumerationContext += EnumCount;
819 EnumerationBuffer->EntriesRead = EnumBuffer.EntriesRead;
820 EnumerationBuffer->Information = EnumBuffer.Information;
821 }
822
823 done:
824 if (!NT_SUCCESS(Status))
825 {
826 if (EnumBuffer.Information)
827 {
828 for (i = 0; i < EnumBuffer.EntriesRead; i++)
829 {
830 if (EnumBuffer.Information[i].Sid != NULL)
831 midl_user_free(EnumBuffer.Information[i].Sid);
832 }
833
834 midl_user_free(EnumBuffer.Information);
835 }
836 }
837
838 if (AccountsKeyHandle != NULL)
839 LsapRegCloseKey(AccountsKeyHandle);
840
841 return Status;
842 }
843
844
845 /* Function 12 */
846 NTSTATUS WINAPI LsarCreateTrustedDomain(
847 LSAPR_HANDLE PolicyHandle,
848 PLSAPR_TRUST_INFORMATION TrustedDomainInformation,
849 ACCESS_MASK DesiredAccess,
850 LSAPR_HANDLE *TrustedDomainHandle)
851 {
852 UNIMPLEMENTED;
853 return STATUS_NOT_IMPLEMENTED;
854 }
855
856
857 /* Function 13 */
858 NTSTATUS WINAPI LsarEnumerateTrustedDomains(
859 LSAPR_HANDLE PolicyHandle,
860 DWORD *EnumerationContext,
861 PLSAPR_TRUSTED_ENUM_BUFFER EnumerationBuffer,
862 DWORD PreferedMaximumLength)
863 {
864 UNIMPLEMENTED;
865 return STATUS_NOT_IMPLEMENTED;
866 }
867
868
869 /* Function 14 */
870 NTSTATUS WINAPI LsarLookupNames(
871 LSAPR_HANDLE PolicyHandle,
872 DWORD Count,
873 PRPC_UNICODE_STRING Names,
874 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
875 PLSAPR_TRANSLATED_SIDS TranslatedSids,
876 LSAP_LOOKUP_LEVEL LookupLevel,
877 DWORD *MappedCount)
878 {
879 LSAPR_TRANSLATED_SIDS_EX2 TranslatedSidsEx2;
880 ULONG i;
881 NTSTATUS Status;
882
883 TRACE("(%p %lu %p %p %p %d %p)\n",
884 PolicyHandle, Count, Names, ReferencedDomains, TranslatedSids,
885 LookupLevel, MappedCount);
886
887 TranslatedSids->Entries = 0;
888 TranslatedSids->Sids = NULL;
889 *ReferencedDomains = NULL;
890
891 if (Count == 0)
892 return STATUS_NONE_MAPPED;
893
894 TranslatedSidsEx2.Entries = 0;
895 TranslatedSidsEx2.Sids = NULL;
896
897 Status = LsapLookupNames(Count,
898 Names,
899 ReferencedDomains,
900 &TranslatedSidsEx2,
901 LookupLevel,
902 MappedCount,
903 0,
904 0);
905 if (!NT_SUCCESS(Status))
906 return Status;
907
908 TranslatedSids->Entries = TranslatedSidsEx2.Entries;
909 TranslatedSids->Sids = MIDL_user_allocate(TranslatedSids->Entries * sizeof(LSA_TRANSLATED_SID));
910 if (TranslatedSids->Sids == NULL)
911 {
912 MIDL_user_free(TranslatedSidsEx2.Sids);
913 MIDL_user_free(*ReferencedDomains);
914 *ReferencedDomains = NULL;
915 return STATUS_INSUFFICIENT_RESOURCES;
916 }
917
918 for (i = 0; i < TranslatedSidsEx2.Entries; i++)
919 {
920 TranslatedSids->Sids[i].Use = TranslatedSidsEx2.Sids[i].Use;
921 TranslatedSids->Sids[i].RelativeId = LsapGetRelativeIdFromSid(TranslatedSidsEx2.Sids[i].Sid);
922 TranslatedSids->Sids[i].DomainIndex = TranslatedSidsEx2.Sids[i].DomainIndex;
923 }
924
925 MIDL_user_free(TranslatedSidsEx2.Sids);
926
927 return STATUS_SUCCESS;
928 }
929
930
931 /* Function 15 */
932 NTSTATUS WINAPI LsarLookupSids(
933 LSAPR_HANDLE PolicyHandle,
934 PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
935 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
936 PLSAPR_TRANSLATED_NAMES TranslatedNames,
937 LSAP_LOOKUP_LEVEL LookupLevel,
938 DWORD *MappedCount)
939 {
940 LSAPR_TRANSLATED_NAMES_EX TranslatedNamesEx;
941 ULONG i;
942 NTSTATUS Status;
943
944 TRACE("(%p %p %p %p %d %p)\n",
945 PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
946 LookupLevel, MappedCount);
947
948 /* FIXME: Fail, if there is an invalid SID in the SidEnumBuffer */
949
950 TranslatedNames->Entries = SidEnumBuffer->Entries;
951 TranslatedNames->Names = NULL;
952 *ReferencedDomains = NULL;
953
954 TranslatedNamesEx.Entries = SidEnumBuffer->Entries;
955 TranslatedNamesEx.Names = NULL;
956
957 Status = LsapLookupSids(SidEnumBuffer,
958 ReferencedDomains,
959 &TranslatedNamesEx,
960 LookupLevel,
961 MappedCount,
962 0,
963 0);
964 if (!NT_SUCCESS(Status))
965 return Status;
966
967 TranslatedNames->Entries = SidEnumBuffer->Entries;
968 TranslatedNames->Names = MIDL_user_allocate(SidEnumBuffer->Entries * sizeof(LSAPR_TRANSLATED_NAME));
969 if (TranslatedNames->Names == NULL)
970 {
971 MIDL_user_free(TranslatedNamesEx.Names);
972 MIDL_user_free(*ReferencedDomains);
973 *ReferencedDomains = NULL;
974 return STATUS_INSUFFICIENT_RESOURCES;
975 }
976
977 for (i = 0; i < TranslatedNamesEx.Entries; i++)
978 {
979 TranslatedNames->Names[i].Use = TranslatedNamesEx.Names[i].Use;
980 TranslatedNames->Names[i].Name.Length = TranslatedNamesEx.Names[i].Name.Length;
981 TranslatedNames->Names[i].Name.MaximumLength = TranslatedNamesEx.Names[i].Name.MaximumLength;
982 TranslatedNames->Names[i].Name.Buffer = TranslatedNamesEx.Names[i].Name.Buffer;
983 TranslatedNames->Names[i].DomainIndex = TranslatedNamesEx.Names[i].DomainIndex;
984 }
985
986 MIDL_user_free(TranslatedNamesEx.Names);
987
988 return Status;
989 }
990
991
992 /* Function 16 */
993 NTSTATUS WINAPI LsarCreateSecret(
994 LSAPR_HANDLE PolicyHandle,
995 PRPC_UNICODE_STRING SecretName,
996 ACCESS_MASK DesiredAccess,
997 LSAPR_HANDLE *SecretHandle)
998 {
999 PLSA_DB_OBJECT PolicyObject;
1000 PLSA_DB_OBJECT SecretObject = NULL;
1001 LARGE_INTEGER Time;
1002 PSECURITY_DESCRIPTOR SecretSd = NULL;
1003 ULONG SecretSdSize;
1004 NTSTATUS Status = STATUS_SUCCESS;
1005
1006 /* Validate the PolicyHandle */
1007 Status = LsapValidateDbObject(PolicyHandle,
1008 LsaDbPolicyObject,
1009 POLICY_CREATE_SECRET,
1010 &PolicyObject);
1011 if (!NT_SUCCESS(Status))
1012 {
1013 ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
1014 return Status;
1015 }
1016
1017 /* Get the current time */
1018 Status = NtQuerySystemTime(&Time);
1019 if (!NT_SUCCESS(Status))
1020 {
1021 ERR("NtQuerySystemTime failed (Status 0x%08lx)\n", Status);
1022 goto done;
1023 }
1024
1025 /* Create a security descriptor for the secret */
1026 Status = LsapCreateSecretSd(&SecretSd,
1027 &SecretSdSize);
1028 if (!NT_SUCCESS(Status))
1029 {
1030 ERR("LsapCreateAccountSd returned 0x%08lx\n", Status);
1031 return Status;
1032 }
1033
1034 /* Create the Secret object */
1035 Status = LsapCreateDbObject(PolicyObject,
1036 L"Secrets",
1037 SecretName->Buffer,
1038 LsaDbSecretObject,
1039 DesiredAccess,
1040 &SecretObject);
1041 if (!NT_SUCCESS(Status))
1042 {
1043 ERR("LsapCreateDbObject failed (Status 0x%08lx)\n", Status);
1044 goto done;
1045 }
1046
1047 /* Set the CurrentTime attribute */
1048 Status = LsapSetObjectAttribute(SecretObject,
1049 L"CurrentTime",
1050 (PVOID)&Time,
1051 sizeof(LARGE_INTEGER));
1052 if (!NT_SUCCESS(Status))
1053 {
1054 ERR("LsapSetObjectAttribute (CurrentTime) failed (Status 0x%08lx)\n", Status);
1055 goto done;
1056 }
1057
1058 /* Set the OldTime attribute */
1059 Status = LsapSetObjectAttribute(SecretObject,
1060 L"OldTime",
1061 (PVOID)&Time,
1062 sizeof(LARGE_INTEGER));
1063 if (!NT_SUCCESS(Status))
1064 {
1065 ERR("LsapSetObjectAttribute (OldTime) failed (Status 0x%08lx)\n", Status);
1066 goto done;
1067 }
1068
1069 /* Set the SecDesc attribute */
1070 Status = LsapSetObjectAttribute(SecretObject,
1071 L"SecDesc",
1072 SecretSd,
1073 SecretSdSize);
1074
1075 done:
1076 if (SecretSd != NULL)
1077 RtlFreeHeap(RtlGetProcessHeap(), 0, SecretSd);
1078
1079 if (!NT_SUCCESS(Status))
1080 {
1081 if (SecretObject != NULL)
1082 LsapCloseDbObject(SecretObject);
1083 }
1084 else
1085 {
1086 *SecretHandle = (LSAPR_HANDLE)SecretObject;
1087 }
1088
1089 return STATUS_SUCCESS;
1090 }
1091
1092
1093 /* Function 17 */
1094 NTSTATUS WINAPI LsarOpenAccount(
1095 LSAPR_HANDLE PolicyHandle,
1096 PRPC_SID AccountSid,
1097 ACCESS_MASK DesiredAccess,
1098 LSAPR_HANDLE *AccountHandle)
1099 {
1100 PLSA_DB_OBJECT PolicyObject;
1101 PLSA_DB_OBJECT AccountObject = NULL;
1102 LPWSTR SidString = NULL;
1103 NTSTATUS Status = STATUS_SUCCESS;
1104
1105 /* Validate the AccountSid */
1106 if (!RtlValidSid(AccountSid))
1107 return STATUS_INVALID_PARAMETER;
1108
1109 /* Validate the PolicyHandle */
1110 Status = LsapValidateDbObject(PolicyHandle,
1111 LsaDbPolicyObject,
1112 0,
1113 &PolicyObject);
1114 if (!NT_SUCCESS(Status))
1115 {
1116 ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
1117 return Status;
1118 }
1119
1120 /* Create SID string */
1121 if (!ConvertSidToStringSid((PSID)AccountSid,
1122 &SidString))
1123 {
1124 ERR("ConvertSidToStringSid failed\n");
1125 Status = STATUS_INVALID_PARAMETER;
1126 goto done;
1127 }
1128
1129 /* Create the Account object */
1130 Status = LsapOpenDbObject(PolicyObject,
1131 L"Accounts",
1132 SidString,
1133 LsaDbAccountObject,
1134 DesiredAccess,
1135 &AccountObject);
1136 if (!NT_SUCCESS(Status))
1137 {
1138 ERR("LsapOpenDbObject failed (Status 0x%08lx)\n", Status);
1139 goto done;
1140 }
1141
1142 /* Set the Sid attribute */
1143 Status = LsapSetObjectAttribute(AccountObject,
1144 L"Sid",
1145 (PVOID)AccountSid,
1146 GetLengthSid(AccountSid));
1147
1148 done:
1149 if (SidString != NULL)
1150 LocalFree(SidString);
1151
1152 if (!NT_SUCCESS(Status))
1153 {
1154 if (AccountObject != NULL)
1155 LsapCloseDbObject(AccountObject);
1156 }
1157 else
1158 {
1159 *AccountHandle = (LSAPR_HANDLE)AccountObject;
1160 }
1161
1162 return Status;
1163 }
1164
1165
1166 /* Function 18 */
1167 NTSTATUS WINAPI LsarEnumeratePrivilegesAccount(
1168 LSAPR_HANDLE AccountHandle,
1169 PLSAPR_PRIVILEGE_SET *Privileges)
1170 {
1171 PLSA_DB_OBJECT AccountObject;
1172 ULONG PrivilegeSetSize = 0;
1173 PLSAPR_PRIVILEGE_SET PrivilegeSet = NULL;
1174 NTSTATUS Status;
1175
1176 *Privileges = NULL;
1177
1178 /* Validate the AccountHandle */
1179 Status = LsapValidateDbObject(AccountHandle,
1180 LsaDbAccountObject,
1181 ACCOUNT_VIEW,
1182 &AccountObject);
1183 if (!NT_SUCCESS(Status))
1184 {
1185 ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
1186 return Status;
1187 }
1188
1189 /* Get the size of the privilege set */
1190 Status = LsapGetObjectAttribute(AccountObject,
1191 L"Privilgs",
1192 NULL,
1193 &PrivilegeSetSize);
1194 if (!NT_SUCCESS(Status))
1195 return Status;
1196
1197 /* Allocate a buffer for the privilege set */
1198 PrivilegeSet = MIDL_user_allocate(PrivilegeSetSize);
1199 if (PrivilegeSet == NULL)
1200 return STATUS_NO_MEMORY;
1201
1202 /* Get the privilege set */
1203 Status = LsapGetObjectAttribute(AccountObject,
1204 L"Privilgs",
1205 PrivilegeSet,
1206 &PrivilegeSetSize);
1207 if (!NT_SUCCESS(Status))
1208 {
1209 MIDL_user_free(PrivilegeSet);
1210 return Status;
1211 }
1212
1213 /* Return a pointer to the privilege set */
1214 *Privileges = PrivilegeSet;
1215
1216 return STATUS_SUCCESS;
1217 }
1218
1219
1220 /* Function 19 */
1221 NTSTATUS WINAPI LsarAddPrivilegesToAccount(
1222 LSAPR_HANDLE AccountHandle,
1223 PLSAPR_PRIVILEGE_SET Privileges)
1224 {
1225 PLSA_DB_OBJECT AccountObject;
1226 PPRIVILEGE_SET CurrentPrivileges = NULL;
1227 PPRIVILEGE_SET NewPrivileges = NULL;
1228 ULONG PrivilegeSetSize = 0;
1229 ULONG PrivilegeCount;
1230 ULONG i, j;
1231 BOOL bFound;
1232 NTSTATUS Status;
1233
1234 /* Validate the AccountHandle */
1235 Status = LsapValidateDbObject(AccountHandle,
1236 LsaDbAccountObject,
1237 ACCOUNT_ADJUST_PRIVILEGES,
1238 &AccountObject);
1239 if (!NT_SUCCESS(Status))
1240 {
1241 ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
1242 return Status;
1243 }
1244
1245 Status = LsapGetObjectAttribute(AccountObject,
1246 L"Privilgs",
1247 NULL,
1248 &PrivilegeSetSize);
1249 if (!NT_SUCCESS(Status) || PrivilegeSetSize == 0)
1250 {
1251 /* The Privilgs attribute does not exist */
1252
1253 PrivilegeSetSize = sizeof(PRIVILEGE_SET) +
1254 (Privileges->PrivilegeCount - 1) * sizeof(LUID_AND_ATTRIBUTES);
1255 Status = LsapSetObjectAttribute(AccountObject,
1256 L"Privilgs",
1257 Privileges,
1258 PrivilegeSetSize);
1259 }
1260 else
1261 {
1262 /* The Privilgs attribute exists */
1263
1264 /* Allocate memory for the stored privilege set */
1265 CurrentPrivileges = MIDL_user_allocate(PrivilegeSetSize);
1266 if (CurrentPrivileges == NULL)
1267 return STATUS_NO_MEMORY;
1268
1269 /* Get the current privilege set */
1270 Status = LsapGetObjectAttribute(AccountObject,
1271 L"Privilgs",
1272 CurrentPrivileges,
1273 &PrivilegeSetSize);
1274 if (!NT_SUCCESS(Status))
1275 {
1276 TRACE("LsapGetObjectAttribute() failed (Status 0x%08lx)\n", Status);
1277 goto done;
1278 }
1279
1280 PrivilegeCount = CurrentPrivileges->PrivilegeCount;
1281 TRACE("Current privilege count: %lu\n", PrivilegeCount);
1282
1283 /* Calculate the number privileges in the combined privilege set */
1284 for (i = 0; i < Privileges->PrivilegeCount; i++)
1285 {
1286 bFound = FALSE;
1287 for (j = 0; j < CurrentPrivileges->PrivilegeCount; j++)
1288 {
1289 if (RtlEqualLuid(&(Privileges->Privilege[i].Luid),
1290 &(CurrentPrivileges->Privilege[i].Luid)))
1291 {
1292 bFound = TRUE;
1293 break;
1294 }
1295 }
1296
1297 if (bFound == FALSE)
1298 {
1299 TRACE("Found new privilege\n");
1300 PrivilegeCount++;
1301 }
1302 }
1303 TRACE("New privilege count: %lu\n", PrivilegeCount);
1304
1305 /* Calculate the size of the new privilege set and allocate it */
1306 PrivilegeSetSize = sizeof(PRIVILEGE_SET) +
1307 (PrivilegeCount - 1) * sizeof(LUID_AND_ATTRIBUTES);
1308 NewPrivileges = MIDL_user_allocate(PrivilegeSetSize);
1309 if (NewPrivileges == NULL)
1310 {
1311 Status = STATUS_NO_MEMORY;
1312 goto done;
1313 }
1314
1315 /* Initialize the new privilege set */
1316 NewPrivileges->PrivilegeCount = PrivilegeCount;
1317 NewPrivileges->Control = 0;
1318
1319 /* Copy all privileges from the current privilege set */
1320 RtlCopyLuidAndAttributesArray(CurrentPrivileges->PrivilegeCount,
1321 &(CurrentPrivileges->Privilege[0]),
1322 &(NewPrivileges->Privilege[0]));
1323
1324 /* Add new privileges to the new privilege set */
1325 PrivilegeCount = CurrentPrivileges->PrivilegeCount;
1326 for (i = 0; i < Privileges->PrivilegeCount; i++)
1327 {
1328 bFound = FALSE;
1329 for (j = 0; j < CurrentPrivileges->PrivilegeCount; j++)
1330 {
1331 if (RtlEqualLuid(&(Privileges->Privilege[i].Luid),
1332 &(CurrentPrivileges->Privilege[i].Luid)))
1333 {
1334 /* Overwrite attributes if a matching privilege was found */
1335 NewPrivileges->Privilege[j].Attributes = Privileges->Privilege[i].Attributes;
1336
1337 bFound = TRUE;
1338 break;
1339 }
1340 }
1341
1342 if (bFound == FALSE)
1343 {
1344 /* Copy the new privilege */
1345 RtlCopyLuidAndAttributesArray(1,
1346 (PLUID_AND_ATTRIBUTES)&(Privileges->Privilege[i]),
1347 &(NewPrivileges->Privilege[PrivilegeCount]));
1348 PrivilegeCount++;
1349 }
1350 }
1351
1352 /* Set the new priivliege set */
1353 Status = LsapSetObjectAttribute(AccountObject,
1354 L"Privilgs",
1355 NewPrivileges,
1356 PrivilegeSetSize);
1357 }
1358
1359 done:
1360 if (CurrentPrivileges != NULL)
1361 MIDL_user_free(CurrentPrivileges);
1362
1363 if (NewPrivileges != NULL)
1364 MIDL_user_free(NewPrivileges);
1365
1366 return Status;
1367 }
1368
1369
1370 /* Function 20 */
1371 NTSTATUS WINAPI LsarRemovePrivilegesFromAccount(
1372 LSAPR_HANDLE AccountHandle,
1373 BOOL AllPrivileges,
1374 PLSAPR_PRIVILEGE_SET Privileges)
1375 {
1376 UNIMPLEMENTED;
1377 return STATUS_NOT_IMPLEMENTED;
1378 }
1379
1380
1381 /* Function 21 */
1382 NTSTATUS WINAPI LsarGetQuotasForAccount(
1383 LSAPR_HANDLE AccountHandle,
1384 PQUOTA_LIMITS QuotaLimits)
1385 {
1386 PLSA_DB_OBJECT AccountObject;
1387 ULONG Size;
1388 NTSTATUS Status;
1389
1390 TRACE("(%p %p)\n", AccountHandle, QuotaLimits);
1391
1392 /* Validate the account handle */
1393 Status = LsapValidateDbObject(AccountHandle,
1394 LsaDbAccountObject,
1395 ACCOUNT_VIEW,
1396 &AccountObject);
1397 if (!NT_SUCCESS(Status))
1398 {
1399 ERR("Invalid handle (Status %lx)\n", Status);
1400 return Status;
1401 }
1402
1403 /* Get the quota attribute */
1404 Status = LsapGetObjectAttribute(AccountObject,
1405 L"DefQuota",
1406 QuotaLimits,
1407 &Size);
1408
1409 return Status;
1410 }
1411
1412
1413 /* Function 22 */
1414 NTSTATUS WINAPI LsarSetQuotasForAccount(
1415 LSAPR_HANDLE AccountHandle,
1416 PQUOTA_LIMITS QuotaLimits)
1417 {
1418 PLSA_DB_OBJECT AccountObject;
1419 QUOTA_LIMITS InternalQuotaLimits;
1420 ULONG Size;
1421 NTSTATUS Status;
1422
1423 TRACE("(%p %p)\n", AccountHandle, QuotaLimits);
1424
1425 /* Validate the account handle */
1426 Status = LsapValidateDbObject(AccountHandle,
1427 LsaDbAccountObject,
1428 ACCOUNT_ADJUST_QUOTAS,
1429 &AccountObject);
1430 if (!NT_SUCCESS(Status))
1431 {
1432 ERR("Invalid handle (Status %lx)\n", Status);
1433 return Status;
1434 }
1435
1436 /* Get the quota limits attribute */
1437 Size = sizeof(QUOTA_LIMITS);
1438 Status = LsapGetObjectAttribute(AccountObject,
1439 L"DefQuota",
1440 &InternalQuotaLimits,
1441 &Size);
1442 if (!NT_SUCCESS(Status))
1443 {
1444 TRACE("LsapGetObjectAttribute() failed (Status 0x%08lx)\n", Status);
1445 return Status;
1446 }
1447
1448 /* Update the quota limits */
1449 if (QuotaLimits->PagedPoolLimit != 0)
1450 InternalQuotaLimits.PagedPoolLimit = QuotaLimits->PagedPoolLimit;
1451
1452 if (QuotaLimits->NonPagedPoolLimit != 0)
1453 InternalQuotaLimits.NonPagedPoolLimit = QuotaLimits->NonPagedPoolLimit;
1454
1455 if (QuotaLimits->MinimumWorkingSetSize != 0)
1456 InternalQuotaLimits.MinimumWorkingSetSize = QuotaLimits->MinimumWorkingSetSize;
1457
1458 if (QuotaLimits->MaximumWorkingSetSize != 0)
1459 InternalQuotaLimits.MaximumWorkingSetSize = QuotaLimits->MaximumWorkingSetSize;
1460
1461 if (QuotaLimits->PagefileLimit != 0)
1462 InternalQuotaLimits.PagefileLimit = QuotaLimits->PagefileLimit;
1463
1464 /* Set the quota limits attribute */
1465 Status = LsapSetObjectAttribute(AccountObject,
1466 L"DefQuota",
1467 &InternalQuotaLimits,
1468 sizeof(QUOTA_LIMITS));
1469
1470 return Status;
1471 }
1472
1473
1474 /* Function 23 */
1475 NTSTATUS WINAPI LsarGetSystemAccessAccount(
1476 LSAPR_HANDLE AccountHandle,
1477 ACCESS_MASK *SystemAccess)
1478 {
1479 PLSA_DB_OBJECT AccountObject;
1480 ULONG Size;
1481 NTSTATUS Status;
1482
1483 /* Validate the account handle */
1484 Status = LsapValidateDbObject(AccountHandle,
1485 LsaDbAccountObject,
1486 ACCOUNT_VIEW,
1487 &AccountObject);
1488 if (!NT_SUCCESS(Status))
1489 {
1490 ERR("Invalid handle (Status %lx)\n", Status);
1491 return Status;
1492 }
1493
1494 /* Get the system access flags */
1495 Status = LsapGetObjectAttribute(AccountObject,
1496 L"ActSysAc",
1497 SystemAccess,
1498 &Size);
1499
1500 return Status;
1501 }
1502
1503
1504 /* Function 24 */
1505 NTSTATUS WINAPI LsarSetSystemAccessAccount(
1506 LSAPR_HANDLE AccountHandle,
1507 ACCESS_MASK SystemAccess)
1508 {
1509 PLSA_DB_OBJECT AccountObject;
1510 NTSTATUS Status;
1511
1512 /* Validate the account handle */
1513 Status = LsapValidateDbObject(AccountHandle,
1514 LsaDbAccountObject,
1515 ACCOUNT_ADJUST_SYSTEM_ACCESS,
1516 &AccountObject);
1517 if (!NT_SUCCESS(Status))
1518 {
1519 ERR("Invalid handle (Status %lx)\n", Status);
1520 return Status;
1521 }
1522
1523 /* Set the system access flags */
1524 Status = LsapSetObjectAttribute(AccountObject,
1525 L"ActSysAc",
1526 &SystemAccess,
1527 sizeof(ACCESS_MASK));
1528
1529 return Status;
1530 }
1531
1532
1533 /* Function 25 */
1534 NTSTATUS WINAPI LsarOpenTrustedDomain(
1535 LSAPR_HANDLE PolicyHandle,
1536 PRPC_SID TrustedDomainSid,
1537 ACCESS_MASK DesiredAccess,
1538 LSAPR_HANDLE *TrustedDomainHandle)
1539 {
1540 UNIMPLEMENTED;
1541 return STATUS_NOT_IMPLEMENTED;
1542 }
1543
1544
1545 /* Function 26 */
1546 NTSTATUS WINAPI LsarQueryInfoTrustedDomain(
1547 LSAPR_HANDLE TrustedDomainHandle,
1548 TRUSTED_INFORMATION_CLASS InformationClass,
1549 PLSAPR_TRUSTED_DOMAIN_INFO *TrustedDomainInformation)
1550 {
1551 UNIMPLEMENTED;
1552 return STATUS_NOT_IMPLEMENTED;
1553 }
1554
1555
1556 /* Function 27 */
1557 NTSTATUS WINAPI LsarSetInformationTrustedDomain(
1558 LSAPR_HANDLE TrustedDomainHandle,
1559 TRUSTED_INFORMATION_CLASS InformationClass,
1560 PLSAPR_TRUSTED_DOMAIN_INFO TrustedDomainInformation)
1561 {
1562 UNIMPLEMENTED;
1563 return STATUS_NOT_IMPLEMENTED;
1564 }
1565
1566
1567 /* Function 28 */
1568 NTSTATUS WINAPI LsarOpenSecret(
1569 LSAPR_HANDLE PolicyHandle,
1570 PRPC_UNICODE_STRING SecretName,
1571 ACCESS_MASK DesiredAccess,
1572 LSAPR_HANDLE *SecretHandle)
1573 {
1574 PLSA_DB_OBJECT PolicyObject;
1575 PLSA_DB_OBJECT SecretObject = NULL;
1576 NTSTATUS Status = STATUS_SUCCESS;
1577
1578 /* Validate the PolicyHandle */
1579 Status = LsapValidateDbObject(PolicyHandle,
1580 LsaDbPolicyObject,
1581 0,
1582 &PolicyObject);
1583 if (!NT_SUCCESS(Status))
1584 {
1585 ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
1586 return Status;
1587 }
1588
1589 /* Create the secret object */
1590 Status = LsapOpenDbObject(PolicyObject,
1591 L"Secrets",
1592 SecretName->Buffer,
1593 LsaDbSecretObject,
1594 DesiredAccess,
1595 &SecretObject);
1596 if (!NT_SUCCESS(Status))
1597 {
1598 ERR("LsapOpenDbObject failed (Status 0x%08lx)\n", Status);
1599 goto done;
1600 }
1601
1602 done:
1603 if (!NT_SUCCESS(Status))
1604 {
1605 if (SecretObject != NULL)
1606 LsapCloseDbObject(SecretObject);
1607 }
1608 else
1609 {
1610 *SecretHandle = (LSAPR_HANDLE)SecretObject;
1611 }
1612
1613 return Status;
1614 }
1615
1616
1617 /* Function 29 */
1618 NTSTATUS WINAPI LsarSetSecret(
1619 LSAPR_HANDLE SecretHandle,
1620 PLSAPR_CR_CIPHER_VALUE EncryptedCurrentValue,
1621 PLSAPR_CR_CIPHER_VALUE EncryptedOldValue)
1622 {
1623 PLSA_DB_OBJECT SecretObject;
1624 PBYTE CurrentValue = NULL;
1625 PBYTE OldValue = NULL;
1626 ULONG CurrentValueLength = 0;
1627 ULONG OldValueLength = 0;
1628 LARGE_INTEGER Time;
1629 NTSTATUS Status;
1630
1631 TRACE("LsarSetSecret(%p %p %p)\n", SecretHandle,
1632 EncryptedCurrentValue, EncryptedOldValue);
1633
1634 /* Validate the SecretHandle */
1635 Status = LsapValidateDbObject(SecretHandle,
1636 LsaDbSecretObject,
1637 SECRET_SET_VALUE,
1638 &SecretObject);
1639 if (!NT_SUCCESS(Status))
1640 {
1641 ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
1642 return Status;
1643 }
1644
1645 if (EncryptedCurrentValue != NULL)
1646 {
1647 /* FIXME: Decrypt the current value */
1648 CurrentValue = EncryptedCurrentValue->Buffer;
1649 CurrentValueLength = EncryptedCurrentValue->MaximumLength;
1650 }
1651
1652 /* Set the current value */
1653 Status = LsapSetObjectAttribute(SecretObject,
1654 L"CurrentValue",
1655 CurrentValue,
1656 CurrentValueLength);
1657 if (!NT_SUCCESS(Status))
1658 {
1659 ERR("LsapSetObjectAttribute failed (Status 0x%08lx)\n", Status);
1660 goto done;
1661 }
1662
1663 /* Get the current time */
1664 Status = NtQuerySystemTime(&Time);
1665 if (!NT_SUCCESS(Status))
1666 {
1667 ERR("NtQuerySystemTime failed (Status 0x%08lx)\n", Status);
1668 goto done;
1669 }
1670
1671 /* Set the current time */
1672 Status = LsapSetObjectAttribute(SecretObject,
1673 L"CurrentTime",
1674 &Time,
1675 sizeof(LARGE_INTEGER));
1676 if (!NT_SUCCESS(Status))
1677 {
1678 ERR("LsapSetObjectAttribute failed (Status 0x%08lx)\n", Status);
1679 goto done;
1680 }
1681
1682 if (EncryptedOldValue != NULL)
1683 {
1684 /* FIXME: Decrypt the old value */
1685 OldValue = EncryptedOldValue->Buffer;
1686 OldValueLength = EncryptedOldValue->MaximumLength;
1687 }
1688
1689 /* Set the old value */
1690 Status = LsapSetObjectAttribute(SecretObject,
1691 L"OldValue",
1692 OldValue,
1693 OldValueLength);
1694 if (!NT_SUCCESS(Status))
1695 {
1696 ERR("LsapSetObjectAttribute failed (Status 0x%08lx)\n", Status);
1697 goto done;
1698 }
1699
1700 /* Set the old time */
1701 Status = LsapSetObjectAttribute(SecretObject,
1702 L"OldTime",
1703 &Time,
1704 sizeof(LARGE_INTEGER));
1705 if (!NT_SUCCESS(Status))
1706 {
1707 ERR("LsapSetObjectAttribute failed (Status 0x%08lx)\n", Status);
1708 }
1709
1710 done:
1711 return Status;
1712 }
1713
1714
1715 /* Function 30 */
1716 NTSTATUS WINAPI LsarQuerySecret(
1717 LSAPR_HANDLE SecretHandle,
1718 PLSAPR_CR_CIPHER_VALUE *EncryptedCurrentValue,
1719 PLARGE_INTEGER CurrentValueSetTime,
1720 PLSAPR_CR_CIPHER_VALUE *EncryptedOldValue,
1721 PLARGE_INTEGER OldValueSetTime)
1722 {
1723 PLSA_DB_OBJECT SecretObject;
1724 PLSAPR_CR_CIPHER_VALUE EncCurrentValue = NULL;
1725 PLSAPR_CR_CIPHER_VALUE EncOldValue = NULL;
1726 PBYTE CurrentValue = NULL;
1727 PBYTE OldValue = NULL;
1728 ULONG CurrentValueLength = 0;
1729 ULONG OldValueLength = 0;
1730 ULONG BufferSize;
1731 NTSTATUS Status;
1732
1733 TRACE("LsarQuerySecret(%p %p %p %p %p)\n", SecretHandle,
1734 EncryptedCurrentValue, CurrentValueSetTime,
1735 EncryptedOldValue, OldValueSetTime);
1736
1737 /* Validate the SecretHandle */
1738 Status = LsapValidateDbObject(SecretHandle,
1739 LsaDbSecretObject,
1740 SECRET_QUERY_VALUE,
1741 &SecretObject);
1742 if (!NT_SUCCESS(Status))
1743 {
1744 ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
1745 return Status;
1746 }
1747
1748 if (EncryptedCurrentValue != NULL)
1749 {
1750 CurrentValueLength = 0;
1751
1752 /* Get the size of the current value */
1753 Status = LsapGetObjectAttribute(SecretObject,
1754 L"CurrentValue",
1755 NULL,
1756 &CurrentValueLength);
1757 if (!NT_SUCCESS(Status))
1758 goto done;
1759
1760 /* Allocate a buffer for the current value */
1761 CurrentValue = midl_user_allocate(CurrentValueLength);
1762 if (CurrentValue == NULL)
1763 {
1764 Status = STATUS_INSUFFICIENT_RESOURCES;
1765 goto done;
1766 }
1767
1768 /* Get the current value */
1769 Status = LsapGetObjectAttribute(SecretObject,
1770 L"CurrentValue",
1771 CurrentValue,
1772 &CurrentValueLength);
1773 if (!NT_SUCCESS(Status))
1774 goto done;
1775
1776 /* Allocate a buffer for the encrypted current value */
1777 EncCurrentValue = midl_user_allocate(sizeof(LSAPR_CR_CIPHER_VALUE));
1778 if (EncCurrentValue == NULL)
1779 {
1780 Status = STATUS_INSUFFICIENT_RESOURCES;
1781 goto done;
1782 }
1783
1784 /* FIXME: Encrypt the current value */
1785 EncCurrentValue->Length = (USHORT)(CurrentValueLength - sizeof(WCHAR));
1786 EncCurrentValue->MaximumLength = (USHORT)CurrentValueLength;
1787 EncCurrentValue->Buffer = (PBYTE)CurrentValue;
1788 }
1789
1790 if (CurrentValueSetTime != NULL)
1791 {
1792 BufferSize = sizeof(LARGE_INTEGER);
1793
1794 /* Get the current value time */
1795 Status = LsapGetObjectAttribute(SecretObject,
1796 L"CurrentTime",
1797 (PBYTE)CurrentValueSetTime,
1798 &BufferSize);
1799 if (!NT_SUCCESS(Status))
1800 goto done;
1801 }
1802
1803 if (EncryptedOldValue != NULL)
1804 {
1805 OldValueLength = 0;
1806
1807 /* Get the size of the old value */
1808 Status = LsapGetObjectAttribute(SecretObject,
1809 L"OldValue",
1810 NULL,
1811 &OldValueLength);
1812 if (!NT_SUCCESS(Status))
1813 goto done;
1814
1815 /* Allocate a buffer for the old value */
1816 OldValue = midl_user_allocate(OldValueLength);
1817 if (OldValue == NULL)
1818 {
1819 Status = STATUS_INSUFFICIENT_RESOURCES;
1820 goto done;
1821 }
1822
1823 /* Get the old value */
1824 Status = LsapGetObjectAttribute(SecretObject,
1825 L"OldValue",
1826 OldValue,
1827 &OldValueLength);
1828 if (!NT_SUCCESS(Status))
1829 goto done;
1830
1831 /* Allocate a buffer for the encrypted old value */
1832 EncOldValue = midl_user_allocate(sizeof(LSAPR_CR_CIPHER_VALUE) + OldValueLength);
1833 if (EncOldValue == NULL)
1834 {
1835 Status = STATUS_INSUFFICIENT_RESOURCES;
1836 goto done;
1837 }
1838
1839 /* FIXME: Encrypt the old value */
1840 EncOldValue->Length = (USHORT)(OldValueLength - sizeof(WCHAR));
1841 EncOldValue->MaximumLength = (USHORT)OldValueLength;
1842 EncOldValue->Buffer = (PBYTE)OldValue;
1843 }
1844
1845 if (OldValueSetTime != NULL)
1846 {
1847 BufferSize = sizeof(LARGE_INTEGER);
1848
1849 /* Get the old value time */
1850 Status = LsapGetObjectAttribute(SecretObject,
1851 L"OldTime",
1852 (PBYTE)OldValueSetTime,
1853 &BufferSize);
1854 if (!NT_SUCCESS(Status))
1855 goto done;
1856 }
1857
1858
1859 done:
1860 if (NT_SUCCESS(Status))
1861 {
1862 if (EncryptedCurrentValue != NULL)
1863 *EncryptedCurrentValue = EncCurrentValue;
1864
1865 if (EncryptedOldValue != NULL)
1866 *EncryptedOldValue = EncOldValue;
1867 }
1868 else
1869 {
1870 if (EncryptedCurrentValue != NULL)
1871 *EncryptedCurrentValue = NULL;
1872
1873 if (EncryptedOldValue != NULL)
1874 *EncryptedOldValue = NULL;
1875
1876 if (EncCurrentValue != NULL)
1877 midl_user_free(EncCurrentValue);
1878
1879 if (EncOldValue != NULL)
1880 midl_user_free(EncOldValue);
1881
1882 if (CurrentValue != NULL)
1883 midl_user_free(CurrentValue);
1884
1885 if (OldValue != NULL)
1886 midl_user_free(OldValue);
1887 }
1888
1889 TRACE("LsarQuerySecret done (Status 0x%08lx)\n", Status);
1890
1891 return Status;
1892 }
1893
1894
1895 /* Function 31 */
1896 NTSTATUS WINAPI LsarLookupPrivilegeValue(
1897 LSAPR_HANDLE PolicyHandle,
1898 PRPC_UNICODE_STRING Name,
1899 PLUID Value)
1900 {
1901 NTSTATUS Status;
1902
1903 TRACE("LsarLookupPrivilegeValue(%p, %wZ, %p)\n",
1904 PolicyHandle, Name, Value);
1905
1906 Status = LsapValidateDbObject(PolicyHandle,
1907 LsaDbPolicyObject,
1908 POLICY_LOOKUP_NAMES,
1909 NULL);
1910 if (!NT_SUCCESS(Status))
1911 {
1912 ERR("Invalid handle (Status %lx)\n", Status);
1913 return Status;
1914 }
1915
1916 TRACE("Privilege: %wZ\n", Name);
1917
1918 Status = LsarpLookupPrivilegeValue(Name,
1919 Value);
1920
1921 return Status;
1922 }
1923
1924
1925 /* Function 32 */
1926 NTSTATUS WINAPI LsarLookupPrivilegeName(
1927 LSAPR_HANDLE PolicyHandle,
1928 PLUID Value,
1929 PRPC_UNICODE_STRING *Name)
1930 {
1931 NTSTATUS Status;
1932
1933 TRACE("LsarLookupPrivilegeName(%p, %p, %p)\n",
1934 PolicyHandle, Value, Name);
1935
1936 Status = LsapValidateDbObject(PolicyHandle,
1937 LsaDbPolicyObject,
1938 POLICY_LOOKUP_NAMES,
1939 NULL);
1940 if (!NT_SUCCESS(Status))
1941 {
1942 ERR("Invalid handle\n");
1943 return Status;
1944 }
1945
1946 Status = LsarpLookupPrivilegeName(Value,
1947 Name);
1948
1949 return Status;
1950 }
1951
1952
1953 /* Function 33 */
1954 NTSTATUS WINAPI LsarLookupPrivilegeDisplayName(
1955 LSAPR_HANDLE PolicyHandle,
1956 PRPC_UNICODE_STRING Name,
1957 USHORT ClientLanguage,
1958 USHORT ClientSystemDefaultLanguage,
1959 PRPC_UNICODE_STRING *DisplayName,
1960 USHORT *LanguageReturned)
1961 {
1962 UNIMPLEMENTED;
1963 return STATUS_NOT_IMPLEMENTED;
1964 }
1965
1966
1967 /* Function 34 */
1968 NTSTATUS WINAPI LsarDeleteObject(
1969 LSAPR_HANDLE *ObjectHandle)
1970 {
1971 PLSA_DB_OBJECT DbObject;
1972 NTSTATUS Status;
1973
1974 TRACE("(%p)\n", ObjectHandle);
1975
1976 if (ObjectHandle == NULL)
1977 return STATUS_INVALID_PARAMETER;
1978
1979 /* Validate the ObjectHandle */
1980 Status = LsapValidateDbObject(*ObjectHandle,
1981 LsaDbIgnoreObject,
1982 DELETE,
1983 &DbObject);
1984 if (!NT_SUCCESS(Status))
1985 {
1986 ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
1987 return Status;
1988 }
1989
1990 /* You cannot delete the policy object */
1991 if (DbObject->ObjectType == LsaDbPolicyObject)
1992 return STATUS_INVALID_PARAMETER;
1993
1994 /* Delete the database object */
1995 Status = LsapDeleteDbObject(DbObject);
1996 if (!NT_SUCCESS(Status))
1997 {
1998 ERR("LsapDeleteDbObject returned 0x%08lx\n", Status);
1999 return Status;
2000 }
2001
2002 /* Invalidate the object handle */
2003 *ObjectHandle = NULL;
2004
2005 return STATUS_SUCCESS;
2006 }
2007
2008
2009 /* Function 35 */
2010 NTSTATUS WINAPI LsarEnumerateAccountsWithUserRight(
2011 LSAPR_HANDLE PolicyHandle,
2012 PRPC_UNICODE_STRING UserRight,
2013 PLSAPR_ACCOUNT_ENUM_BUFFER EnumerationBuffer)
2014 {
2015 UNIMPLEMENTED;
2016 return STATUS_NOT_IMPLEMENTED;
2017 }
2018
2019
2020 /* Function 36 */
2021 NTSTATUS WINAPI LsarEnumerateAccountRights(
2022 LSAPR_HANDLE PolicyHandle,
2023 PRPC_SID AccountSid,
2024 PLSAPR_USER_RIGHT_SET UserRights)
2025 {
2026 LSAPR_HANDLE AccountHandle;
2027 PLSAPR_PRIVILEGE_SET PrivilegeSet = NULL;
2028 PRPC_UNICODE_STRING RightsBuffer = NULL;
2029 PRPC_UNICODE_STRING PrivilegeString;
2030 ACCESS_MASK SystemAccess;
2031 ULONG RightsCount;
2032 ULONG RightsIndex;
2033 ULONG i;
2034 NTSTATUS Status;
2035
2036 TRACE("LsarEnumerateAccountRights(%p %p %p)\n",
2037 PolicyHandle, AccountSid, UserRights);
2038
2039 /* Open the account */
2040 Status = LsarOpenAccount(PolicyHandle,
2041 AccountSid,
2042 ACCOUNT_VIEW,
2043 &AccountHandle);
2044 if (!NT_SUCCESS(Status))
2045 {
2046 ERR("LsarOpenAccount returned 0x%08lx\n", Status);
2047 return Status;
2048 }
2049
2050 /* Enumerate the privileges */
2051 Status = LsarEnumeratePrivilegesAccount(AccountHandle,
2052 &PrivilegeSet);
2053 if (!NT_SUCCESS(Status))
2054 {
2055 ERR("LsarEnumeratePrivilegesAccount returned 0x%08lx\n", Status);
2056 goto done;
2057 }
2058
2059 /* Get account rights */
2060 Status = LsarGetSystemAccessAccount(AccountHandle,
2061 &SystemAccess);
2062 if (!NT_SUCCESS(Status))
2063 {
2064 ERR("LsarGetSystemAccessAccount returned 0x%08lx\n", Status);
2065 goto done;
2066 }
2067
2068 RightsCount = PrivilegeSet->PrivilegeCount;
2069
2070 /* Count account rights */
2071 for (i = 0; i < sizeof(ACCESS_MASK) * 8; i++)
2072 {
2073 if (SystemAccess & (1 << i))
2074 RightsCount++;
2075 }
2076
2077 /* We are done if there are no rights to be enumerated */
2078 if (RightsCount == 0)
2079 {
2080 UserRights->Entries = 0;
2081 UserRights->UserRights = NULL;
2082 Status = STATUS_SUCCESS;
2083 goto done;
2084 }
2085
2086 /* Allocate a buffer for the account rights */
2087 RightsBuffer = MIDL_user_allocate(RightsCount * sizeof(RPC_UNICODE_STRING));
2088 if (RightsBuffer == NULL)
2089 {
2090 Status = STATUS_INSUFFICIENT_RESOURCES;
2091 goto done;
2092 }
2093
2094 /* Copy the privileges into the buffer */
2095 RightsIndex = 0;
2096 for (i = 0; i < PrivilegeSet->PrivilegeCount; i++)
2097 {
2098 PrivilegeString = NULL;
2099 Status = LsarLookupPrivilegeName(PolicyHandle,
2100 (PLUID)&PrivilegeSet->Privilege[i].Luid,
2101 &PrivilegeString);
2102 if (!NT_SUCCESS(Status))
2103 goto done;
2104
2105 RightsBuffer[i].Length = PrivilegeString->Length;
2106 RightsBuffer[i].MaximumLength = PrivilegeString->MaximumLength;
2107 RightsBuffer[i].Buffer = PrivilegeString->Buffer;
2108
2109 MIDL_user_free(PrivilegeString);
2110 RightsIndex++;
2111 }
2112
2113 /* Copy account rights into the buffer */
2114 for (i = 0; i < sizeof(ACCESS_MASK) * 8; i++)
2115 {
2116 if (SystemAccess & (1 << i))
2117 {
2118 Status = LsapLookupAccountRightName(1 << i,
2119 &PrivilegeString);
2120 if (!NT_SUCCESS(Status))
2121 goto done;
2122
2123 RightsBuffer[i].Length = PrivilegeString->Length;
2124 RightsBuffer[i].MaximumLength = PrivilegeString->MaximumLength;
2125 RightsBuffer[i].Buffer = PrivilegeString->Buffer;
2126
2127 MIDL_user_free(PrivilegeString);
2128 RightsIndex++;
2129 }
2130 }
2131
2132 UserRights->Entries = RightsCount;
2133 UserRights->UserRights = (PRPC_UNICODE_STRING)RightsBuffer;
2134
2135 done:
2136 if (!NT_SUCCESS(Status))
2137 {
2138 if (RightsBuffer != NULL)
2139 {
2140 for (RightsIndex = 0; RightsIndex < RightsCount; RightsIndex++)
2141 {
2142 if (RightsBuffer[RightsIndex].Buffer != NULL)
2143 MIDL_user_free(RightsBuffer[RightsIndex].Buffer);
2144 }
2145
2146 MIDL_user_free(RightsBuffer);
2147 }
2148 }
2149
2150 if (PrivilegeSet != NULL)
2151 MIDL_user_free(PrivilegeSet);
2152
2153 LsarClose(&AccountHandle);
2154
2155 return Status;
2156 }
2157
2158
2159 /* Function 37 */
2160 NTSTATUS WINAPI LsarAddAccountRights(
2161 LSAPR_HANDLE PolicyHandle,
2162 PRPC_SID AccountSid,
2163 PLSAPR_USER_RIGHT_SET UserRights)
2164 {
2165 UNIMPLEMENTED;
2166 return STATUS_NOT_IMPLEMENTED;
2167 }
2168
2169
2170 /* Function 38 */
2171 NTSTATUS WINAPI LsarRemoveAccountRights(
2172 LSAPR_HANDLE PolicyHandle,
2173 PRPC_SID AccountSid,
2174 BOOL AllRights,
2175 PLSAPR_USER_RIGHT_SET UserRights)
2176 {
2177 UNIMPLEMENTED;
2178 return STATUS_NOT_IMPLEMENTED;
2179 }
2180
2181
2182 /* Function 39 */
2183 NTSTATUS WINAPI LsarQueryTrustedDomainInfo(
2184 LSAPR_HANDLE PolicyHandle,
2185 PRPC_SID TrustedDomainSid,
2186 TRUSTED_INFORMATION_CLASS InformationClass,
2187 PLSAPR_TRUSTED_DOMAIN_INFO *TrustedDomainInformation)
2188 {
2189 UNIMPLEMENTED;
2190 return STATUS_NOT_IMPLEMENTED;
2191 }
2192
2193
2194 /* Function 40 */
2195 NTSTATUS WINAPI LsarSetTrustedDomainInfo(
2196 LSAPR_HANDLE PolicyHandle,
2197 PRPC_SID TrustedDomainSid,
2198 TRUSTED_INFORMATION_CLASS InformationClass,
2199 PLSAPR_TRUSTED_DOMAIN_INFO TrustedDomainInformation)
2200 {
2201 UNIMPLEMENTED;
2202 return STATUS_NOT_IMPLEMENTED;
2203 }
2204
2205
2206 /* Function 41 */
2207 NTSTATUS WINAPI LsarDeleteTrustedDomain(
2208 LSAPR_HANDLE PolicyHandle,
2209 PRPC_SID TrustedDomainSid)
2210 {
2211 UNIMPLEMENTED;
2212 return STATUS_NOT_IMPLEMENTED;
2213 }
2214
2215
2216 /* Function 42 */
2217 NTSTATUS WINAPI LsarStorePrivateData(
2218 LSAPR_HANDLE PolicyHandle,
2219 PRPC_UNICODE_STRING KeyName,
2220 PLSAPR_CR_CIPHER_VALUE EncryptedData)
2221 {
2222 UNIMPLEMENTED;
2223 return STATUS_NOT_IMPLEMENTED;
2224 }
2225
2226
2227 /* Function 43 */
2228 NTSTATUS WINAPI LsarRetrievePrivateData(
2229 LSAPR_HANDLE PolicyHandle,
2230 PRPC_UNICODE_STRING KeyName,
2231 PLSAPR_CR_CIPHER_VALUE *EncryptedData)
2232 {
2233 UNIMPLEMENTED;
2234 return STATUS_NOT_IMPLEMENTED;
2235 }
2236
2237
2238 /* Function 44 */
2239 NTSTATUS WINAPI LsarOpenPolicy2(
2240 LPWSTR SystemName,
2241 PLSAPR_OBJECT_ATTRIBUTES ObjectAttributes,
2242 ACCESS_MASK DesiredAccess,
2243 LSAPR_HANDLE *PolicyHandle)
2244 {
2245 UNIMPLEMENTED;
2246 return STATUS_NOT_IMPLEMENTED;
2247 }
2248
2249
2250 /* Function 45 */
2251 NTSTATUS WINAPI LsarGetUserName(
2252 LPWSTR SystemName,
2253 PRPC_UNICODE_STRING *UserName,
2254 PRPC_UNICODE_STRING *DomainName)
2255 {
2256 UNIMPLEMENTED;
2257 return STATUS_NOT_IMPLEMENTED;
2258 }
2259
2260
2261 /* Function 46 */
2262 NTSTATUS WINAPI LsarQueryInformationPolicy2(
2263 LSAPR_HANDLE PolicyHandle,
2264 POLICY_INFORMATION_CLASS InformationClass,
2265 PLSAPR_POLICY_INFORMATION *PolicyInformation)
2266 {
2267 return LsarQueryInformationPolicy(PolicyHandle,
2268 InformationClass,
2269 PolicyInformation);
2270 }
2271
2272
2273 /* Function 47 */
2274 NTSTATUS WINAPI LsarSetInformationPolicy2(
2275 LSAPR_HANDLE PolicyHandle,
2276 POLICY_INFORMATION_CLASS InformationClass,
2277 PLSAPR_POLICY_INFORMATION PolicyInformation)
2278 {
2279 return LsarSetInformationPolicy(PolicyHandle,
2280 InformationClass,
2281 PolicyInformation);
2282 }
2283
2284
2285 /* Function 48 */
2286 NTSTATUS WINAPI LsarQueryTrustedDomainInfoByName(
2287 LSAPR_HANDLE PolicyHandle,
2288 PRPC_UNICODE_STRING TrustedDomainName,
2289 POLICY_INFORMATION_CLASS InformationClass,
2290 PLSAPR_TRUSTED_DOMAIN_INFO *PolicyInformation)
2291 {
2292 UNIMPLEMENTED;
2293 return STATUS_NOT_IMPLEMENTED;
2294 }
2295
2296
2297 /* Function 49 */
2298 NTSTATUS WINAPI LsarSetTrustedDomainInfoByName(
2299 LSAPR_HANDLE PolicyHandle,
2300 PRPC_UNICODE_STRING TrustedDomainName,
2301 POLICY_INFORMATION_CLASS InformationClass,
2302 PLSAPR_TRUSTED_DOMAIN_INFO PolicyInformation)
2303 {
2304 UNIMPLEMENTED;
2305 return STATUS_NOT_IMPLEMENTED;
2306 }
2307
2308
2309 /* Function 50 */
2310 NTSTATUS WINAPI LsarEnumerateTrustedDomainsEx(
2311 LSAPR_HANDLE PolicyHandle,
2312 DWORD *EnumerationContext,
2313 PLSAPR_TRUSTED_ENUM_BUFFER_EX EnumerationBuffer,
2314 DWORD PreferedMaximumLength)
2315 {
2316 UNIMPLEMENTED;
2317 return STATUS_NOT_IMPLEMENTED;
2318 }
2319
2320
2321 /* Function 51 */
2322 NTSTATUS WINAPI LsarCreateTrustedDomainEx(
2323 LSAPR_HANDLE PolicyHandle,
2324 PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation,
2325 PLSAPR_TRUSTED_DOMAIN_AUTH_INFORMATION AuthentificationInformation,
2326 ACCESS_MASK DesiredAccess,
2327 LSAPR_HANDLE *TrustedDomainHandle)
2328 {
2329 UNIMPLEMENTED;
2330 return STATUS_NOT_IMPLEMENTED;
2331 }
2332
2333
2334 /* Function 52 */
2335 NTSTATUS WINAPI LsarSetPolicyReplicationHandle(
2336 PLSAPR_HANDLE PolicyHandle)
2337 {
2338 /* Deprecated */
2339 return STATUS_NOT_IMPLEMENTED;
2340 }
2341
2342
2343 /* Function 53 */
2344 NTSTATUS WINAPI LsarQueryDomainInformationPolicy(
2345 LSAPR_HANDLE PolicyHandle,
2346 POLICY_INFORMATION_CLASS InformationClass,
2347 PLSAPR_POLICY_DOMAIN_INFORMATION *PolicyInformation)
2348 {
2349 UNIMPLEMENTED;
2350 return STATUS_NOT_IMPLEMENTED;
2351 }
2352
2353
2354 /* Function 54 */
2355 NTSTATUS WINAPI LsarSetDomainInformationPolicy(
2356 LSAPR_HANDLE PolicyHandle,
2357 POLICY_INFORMATION_CLASS InformationClass,
2358 PLSAPR_POLICY_DOMAIN_INFORMATION PolicyInformation)
2359 {
2360 UNIMPLEMENTED;
2361 return STATUS_NOT_IMPLEMENTED;
2362 }
2363
2364
2365 /* Function 55 */
2366 NTSTATUS WINAPI LsarOpenTrustedDomainByName(
2367 LSAPR_HANDLE PolicyHandle,
2368 PRPC_UNICODE_STRING TrustedDomainName,
2369 ACCESS_MASK DesiredAccess,
2370 LSAPR_HANDLE *TrustedDomainHandle)
2371 {
2372 UNIMPLEMENTED;
2373 return STATUS_NOT_IMPLEMENTED;
2374 }
2375
2376
2377 /* Function 56 */
2378 NTSTATUS WINAPI LsarTestCall(
2379 handle_t hBinding)
2380 {
2381 UNIMPLEMENTED;
2382 return STATUS_NOT_IMPLEMENTED;
2383 }
2384
2385
2386 /* Function 57 */
2387 NTSTATUS WINAPI LsarLookupSids2(
2388 LSAPR_HANDLE PolicyHandle,
2389 PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
2390 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
2391 PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
2392 LSAP_LOOKUP_LEVEL LookupLevel,
2393 DWORD *MappedCount,
2394 DWORD LookupOptions,
2395 DWORD ClientRevision)
2396 {
2397 NTSTATUS Status;
2398
2399 TRACE("(%p %p %p %p %d %p %lu %lu)\n",
2400 PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
2401 LookupLevel, MappedCount, LookupOptions, ClientRevision);
2402
2403 TranslatedNames->Entries = SidEnumBuffer->Entries;
2404 TranslatedNames->Names = NULL;
2405 *ReferencedDomains = NULL;
2406
2407 /* FIXME: Fail, if there is an invalid SID in the SidEnumBuffer */
2408
2409 Status = LsapLookupSids(SidEnumBuffer,
2410 ReferencedDomains,
2411 TranslatedNames,
2412 LookupLevel,
2413 MappedCount,
2414 LookupOptions,
2415 ClientRevision);
2416
2417 return Status;
2418 }
2419
2420
2421 /* Function 58 */
2422 NTSTATUS WINAPI LsarLookupNames2(
2423 LSAPR_HANDLE PolicyHandle,
2424 DWORD Count,
2425 PRPC_UNICODE_STRING Names,
2426 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
2427 PLSAPR_TRANSLATED_SIDS_EX TranslatedSids,
2428 LSAP_LOOKUP_LEVEL LookupLevel,
2429 DWORD *MappedCount,
2430 DWORD LookupOptions,
2431 DWORD ClientRevision)
2432 {
2433 LSAPR_TRANSLATED_SIDS_EX2 TranslatedSidsEx2;
2434 ULONG i;
2435 NTSTATUS Status;
2436
2437 TRACE("(%p %lu %p %p %p %d %p %lu %lu)\n",
2438 PolicyHandle, Count, Names, ReferencedDomains, TranslatedSids,
2439 LookupLevel, MappedCount, LookupOptions, ClientRevision);
2440
2441 TranslatedSids->Entries = 0;
2442 TranslatedSids->Sids = NULL;
2443 *ReferencedDomains = NULL;
2444
2445 if (Count == 0)
2446 return STATUS_NONE_MAPPED;
2447
2448 TranslatedSidsEx2.Entries = 0;
2449 TranslatedSidsEx2.Sids = NULL;
2450
2451 Status = LsapLookupNames(Count,
2452 Names,
2453 ReferencedDomains,
2454 &TranslatedSidsEx2,
2455 LookupLevel,
2456 MappedCount,
2457 LookupOptions,
2458 ClientRevision);
2459 if (!NT_SUCCESS(Status))
2460 return Status;
2461
2462 TranslatedSids->Entries = TranslatedSidsEx2.Entries;
2463 TranslatedSids->Sids = MIDL_user_allocate(TranslatedSids->Entries * sizeof(LSA_TRANSLATED_SID));
2464 if (TranslatedSids->Sids == NULL)
2465 {
2466 MIDL_user_free(TranslatedSidsEx2.Sids);
2467 MIDL_user_free(*ReferencedDomains);
2468 *ReferencedDomains = NULL;
2469 return STATUS_INSUFFICIENT_RESOURCES;
2470 }
2471
2472 for (i = 0; i < TranslatedSidsEx2.Entries; i++)
2473 {
2474 TranslatedSids->Sids[i].Use = TranslatedSidsEx2.Sids[i].Use;
2475 TranslatedSids->Sids[i].RelativeId = LsapGetRelativeIdFromSid(TranslatedSidsEx2.Sids[i].Sid);
2476 TranslatedSids->Sids[i].DomainIndex = TranslatedSidsEx2.Sids[i].DomainIndex;
2477 TranslatedSids->Sids[i].Flags = TranslatedSidsEx2.Sids[i].Flags;
2478 }
2479
2480 MIDL_user_free(TranslatedSidsEx2.Sids);
2481
2482 return STATUS_SUCCESS;
2483 }
2484
2485
2486 /* Function 59 */
2487 NTSTATUS WINAPI LsarCreateTrustedDomainEx2(
2488 LSAPR_HANDLE PolicyHandle,
2489 PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation,
2490 PLSAPR_TRUSTED_DOMAIN_AUTH_INFORMATION_INTERNAL AuthentificationInformation,
2491 ACCESS_MASK DesiredAccess,
2492 LSAPR_HANDLE *TrustedDomainHandle)
2493 {
2494 UNIMPLEMENTED;
2495 return STATUS_NOT_IMPLEMENTED;
2496 }
2497
2498
2499 /* Function 60 */
2500 NTSTATUS WINAPI CredrWrite(
2501 handle_t hBinding)
2502 {
2503 UNIMPLEMENTED;
2504 return STATUS_NOT_IMPLEMENTED;
2505 }
2506
2507
2508 /* Function 61 */
2509 NTSTATUS WINAPI CredrRead(
2510 handle_t hBinding)
2511 {
2512 UNIMPLEMENTED;
2513 return STATUS_NOT_IMPLEMENTED;
2514 }
2515
2516
2517 /* Function 62 */
2518 NTSTATUS WINAPI CredrEnumerate(
2519 handle_t hBinding)
2520 {
2521 UNIMPLEMENTED;
2522 return STATUS_NOT_IMPLEMENTED;
2523 }
2524
2525
2526 /* Function 63 */
2527 NTSTATUS WINAPI CredrWriteDomainCredentials(
2528 handle_t hBinding)
2529 {
2530 UNIMPLEMENTED;
2531 return STATUS_NOT_IMPLEMENTED;
2532 }
2533
2534
2535 /* Function 64 */
2536 NTSTATUS WINAPI CredrReadDomainCredentials(
2537 handle_t hBinding)
2538 {
2539 UNIMPLEMENTED;
2540 return STATUS_NOT_IMPLEMENTED;
2541 }
2542
2543
2544 /* Function 65 */
2545 NTSTATUS WINAPI CredrDelete(
2546 handle_t hBinding)
2547 {
2548 UNIMPLEMENTED;
2549 return STATUS_NOT_IMPLEMENTED;
2550 }
2551
2552
2553 /* Function 66 */
2554 NTSTATUS WINAPI CredrGetTargetInfo(
2555 handle_t hBinding)
2556 {
2557 UNIMPLEMENTED;
2558 return STATUS_NOT_IMPLEMENTED;
2559 }
2560
2561
2562 /* Function 67 */
2563 NTSTATUS WINAPI CredrProfileLoaded(
2564 handle_t hBinding)
2565 {
2566 UNIMPLEMENTED;
2567 return STATUS_NOT_IMPLEMENTED;
2568 }
2569
2570
2571 /* Function 68 */
2572 NTSTATUS WINAPI LsarLookupNames3(
2573 LSAPR_HANDLE PolicyHandle,
2574 DWORD Count,
2575 PRPC_UNICODE_STRING Names,
2576 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
2577 PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids,
2578 LSAP_LOOKUP_LEVEL LookupLevel,
2579 DWORD *MappedCount,
2580 DWORD LookupOptions,
2581 DWORD ClientRevision)
2582 {
2583 NTSTATUS Status;
2584
2585 TRACE("(%p %lu %p %p %p %d %p %lu %lu)\n",
2586 PolicyHandle, Count, Names, ReferencedDomains, TranslatedSids,
2587 LookupLevel, MappedCount, LookupOptions, ClientRevision);
2588
2589 TranslatedSids->Entries = 0;
2590 TranslatedSids->Sids = NULL;
2591 *ReferencedDomains = NULL;
2592
2593 if (Count == 0)
2594 return STATUS_NONE_MAPPED;
2595
2596 Status = LsapLookupNames(Count,
2597 Names,
2598 ReferencedDomains,
2599 TranslatedSids,
2600 LookupLevel,
2601 MappedCount,
2602 LookupOptions,
2603 ClientRevision);
2604
2605 return Status;
2606 }
2607
2608
2609 /* Function 69 */
2610 NTSTATUS WINAPI CredrGetSessionTypes(
2611 handle_t hBinding)
2612 {
2613 UNIMPLEMENTED;
2614 return STATUS_NOT_IMPLEMENTED;
2615 }
2616
2617
2618 /* Function 70 */
2619 NTSTATUS WINAPI LsarRegisterAuditEvent(
2620 handle_t hBinding)
2621 {
2622 UNIMPLEMENTED;
2623 return STATUS_NOT_IMPLEMENTED;
2624 }
2625
2626
2627 /* Function 71 */
2628 NTSTATUS WINAPI LsarGenAuditEvent(
2629 handle_t hBinding)
2630 {
2631 UNIMPLEMENTED;
2632 return STATUS_NOT_IMPLEMENTED;
2633 }
2634
2635
2636 /* Function 72 */
2637 NTSTATUS WINAPI LsarUnregisterAuditEvent(
2638 handle_t hBinding)
2639 {
2640 UNIMPLEMENTED;
2641 return STATUS_NOT_IMPLEMENTED;
2642 }
2643
2644
2645 /* Function 73 */
2646 NTSTATUS WINAPI LsarQueryForestTrustInformation(
2647 LSAPR_HANDLE PolicyHandle,
2648 PLSA_UNICODE_STRING TrustedDomainName,
2649 LSA_FOREST_TRUST_RECORD_TYPE HighestRecordType,
2650 PLSA_FOREST_TRUST_INFORMATION *ForestTrustInfo)
2651 {
2652 UNIMPLEMENTED;
2653 return STATUS_NOT_IMPLEMENTED;
2654 }
2655
2656
2657 /* Function 74 */
2658 NTSTATUS WINAPI LsarSetForestTrustInformation(
2659 LSAPR_HANDLE PolicyHandle,
2660 PLSA_UNICODE_STRING TrustedDomainName,
2661 LSA_FOREST_TRUST_RECORD_TYPE HighestRecordType,
2662 PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo,
2663 BOOL CheckOnly,
2664 PLSA_FOREST_TRUST_COLLISION_INFORMATION *CollisionInfo)
2665 {
2666 UNIMPLEMENTED;
2667 return STATUS_NOT_IMPLEMENTED;
2668 }
2669
2670
2671 /* Function 75 */
2672 NTSTATUS WINAPI CredrRename(
2673 handle_t hBinding)
2674 {
2675 UNIMPLEMENTED;
2676 return STATUS_NOT_IMPLEMENTED;
2677 }
2678
2679
2680 /* Function 76 */
2681 NTSTATUS WINAPI LsarLookupSids3(
2682 LSAPR_HANDLE PolicyHandle,
2683 PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
2684 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
2685 PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
2686 LSAP_LOOKUP_LEVEL LookupLevel,
2687 DWORD *MappedCount,
2688 DWORD LookupOptions,
2689 DWORD ClientRevision)
2690 {
2691 NTSTATUS Status;
2692
2693 TRACE("(%p %p %p %p %d %p %lu %lu)\n",
2694 PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
2695 LookupLevel, MappedCount, LookupOptions, ClientRevision);
2696
2697 TranslatedNames->Entries = SidEnumBuffer->Entries;
2698 TranslatedNames->Names = NULL;
2699 *ReferencedDomains = NULL;
2700
2701 /* FIXME: Fail, if there is an invalid SID in the SidEnumBuffer */
2702
2703 Status = LsapLookupSids(SidEnumBuffer,
2704 ReferencedDomains,
2705 TranslatedNames,
2706 LookupLevel,
2707 MappedCount,
2708 LookupOptions,
2709 ClientRevision);
2710
2711 return Status;
2712 }
2713
2714
2715 /* Function 77 */
2716 NTSTATUS WINAPI LsarLookupNames4(
2717 handle_t RpcHandle,
2718 DWORD Count,
2719 PRPC_UNICODE_STRING Names,
2720 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
2721 PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids,
2722 LSAP_LOOKUP_LEVEL LookupLevel,
2723 DWORD *MappedCount,
2724 DWORD LookupOptions,
2725 DWORD ClientRevision)
2726 {
2727 NTSTATUS Status;
2728
2729 TRACE("(%p %lu %p %p %p %d %p %lu %lu)\n",
2730 RpcHandle, Count, Names, ReferencedDomains, TranslatedSids,
2731 LookupLevel, MappedCount, LookupOptions, ClientRevision);
2732
2733 TranslatedSids->Entries = 0;
2734 TranslatedSids->Sids = NULL;
2735 *ReferencedDomains = NULL;
2736
2737 if (Count == 0)
2738 return STATUS_NONE_MAPPED;
2739
2740 Status = LsapLookupNames(Count,
2741 Names,
2742 ReferencedDomains,
2743 TranslatedSids,
2744 LookupLevel,
2745 MappedCount,
2746 LookupOptions,
2747 ClientRevision);
2748
2749 return Status;
2750 }
2751
2752
2753 /* Function 78 */
2754 NTSTATUS WINAPI LsarOpenPolicySce(
2755 handle_t hBinding)
2756 {
2757 UNIMPLEMENTED;
2758 return STATUS_NOT_IMPLEMENTED;
2759 }
2760
2761
2762 /* Function 79 */
2763 NTSTATUS WINAPI LsarAdtRegisterSecurityEventSource(
2764 handle_t hBinding)
2765 {
2766 UNIMPLEMENTED;
2767 return STATUS_NOT_IMPLEMENTED;
2768 }
2769
2770
2771 /* Function 80 */
2772 NTSTATUS WINAPI LsarAdtUnregisterSecurityEventSource(
2773 handle_t hBinding)
2774 {
2775 UNIMPLEMENTED;
2776 return STATUS_NOT_IMPLEMENTED;
2777 }
2778
2779
2780 /* Function 81 */
2781 NTSTATUS WINAPI LsarAdtReportSecurityEvent(
2782 handle_t hBinding)
2783 {
2784 UNIMPLEMENTED;
2785 return STATUS_NOT_IMPLEMENTED;
2786 }
2787
2788
2789 /* Function 82 */
2790 NTSTATUS WINAPI CredrFindBestCredential(
2791 handle_t hBinding)
2792 {
2793 UNIMPLEMENTED;
2794 return STATUS_NOT_IMPLEMENTED;
2795 }
2796
2797
2798 /* Function 83 */
2799 NTSTATUS WINAPI LsarSetAuditPolicy(
2800 handle_t hBinding)
2801 {
2802 UNIMPLEMENTED;
2803 return STATUS_NOT_IMPLEMENTED;
2804 }
2805
2806
2807 /* Function 84 */
2808 NTSTATUS WINAPI LsarQueryAuditPolicy(
2809 handle_t hBinding)
2810 {
2811 UNIMPLEMENTED;
2812 return STATUS_NOT_IMPLEMENTED;
2813 }
2814
2815
2816 /* Function 85 */
2817 NTSTATUS WINAPI LsarEnumerateAuditPolicy(
2818 handle_t hBinding)
2819 {
2820 UNIMPLEMENTED;
2821 return STATUS_NOT_IMPLEMENTED;
2822 }
2823
2824
2825 /* Function 86 */
2826 NTSTATUS WINAPI LsarEnumerateAuditCategories(
2827 handle_t hBinding)
2828 {
2829 UNIMPLEMENTED;
2830 return STATUS_NOT_IMPLEMENTED;
2831 }
2832
2833
2834 /* Function 87 */
2835 NTSTATUS WINAPI LsarEnumerateAuditSubCategories(
2836 handle_t hBinding)
2837 {
2838 UNIMPLEMENTED;
2839 return STATUS_NOT_IMPLEMENTED;
2840 }
2841
2842
2843 /* Function 88 */
2844 NTSTATUS WINAPI LsarLookupAuditCategoryName(
2845 handle_t hBinding)
2846 {
2847 UNIMPLEMENTED;
2848 return STATUS_NOT_IMPLEMENTED;
2849 }
2850
2851
2852 /* Function 89 */
2853 NTSTATUS WINAPI LsarLookupAuditSubCategoryName(
2854 handle_t hBinding)
2855 {
2856 UNIMPLEMENTED;
2857 return STATUS_NOT_IMPLEMENTED;
2858 }
2859
2860
2861 /* Function 90 */
2862 NTSTATUS WINAPI LsarSetAuditSecurity(
2863 handle_t hBinding)
2864 {
2865 UNIMPLEMENTED;
2866 return STATUS_NOT_IMPLEMENTED;
2867 }
2868
2869
2870 /* Function 91 */
2871 NTSTATUS WINAPI LsarQueryAuditSecurity(
2872 handle_t hBinding)
2873 {
2874 UNIMPLEMENTED;
2875 return STATUS_NOT_IMPLEMENTED;
2876 }
2877
2878
2879 /* Function 92 */
2880 NTSTATUS WINAPI CredReadByTokenHandle(
2881 handle_t hBinding)
2882 {
2883 UNIMPLEMENTED;
2884 return STATUS_NOT_IMPLEMENTED;
2885 }
2886
2887
2888 /* Function 93 */
2889 NTSTATUS WINAPI CredrRestoreCredentials(
2890 handle_t hBinding)
2891 {
2892 UNIMPLEMENTED;
2893 return STATUS_NOT_IMPLEMENTED;
2894 }
2895
2896
2897 /* Function 94 */
2898 NTSTATUS WINAPI CredrBackupCredentials(
2899 handle_t hBinding)
2900 {
2901 UNIMPLEMENTED;
2902 return STATUS_NOT_IMPLEMENTED;
2903 }
2904
2905 /* EOF */