[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
15 static RTL_CRITICAL_SECTION PolicyHandleTableLock;
16
17 WINE_DEFAULT_DEBUG_CHANNEL(lsasrv);
18
19
20 /* FUNCTIONS ***************************************************************/
21
22
23 VOID
24 LsarStartRpcServer(VOID)
25 {
26 RPC_STATUS Status;
27
28 RtlInitializeCriticalSection(&PolicyHandleTableLock);
29
30 TRACE("LsarStartRpcServer() called\n");
31
32 Status = RpcServerUseProtseqEpW(L"ncacn_np",
33 10,
34 L"\\pipe\\lsarpc",
35 NULL);
36 if (Status != RPC_S_OK)
37 {
38 WARN("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
39 return;
40 }
41
42 Status = RpcServerRegisterIf(lsarpc_v0_0_s_ifspec,
43 NULL,
44 NULL);
45 if (Status != RPC_S_OK)
46 {
47 WARN("RpcServerRegisterIf() failed (Status %lx)\n", Status);
48 return;
49 }
50
51 Status = RpcServerListen(1, 20, TRUE);
52 if (Status != RPC_S_OK)
53 {
54 WARN("RpcServerListen() failed (Status %lx)\n", Status);
55 return;
56 }
57
58 TRACE("LsarStartRpcServer() done\n");
59 }
60
61
62 void __RPC_USER LSAPR_HANDLE_rundown(LSAPR_HANDLE hHandle)
63 {
64
65 }
66
67
68 /* Function 0 */
69 NTSTATUS WINAPI LsarClose(
70 LSAPR_HANDLE *ObjectHandle)
71 {
72 PLSA_DB_OBJECT DbObject;
73 NTSTATUS Status = STATUS_SUCCESS;
74
75 TRACE("0x%p\n", ObjectHandle);
76
77 // RtlEnterCriticalSection(&PolicyHandleTableLock);
78
79 Status = LsapValidateDbObject(*ObjectHandle,
80 LsaDbIgnoreObject,
81 0,
82 &DbObject);
83 if (Status == STATUS_SUCCESS)
84 {
85 Status = LsapCloseDbObject(DbObject);
86 *ObjectHandle = NULL;
87 }
88
89 // RtlLeaveCriticalSection(&PolicyHandleTableLock);
90
91 return Status;
92 }
93
94
95 /* Function 1 */
96 NTSTATUS WINAPI LsarDelete(
97 LSAPR_HANDLE ObjectHandle)
98 {
99 /* Deprecated */
100 return STATUS_NOT_SUPPORTED;
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 UNIMPLEMENTED;
112 return STATUS_NOT_IMPLEMENTED;
113 }
114
115
116 /* Function 3 */
117 NTSTATUS WINAPI LsarQuerySecurityObject(
118 LSAPR_HANDLE ObjectHandle,
119 SECURITY_INFORMATION SecurityInformation,
120 PLSAPR_SR_SECURITY_DESCRIPTOR *SecurityDescriptor)
121 {
122 UNIMPLEMENTED;
123 return STATUS_NOT_IMPLEMENTED;
124 }
125
126
127 /* Function 4 */
128 NTSTATUS WINAPI LsarSetSecurityObject(
129 LSAPR_HANDLE ObjectHandle,
130 SECURITY_INFORMATION SecurityInformation,
131 PLSAPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor)
132 {
133 UNIMPLEMENTED;
134 return STATUS_NOT_IMPLEMENTED;
135 }
136
137
138 /* Function 5 */
139 NTSTATUS WINAPI LsarChangePassword(
140 handle_t IDL_handle,
141 PRPC_UNICODE_STRING String1,
142 PRPC_UNICODE_STRING String2,
143 PRPC_UNICODE_STRING String3,
144 PRPC_UNICODE_STRING String4,
145 PRPC_UNICODE_STRING String5)
146 {
147 /* Deprecated */
148 return STATUS_NOT_IMPLEMENTED;
149 }
150
151
152 /* Function 6 */
153 NTSTATUS WINAPI LsarOpenPolicy(
154 LPWSTR SystemName,
155 PLSAPR_OBJECT_ATTRIBUTES ObjectAttributes,
156 ACCESS_MASK DesiredAccess,
157 LSAPR_HANDLE *PolicyHandle)
158 {
159 PLSA_DB_OBJECT PolicyObject;
160 NTSTATUS Status;
161
162 TRACE("LsarOpenPolicy called!\n");
163
164 RtlEnterCriticalSection(&PolicyHandleTableLock);
165
166 Status = LsapOpenDbObject(NULL,
167 L"Policy",
168 LsaDbPolicyObject,
169 DesiredAccess,
170 &PolicyObject);
171
172 RtlLeaveCriticalSection(&PolicyHandleTableLock);
173
174 if (NT_SUCCESS(Status))
175 *PolicyHandle = (LSAPR_HANDLE)PolicyObject;
176
177 TRACE("LsarOpenPolicy done!\n");
178
179 return Status;
180 }
181
182
183 /* Function 7 */
184 NTSTATUS WINAPI LsarQueryInformationPolicy(
185 LSAPR_HANDLE PolicyHandle,
186 POLICY_INFORMATION_CLASS InformationClass,
187 PLSAPR_POLICY_INFORMATION *PolicyInformation)
188 {
189 PLSA_DB_OBJECT DbObject;
190 NTSTATUS Status;
191
192 TRACE("LsarQueryInformationPolicy(%p,0x%08x,%p)\n",
193 PolicyHandle, InformationClass, PolicyInformation);
194
195 if (PolicyInformation)
196 {
197 TRACE("*PolicyInformation %p\n", *PolicyInformation);
198 }
199
200 Status = LsapValidateDbObject(PolicyHandle,
201 LsaDbPolicyObject,
202 0, /* FIXME */
203 &DbObject);
204 if (!NT_SUCCESS(Status))
205 return Status;
206
207 switch (InformationClass)
208 {
209 case PolicyAuditEventsInformation: /* 2 */
210 Status = LsarQueryAuditEvents(PolicyHandle,
211 PolicyInformation);
212 break;
213
214 case PolicyPrimaryDomainInformation: /* 3 */
215 Status = LsarQueryPrimaryDomain(PolicyHandle,
216 PolicyInformation);
217 break;
218
219 case PolicyAccountDomainInformation: /* 5 */
220 Status = LsarQueryAccountDomain(PolicyHandle,
221 PolicyInformation);
222 break;
223
224 case PolicyDnsDomainInformation: /* 12 (0xc) */
225 Status = LsarQueryDnsDomain(PolicyHandle,
226 PolicyInformation);
227 break;
228
229 case PolicyAuditLogInformation:
230 case PolicyPdAccountInformation:
231 case PolicyLsaServerRoleInformation:
232 case PolicyReplicaSourceInformation:
233 case PolicyDefaultQuotaInformation:
234 case PolicyModificationInformation:
235 case PolicyAuditFullSetInformation:
236 case PolicyAuditFullQueryInformation:
237 case PolicyEfsInformation:
238 FIXME("category not implemented\n");
239 Status = STATUS_UNSUCCESSFUL;
240 break;
241 }
242
243 return Status;
244 }
245
246
247 /* Function 8 */
248 NTSTATUS WINAPI LsarSetInformationPolicy(
249 LSAPR_HANDLE PolicyHandle,
250 POLICY_INFORMATION_CLASS InformationClass,
251 PLSAPR_POLICY_INFORMATION PolicyInformation)
252 {
253 PLSA_DB_OBJECT DbObject;
254 NTSTATUS Status;
255
256 TRACE("LsarSetInformationPolicy(%p,0x%08x,%p)\n",
257 PolicyHandle, InformationClass, PolicyInformation);
258
259 if (PolicyInformation)
260 {
261 TRACE("*PolicyInformation %p\n", *PolicyInformation);
262 }
263
264 Status = LsapValidateDbObject(PolicyHandle,
265 LsaDbPolicyObject,
266 0, /* FIXME */
267 &DbObject);
268 if (!NT_SUCCESS(Status))
269 return Status;
270
271 switch (InformationClass)
272 {
273 case PolicyAuditEventsInformation:
274 Status = STATUS_NOT_IMPLEMENTED;
275 break;
276
277 case PolicyPrimaryDomainInformation:
278 Status = LsarSetPrimaryDomain(PolicyHandle,
279 (PLSAPR_POLICY_PRIMARY_DOM_INFO)PolicyInformation);
280 break;
281
282 case PolicyAccountDomainInformation:
283 Status = LsarSetAccountDomain(PolicyHandle,
284 (PLSAPR_POLICY_ACCOUNT_DOM_INFO)PolicyInformation);
285 break;
286
287 case PolicyDnsDomainInformation:
288 Status = LsarSetDnsDomain(PolicyHandle,
289 (PLSAPR_POLICY_DNS_DOMAIN_INFO)PolicyInformation);
290 break;
291
292 case PolicyLsaServerRoleInformation:
293 Status = STATUS_NOT_IMPLEMENTED;
294 break;
295
296 default:
297 Status = STATUS_INVALID_PARAMETER;
298 break;
299 }
300
301 return Status;
302 }
303
304
305 /* Function 9 */
306 NTSTATUS WINAPI LsarClearAuditLog(
307 LSAPR_HANDLE ObjectHandle)
308 {
309 /* Deprecated */
310 return STATUS_NOT_IMPLEMENTED;
311 }
312
313
314 /* Function 10 */
315 NTSTATUS WINAPI LsarCreateAccount(
316 LSAPR_HANDLE PolicyHandle,
317 PRPC_SID AccountSid,
318 ACCESS_MASK DesiredAccess,
319 LSAPR_HANDLE *AccountHandle)
320 {
321 PLSA_DB_OBJECT PolicyObject;
322 PLSA_DB_OBJECT AccountsObject = NULL;
323 PLSA_DB_OBJECT AccountObject = NULL;
324 LPWSTR SidString = NULL;
325 NTSTATUS Status = STATUS_SUCCESS;
326
327 /* Validate the PolicyHandle */
328 Status = LsapValidateDbObject(PolicyHandle,
329 LsaDbPolicyObject,
330 POLICY_CREATE_ACCOUNT,
331 &PolicyObject);
332 if (!NT_SUCCESS(Status))
333 {
334 ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
335 return Status;
336 }
337
338 /* Open the Accounts object */
339 Status = LsapOpenDbObject(PolicyObject,
340 L"Accounts",
341 LsaDbContainerObject,
342 0,
343 &AccountsObject);
344 if (!NT_SUCCESS(Status))
345 {
346 ERR("LsapCreateDbObject (Accounts) failed (Status 0x%08lx)\n", Status);
347 goto done;
348 }
349
350 /* Create SID string */
351 if (!ConvertSidToStringSid((PSID)AccountSid,
352 &SidString))
353 {
354 ERR("ConvertSidToStringSid failed\n");
355 Status = STATUS_INVALID_PARAMETER;
356 goto done;
357 }
358
359 /* Create the Account object */
360 Status = LsapCreateDbObject(AccountsObject,
361 SidString,
362 LsaDbAccountObject,
363 DesiredAccess,
364 &AccountObject);
365 if (!NT_SUCCESS(Status))
366 {
367 ERR("LsapCreateDbObject (Account) failed (Status 0x%08lx)\n", Status);
368 goto done;
369 }
370
371 /* Set the Sid attribute */
372 Status = LsapSetObjectAttribute(AccountObject,
373 L"Sid",
374 (PVOID)AccountSid,
375 GetLengthSid(AccountSid));
376
377 done:
378 if (SidString != NULL)
379 LocalFree(SidString);
380
381 if (!NT_SUCCESS(Status))
382 {
383 if (AccountObject != NULL)
384 LsapCloseDbObject(AccountObject);
385 }
386 else
387 {
388 *AccountHandle = (LSAPR_HANDLE)AccountObject;
389 }
390
391 if (AccountsObject != NULL)
392 LsapCloseDbObject(AccountsObject);
393
394 return STATUS_SUCCESS;
395 }
396
397
398 /* Function 11 */
399 NTSTATUS WINAPI LsarEnumerateAccounts(
400 LSAPR_HANDLE PolicyHandle,
401 DWORD *EnumerationContext,
402 PLSAPR_ACCOUNT_ENUM_BUFFER EnumerationBuffer,
403 DWORD PreferedMaximumLength)
404 {
405 UNIMPLEMENTED;
406 return STATUS_NOT_IMPLEMENTED;
407 }
408
409
410 /* Function 12 */
411 NTSTATUS WINAPI LsarCreateTrustedDomain(
412 LSAPR_HANDLE PolicyHandle,
413 PLSAPR_TRUST_INFORMATION TrustedDomainInformation,
414 ACCESS_MASK DesiredAccess,
415 LSAPR_HANDLE *TrustedDomainHandle)
416 {
417 UNIMPLEMENTED;
418 return STATUS_NOT_IMPLEMENTED;
419 }
420
421
422 /* Function 13 */
423 NTSTATUS WINAPI LsarEnumerateTrustedDomains(
424 LSAPR_HANDLE PolicyHandle,
425 DWORD *EnumerationContext,
426 PLSAPR_TRUSTED_ENUM_BUFFER EnumerationBuffer,
427 DWORD PreferedMaximumLength)
428 {
429 UNIMPLEMENTED;
430 return STATUS_NOT_IMPLEMENTED;
431 }
432
433
434 /* Function 14 */
435 NTSTATUS WINAPI LsarLookupNames(
436 LSAPR_HANDLE PolicyHandle,
437 DWORD Count,
438 PRPC_UNICODE_STRING Names,
439 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
440 PLSAPR_TRANSLATED_SIDS TranslatedSids,
441 LSAP_LOOKUP_LEVEL LookupLevel,
442 DWORD *MappedCount)
443 {
444 SID_IDENTIFIER_AUTHORITY IdentifierAuthority = {SECURITY_NT_AUTHORITY};
445 static const UNICODE_STRING DomainName = RTL_CONSTANT_STRING(L"DOMAIN");
446 PLSAPR_REFERENCED_DOMAIN_LIST OutputDomains = NULL;
447 PLSA_TRANSLATED_SID OutputSids = NULL;
448 ULONG OutputSidsLength;
449 ULONG i;
450 PSID Sid;
451 ULONG SidLength;
452 NTSTATUS Status;
453
454 TRACE("LsarLookupNames(%p, %lu, %p, %p, %p, %d, %p)\n",
455 PolicyHandle, Count, Names, ReferencedDomains, TranslatedSids,
456 LookupLevel, MappedCount);
457
458 TranslatedSids->Entries = Count;
459 TranslatedSids->Sids = NULL;
460 *ReferencedDomains = NULL;
461
462 OutputSidsLength = Count * sizeof(LSA_TRANSLATED_SID);
463 OutputSids = MIDL_user_allocate(OutputSidsLength);
464 if (OutputSids == NULL)
465 {
466 return STATUS_INSUFFICIENT_RESOURCES;
467 }
468
469 RtlZeroMemory(OutputSids, OutputSidsLength);
470
471 OutputDomains = MIDL_user_allocate(sizeof(LSAPR_REFERENCED_DOMAIN_LIST));
472 if (OutputDomains == NULL)
473 {
474 MIDL_user_free(OutputSids);
475 return STATUS_INSUFFICIENT_RESOURCES;
476 }
477
478 OutputDomains->Entries = Count;
479 OutputDomains->Domains = MIDL_user_allocate(Count * sizeof(LSA_TRUST_INFORMATION));
480 if (OutputDomains->Domains == NULL)
481 {
482 MIDL_user_free(OutputDomains);
483 MIDL_user_free(OutputSids);
484 return STATUS_INSUFFICIENT_RESOURCES;
485 }
486
487 Status = RtlAllocateAndInitializeSid(&IdentifierAuthority,
488 2,
489 SECURITY_BUILTIN_DOMAIN_RID,
490 DOMAIN_ALIAS_RID_ADMINS,
491 0, 0, 0, 0, 0, 0,
492 &Sid);
493 if (!NT_SUCCESS(Status))
494 {
495 MIDL_user_free(OutputDomains->Domains);
496 MIDL_user_free(OutputDomains);
497 MIDL_user_free(OutputSids);
498 return Status;
499 }
500
501 SidLength = RtlLengthSid(Sid);
502
503 for (i = 0; i < Count; i++)
504 {
505 OutputDomains->Domains[i].Sid = MIDL_user_allocate(SidLength);
506 RtlCopyMemory(OutputDomains->Domains[i].Sid, Sid, SidLength);
507
508 OutputDomains->Domains[i].Name.Buffer = MIDL_user_allocate(DomainName.MaximumLength);
509 OutputDomains->Domains[i].Name.Length = DomainName.Length;
510 OutputDomains->Domains[i].Name.MaximumLength = DomainName.MaximumLength;
511 RtlCopyMemory(OutputDomains->Domains[i].Name.Buffer, DomainName.Buffer, DomainName.MaximumLength);
512 }
513
514 for (i = 0; i < Count; i++)
515 {
516 OutputSids[i].Use = SidTypeWellKnownGroup;
517 OutputSids[i].RelativeId = DOMAIN_USER_RID_ADMIN; //DOMAIN_ALIAS_RID_ADMINS;
518 OutputSids[i].DomainIndex = i;
519 }
520
521 *ReferencedDomains = OutputDomains;
522
523 *MappedCount = Count;
524
525 TranslatedSids->Entries = Count;
526 TranslatedSids->Sids = OutputSids;
527
528 return STATUS_SUCCESS;
529 }
530
531
532 /* Function 15 */
533 NTSTATUS WINAPI LsarLookupSids(
534 LSAPR_HANDLE PolicyHandle,
535 PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
536 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
537 PLSAPR_TRANSLATED_NAMES TranslatedNames,
538 LSAP_LOOKUP_LEVEL LookupLevel,
539 DWORD *MappedCount)
540 {
541 SID_IDENTIFIER_AUTHORITY IdentifierAuthority = {SECURITY_NT_AUTHORITY};
542 static const UNICODE_STRING DomainName = RTL_CONSTANT_STRING(L"DOMAIN");
543 PLSAPR_REFERENCED_DOMAIN_LIST OutputDomains = NULL;
544 PLSAPR_TRANSLATED_NAME OutputNames = NULL;
545 ULONG OutputNamesLength;
546 ULONG i;
547 PSID Sid;
548 ULONG SidLength;
549 NTSTATUS Status;
550
551 TRACE("LsarLookupSids(%p, %p, %p, %p, %d, %p)\n",
552 PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
553 LookupLevel, MappedCount);
554
555 TranslatedNames->Entries = SidEnumBuffer->Entries;
556 TranslatedNames->Names = NULL;
557 *ReferencedDomains = NULL;
558
559 OutputNamesLength = SidEnumBuffer->Entries * sizeof(LSA_TRANSLATED_NAME);
560 OutputNames = MIDL_user_allocate(OutputNamesLength);
561 if (OutputNames == NULL)
562 {
563 return STATUS_INSUFFICIENT_RESOURCES;
564 }
565
566 RtlZeroMemory(OutputNames, OutputNamesLength);
567
568 OutputDomains = MIDL_user_allocate(sizeof(LSAPR_REFERENCED_DOMAIN_LIST));
569 if (OutputDomains == NULL)
570 {
571 MIDL_user_free(OutputNames);
572 return STATUS_INSUFFICIENT_RESOURCES;
573 }
574
575 OutputDomains->Entries = SidEnumBuffer->Entries;
576 OutputDomains->Domains = MIDL_user_allocate(SidEnumBuffer->Entries * sizeof(LSA_TRUST_INFORMATION));
577 if (OutputDomains->Domains == NULL)
578 {
579 MIDL_user_free(OutputDomains);
580 MIDL_user_free(OutputNames);
581 return STATUS_INSUFFICIENT_RESOURCES;
582 }
583
584 Status = RtlAllocateAndInitializeSid(&IdentifierAuthority,
585 2,
586 SECURITY_BUILTIN_DOMAIN_RID,
587 DOMAIN_ALIAS_RID_ADMINS,
588 0, 0, 0, 0, 0, 0,
589 &Sid);
590 if (!NT_SUCCESS(Status))
591 {
592 MIDL_user_free(OutputDomains->Domains);
593 MIDL_user_free(OutputDomains);
594 MIDL_user_free(OutputNames);
595 return Status;
596 }
597
598 SidLength = RtlLengthSid(Sid);
599
600 for (i = 0; i < SidEnumBuffer->Entries; i++)
601 {
602 OutputDomains->Domains[i].Sid = MIDL_user_allocate(SidLength);
603 RtlCopyMemory(OutputDomains->Domains[i].Sid, Sid, SidLength);
604
605 OutputDomains->Domains[i].Name.Buffer = MIDL_user_allocate(DomainName.MaximumLength);
606 OutputDomains->Domains[i].Name.Length = DomainName.Length;
607 OutputDomains->Domains[i].Name.MaximumLength = DomainName.MaximumLength;
608 RtlCopyMemory(OutputDomains->Domains[i].Name.Buffer, DomainName.Buffer, DomainName.MaximumLength);
609 }
610
611 Status = LsapLookupSids(SidEnumBuffer,
612 OutputNames);
613
614 *ReferencedDomains = OutputDomains;
615
616 *MappedCount = SidEnumBuffer->Entries;
617
618 TranslatedNames->Entries = SidEnumBuffer->Entries;
619 TranslatedNames->Names = OutputNames;
620
621 return Status;
622 }
623
624
625 /* Function 16 */
626 NTSTATUS WINAPI LsarCreateSecret(
627 LSAPR_HANDLE PolicyHandle,
628 PRPC_UNICODE_STRING SecretName,
629 ACCESS_MASK DesiredAccess,
630 LSAPR_HANDLE *SecretHandle)
631 {
632 UNIMPLEMENTED;
633 return STATUS_NOT_IMPLEMENTED;
634 }
635
636
637 /* Function 17 */
638 NTSTATUS WINAPI LsarOpenAccount(
639 LSAPR_HANDLE PolicyHandle,
640 PRPC_SID AccountSid,
641 ACCESS_MASK DesiredAccess,
642 LSAPR_HANDLE *AccountHandle)
643 {
644 PLSA_DB_OBJECT PolicyObject;
645 PLSA_DB_OBJECT AccountsObject = NULL;
646 PLSA_DB_OBJECT AccountObject = NULL;
647 LPWSTR SidString = NULL;
648 NTSTATUS Status = STATUS_SUCCESS;
649
650 /* Validate the PolicyHandle */
651 Status = LsapValidateDbObject(PolicyHandle,
652 LsaDbPolicyObject,
653 POLICY_CREATE_ACCOUNT,
654 &PolicyObject);
655 if (!NT_SUCCESS(Status))
656 {
657 ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
658 return Status;
659 }
660
661 /* Open the Accounts object */
662 Status = LsapOpenDbObject(PolicyObject,
663 L"Accounts",
664 LsaDbContainerObject,
665 0,
666 &AccountsObject);
667 if (!NT_SUCCESS(Status))
668 {
669 ERR("LsapCreateDbObject (Accounts) failed (Status 0x%08lx)\n", Status);
670 goto done;
671 }
672
673 /* Create SID string */
674 if (!ConvertSidToStringSid((PSID)AccountSid,
675 &SidString))
676 {
677 ERR("ConvertSidToStringSid failed\n");
678 Status = STATUS_INVALID_PARAMETER;
679 goto done;
680 }
681
682 /* Create the Account object */
683 Status = LsapOpenDbObject(AccountsObject,
684 SidString,
685 LsaDbAccountObject,
686 DesiredAccess,
687 &AccountObject);
688 if (!NT_SUCCESS(Status))
689 {
690 ERR("LsapOpenDbObject (Account) failed (Status 0x%08lx)\n", Status);
691 goto done;
692 }
693
694 /* Set the Sid attribute */
695 Status = LsapSetObjectAttribute(AccountObject,
696 L"Sid",
697 (PVOID)AccountSid,
698 GetLengthSid(AccountSid));
699
700 done:
701 if (SidString != NULL)
702 LocalFree(SidString);
703
704 if (!NT_SUCCESS(Status))
705 {
706 if (AccountObject != NULL)
707 LsapCloseDbObject(AccountObject);
708 }
709 else
710 {
711 *AccountHandle = (LSAPR_HANDLE)AccountObject;
712 }
713
714 if (AccountsObject != NULL)
715 LsapCloseDbObject(AccountsObject);
716
717 return STATUS_SUCCESS;
718 }
719
720
721 /* Function 18 */
722 NTSTATUS WINAPI LsarEnumeratePrivilegesAccount(
723 LSAPR_HANDLE AccountHandle,
724 PLSAPR_PRIVILEGE_SET *Privileges)
725 {
726 UNIMPLEMENTED;
727 return STATUS_NOT_IMPLEMENTED;
728 }
729
730
731 /* Function 19 */
732 NTSTATUS WINAPI LsarAddPrivilegesToAccount(
733 LSAPR_HANDLE AccountHandle,
734 PLSAPR_PRIVILEGE_SET Privileges)
735 {
736 UNIMPLEMENTED;
737 return STATUS_NOT_IMPLEMENTED;
738 }
739
740
741 /* Function 20 */
742 NTSTATUS WINAPI LsarRemovePrivilegesFromAccount(
743 LSAPR_HANDLE AccountHandle,
744 BOOL AllPrivileges,
745 PLSAPR_PRIVILEGE_SET Privileges)
746 {
747 UNIMPLEMENTED;
748 return STATUS_NOT_IMPLEMENTED;
749 }
750
751
752 /* Function 21 */
753 NTSTATUS WINAPI LsarGetQuotasForAccount(
754 LSAPR_HANDLE AccountHandle,
755 PQUOTA_LIMITS QuotaLimits)
756 {
757 UNIMPLEMENTED;
758 return STATUS_NOT_IMPLEMENTED;
759 }
760
761
762 /* Function 22 */
763 NTSTATUS WINAPI LsarSetQuotasForAccount(
764 LSAPR_HANDLE AccountHandle,
765 PQUOTA_LIMITS QuotaLimits)
766 {
767 UNIMPLEMENTED;
768 return STATUS_NOT_IMPLEMENTED;
769 }
770
771
772 /* Function 23 */
773 NTSTATUS WINAPI LsarGetSystemAccessAccount(
774 LSAPR_HANDLE AccountHandle,
775 ACCESS_MASK *SystemAccess)
776 {
777 UNIMPLEMENTED;
778 return STATUS_NOT_IMPLEMENTED;
779 }
780
781
782 /* Function 24 */
783 NTSTATUS WINAPI LsarSetSystemAccessAccount(
784 LSAPR_HANDLE AccountHandle,
785 ACCESS_MASK SystemAccess)
786 {
787 UNIMPLEMENTED;
788 return STATUS_NOT_IMPLEMENTED;
789 }
790
791
792 /* Function 25 */
793 NTSTATUS WINAPI LsarOpenTrustedDomain(
794 LSAPR_HANDLE PolicyHandle,
795 PRPC_SID TrustedDomainSid,
796 ACCESS_MASK DesiredAccess,
797 LSAPR_HANDLE *TrustedDomainHandle)
798 {
799 UNIMPLEMENTED;
800 return STATUS_NOT_IMPLEMENTED;
801 }
802
803
804 /* Function 26 */
805 NTSTATUS WINAPI LsarQueryInfoTrustedDomain(
806 LSAPR_HANDLE TrustedDomainHandle,
807 TRUSTED_INFORMATION_CLASS InformationClass,
808 PLSAPR_TRUSTED_DOMAIN_INFO *TrustedDomainInformation)
809 {
810 UNIMPLEMENTED;
811 return STATUS_NOT_IMPLEMENTED;
812 }
813
814
815 /* Function 27 */
816 NTSTATUS WINAPI LsarSetInformationTrustedDomain(
817 LSAPR_HANDLE TrustedDomainHandle,
818 TRUSTED_INFORMATION_CLASS InformationClass,
819 PLSAPR_TRUSTED_DOMAIN_INFO TrustedDomainInformation)
820 {
821 UNIMPLEMENTED;
822 return STATUS_NOT_IMPLEMENTED;
823 }
824
825
826 /* Function 28 */
827 NTSTATUS WINAPI LsarOpenSecret(
828 LSAPR_HANDLE PolicyHandle,
829 PRPC_UNICODE_STRING SecretName,
830 ACCESS_MASK DesiredAccess,
831 LSAPR_HANDLE *SecretHandle)
832 {
833 UNIMPLEMENTED;
834 return STATUS_NOT_IMPLEMENTED;
835 }
836
837
838 /* Function 29 */
839 NTSTATUS WINAPI LsarSetSecret(
840 LSAPR_HANDLE *SecretHandle,
841 PLSAPR_CR_CIPHER_VALUE EncryptedCurrentValue,
842 PLSAPR_CR_CIPHER_VALUE EncryptedOldValue)
843 {
844 UNIMPLEMENTED;
845 return STATUS_NOT_IMPLEMENTED;
846 }
847
848
849 /* Function 30 */
850 NTSTATUS WINAPI LsarQuerySecret(
851 LSAPR_HANDLE SecretHandle,
852 PLSAPR_CR_CIPHER_VALUE *EncryptedCurrentValue,
853 PLARGE_INTEGER CurrentValueSetTime,
854 PLSAPR_CR_CIPHER_VALUE *EncryptedOldValue,
855 PLARGE_INTEGER OldValueSetTime)
856 {
857 UNIMPLEMENTED;
858 return STATUS_NOT_IMPLEMENTED;
859 }
860
861
862 /* Function 31 */
863 NTSTATUS WINAPI LsarLookupPrivilegeValue(
864 LSAPR_HANDLE PolicyHandle,
865 PRPC_UNICODE_STRING Name,
866 PLUID Value)
867 {
868 NTSTATUS Status;
869
870 TRACE("LsarLookupPrivilegeValue(%p, %wZ, %p)\n",
871 PolicyHandle, Name, Value);
872
873 Status = LsapValidateDbObject(PolicyHandle,
874 LsaDbPolicyObject,
875 0, /* FIXME */
876 NULL);
877 if (!NT_SUCCESS(Status))
878 {
879 ERR("Invalid handle (Status %lx)\n", Status);
880 return Status;
881 }
882
883 TRACE("Privilege: %wZ\n", Name);
884
885 Status = LsarpLookupPrivilegeValue((PUNICODE_STRING)Name,
886 Value);
887
888 return Status;
889 }
890
891
892 /* Function 32 */
893 NTSTATUS WINAPI LsarLookupPrivilegeName(
894 LSAPR_HANDLE PolicyHandle,
895 PLUID Value,
896 PRPC_UNICODE_STRING *Name)
897 {
898 NTSTATUS Status;
899
900 TRACE("LsarLookupPrivilegeName(%p, %p, %p)\n",
901 PolicyHandle, Value, Name);
902
903 Status = LsapValidateDbObject(PolicyHandle,
904 LsaDbPolicyObject,
905 0, /* FIXME */
906 NULL);
907 if (!NT_SUCCESS(Status))
908 {
909 ERR("Invalid handle\n");
910 return Status;
911 }
912
913 Status = LsarpLookupPrivilegeName(Value, (PUNICODE_STRING*)Name);
914
915 return Status;
916 }
917
918
919 /* Function 33 */
920 NTSTATUS WINAPI LsarLookupPrivilegeDisplayName(
921 LSAPR_HANDLE PolicyHandle,
922 PRPC_UNICODE_STRING Name,
923 USHORT ClientLanguage,
924 USHORT ClientSystemDefaultLanguage,
925 PRPC_UNICODE_STRING *DisplayName,
926 USHORT *LanguageReturned)
927 {
928 UNIMPLEMENTED;
929 return STATUS_NOT_IMPLEMENTED;
930 }
931
932
933 /* Function 34 */
934 NTSTATUS WINAPI LsarDeleteObject(
935 LSAPR_HANDLE *ObjectHandle)
936 {
937 UNIMPLEMENTED;
938 return STATUS_NOT_IMPLEMENTED;
939 }
940
941
942 /* Function 35 */
943 NTSTATUS WINAPI LsarEnumerateAccountsWithUserRight(
944 LSAPR_HANDLE PolicyHandle,
945 PRPC_UNICODE_STRING UserRight,
946 PLSAPR_ACCOUNT_ENUM_BUFFER EnumerationBuffer)
947 {
948 UNIMPLEMENTED;
949 return STATUS_NOT_IMPLEMENTED;
950 }
951
952
953 /* Function 36 */
954 NTSTATUS WINAPI LsarEnmuerateAccountRights(
955 LSAPR_HANDLE PolicyHandle,
956 PRPC_SID AccountSid,
957 PLSAPR_USER_RIGHT_SET UserRights)
958 {
959 PLSA_DB_OBJECT PolicyObject;
960 NTSTATUS Status;
961
962 FIXME("(%p,%p,%p) stub\n", PolicyHandle, AccountSid, UserRights);
963
964 Status = LsapValidateDbObject(PolicyHandle,
965 LsaDbPolicyObject,
966 0, /* FIXME */
967 &PolicyObject);
968 if (!NT_SUCCESS(Status))
969 return Status;
970
971 UserRights->Entries = 0;
972 UserRights->UserRights = NULL;
973 return STATUS_OBJECT_NAME_NOT_FOUND;
974 }
975
976
977 /* Function 37 */
978 NTSTATUS WINAPI LsarAddAccountRights(
979 LSAPR_HANDLE PolicyHandle,
980 PRPC_SID AccountSid,
981 PLSAPR_USER_RIGHT_SET UserRights)
982 {
983 UNIMPLEMENTED;
984 return STATUS_NOT_IMPLEMENTED;
985 }
986
987
988 /* Function 38 */
989 NTSTATUS WINAPI LsarRemoveAccountRights(
990 LSAPR_HANDLE PolicyHandle,
991 PRPC_SID AccountSid,
992 BOOL AllRights,
993 PLSAPR_USER_RIGHT_SET UserRights)
994 {
995 UNIMPLEMENTED;
996 return STATUS_NOT_IMPLEMENTED;
997 }
998
999
1000 /* Function 39 */
1001 NTSTATUS WINAPI LsarQueryTrustedDomainInfo(
1002 LSAPR_HANDLE PolicyHandle,
1003 PRPC_SID TrustedDomainSid,
1004 TRUSTED_INFORMATION_CLASS InformationClass,
1005 PLSAPR_TRUSTED_DOMAIN_INFO *TrustedDomainInformation)
1006 {
1007 UNIMPLEMENTED;
1008 return STATUS_NOT_IMPLEMENTED;
1009 }
1010
1011
1012 /* Function 40 */
1013 NTSTATUS WINAPI LsarSetTrustedDomainInfo(
1014 LSAPR_HANDLE PolicyHandle,
1015 PRPC_SID TrustedDomainSid,
1016 TRUSTED_INFORMATION_CLASS InformationClass,
1017 PLSAPR_TRUSTED_DOMAIN_INFO TrustedDomainInformation)
1018 {
1019 UNIMPLEMENTED;
1020 return STATUS_NOT_IMPLEMENTED;
1021 }
1022
1023
1024 /* Function 41 */
1025 NTSTATUS WINAPI LsarDeleteTrustedDomain(
1026 LSAPR_HANDLE PolicyHandle,
1027 PRPC_SID TrustedDomainSid)
1028 {
1029 UNIMPLEMENTED;
1030 return STATUS_NOT_IMPLEMENTED;
1031 }
1032
1033
1034 /* Function 42 */
1035 NTSTATUS WINAPI LsarStorePrivateData(
1036 LSAPR_HANDLE PolicyHandle,
1037 PRPC_UNICODE_STRING KeyName,
1038 PLSAPR_CR_CIPHER_VALUE EncryptedData)
1039 {
1040 UNIMPLEMENTED;
1041 return STATUS_NOT_IMPLEMENTED;
1042 }
1043
1044
1045 /* Function 43 */
1046 NTSTATUS WINAPI LsarRetrievePrivateData(
1047 LSAPR_HANDLE PolicyHandle,
1048 PRPC_UNICODE_STRING KeyName,
1049 PLSAPR_CR_CIPHER_VALUE *EncryptedData)
1050 {
1051 UNIMPLEMENTED;
1052 return STATUS_NOT_IMPLEMENTED;
1053 }
1054
1055
1056 /* Function 44 */
1057 NTSTATUS WINAPI LsarOpenPolicy2(
1058 LPWSTR SystemName,
1059 PLSAPR_OBJECT_ATTRIBUTES ObjectAttributes,
1060 ACCESS_MASK DesiredAccess,
1061 LSAPR_HANDLE *PolicyHandle)
1062 {
1063 UNIMPLEMENTED;
1064 return STATUS_NOT_IMPLEMENTED;
1065 }
1066
1067
1068 /* Function 45 */
1069 NTSTATUS WINAPI LsarGetUserName(
1070 LPWSTR SystemName,
1071 PRPC_UNICODE_STRING *UserName,
1072 PRPC_UNICODE_STRING *DomainName)
1073 {
1074 UNIMPLEMENTED;
1075 return STATUS_NOT_IMPLEMENTED;
1076 }
1077
1078
1079 /* Function 46 */
1080 NTSTATUS WINAPI LsarQueryInformationPolicy2(
1081 LSAPR_HANDLE PolicyHandle,
1082 POLICY_INFORMATION_CLASS InformationClass,
1083 unsigned long *PolicyInformation)
1084 {
1085 UNIMPLEMENTED;
1086 return STATUS_NOT_IMPLEMENTED;
1087 }
1088
1089
1090 /* Function 47 */
1091 NTSTATUS WINAPI LsarSetInformationPolicy2(
1092 LSAPR_HANDLE PolicyHandle,
1093 POLICY_INFORMATION_CLASS InformationClass,
1094 unsigned long PolicyInformation)
1095 {
1096 UNIMPLEMENTED;
1097 return STATUS_NOT_IMPLEMENTED;
1098 }
1099
1100
1101 /* Function 48 */
1102 NTSTATUS WINAPI LsarQueryTrustedDomainInfoByName(
1103 LSAPR_HANDLE PolicyHandle,
1104 PRPC_UNICODE_STRING TrustedDomainName,
1105 POLICY_INFORMATION_CLASS InformationClass,
1106 unsigned long *PolicyInformation)
1107 {
1108 UNIMPLEMENTED;
1109 return STATUS_NOT_IMPLEMENTED;
1110 }
1111
1112
1113 /* Function 49 */
1114 NTSTATUS WINAPI LsarSetTrustedDomainInfoByName(
1115 LSAPR_HANDLE PolicyHandle,
1116 PRPC_UNICODE_STRING TrustedDomainName,
1117 POLICY_INFORMATION_CLASS InformationClass,
1118 unsigned long PolicyInformation)
1119 {
1120 UNIMPLEMENTED;
1121 return STATUS_NOT_IMPLEMENTED;
1122 }
1123
1124
1125 /* Function 50 */
1126 NTSTATUS WINAPI LsarEnumerateTrustedDomainsEx(
1127 LSAPR_HANDLE PolicyHandle,
1128 DWORD *EnumerationContext,
1129 PLSAPR_TRUSTED_ENUM_BUFFER_EX EnumerationBuffer,
1130 DWORD PreferedMaximumLength)
1131 {
1132 UNIMPLEMENTED;
1133 return STATUS_NOT_IMPLEMENTED;
1134 }
1135
1136
1137 /* Function 51 */
1138 NTSTATUS WINAPI LsarCreateTrustedDomainEx(
1139 LSAPR_HANDLE PolicyHandle,
1140 PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation,
1141 PLSAPR_TRUSTED_DOMAIN_AUTH_INFORMATION AuthentificationInformation,
1142 ACCESS_MASK DesiredAccess,
1143 LSAPR_HANDLE *TrustedDomainHandle)
1144 {
1145 UNIMPLEMENTED;
1146 return STATUS_NOT_IMPLEMENTED;
1147 }
1148
1149
1150 /* Function 52 */
1151 NTSTATUS WINAPI LsarSetPolicyReplicationHandle(
1152 PLSAPR_HANDLE PolicyHandle)
1153 {
1154 /* Deprecated */
1155 return STATUS_NOT_IMPLEMENTED;
1156 }
1157
1158
1159 /* Function 53 */
1160 NTSTATUS WINAPI LsarQueryDomainInformationPolicy(
1161 LSAPR_HANDLE PolicyHandle,
1162 POLICY_INFORMATION_CLASS InformationClass,
1163 unsigned long *PolicyInformation)
1164 {
1165 UNIMPLEMENTED;
1166 return STATUS_NOT_IMPLEMENTED;
1167 }
1168
1169
1170 /* Function 54 */
1171 NTSTATUS WINAPI LsarSetDomainInformationPolicy(
1172 LSAPR_HANDLE PolicyHandle,
1173 POLICY_INFORMATION_CLASS InformationClass,
1174 unsigned long PolicyInformation)
1175 {
1176 UNIMPLEMENTED;
1177 return STATUS_NOT_IMPLEMENTED;
1178 }
1179
1180
1181 /* Function 55 */
1182 NTSTATUS WINAPI LsarOpenTrustedDomainByName(
1183 LSAPR_HANDLE PolicyHandle,
1184 PRPC_UNICODE_STRING TrustedDomainName,
1185 ACCESS_MASK DesiredAccess,
1186 LSAPR_HANDLE *TrustedDomainHandle)
1187 {
1188 UNIMPLEMENTED;
1189 return STATUS_NOT_IMPLEMENTED;
1190 }
1191
1192
1193 /* Function 56 */
1194 NTSTATUS WINAPI LsarTestCall(
1195 handle_t hBinding)
1196 {
1197 UNIMPLEMENTED;
1198 return STATUS_NOT_IMPLEMENTED;
1199 }
1200
1201
1202 /* Function 57 */
1203 NTSTATUS WINAPI LsarLookupSids2(
1204 LSAPR_HANDLE PolicyHandle,
1205 PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
1206 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
1207 PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
1208 LSAP_LOOKUP_LEVEL LookupLevel,
1209 DWORD *MappedCount,
1210 DWORD LookupOptions,
1211 DWORD ClientRevision)
1212 {
1213 UNIMPLEMENTED;
1214 return STATUS_NOT_IMPLEMENTED;
1215 }
1216
1217
1218 /* Function 58 */
1219 NTSTATUS WINAPI LsarLookupNames2(
1220 LSAPR_HANDLE PolicyHandle,
1221 DWORD Count,
1222 PRPC_UNICODE_STRING Names,
1223 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
1224 PLSAPR_TRANSLATED_SIDS_EX TranslatedSids,
1225 LSAP_LOOKUP_LEVEL LookupLevel,
1226 DWORD *MappedCount,
1227 DWORD LookupOptions,
1228 DWORD ClientRevision)
1229 {
1230 UNIMPLEMENTED;
1231 return STATUS_NOT_IMPLEMENTED;
1232 }
1233
1234
1235 /* Function 59 */
1236 NTSTATUS WINAPI LsarCreateTrustedDomainEx2(
1237 LSAPR_HANDLE PolicyHandle,
1238 PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation,
1239 PLSAPR_TRUSTED_DOMAIN_AUTH_INFORMATION_INTERNAL AuthentificationInformation,
1240 ACCESS_MASK DesiredAccess,
1241 LSAPR_HANDLE *TrustedDomainHandle)
1242 {
1243 UNIMPLEMENTED;
1244 return STATUS_NOT_IMPLEMENTED;
1245 }
1246
1247
1248 /* Function 60 */
1249 NTSTATUS WINAPI CredrWrite(
1250 handle_t hBinding)
1251 {
1252 UNIMPLEMENTED;
1253 return STATUS_NOT_IMPLEMENTED;
1254 }
1255
1256
1257 /* Function 61 */
1258 NTSTATUS WINAPI CredrRead(
1259 handle_t hBinding)
1260 {
1261 UNIMPLEMENTED;
1262 return STATUS_NOT_IMPLEMENTED;
1263 }
1264
1265
1266 /* Function 62 */
1267 NTSTATUS WINAPI CredrEnumerate(
1268 handle_t hBinding)
1269 {
1270 UNIMPLEMENTED;
1271 return STATUS_NOT_IMPLEMENTED;
1272 }
1273
1274
1275 /* Function 63 */
1276 NTSTATUS WINAPI CredrWriteDomainCredentials(
1277 handle_t hBinding)
1278 {
1279 UNIMPLEMENTED;
1280 return STATUS_NOT_IMPLEMENTED;
1281 }
1282
1283
1284 /* Function 64 */
1285 NTSTATUS WINAPI CredrReadDomainCredentials(
1286 handle_t hBinding)
1287 {
1288 UNIMPLEMENTED;
1289 return STATUS_NOT_IMPLEMENTED;
1290 }
1291
1292
1293 /* Function 65 */
1294 NTSTATUS WINAPI CredrDelete(
1295 handle_t hBinding)
1296 {
1297 UNIMPLEMENTED;
1298 return STATUS_NOT_IMPLEMENTED;
1299 }
1300
1301
1302 /* Function 66 */
1303 NTSTATUS WINAPI CredrGetTargetInfo(
1304 handle_t hBinding)
1305 {
1306 UNIMPLEMENTED;
1307 return STATUS_NOT_IMPLEMENTED;
1308 }
1309
1310
1311 /* Function 67 */
1312 NTSTATUS WINAPI CredrProfileLoaded(
1313 handle_t hBinding)
1314 {
1315 UNIMPLEMENTED;
1316 return STATUS_NOT_IMPLEMENTED;
1317 }
1318
1319
1320 /* Function 68 */
1321 NTSTATUS WINAPI LsarLookupNames3(
1322 LSAPR_HANDLE PolicyHandle,
1323 DWORD Count,
1324 PRPC_UNICODE_STRING Names,
1325 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
1326 PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids,
1327 LSAP_LOOKUP_LEVEL LookupLevel,
1328 DWORD *MappedCount,
1329 DWORD LookupOptions,
1330 DWORD ClientRevision)
1331 {
1332 SID_IDENTIFIER_AUTHORITY IdentifierAuthority = {SECURITY_NT_AUTHORITY};
1333 static const UNICODE_STRING DomainName = RTL_CONSTANT_STRING(L"DOMAIN");
1334 PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer = NULL;
1335 PLSAPR_TRANSLATED_SID_EX2 SidsBuffer = NULL;
1336 ULONG SidsBufferLength;
1337 ULONG DomainSidLength;
1338 ULONG AccountSidLength;
1339 PSID DomainSid;
1340 PSID AccountSid;
1341 ULONG i;
1342 NTSTATUS Status;
1343
1344 TRACE("LsarLookupNames3(%p, %lu, %p, %p, %p, %d, %p, %lu, %lu)\n",
1345 PolicyHandle, Count, Names, ReferencedDomains, TranslatedSids,
1346 LookupLevel, MappedCount, LookupOptions, ClientRevision);
1347
1348 if (Count == 0)
1349 return STATUS_NONE_MAPPED;
1350
1351 TranslatedSids->Entries = Count;
1352 TranslatedSids->Sids = NULL;
1353 *ReferencedDomains = NULL;
1354
1355 SidsBufferLength = Count * sizeof(LSAPR_TRANSLATED_SID_EX2);
1356 SidsBuffer = MIDL_user_allocate(SidsBufferLength);
1357 if (SidsBuffer == NULL)
1358 return STATUS_INSUFFICIENT_RESOURCES;
1359
1360 for (i = 0; i < Count; i++)
1361 {
1362 SidsBuffer[i].Use = SidTypeUser;
1363 SidsBuffer[i].Sid = NULL;
1364 SidsBuffer[i].DomainIndex = -1;
1365 SidsBuffer[i].Flags = 0;
1366 }
1367
1368 DomainsBuffer = MIDL_user_allocate(sizeof(LSAPR_REFERENCED_DOMAIN_LIST));
1369 if (DomainsBuffer == NULL)
1370 {
1371 MIDL_user_free(SidsBuffer);
1372 return STATUS_INSUFFICIENT_RESOURCES;
1373 }
1374
1375 DomainsBuffer->Entries = Count;
1376 DomainsBuffer->Domains = MIDL_user_allocate(Count * sizeof(LSA_TRUST_INFORMATION));
1377 if (DomainsBuffer->Domains == NULL)
1378 {
1379 MIDL_user_free(DomainsBuffer);
1380 MIDL_user_free(SidsBuffer);
1381 return STATUS_INSUFFICIENT_RESOURCES;
1382 }
1383
1384 Status = RtlAllocateAndInitializeSid(&IdentifierAuthority,
1385 2,
1386 SECURITY_BUILTIN_DOMAIN_RID,
1387 DOMAIN_ALIAS_RID_ADMINS,
1388 0, 0, 0, 0, 0, 0,
1389 &DomainSid);
1390 if (!NT_SUCCESS(Status))
1391 {
1392 MIDL_user_free(DomainsBuffer->Domains);
1393 MIDL_user_free(DomainsBuffer);
1394 MIDL_user_free(SidsBuffer);
1395 return Status;
1396 }
1397
1398 DomainSidLength = RtlLengthSid(DomainSid);
1399
1400 for (i = 0; i < Count; i++)
1401 {
1402 DomainsBuffer->Domains[i].Sid = MIDL_user_allocate(DomainSidLength);
1403 RtlCopyMemory(DomainsBuffer->Domains[i].Sid,
1404 DomainSid,
1405 DomainSidLength);
1406
1407 DomainsBuffer->Domains[i].Name.Buffer = MIDL_user_allocate(DomainName.MaximumLength);
1408 DomainsBuffer->Domains[i].Name.Length = DomainName.Length;
1409 DomainsBuffer->Domains[i].Name.MaximumLength = DomainName.MaximumLength;
1410 RtlCopyMemory(DomainsBuffer->Domains[i].Name.Buffer,
1411 DomainName.Buffer,
1412 DomainName.MaximumLength);
1413 }
1414
1415 Status = RtlAllocateAndInitializeSid(&IdentifierAuthority,
1416 3,
1417 SECURITY_BUILTIN_DOMAIN_RID,
1418 DOMAIN_ALIAS_RID_ADMINS,
1419 DOMAIN_USER_RID_ADMIN,
1420 0, 0, 0, 0, 0,
1421 &AccountSid);
1422 if (!NT_SUCCESS(Status))
1423 {
1424 MIDL_user_free(DomainsBuffer->Domains);
1425 MIDL_user_free(DomainsBuffer);
1426 MIDL_user_free(SidsBuffer);
1427 return Status;
1428 }
1429
1430 AccountSidLength = RtlLengthSid(AccountSid);
1431
1432 for (i = 0; i < Count; i++)
1433 {
1434 SidsBuffer[i].Use = SidTypeWellKnownGroup;
1435 SidsBuffer[i].Sid = MIDL_user_allocate(AccountSidLength);
1436
1437 RtlCopyMemory(SidsBuffer[i].Sid,
1438 AccountSid,
1439 AccountSidLength);
1440
1441 SidsBuffer[i].DomainIndex = i;
1442 SidsBuffer[i].Flags = 0;
1443 }
1444
1445 *ReferencedDomains = DomainsBuffer;
1446 *MappedCount = Count;
1447
1448 TranslatedSids->Entries = Count;
1449 TranslatedSids->Sids = SidsBuffer;
1450
1451 return STATUS_SUCCESS;
1452 }
1453
1454
1455 /* Function 69 */
1456 NTSTATUS WINAPI CredrGetSessionTypes(
1457 handle_t hBinding)
1458 {
1459 UNIMPLEMENTED;
1460 return STATUS_NOT_IMPLEMENTED;
1461 }
1462
1463
1464 /* Function 70 */
1465 NTSTATUS WINAPI LsarRegisterAuditEvent(
1466 handle_t hBinding)
1467 {
1468 UNIMPLEMENTED;
1469 return STATUS_NOT_IMPLEMENTED;
1470 }
1471
1472
1473 /* Function 71 */
1474 NTSTATUS WINAPI LsarGenAuditEvent(
1475 handle_t hBinding)
1476 {
1477 UNIMPLEMENTED;
1478 return STATUS_NOT_IMPLEMENTED;
1479 }
1480
1481
1482 /* Function 72 */
1483 NTSTATUS WINAPI LsarUnregisterAuditEvent(
1484 handle_t hBinding)
1485 {
1486 UNIMPLEMENTED;
1487 return STATUS_NOT_IMPLEMENTED;
1488 }
1489
1490
1491 /* Function 73 */
1492 NTSTATUS WINAPI LsarQueryForestTrustInformation(
1493 LSAPR_HANDLE PolicyHandle,
1494 PLSA_UNICODE_STRING TrustedDomainName,
1495 LSA_FOREST_TRUST_RECORD_TYPE HighestRecordType,
1496 PLSA_FOREST_TRUST_INFORMATION *ForestTrustInfo)
1497 {
1498 UNIMPLEMENTED;
1499 return STATUS_NOT_IMPLEMENTED;
1500 }
1501
1502
1503 /* Function 74 */
1504 NTSTATUS WINAPI LsarSetForestTrustInformation(
1505 LSAPR_HANDLE PolicyHandle,
1506 PLSA_UNICODE_STRING TrustedDomainName,
1507 LSA_FOREST_TRUST_RECORD_TYPE HighestRecordType,
1508 PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo,
1509 BOOL CheckOnly,
1510 PLSA_FOREST_TRUST_COLLISION_INFORMATION *CollisionInfo)
1511 {
1512 UNIMPLEMENTED;
1513 return STATUS_NOT_IMPLEMENTED;
1514 }
1515
1516
1517 /* Function 75 */
1518 NTSTATUS WINAPI CredrRename(
1519 handle_t hBinding)
1520 {
1521 UNIMPLEMENTED;
1522 return STATUS_NOT_IMPLEMENTED;
1523 }
1524
1525
1526 /* Function 76 */
1527 NTSTATUS WINAPI LsarLookupSids3(
1528 LSAPR_HANDLE PolicyHandle,
1529 PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
1530 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
1531 PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
1532 LSAP_LOOKUP_LEVEL LookupLevel,
1533 DWORD *MappedCount,
1534 DWORD LookupOptions,
1535 DWORD ClientRevision)
1536 {
1537 UNIMPLEMENTED;
1538 return STATUS_NOT_IMPLEMENTED;
1539 }
1540
1541
1542 /* Function 77 */
1543 NTSTATUS WINAPI LsarLookupNames4(
1544 handle_t RpcHandle,
1545 DWORD Count,
1546 PRPC_UNICODE_STRING Names,
1547 PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
1548 PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids,
1549 LSAP_LOOKUP_LEVEL LookupLevel,
1550 DWORD *MappedCount,
1551 DWORD LookupOptions,
1552 DWORD ClientRevision)
1553 {
1554 UNIMPLEMENTED;
1555 return STATUS_NOT_IMPLEMENTED;
1556 }
1557
1558
1559 /* Function 78 */
1560 NTSTATUS WINAPI LsarOpenPolicySce(
1561 handle_t hBinding)
1562 {
1563 UNIMPLEMENTED;
1564 return STATUS_NOT_IMPLEMENTED;
1565 }
1566
1567
1568 /* Function 79 */
1569 NTSTATUS WINAPI LsarAdtRegisterSecurityEventSource(
1570 handle_t hBinding)
1571 {
1572 UNIMPLEMENTED;
1573 return STATUS_NOT_IMPLEMENTED;
1574 }
1575
1576
1577 /* Function 80 */
1578 NTSTATUS WINAPI LsarAdtUnregisterSecurityEventSource(
1579 handle_t hBinding)
1580 {
1581 UNIMPLEMENTED;
1582 return STATUS_NOT_IMPLEMENTED;
1583 }
1584
1585
1586 /* Function 81 */
1587 NTSTATUS WINAPI LsarAdtReportSecurityEvent(
1588 handle_t hBinding)
1589 {
1590 UNIMPLEMENTED;
1591 return STATUS_NOT_IMPLEMENTED;
1592 }
1593
1594
1595 /* Function 82 */
1596 NTSTATUS WINAPI CredrFindBestCredential(
1597 handle_t hBinding)
1598 {
1599 UNIMPLEMENTED;
1600 return STATUS_NOT_IMPLEMENTED;
1601 }
1602
1603
1604 /* Function 83 */
1605 NTSTATUS WINAPI LsarSetAuditPolicy(
1606 handle_t hBinding)
1607 {
1608 UNIMPLEMENTED;
1609 return STATUS_NOT_IMPLEMENTED;
1610 }
1611
1612
1613 /* Function 84 */
1614 NTSTATUS WINAPI LsarQueryAuditPolicy(
1615 handle_t hBinding)
1616 {
1617 UNIMPLEMENTED;
1618 return STATUS_NOT_IMPLEMENTED;
1619 }
1620
1621
1622 /* Function 85 */
1623 NTSTATUS WINAPI LsarEnumerateAuditPolicy(
1624 handle_t hBinding)
1625 {
1626 UNIMPLEMENTED;
1627 return STATUS_NOT_IMPLEMENTED;
1628 }
1629
1630
1631 /* Function 86 */
1632 NTSTATUS WINAPI LsarEnumerateAuditCategories(
1633 handle_t hBinding)
1634 {
1635 UNIMPLEMENTED;
1636 return STATUS_NOT_IMPLEMENTED;
1637 }
1638
1639
1640 /* Function 87 */
1641 NTSTATUS WINAPI LsarEnumerateAuditSubCategories(
1642 handle_t hBinding)
1643 {
1644 UNIMPLEMENTED;
1645 return STATUS_NOT_IMPLEMENTED;
1646 }
1647
1648
1649 /* Function 88 */
1650 NTSTATUS WINAPI LsarLookupAuditCategoryName(
1651 handle_t hBinding)
1652 {
1653 UNIMPLEMENTED;
1654 return STATUS_NOT_IMPLEMENTED;
1655 }
1656
1657
1658 /* Function 89 */
1659 NTSTATUS WINAPI LsarLookupAuditSubCategoryName(
1660 handle_t hBinding)
1661 {
1662 UNIMPLEMENTED;
1663 return STATUS_NOT_IMPLEMENTED;
1664 }
1665
1666
1667 /* Function 90 */
1668 NTSTATUS WINAPI LsarSetAuditSecurity(
1669 handle_t hBinding)
1670 {
1671 UNIMPLEMENTED;
1672 return STATUS_NOT_IMPLEMENTED;
1673 }
1674
1675
1676 /* Function 91 */
1677 NTSTATUS WINAPI LsarQueryAuditSecurity(
1678 handle_t hBinding)
1679 {
1680 UNIMPLEMENTED;
1681 return STATUS_NOT_IMPLEMENTED;
1682 }
1683
1684
1685 /* Function 92 */
1686 NTSTATUS WINAPI CredReadByTokenHandle(
1687 handle_t hBinding)
1688 {
1689 UNIMPLEMENTED;
1690 return STATUS_NOT_IMPLEMENTED;
1691 }
1692
1693
1694 /* Function 93 */
1695 NTSTATUS WINAPI CredrRestoreCredentials(
1696 handle_t hBinding)
1697 {
1698 UNIMPLEMENTED;
1699 return STATUS_NOT_IMPLEMENTED;
1700 }
1701
1702
1703 /* Function 94 */
1704 NTSTATUS WINAPI CredrBackupCredentials(
1705 handle_t hBinding)
1706 {
1707 UNIMPLEMENTED;
1708 return STATUS_NOT_IMPLEMENTED;
1709 }
1710
1711 /* EOF */