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