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