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