ReactOS  0.4.14-dev-49-gfb4591c
lsa.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS system libraries
4  * FILE: dll/win32/advapi32/sec/lsa.c
5  * PURPOSE: Local security authority functions
6  * PROGRAMMER: Emanuele Aliberti
7  * UPDATE HISTORY:
8  * 19990322 EA created
9  * 19990515 EA stubs
10  * 20030202 KJK compressed stubs
11  */
12 
13 #include <advapi32.h>
14 
15 #include <lsa_c.h>
16 
18 
19 static
20 BOOL
22 {
24  BOOL Result;
25  LPWSTR buf;
26 
27  if (ServerName == NULL || ServerName->Length == 0 || ServerName->Buffer == NULL)
28  return TRUE;
29 
30  buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
32  if (Result && (ServerName->Buffer[0] == '\\') && (ServerName->Buffer[1] == '\\'))
33  ServerName += 2;
34  Result = Result && !lstrcmpW(ServerName->Buffer, buf);
36 
37  return Result;
38 }
39 
40 
44 {
46  LPWSTR pszStringBinding;
48 
49  TRACE("PLSAPR_SERVER_NAME_bind() called\n");
50 
52  L"ncacn_np",
53  pszSystemName,
54  L"\\pipe\\lsarpc",
55  NULL,
56  &pszStringBinding);
57  if (status)
58  {
59  TRACE("RpcStringBindingCompose returned 0x%x\n", status);
60  return NULL;
61  }
62 
63  /* Set the binding handle that will be used to bind to the server. */
64  status = RpcBindingFromStringBindingW(pszStringBinding,
65  &hBinding);
66  if (status)
67  {
68  TRACE("RpcBindingFromStringBinding returned 0x%x\n", status);
69  }
70 
71  status = RpcStringFreeW(&pszStringBinding);
72  if (status)
73  {
74  TRACE("RpcStringFree returned 0x%x\n", status);
75  }
76 
77  return hBinding;
78 }
79 
80 
81 void
85 {
87 
88  TRACE("PLSAPR_SERVER_NAME_unbind() called\n");
89 
91  if (status)
92  {
93  TRACE("RpcBindingFree returned 0x%x\n", status);
94  }
95 }
96 
97 
98 /*
99  * @implemented
100  */
101 NTSTATUS
102 WINAPI
104  IN PSID AccountSid,
105  IN PLSA_UNICODE_STRING UserRights,
106  IN ULONG CountOfRights)
107 {
108  LSAPR_USER_RIGHT_SET UserRightSet;
110 
111  TRACE("LsaAddAccountRights(%p %p %p 0x%08x)\n",
112  PolicyHandle, AccountSid, UserRights, CountOfRights);
113 
114  UserRightSet.Entries = CountOfRights;
115  UserRightSet.UserRights = (PRPC_UNICODE_STRING)UserRights;
116 
118  {
119  Status = LsarAddAccountRights((LSAPR_HANDLE)PolicyHandle,
120  (PRPC_SID)AccountSid,
121  &UserRightSet);
122 
123  }
125  {
127  }
128  RpcEndExcept;
129 
130  return Status;
131 }
132 
133 
134 /*
135  * @implemented
136  */
137 NTSTATUS
138 WINAPI
140  IN PPRIVILEGE_SET PrivilegeSet)
141 {
143 
144  TRACE("LsaAddPrivilegesToAccount(%p %p)\n",
145  AccountHandle, PrivilegeSet);
146 
148  {
150  (PLSAPR_PRIVILEGE_SET)PrivilegeSet);
151  }
153  {
155  }
156  RpcEndExcept;
157 
158  return Status;
159 }
160 
161 
162 /*
163  * @implemented
164  */
165 NTSTATUS
166 WINAPI
168 {
170 
171  TRACE("LsaClearAuditLog(%p)\n", PolicyHandle);
172 
174  {
175  Status = LsarClearAuditLog((LSAPR_HANDLE)PolicyHandle);
176  }
178  {
180  }
181  RpcEndExcept;
182 
183  return Status;
184 }
185 
186 
187 /*
188  * @implemented
189  */
190 NTSTATUS
191 WINAPI
192 LsaClose(IN LSA_HANDLE ObjectHandle)
193 {
195 
196  TRACE("LsaClose(%p) called\n", ObjectHandle);
197 
199  {
200  Status = LsarClose((PLSAPR_HANDLE)&ObjectHandle);
201  }
203  {
205  }
206  RpcEndExcept;
207 
208  return Status;
209 }
210 
211 
212 /*
213  * @implemented
214  */
215 NTSTATUS
216 WINAPI
218  IN PSID AccountSid,
220  OUT PLSA_HANDLE AccountHandle)
221 {
223 
224  TRACE("LsaCreateAccount(%p %p 0x%08lx %p)\n",
225  PolicyHandle, AccountSid, DesiredAccess, AccountHandle);
226 
228  {
229  Status = LsarCreateAccount((LSAPR_HANDLE)PolicyHandle,
230  AccountSid,
232  AccountHandle);
233  }
235  {
237  }
238  RpcEndExcept;
239 
240  return Status;
241 }
242 
243 
244 /*
245  * @implemented
246  */
247 NTSTATUS
248 WINAPI
250  IN PLSA_UNICODE_STRING SecretName,
252  OUT PLSA_HANDLE SecretHandle)
253 {
255 
256  TRACE("LsaCreateSecret(%p %p 0x%08lx %p)\n",
257  PolicyHandle, SecretName, DesiredAccess, SecretHandle);
258 
260  {
261  Status = LsarCreateSecret((LSAPR_HANDLE)PolicyHandle,
262  (PRPC_UNICODE_STRING)SecretName,
264  SecretHandle);
265  }
267  {
269  }
270  RpcEndExcept;
271 
272  return Status;
273 }
274 
275 
276 /*
277  * @implemented
278  */
279 NTSTATUS
280 WINAPI
282  IN PLSA_TRUST_INFORMATION TrustedDomainInformation,
284  OUT PLSA_HANDLE TrustedDomainHandle)
285 {
287 
288  TRACE("LsaCreateTrustedDomain(%p %p 0x%08lx %p)\n",
289  PolicyHandle, TrustedDomainInformation, DesiredAccess, TrustedDomainHandle);
290 
292  {
294  (PLSAPR_TRUST_INFORMATION)TrustedDomainInformation,
296  (PLSAPR_HANDLE)TrustedDomainHandle);
297  }
299  {
301  }
302  RpcEndExcept;
303 
304  return Status;
305 }
306 
307 
308 /*
309  * @unimplemented
310  */
311 NTSTATUS
312 WINAPI
314  IN PTRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation,
315  IN PTRUSTED_DOMAIN_AUTH_INFORMATION AuthenticationInformation,
317  OUT PLSA_HANDLE TrustedDomainHandle)
318 {
321 
322  TRACE("LsaCreateTrustedDomainEx(%p %p %p 0x%08lx %p) stub\n",
323  PolicyHandle, TrustedDomainInformation, AuthenticationInformation,
324  DesiredAccess, TrustedDomainHandle);
325 
327  {
328  /* FIXME: Encrypt AuthenticationInformation */
329 
331  (PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX)TrustedDomainInformation,
332  EncryptedAuthInfo,
334  (PLSAPR_HANDLE)TrustedDomainHandle);
335  }
337  {
339  }
340  RpcEndExcept;
341 
342  return Status;
343 }
344 
345 
346 /*
347  * @implemented
348  */
349 NTSTATUS
350 WINAPI
351 LsaDelete(IN LSA_HANDLE ObjectHandle)
352 {
354 
355  TRACE("LsaDelete(%p)\n", ObjectHandle);
356 
358  {
359  Status = LsarDelete((LSAPR_HANDLE)ObjectHandle);
360  }
362  {
364  }
365  RpcEndExcept;
366 
367  return Status;
368 }
369 
370 
371 /*
372  * @implemented
373  */
374 NTSTATUS
375 WINAPI
377  IN PSID TrustedDomainSid)
378 {
380 
381  TRACE("LsaDeleteTrustedDomain(%p %p)\n",
382  PolicyHandle, TrustedDomainSid);
383 
385  {
387  TrustedDomainSid);
388  }
390  {
392  }
393  RpcEndExcept;
394 
395  return Status;
396 }
397 
398 
399 /*
400  * @implemented
401  */
402 NTSTATUS
403 WINAPI
405  IN PSID AccountSid,
406  OUT PLSA_UNICODE_STRING *UserRights,
407  OUT PULONG CountOfRights)
408 {
409  LSAPR_USER_RIGHT_SET UserRightsSet;
411 
412  TRACE("LsaEnumerateAccountRights(%p %p %p %p)\n",
413  PolicyHandle, AccountSid, UserRights, CountOfRights);
414 
415  UserRightsSet.Entries = 0;
416  UserRightsSet.UserRights = NULL;
417 
419  {
421  AccountSid,
422  &UserRightsSet);
423 
424  *UserRights = (PUNICODE_STRING)UserRightsSet.UserRights;
425  *CountOfRights = UserRightsSet.Entries;
426  }
428  {
430 
431  if (UserRightsSet.UserRights != NULL)
432  MIDL_user_free(UserRightsSet.UserRights);
433  }
434  RpcEndExcept;
435 
436  return Status;
437 }
438 
439 
440 /*
441  * @implemented
442  */
443 NTSTATUS
444 WINAPI
446  IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
447  OUT PVOID *Buffer,
448  IN ULONG PreferedMaximumLength,
449  OUT PULONG CountReturned)
450 {
451  LSAPR_ACCOUNT_ENUM_BUFFER AccountEnumBuffer;
453 
454  TRACE("LsaEnumerateAccounts(%p %p %p %lu %p)\n",
455  PolicyHandle, EnumerationContext, Buffer,
456  PreferedMaximumLength, CountReturned);
457 
458  AccountEnumBuffer.EntriesRead = 0;
459  AccountEnumBuffer.Information = NULL;
460 
462  {
463  Status = LsarEnumerateAccounts((LSAPR_HANDLE)PolicyHandle,
464  EnumerationContext,
465  &AccountEnumBuffer,
466  PreferedMaximumLength);
467 
468  *Buffer = AccountEnumBuffer.Information;
469  *CountReturned = AccountEnumBuffer.EntriesRead;
470  }
472  {
473  if (AccountEnumBuffer.Information != NULL)
474  MIDL_user_free(AccountEnumBuffer.Information);
475 
477  }
478  RpcEndExcept;
479 
480  return Status;
481 }
482 
483 
484 /*
485  * @implemented
486  */
487 NTSTATUS
488 WINAPI
490  IN PLSA_UNICODE_STRING UserRight OPTIONAL,
491  OUT PVOID *Buffer,
492  OUT PULONG CountReturned)
493 {
494  LSAPR_ACCOUNT_ENUM_BUFFER AccountEnumBuffer;
496 
497  TRACE("LsaEnumerateAccountsWithUserRight(%p %p %p %p) stub\n",
498  PolicyHandle, UserRight, Buffer, CountReturned);
499 
500  AccountEnumBuffer.EntriesRead = 0;
501  AccountEnumBuffer.Information = NULL;
502 
504  {
506  (PRPC_UNICODE_STRING)UserRight,
507  &AccountEnumBuffer);
508 
509  *Buffer = AccountEnumBuffer.Information;
510  *CountReturned = AccountEnumBuffer.EntriesRead;
511  }
513  {
514  if (AccountEnumBuffer.Information != NULL)
515  MIDL_user_free(AccountEnumBuffer.Information);
516 
518  }
519  RpcEndExcept;
520 
521  return Status;
522 }
523 
524 
525 /*
526  * @implemented
527  */
528 NTSTATUS
529 WINAPI
531  IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
532  OUT PVOID *Buffer,
533  IN ULONG PreferedMaximumLength,
534  OUT PULONG CountReturned)
535 {
536  LSAPR_PRIVILEGE_ENUM_BUFFER PrivilegeEnumBuffer;
538 
539  TRACE("LsaEnumeratePrivileges(%p %p %p %lu %p)\n",
540  PolicyHandle, EnumerationContext, Buffer,
541  PreferedMaximumLength, CountReturned);
542 
543  PrivilegeEnumBuffer.Entries = 0;
544  PrivilegeEnumBuffer.Privileges = NULL;
545 
547  {
549  EnumerationContext,
550  &PrivilegeEnumBuffer,
551  PreferedMaximumLength);
552 
553  *Buffer = PrivilegeEnumBuffer.Privileges;
554  *CountReturned = PrivilegeEnumBuffer.Entries;
555 
556  }
558  {
559  if (PrivilegeEnumBuffer.Privileges != NULL)
560  MIDL_user_free(PrivilegeEnumBuffer.Privileges);
561 
563  }
564  RpcEndExcept;
565 
566  return Status;
567 }
568 
569 
570 /*
571  * @implemented
572  */
573 NTSTATUS
574 WINAPI
577 {
579 
580  TRACE("LsaEnumeratePrivilegesOfAccount(%p %p)\n",
581  AccountHandle, Privileges);
582 
584  {
587  }
589  {
591  }
592  RpcEndExcept;
593 
594  return Status;
595 }
596 
597 
598 /*
599  * @implemented
600  */
601 NTSTATUS
602 WINAPI
604  IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
605  OUT PVOID *Buffer,
606  IN ULONG PreferedMaximumLength,
607  OUT PULONG CountReturned)
608 {
609  LSAPR_TRUSTED_ENUM_BUFFER TrustedEnumBuffer;
611 
612  TRACE("LsaEnumerateTrustedDomains(%p %p %p %lu %p)\n",
613  PolicyHandle, EnumerationContext, Buffer,
614  PreferedMaximumLength, CountReturned);
615 
616  if (Buffer == NULL)
618 
619  TrustedEnumBuffer.EntriesRead = 0;
620  TrustedEnumBuffer.Information = NULL;
621 
623  {
625  EnumerationContext,
626  &TrustedEnumBuffer,
627  PreferedMaximumLength);
628 
629  *Buffer = TrustedEnumBuffer.Information;
630  *CountReturned = TrustedEnumBuffer.EntriesRead;
631 
632  }
634  {
635  if (TrustedEnumBuffer.Information != NULL)
636  MIDL_user_free(TrustedEnumBuffer.Information);
637 
639  }
640  RpcEndExcept;
641 
642  return Status;
643 }
644 
645 
646 /*
647  * @implemented
648  */
649 NTSTATUS
650 WINAPI
652  IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
653  OUT PVOID *Buffer,
654  IN ULONG PreferedMaximumLength,
655  OUT PULONG CountReturned)
656 {
657  LSAPR_TRUSTED_ENUM_BUFFER_EX TrustedEnumBuffer;
659 
660  TRACE("LsaEnumerateTrustedDomainsEx(%p %p %p %lu %p)\n",
661  PolicyHandle, EnumerationContext, Buffer,
662  PreferedMaximumLength, CountReturned);
663 
664  if (Buffer == NULL)
666 
667  TrustedEnumBuffer.EntriesRead = 0;
668  TrustedEnumBuffer.EnumerationBuffer = NULL;
669 
671  {
673  EnumerationContext,
674  &TrustedEnumBuffer,
675  PreferedMaximumLength);
676 
677  *Buffer = TrustedEnumBuffer.EnumerationBuffer;
678  *CountReturned = TrustedEnumBuffer.EntriesRead;
679 
680  }
682  {
683  if (TrustedEnumBuffer.EnumerationBuffer != NULL)
684  MIDL_user_free(TrustedEnumBuffer.EnumerationBuffer);
685 
687  }
688  RpcEndExcept;
689 
690  return Status;
691 }
692 
693 
694 /*
695  * @implemented
696  */
697 NTSTATUS
698 WINAPI
700 {
701  TRACE("LsaFreeMemory(%p)\n", Buffer);
702  return RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
703 }
704 
705 
706 /*
707  * @implemented
708  */
709 NTSTATUS
710 WINAPI
712  OUT PQUOTA_LIMITS QuotaLimits)
713 {
715 
716  TRACE("LsaGetQuotasForAccount(%p %p)\n",
717  AccountHandle, QuotaLimits);
718 
720  {
722  QuotaLimits);
723  }
725  {
727  }
728  RpcEndExcept;
729 
730  return Status;
731 }
732 
733 
734 /*
735  * @implemented
736  */
737 NTSTATUS
738 WINAPI
740  OUT PLSA_UNICODE_STRING *UserName,
741  OUT PLSA_UNICODE_STRING *DomainName OPTIONAL)
742 {
743  PRPC_UNICODE_STRING UserNameString = NULL;
744  PRPC_UNICODE_STRING DomainNameString = NULL;
746 
747  TRACE("LsaGetRemoteUserName(%s %p %p)\n",
748  SystemName ? debugstr_w(SystemName->Buffer) : "(null)",
749  UserName, DomainName);
750 
752  {
754  &UserNameString,
755  (DomainName != NULL) ? &DomainNameString : NULL);
756 
757  *UserName = (PLSA_UNICODE_STRING)UserNameString;
758 
759  if (DomainName != NULL)
760  *DomainName = (PLSA_UNICODE_STRING)DomainNameString;
761  }
763  {
764  if (UserNameString != NULL)
765  MIDL_user_free(UserNameString);
766 
767  if (DomainNameString != NULL)
768  MIDL_user_free(DomainNameString);
769 
771  }
772  RpcEndExcept;
773 
774  return Status;
775 }
776 
777 
778 /*
779  * @implemented
780  */
781 NTSTATUS
782 WINAPI
784  OUT PULONG SystemAccess)
785 {
787 
788  TRACE("LsaGetSystemAccessAccount(%p %p)\n",
789  AccountHandle, SystemAccess);
790 
792  {
794  (ACCESS_MASK *)SystemAccess);
795  }
797  {
799  }
800  RpcEndExcept;
801 
802  return Status;
803 }
804 
805 
806 /*
807  * @implemented
808  */
809 NTSTATUS
810 WINAPI
812  OUT PUNICODE_STRING *DomainName OPTIONAL)
813 {
814  PRPC_UNICODE_STRING UserNameString = NULL;
815  PRPC_UNICODE_STRING DomainNameString = NULL;
817 
818  TRACE("LsaGetUserName(%p %p)\n",
819  UserName, DomainName);
820 
822  {
824  &UserNameString,
825  (DomainName != NULL) ? &DomainNameString : NULL);
826 
827  *UserName = (PUNICODE_STRING)UserNameString;
828 
829  if (DomainName != NULL)
830  *DomainName = (PUNICODE_STRING)DomainNameString;
831  }
833  {
834  if (UserNameString != NULL)
835  MIDL_user_free(UserNameString);
836 
837  if (DomainNameString != NULL)
838  MIDL_user_free(DomainNameString);
839 
841  }
842  RpcEndExcept;
843 
844  return Status;
845 }
846 
847 
848 /*
849  * @implemented
850  */
851 NTSTATUS
852 WINAPI
854  IN ULONG Count,
856  OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
857  OUT PLSA_TRANSLATED_SID *Sids)
858 {
859  LSAPR_TRANSLATED_SIDS TranslatedSids = {0, NULL};
860  ULONG MappedCount = 0;
862 
863  TRACE("LsaLookupNames(%p %lu %p %p %p)\n",
864  PolicyHandle, Count, Names, ReferencedDomains, Sids);
865 
866  if (ReferencedDomains == NULL || Sids == NULL)
868 
870  {
871  *ReferencedDomains = NULL;
872  *Sids = NULL;
873 
874  TranslatedSids.Entries = Count;
875 
876  Status = LsarLookupNames((LSAPR_HANDLE)PolicyHandle,
877  Count,
879  (PLSAPR_REFERENCED_DOMAIN_LIST *)ReferencedDomains,
880  &TranslatedSids,
882  &MappedCount);
883 
884  *Sids = (PLSA_TRANSLATED_SID)TranslatedSids.Sids;
885  }
887  {
888  if (TranslatedSids.Sids != NULL)
889  MIDL_user_free(TranslatedSids.Sids);
890 
892  }
893  RpcEndExcept;
894 
895  return Status;
896 }
897 
898 
899 /*
900  * @implemented
901  */
902 NTSTATUS
903 WINAPI
905  IN ULONG Flags,
906  IN ULONG Count,
908  OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
910 {
911  LSAPR_TRANSLATED_SIDS_EX2 TranslatedSids = {0, NULL};
912  ULONG MappedCount = 0;
914 
915  TRACE("LsaLookupNames2(%p 0x%08x %lu %p %p %p)\n",
916  PolicyHandle, Flags, Count, Names, ReferencedDomains, Sids);
917 
918  if (ReferencedDomains == NULL || Sids == NULL)
920 
922  {
923  *ReferencedDomains = NULL;
924  *Sids = NULL;
925 
926  TranslatedSids.Entries = Count;
927 
928  Status = LsarLookupNames3((LSAPR_HANDLE)PolicyHandle,
929  Count,
931  (PLSAPR_REFERENCED_DOMAIN_LIST *)ReferencedDomains,
932  &TranslatedSids,
934  &MappedCount,
935  Flags,
936  2);
937 
938  *Sids = (PLSA_TRANSLATED_SID2)TranslatedSids.Sids;
939  }
941  {
942  if (TranslatedSids.Sids != NULL)
943  MIDL_user_free(TranslatedSids.Sids);
944 
946  }
947  RpcEndExcept;
948 
949  return Status;
950 }
951 
952 
953 /*
954  * @implemented
955  */
956 NTSTATUS
957 WINAPI
960  OUT PLSA_UNICODE_STRING *DisplayName,
961  OUT PUSHORT LanguageReturned)
962 {
963  PRPC_UNICODE_STRING DisplayNameBuffer = NULL;
965 
966  TRACE("LsaLookupPrivilegeDisplayName(%p %p %p %p)\n",
967  PolicyHandle, Name, DisplayName, LanguageReturned);
968 
970  {
971  Status = LsarLookupPrivilegeDisplayName(PolicyHandle,
975  &DisplayNameBuffer,
976  LanguageReturned);
977 
978  *DisplayName = (PUNICODE_STRING)DisplayNameBuffer;
979  }
981  {
982  if (DisplayNameBuffer != NULL)
983  MIDL_user_free(DisplayNameBuffer);
984 
986  }
987  RpcEndExcept;
988 
989  return Status;
990 }
991 
992 
993 /*
994  * @implemented
995  */
996 NTSTATUS
997 WINAPI
999  IN PLUID Value,
1001 {
1002  PRPC_UNICODE_STRING NameBuffer = NULL;
1003  NTSTATUS Status;
1004 
1005  TRACE("LsaLookupPrivilegeName(%p %p %p)\n",
1006  PolicyHandle, Value, Name);
1007 
1008  RpcTryExcept
1009  {
1010  Status = LsarLookupPrivilegeName(PolicyHandle,
1011  Value,
1012  &NameBuffer);
1013 
1014  *Name = (PUNICODE_STRING)NameBuffer;
1015  }
1017  {
1018  if (NameBuffer != NULL)
1019  MIDL_user_free(NameBuffer);
1020 
1022  }
1023  RpcEndExcept;
1024 
1025  return Status;
1026 }
1027 
1028 
1029 /*
1030  * @implemented
1031  */
1032 NTSTATUS
1033 WINAPI
1036  OUT PLUID Value)
1037 {
1038  LUID Luid;
1039  NTSTATUS Status;
1040 
1041  TRACE("LsaLookupPrivilegeValue(%p %p %p)\n",
1042  PolicyHandle, Name, Value);
1043 
1044  RpcTryExcept
1045  {
1046  Status = LsarLookupPrivilegeValue(PolicyHandle,
1048  &Luid);
1049  if (Status == STATUS_SUCCESS)
1050  *Value = Luid;
1051  }
1053  {
1055  }
1056  RpcEndExcept;
1057 
1058  return Status;
1059 }
1060 
1061 
1062 /*
1063  * @implemented
1064  */
1065 NTSTATUS
1066 WINAPI
1068  IN ULONG Count,
1069  IN PSID *Sids,
1070  OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
1072 {
1073  LSAPR_SID_ENUM_BUFFER SidEnumBuffer;
1074  LSAPR_TRANSLATED_NAMES TranslatedNames;
1075  ULONG MappedCount = 0;
1076  NTSTATUS Status;
1077 
1078  TRACE("LsaLookupSids(%p %lu %p %p %p)\n",
1079  PolicyHandle, Count, Sids, ReferencedDomains, Names);
1080 
1081  if (Count == 0)
1082  return STATUS_INVALID_PARAMETER;
1083 
1084  SidEnumBuffer.Entries = Count;
1085  SidEnumBuffer.SidInfo = (PLSAPR_SID_INFORMATION)Sids;
1086 
1087  RpcTryExcept
1088  {
1089  *ReferencedDomains = NULL;
1090  *Names = NULL;
1091 
1092  TranslatedNames.Entries = 0;
1093  TranslatedNames.Names = NULL;
1094 
1095  Status = LsarLookupSids((LSAPR_HANDLE)PolicyHandle,
1096  &SidEnumBuffer,
1097  (PLSAPR_REFERENCED_DOMAIN_LIST *)ReferencedDomains,
1098  &TranslatedNames,
1100  &MappedCount);
1101 
1102  *Names = (PLSA_TRANSLATED_NAME)TranslatedNames.Names;
1103  }
1105  {
1106  if (TranslatedNames.Names != NULL)
1107  {
1108  MIDL_user_free(TranslatedNames.Names);
1109  }
1110 
1112  }
1113  RpcEndExcept;
1114 
1115  return Status;
1116 }
1117 
1118 
1119 /******************************************************************************
1120  * LsaNtStatusToWinError
1121  *
1122  * PARAMS
1123  * Status [I]
1124  *
1125  * @implemented
1126  */
1127 ULONG
1128 WINAPI
1130 {
1131  TRACE("LsaNtStatusToWinError(0x%lx)\n", Status);
1132  return RtlNtStatusToDosError(Status);
1133 }
1134 
1135 
1136 /*
1137  * @implemented
1138  */
1139 NTSTATUS
1140 WINAPI
1142  IN PSID AccountSid,
1144  OUT PLSA_HANDLE AccountHandle)
1145 {
1146  NTSTATUS Status;
1147 
1148  TRACE("LsaOpenAccount(%p %p 0x%08lx %p)\n",
1149  PolicyHandle, AccountSid, DesiredAccess, AccountHandle);
1150 
1151  RpcTryExcept
1152  {
1153  Status = LsarOpenAccount((LSAPR_HANDLE)PolicyHandle,
1154  AccountSid,
1155  DesiredAccess,
1156  AccountHandle);
1157  }
1159  {
1161  }
1162  RpcEndExcept;
1163 
1164  return Status;
1165 }
1166 
1167 
1168 /******************************************************************************
1169  * LsaOpenPolicy
1170  *
1171  * PARAMS
1172  * x1 []
1173  * x2 []
1174  * x3 []
1175  * x4 []
1176  *
1177  * @implemented
1178  */
1179 NTSTATUS
1180 WINAPI
1184  OUT PLSA_HANDLE PolicyHandle)
1185 {
1186  NTSTATUS Status;
1187 
1188  TRACE("LsaOpenPolicy(%s %p 0x%08lx %p)\n",
1189  SystemName ? debugstr_w(SystemName->Buffer) : "(null)",
1190  ObjectAttributes, DesiredAccess, PolicyHandle);
1191 
1192  /* FIXME: RPC should take care of this */
1193  if (!LsapIsLocalComputer(SystemName))
1195 
1196  RpcTryExcept
1197  {
1198  *PolicyHandle = NULL;
1199 
1200  Status = LsarOpenPolicy(SystemName ? SystemName->Buffer : NULL,
1202  DesiredAccess,
1203  PolicyHandle);
1204  }
1206  {
1208  }
1209  RpcEndExcept;
1210 
1211  TRACE("LsaOpenPolicy() done (Status: 0x%08lx)\n", Status);
1212 
1213  return Status;
1214 }
1215 
1216 
1217 /*
1218  * @implemented
1219  */
1220 NTSTATUS
1221 WINAPI
1225  OUT PLSA_HANDLE PolicyHandle)
1226 {
1227  NTSTATUS Status;
1228 
1229  TRACE("LsaOpenPolicySce(%s %p 0x%08lx %p)\n",
1230  SystemName ? debugstr_w(SystemName->Buffer) : "(null)",
1231  ObjectAttributes, DesiredAccess, PolicyHandle);
1232 
1233  /* FIXME: RPC should take care of this */
1234  if (!LsapIsLocalComputer(SystemName))
1236 
1237  RpcTryExcept
1238  {
1239  *PolicyHandle = NULL;
1240 
1241  Status = LsarOpenPolicySce(SystemName ? SystemName->Buffer : NULL,
1243  DesiredAccess,
1244  PolicyHandle);
1245  }
1247  {
1249  }
1250  RpcEndExcept;
1251 
1252  TRACE("LsaOpenPolicySce() done (Status: 0x%08lx)\n", Status);
1253 
1254  return Status;
1255 }
1256 
1257 
1258 /*
1259  * @implemented
1260  */
1261 NTSTATUS
1262 WINAPI
1264  IN PLSA_UNICODE_STRING SecretName,
1266  OUT PLSA_HANDLE SecretHandle)
1267 {
1268  NTSTATUS Status;
1269 
1270  TRACE("LsaOpenSecret(%p %p 0x%08lx %p)\n",
1271  PolicyHandle, SecretName, DesiredAccess, SecretHandle);
1272 
1273  RpcTryExcept
1274  {
1275  *SecretHandle = NULL;
1276 
1277  Status = LsarOpenSecret((LSAPR_HANDLE)PolicyHandle,
1278  (PRPC_UNICODE_STRING)SecretName,
1279  DesiredAccess,
1280  SecretHandle);
1281  }
1283  {
1285  }
1286  RpcEndExcept;
1287 
1288  TRACE("LsaOpenSecret() done (Status: 0x%08lx)\n", Status);
1289 
1290  return Status;
1291 }
1292 
1293 
1294 /*
1295  * @implemented
1296  */
1297 NTSTATUS
1298 WINAPI
1300  IN PSID TrustedDomainSid,
1302  OUT PLSA_HANDLE TrustedDomainHandle)
1303 {
1304  NTSTATUS Status;
1305 
1306  TRACE("LsaOpenTrustedDomain(%p %p 0x%08lx %p)\n",
1307  PolicyHandle, TrustedDomainSid, DesiredAccess, TrustedDomainHandle);
1308 
1309  RpcTryExcept
1310  {
1311  Status = LsarOpenTrustedDomain((LSAPR_HANDLE)PolicyHandle,
1312  (PRPC_SID)TrustedDomainSid,
1313  DesiredAccess,
1314  (PLSAPR_HANDLE)TrustedDomainHandle);
1315  }
1317  {
1319  }
1320  RpcEndExcept;
1321 
1322  return Status;
1323 }
1324 
1325 
1326 /*
1327  * @implemented
1328  */
1329 NTSTATUS
1330 WINAPI
1332  IN PLSA_UNICODE_STRING TrustedDomainName,
1334  OUT PLSA_HANDLE TrustedDomainHandle)
1335 {
1336  NTSTATUS Status;
1337 
1338  TRACE("LsaOpenTrustedDomainByName(%p %p 0x%08lx %p)\n",
1339  PolicyHandle, TrustedDomainName, DesiredAccess, TrustedDomainHandle);
1340 
1341  RpcTryExcept
1342  {
1344  (PRPC_UNICODE_STRING)TrustedDomainName,
1345  DesiredAccess,
1346  TrustedDomainHandle);
1347  }
1349  {
1351  }
1352  RpcEndExcept;
1353 
1354  return Status;
1355 }
1356 
1357 
1358 /*
1359  * @implemented
1360  */
1361 NTSTATUS
1362 WINAPI
1365  OUT PVOID *Buffer)
1366 {
1367  PLSAPR_POLICY_DOMAIN_INFORMATION PolicyInformation = NULL;
1368  NTSTATUS Status;
1369 
1370  TRACE("LsaQueryDomainInformationPolicy(%p %lu %p)\n",
1371  PolicyHandle, InformationClass, Buffer);
1372 
1373  RpcTryExcept
1374  {
1377  &PolicyInformation);
1378 
1379  *Buffer = PolicyInformation;
1380  }
1382  {
1383  if (PolicyInformation != NULL)
1384  MIDL_user_free(PolicyInformation);
1385 
1387  }
1388  RpcEndExcept;
1389 
1390  return Status;
1391 }
1392 
1393 
1394 /*
1395  * @implemented
1396  */
1397 NTSTATUS
1398 WINAPI
1400  IN PLSA_UNICODE_STRING TrustedDomainName,
1401  OUT PLSA_FOREST_TRUST_INFORMATION *ForestTrustInfo)
1402 {
1403  NTSTATUS Status;
1404 
1405  TRACE("LsaQueryForestTrustInformation(%p %p %p)\n",
1406  PolicyHandle, TrustedDomainName, ForestTrustInfo);
1407 
1408  RpcTryExcept
1409  {
1411  TrustedDomainName,
1413  ForestTrustInfo);
1414  }
1416  {
1418  }
1419  RpcEndExcept;
1420 
1421  return Status;
1422 }
1423 
1424 
1425 /*
1426  * @implemented
1427  */
1428 NTSTATUS
1429 WINAPI
1432  OUT PVOID *Buffer)
1433 {
1434  PLSAPR_TRUSTED_DOMAIN_INFO TrustedDomainInformation = NULL;
1435  NTSTATUS Status;
1436 
1437  TRACE("LsaQueryInfoTrustedDomain(%p %d %p) stub\n",
1438  TrustedDomainHandle, InformationClass, Buffer);
1439 
1443 
1444  RpcTryExcept
1445  {
1446  Status = LsarQueryInfoTrustedDomain((LSAPR_HANDLE)TrustedDomainHandle,
1448  &TrustedDomainInformation);
1449  *Buffer = TrustedDomainInformation;
1450  }
1452  {
1453  if (TrustedDomainInformation != NULL)
1454  MIDL_user_free(TrustedDomainInformation);
1455 
1457  }
1458  RpcEndExcept;
1459 
1460  TRACE("Done (Status: 0x%08x)\n", Status);
1461 
1462  return Status;
1463 }
1464 
1465 
1466 /*
1467  * @implemented
1468  */
1469 NTSTATUS
1470 WINAPI
1473  OUT PVOID *Buffer)
1474 {
1475  PLSAPR_POLICY_INFORMATION PolicyInformation = NULL;
1476  NTSTATUS Status;
1477 
1478  TRACE("LsaQueryInformationPolicy(%p %d %p)\n",
1479  PolicyHandle, InformationClass, Buffer);
1480 
1481  RpcTryExcept
1482  {
1485  &PolicyInformation);
1486  *Buffer = PolicyInformation;
1487  }
1489  {
1490  if (PolicyInformation != NULL)
1491  MIDL_user_free(PolicyInformation);
1492 
1494  }
1495  RpcEndExcept;
1496 
1497  TRACE("Done (Status: 0x%08x)\n", Status);
1498 
1499  return Status;
1500 }
1501 
1502 
1503 /*
1504  * @implemented
1505  */
1506 NTSTATUS
1507 WINAPI
1509  OUT PLSA_UNICODE_STRING *CurrentValue OPTIONAL,
1510  OUT PLARGE_INTEGER CurrentValueSetTime OPTIONAL,
1511  OUT PLSA_UNICODE_STRING *OldValue OPTIONAL,
1512  OUT PLARGE_INTEGER OldValueSetTime OPTIONAL)
1513 {
1514  PLSAPR_CR_CIPHER_VALUE EncryptedCurrentValue = NULL;
1515  PLSAPR_CR_CIPHER_VALUE EncryptedOldValue = NULL;
1516  PLSA_UNICODE_STRING DecryptedCurrentValue = NULL;
1517  PLSA_UNICODE_STRING DecryptedOldValue = NULL;
1519  NTSTATUS Status;
1520 
1521  TRACE("LsaQuerySecret(%p %p %p %p %p)\n",
1522  SecretHandle, CurrentValue, CurrentValueSetTime,
1523  OldValue, OldValueSetTime);
1524 
1525  RpcTryExcept
1526  {
1527  Status = LsarQuerySecret((PLSAPR_HANDLE)SecretHandle,
1528  &EncryptedCurrentValue,
1529  CurrentValueSetTime,
1530  &EncryptedOldValue,
1531  OldValueSetTime);
1532  }
1534  {
1536  }
1537  RpcEndExcept;
1538 
1539  if (!NT_SUCCESS(Status))
1540  goto done;
1541 
1542  /* Decrypt the current value */
1543  if (CurrentValue != NULL)
1544  {
1545  if (EncryptedCurrentValue == NULL)
1546  {
1547  *CurrentValue = NULL;
1548  }
1549  else
1550  {
1551  /* FIXME: Decrypt the current value */
1552  BufferSize = sizeof(LSA_UNICODE_STRING) + EncryptedCurrentValue->MaximumLength;
1553  DecryptedCurrentValue = midl_user_allocate(BufferSize);
1554  if (DecryptedCurrentValue == NULL)
1555  {
1557  goto done;
1558  }
1559 
1560  DecryptedCurrentValue->Length = (USHORT)EncryptedCurrentValue->Length;
1561  DecryptedCurrentValue->MaximumLength = (USHORT)EncryptedCurrentValue->MaximumLength;
1562  DecryptedCurrentValue->Buffer = (PWSTR)(DecryptedCurrentValue + 1);
1563  RtlCopyMemory(DecryptedCurrentValue->Buffer,
1564  EncryptedCurrentValue->Buffer,
1565  EncryptedCurrentValue->Length);
1566 
1567  *CurrentValue = DecryptedCurrentValue;
1568  }
1569  }
1570 
1571  /* Decrypt the old value */
1572  if (OldValue != NULL)
1573  {
1574  if (EncryptedOldValue == NULL)
1575  {
1576  *OldValue = NULL;
1577  }
1578  else
1579  {
1580  /* FIXME: Decrypt the old value */
1581  BufferSize = sizeof(LSA_UNICODE_STRING) + EncryptedOldValue->MaximumLength;
1582  DecryptedOldValue = midl_user_allocate(BufferSize);
1583  if (DecryptedOldValue == NULL)
1584  {
1586  goto done;
1587  }
1588 
1589  DecryptedOldValue->Length = (USHORT)EncryptedOldValue->Length;
1590  DecryptedOldValue->MaximumLength = (USHORT)EncryptedOldValue->MaximumLength;
1591  DecryptedOldValue->Buffer = (PWSTR)(DecryptedOldValue + 1);
1592  RtlCopyMemory(DecryptedOldValue->Buffer,
1593  EncryptedOldValue->Buffer,
1594  EncryptedOldValue->Length);
1595 
1596  *OldValue = DecryptedOldValue;
1597  }
1598  }
1599 
1600 done:
1601  if (!NT_SUCCESS(Status))
1602  {
1603  if (DecryptedCurrentValue != NULL)
1604  midl_user_free(DecryptedCurrentValue);
1605 
1606  if (DecryptedOldValue != NULL)
1607  midl_user_free(DecryptedOldValue);
1608 
1609  if (CurrentValue != NULL)
1610  *CurrentValue = NULL;
1611 
1612  if (OldValue != NULL)
1613  *OldValue = NULL;
1614  }
1615 
1616  if (EncryptedCurrentValue != NULL)
1617  midl_user_free(EncryptedCurrentValue);
1618 
1619  if (EncryptedOldValue != NULL)
1620  midl_user_free(EncryptedOldValue);
1621 
1622  return Status;
1623 }
1624 
1625 
1626 /*
1627  * @implemented
1628  */
1629 NTSTATUS
1630 WINAPI
1634 {
1637  NTSTATUS Status;
1638 
1639  TRACE("LsaQuerySecurityObject(%p %lx %p)\n",
1640  ObjectHandle, SecurityInformation, SecurityDescriptor);
1641 
1642  SdBuffer.Length = 0;
1643  SdBuffer.SecurityDescriptor = NULL;
1644 
1645  SdPointer = &SdBuffer;
1646 
1647  RpcTryExcept
1648  {
1651  &SdPointer);
1652  if (NT_SUCCESS(Status))
1653  {
1655  }
1656  else
1657  {
1659  }
1660  }
1662  {
1664  }
1665  RpcEndExcept;
1666 
1667  return Status;
1668 }
1669 
1670 
1671 /*
1672  * @implemented
1673  */
1674 NTSTATUS
1675 WINAPI
1677  IN PSID TrustedDomainSid,
1679  OUT PVOID *Buffer)
1680 {
1681  NTSTATUS Status;
1682 
1683  TRACE("LsaQueryTrustedDomainInfo(%p %p %d %p) stub\n",
1684  PolicyHandle, TrustedDomainSid, InformationClass, Buffer);
1685 
1689 
1690  RpcTryExcept
1691  {
1693  (PRPC_SID)TrustedDomainSid,
1696  }
1698  {
1700  }
1701  RpcEndExcept;
1702 
1703  return Status;
1704 }
1705 
1706 
1707 /*
1708  * @implemented
1709  */
1710 NTSTATUS
1711 WINAPI
1713  IN PLSA_UNICODE_STRING TrustedDomainName,
1715  OUT PVOID *Buffer)
1716 {
1717  NTSTATUS Status;
1718 
1719  TRACE("LsaQueryTrustedDomainInfoByName(%p %p %d %p)\n",
1720  PolicyHandle, TrustedDomainName, InformationClass, Buffer);
1721 
1725 
1726  RpcTryExcept
1727  {
1729  (PRPC_UNICODE_STRING)TrustedDomainName,
1732  }
1734  {
1736  }
1737  RpcEndExcept;
1738 
1739  return Status;
1740 }
1741 
1742 
1743 /*
1744  * @implemented
1745  */
1746 NTSTATUS
1747 WINAPI
1749  IN PSID AccountSid,
1750  IN BOOLEAN AllRights,
1751  IN PLSA_UNICODE_STRING UserRights,
1752  IN ULONG CountOfRights)
1753 {
1754  NTSTATUS Status;
1755  LSAPR_USER_RIGHT_SET UserRightSet;
1756 
1757  TRACE("LsaRemoveAccountRights(%p %p %d %p %lu)\n",
1758  PolicyHandle, AccountSid, AllRights, UserRights, CountOfRights);
1759 
1760  UserRightSet.Entries = CountOfRights;
1761  UserRightSet.UserRights = (PRPC_UNICODE_STRING)UserRights;
1762 
1763  RpcTryExcept
1764  {
1766  (PRPC_SID)AccountSid,
1767  AllRights,
1768  &UserRightSet);
1769  }
1771  {
1773  }
1774  RpcEndExcept;
1775 
1776  return Status;
1777 }
1778 
1779 
1780 /*
1781  * @implemented
1782  */
1783 NTSTATUS
1784 WINAPI
1786  IN BOOLEAN AllPrivileges,
1788 {
1789  NTSTATUS Status;
1790 
1791  RpcTryExcept
1792  {
1794  AllPrivileges,
1796  }
1798  {
1800  }
1801  RpcEndExcept;
1802 
1803  return Status;
1804 }
1805 
1806 
1807 /*
1808  * @implemented
1809  */
1810 NTSTATUS
1811 WINAPI
1814  OUT PLSA_UNICODE_STRING *PrivateData)
1815 {
1816  PLSAPR_CR_CIPHER_VALUE EncryptedData = NULL;
1817  PLSA_UNICODE_STRING DecryptedData = NULL;
1819  NTSTATUS Status;
1820 
1821  TRACE("LsaRetrievePrivateData(%p %p %p)\n",
1822  PolicyHandle, KeyName, PrivateData);
1823 
1824  RpcTryExcept
1825  {
1828  &EncryptedData);
1829  }
1831  {
1833  }
1834  RpcEndExcept;
1835 
1836  if (EncryptedData == NULL)
1837  {
1838  *PrivateData = NULL;
1839  }
1840  else
1841  {
1842  BufferSize = sizeof(LSA_UNICODE_STRING) + EncryptedData->MaximumLength;
1843  DecryptedData = midl_user_allocate(BufferSize);
1844  if (DecryptedData == NULL)
1845  {
1847  goto done;
1848  }
1849 
1850  DecryptedData->Length = (USHORT)EncryptedData->Length;
1851  DecryptedData->MaximumLength = (USHORT)EncryptedData->MaximumLength;
1852  DecryptedData->Buffer = (PWSTR)(DecryptedData + 1);
1853  RtlCopyMemory(DecryptedData->Buffer,
1854  EncryptedData->Buffer,
1855  EncryptedData->Length);
1856 
1857  *PrivateData = DecryptedData;
1858  }
1859 
1860 done:
1861  if (!NT_SUCCESS(Status))
1862  {
1863  if (DecryptedData != NULL)
1864  midl_user_free(DecryptedData);
1865 
1866  *PrivateData = NULL;
1867  }
1868 
1869  if (EncryptedData != NULL)
1870  midl_user_free(EncryptedData);
1871 
1872  return Status;
1873 }
1874 
1875 
1876 /*
1877  * @implemented
1878  */
1879 NTSTATUS
1880 WINAPI
1884 {
1885  NTSTATUS Status;
1886 
1887  TRACE("LsaSetDomainInformationPolicy(%p %d %p)\n",
1888  PolicyHandle, InformationClass, Buffer);
1889 
1890  RpcTryExcept
1891  {
1895  }
1897  {
1899  }
1900  RpcEndExcept;
1901 
1902  return Status;
1903 }
1904 
1905 
1906 /*
1907  * @implemented
1908  */
1909 NTSTATUS
1910 WINAPI
1912  IN PLSA_UNICODE_STRING TrustedDomainName,
1913  IN PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo,
1914  IN BOOLEAN CheckOnly,
1916 {
1917  NTSTATUS Status;
1918 
1919  TRACE("LsaSetForestTrustInformation(%p %p %p %d %p)\n",
1920  PolicyHandle, TrustedDomainName, ForestTrustInfo, CheckOnly, CollisionInfo);
1921 
1922  RpcTryExcept
1923  {
1925  TrustedDomainName,
1927  ForestTrustInfo,
1928  CheckOnly,
1929  CollisionInfo);
1930  }
1932  {
1934  }
1935  RpcEndExcept;
1936 
1937  return Status;
1938 }
1939 
1940 
1941 /*
1942  * @implemented
1943  */
1944 NTSTATUS
1945 WINAPI
1948  IN PVOID Buffer)
1949 {
1950  NTSTATUS Status;
1951 
1952  TRACE("LsaSetInformationPolicy(%p %d %p)\n",
1953  PolicyHandle, InformationClass, Buffer);
1954 
1955  RpcTryExcept
1956  {
1960  }
1962  {
1964  }
1965  RpcEndExcept;
1966 
1967  return Status;
1968 }
1969 
1970 
1971 /*
1972  * @unimplemented
1973  */
1974 NTSTATUS
1975 WINAPI
1978  IN PVOID Buffer)
1979 {
1980  FIXME("LsaSetInformationTrustedDomain(%p %d %p)\n",
1981  TrustedDomainHandle, InformationClass, Buffer);
1982  return STATUS_NOT_IMPLEMENTED;
1983 }
1984 
1985 
1986 /*
1987  * @implemented
1988  */
1989 NTSTATUS
1990 WINAPI
1992  IN PQUOTA_LIMITS QuotaLimits)
1993 {
1994  NTSTATUS Status;
1995 
1996  TRACE("LsaSetQuotasForAccount(%p %p)\n",
1997  AccountHandle, QuotaLimits);
1998 
1999  RpcTryExcept
2000  {
2001  Status = LsarSetQuotasForAccount((LSAPR_HANDLE)AccountHandle,
2002  QuotaLimits);
2003  }
2005  {
2007  }
2008  RpcEndExcept;
2009 
2010  return Status;
2011 }
2012 
2013 
2014 /*
2015  * @implemented
2016  */
2017 NTSTATUS
2018 WINAPI
2020  IN PLSA_UNICODE_STRING CurrentValue OPTIONAL,
2021  IN PLSA_UNICODE_STRING OldValue OPTIONAL)
2022 {
2023  PLSAPR_CR_CIPHER_VALUE EncryptedCurrentValue = NULL;
2024  PLSAPR_CR_CIPHER_VALUE EncryptedOldValue = NULL;
2026  NTSTATUS Status;
2027 
2028  TRACE("LsaSetSecret(%p %p %p)\n",
2029  SecretHandle, EncryptedCurrentValue, EncryptedOldValue);
2030 
2031  if (CurrentValue != NULL)
2032  {
2033  BufferSize = sizeof(LSAPR_CR_CIPHER_VALUE) + CurrentValue->MaximumLength;
2034  EncryptedCurrentValue = midl_user_allocate(BufferSize);
2035  if (EncryptedCurrentValue == NULL)
2036  {
2038  goto done;
2039  }
2040 
2041  EncryptedCurrentValue->Length = CurrentValue->Length;
2042  EncryptedCurrentValue->MaximumLength = CurrentValue->MaximumLength;
2043  EncryptedCurrentValue->Buffer = (BYTE *)(EncryptedCurrentValue + 1);
2044  if (EncryptedCurrentValue->Buffer != NULL)
2045  memcpy(EncryptedCurrentValue->Buffer, CurrentValue->Buffer, CurrentValue->Length);
2046  }
2047 
2048  if (OldValue != NULL)
2049  {
2050  BufferSize = sizeof(LSAPR_CR_CIPHER_VALUE) + OldValue->MaximumLength;
2051  EncryptedOldValue = midl_user_allocate(BufferSize);
2052  if (EncryptedOldValue == NULL)
2053  {
2055  goto done;
2056  }
2057 
2058  EncryptedOldValue->Length = OldValue->Length;
2059  EncryptedOldValue->MaximumLength = OldValue->MaximumLength;
2060  EncryptedOldValue->Buffer = (BYTE*)(EncryptedOldValue + 1);
2061  if (EncryptedOldValue->Buffer != NULL)
2062  memcpy(EncryptedOldValue->Buffer, OldValue->Buffer, OldValue->Length);
2063  }
2064 
2065  RpcTryExcept
2066  {
2067  Status = LsarSetSecret((LSAPR_HANDLE)SecretHandle,
2068  EncryptedCurrentValue,
2069  EncryptedOldValue);
2070  }
2072  {
2074  }
2075  RpcEndExcept;
2076 
2077 done:
2078  if (EncryptedCurrentValue != NULL)
2079  midl_user_free(EncryptedCurrentValue);
2080 
2081  if (EncryptedOldValue != NULL)
2082  midl_user_free(EncryptedOldValue);
2083 
2084  return Status;
2085 }
2086 
2087 
2088 /*
2089  * @implemented
2090  */
2091 NTSTATUS
2092 WINAPI
2096 {
2097  LSAPR_SR_SECURITY_DESCRIPTOR SdBuffer = {0, NULL};
2098  ULONG SdLength = 0;
2099  NTSTATUS Status;
2100 
2101  TRACE("LsaSetSecurityObject(%p %lx %p)\n",
2102  ObjectHandle, SecurityInformation, SecurityDescriptor);
2103 
2105  NULL,
2106  &SdLength);
2108  return STATUS_INVALID_PARAMETER;
2109 
2110  SdBuffer.SecurityDescriptor = MIDL_user_allocate(SdLength);
2111  if (SdBuffer.SecurityDescriptor == NULL)
2113 
2116  &SdLength);
2117  if (!NT_SUCCESS(Status))
2118  goto done;
2119 
2120  SdBuffer.Length = SdLength;
2121 
2122  RpcTryExcept
2123  {
2124  Status = LsarSetSecurityObject((LSAPR_HANDLE)ObjectHandle,
2126  &SdBuffer);
2127  }
2129  {
2131  }
2132  RpcEndExcept;
2133 
2134 done:
2135  if (SdBuffer.SecurityDescriptor != NULL)
2137 
2138  return Status;
2139 }
2140 
2141 
2142 /*
2143  * @implemented
2144  */
2145 NTSTATUS
2146 WINAPI
2148  IN ULONG SystemAccess)
2149 {
2150  NTSTATUS Status;
2151 
2152  TRACE("LsaSetSystemAccessAccount(%p 0x%lx)\n",
2153  AccountHandle, SystemAccess);
2154 
2155  RpcTryExcept
2156  {
2158  SystemAccess);
2159  }
2161  {
2163  }
2164  RpcEndExcept;
2165 
2166  return Status;
2167 }
2168 
2169 
2170 /*
2171  * @unimplemented
2172  */
2173 NTSTATUS
2174 WINAPI
2176  IN PLSA_UNICODE_STRING TrustedDomainName,
2178  IN PVOID Buffer)
2179 {
2180  FIXME("LsaSetTrustedDomainInfoByName(%p %p %d %p) stub\n",
2181  PolicyHandle, TrustedDomainName, InformationClass, Buffer);
2182  return STATUS_SUCCESS;
2183 }
2184 
2185 
2186 /*
2187  * @unimplemented
2188  */
2189 NTSTATUS
2190 WINAPI
2192  IN PSID TrustedDomainSid,
2194  IN PVOID Buffer)
2195 {
2196  FIXME("LsaSetTrustedDomainInformation(%p %p %d %p) stub\n",
2197  PolicyHandle, TrustedDomainSid, InformationClass, Buffer);
2198  return STATUS_SUCCESS;
2199 }
2200 
2201 
2202 /*
2203  * @implemented
2204  */
2205 NTSTATUS
2206 WINAPI
2209  IN PLSA_UNICODE_STRING PrivateData OPTIONAL)
2210 {
2211  PLSAPR_CR_CIPHER_VALUE EncryptedData = NULL;
2213  NTSTATUS Status;
2214 
2215  TRACE("LsaStorePrivateData(%p %p %p)\n",
2216  PolicyHandle, KeyName, PrivateData);
2217 
2218  if (PrivateData != NULL)
2219  {
2220  BufferSize = sizeof(LSAPR_CR_CIPHER_VALUE) + PrivateData->MaximumLength;
2221  EncryptedData = midl_user_allocate(BufferSize);
2222  if (EncryptedData == NULL)
2223  {
2225  goto done;
2226  }
2227 
2228  EncryptedData->Length = PrivateData->Length;
2229  EncryptedData->MaximumLength = PrivateData->MaximumLength;
2230  EncryptedData->Buffer = (BYTE *)(EncryptedData + 1);
2231  if (EncryptedData->Buffer != NULL)
2232  RtlCopyMemory(EncryptedData->Buffer,
2233  PrivateData->Buffer,
2234  PrivateData->Length);
2235  }
2236 
2237  RpcTryExcept
2238  {
2239  Status = LsarStorePrivateData((LSAPR_HANDLE)PolicyHandle,
2241  EncryptedData);
2242  }
2244  {
2246  }
2247  RpcEndExcept;
2248 
2249 done:
2250  if (EncryptedData != NULL)
2251  midl_user_free(EncryptedData);
2252 
2253  return Status;
2254 }
2255 
2256 /* EOF */
NTSTATUS WINAPI LsarLookupNames3(LSAPR_HANDLE PolicyHandle, DWORD Count, PRPC_UNICODE_STRING Names, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
Definition: lsarpc.c:4138
NTSTATUS WINAPI LsaEnumeratePrivilegesOfAccount(IN LSA_HANDLE AccountHandle, OUT PPRIVILEGE_SET *Privileges)
Definition: lsa.c:575
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:877
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
NTSTATUS WINAPI LsaSetSystemAccessAccount(IN LSA_HANDLE AccountHandle, IN ULONG SystemAccess)
Definition: lsa.c:2147
NTSTATUS WINAPI LsarSetForestTrustInformation(LSAPR_HANDLE PolicyHandle, PLSA_UNICODE_STRING TrustedDomainName, LSA_FOREST_TRUST_RECORD_TYPE HighestRecordType, PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo, BOOLEAN CheckOnly, PLSA_FOREST_TRUST_COLLISION_INFORMATION *CollisionInfo)
Definition: lsarpc.c:4238
NTSTATUS WINAPI LsarQueryInfoTrustedDomain(LSAPR_HANDLE TrustedDomainHandle, TRUSTED_INFORMATION_CLASS InformationClass, PLSAPR_TRUSTED_DOMAIN_INFO *TrustedDomainInformation)
Definition: lsarpc.c:2064
#define IN
Definition: typedefs.h:38
PWSTR Names[NAMES_COUNT]
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: lang.c:806
#define midl_user_free
Definition: rpc.h:45
#define RpcEndExcept
Definition: rpc.h:128
NTSTATUS WINAPI LsarOpenTrustedDomainByName(LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING TrustedDomainName, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *TrustedDomainHandle)
Definition: lsarpc.c:3892
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:784
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS WINAPI LsarEnumeratePrivileges(LSAPR_HANDLE PolicyHandle, DWORD *EnumerationContext, PLSAPR_PRIVILEGE_ENUM_BUFFER EnumerationBuffer, DWORD PreferedMaximumLength)
Definition: lsarpc.c:166
NTSTATUS WINAPI LsarQueryDomainInformationPolicy(LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_DOMAIN_INFORMATION *PolicyInformation)
Definition: lsarpc.c:3866
handle_t __RPC_USER PLSAPR_SERVER_NAME_bind(PLSAPR_SERVER_NAME pszSystemName)
Definition: lsa.c:43
NTSTATUS WINAPI LsaQueryInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
Definition: lsa.c:1471
LPWSTR PLSAPR_SERVER_NAME
Definition: lsa.idl:7
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
handle_t hBinding
Definition: ctx_c.c:54
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:177
LANGID WINAPI GetSystemDefaultUILanguage(void)
Definition: lang.c:826
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:182
#define midl_user_allocate
Definition: rpc.h:44
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
NTSTATUS WINAPI LsarSetSecret(LSAPR_HANDLE SecretHandle, PLSAPR_CR_CIPHER_VALUE EncryptedCurrentValue, PLSAPR_CR_CIPHER_VALUE EncryptedOldValue)
Definition: lsarpc.c:2146
uint16_t * PWSTR
Definition: typedefs.h:54
NTSTATUS WINAPI LsaStorePrivateData(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING KeyName, IN PLSA_UNICODE_STRING PrivateData OPTIONAL)
Definition: lsa.c:2207
NTSTATUS WINAPI LsaOpenTrustedDomainByName(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING TrustedDomainName, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE TrustedDomainHandle)
Definition: lsa.c:1331
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
NTSTATUS WINAPI LsaCreateTrustedDomain(IN LSA_HANDLE PolicyHandle, IN PLSA_TRUST_INFORMATION TrustedDomainInformation, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE TrustedDomainHandle)
Definition: lsa.c:281
PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX EnumerationBuffer
Definition: lsa.idl:442
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
NTSTATUS WINAPI LsaLookupNames(IN LSA_HANDLE PolicyHandle, IN ULONG Count, IN PLSA_UNICODE_STRING Names, OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, OUT PLSA_TRANSLATED_SID *Sids)
Definition: lsa.c:853
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
Definition: lsa.c:192
NTSTATUS WINAPI LsarRemovePrivilegesFromAccount(LSAPR_HANDLE AccountHandle, BOOLEAN AllPrivileges, PLSAPR_PRIVILEGE_SET Privileges)
Definition: lsarpc.c:1719
NTSTATUS WINAPI LsarSetSystemAccessAccount(LSAPR_HANDLE AccountHandle, ACCESS_MASK SystemAccess)
Definition: lsarpc.c:2012
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
ULONG * PLSA_ENUMERATION_HANDLE
Definition: ntsecapi.h:360
NTSTATUS WINAPI LsaSetQuotasForAccount(IN LSA_HANDLE AccountHandle, IN PQUOTA_LIMITS QuotaLimits)
Definition: lsa.c:1991
enum _POLICY_DOMAIN_INFORMATION_CLASS POLICY_DOMAIN_INFORMATION_CLASS
NTSTATUS WINAPI LsarEnumeratePrivilegesAccount(LSAPR_HANDLE AccountHandle, PLSAPR_PRIVILEGE_SET *Privileges)
Definition: lsarpc.c:1504
NTSTATUS WINAPI LsaSetSecret(IN LSA_HANDLE SecretHandle, IN PLSA_UNICODE_STRING CurrentValue OPTIONAL, IN PLSA_UNICODE_STRING OldValue OPTIONAL)
Definition: lsa.c:2019
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:440
NTSTATUS WINAPI LsaEnumerateTrustedDomains(IN LSA_HANDLE PolicyHandle, IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext, OUT PVOID *Buffer, IN ULONG PreferedMaximumLength, OUT PULONG CountReturned)
Definition: lsa.c:603
NTSTATUS WINAPI LsaCreateTrustedDomainEx(IN LSA_HANDLE PolicyHandle, IN PTRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation, IN PTRUSTED_DOMAIN_AUTH_INFORMATION AuthenticationInformation, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE TrustedDomainHandle)
Definition: lsa.c:313
NTSTATUS WINAPI LsaLookupSids(IN LSA_HANDLE PolicyHandle, IN ULONG Count, IN PSID *Sids, OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, OUT PLSA_TRANSLATED_NAME *Names)
Definition: lsa.c:1067
NTSTATUS WINAPI LsarOpenSecret(LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING SecretName, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *SecretHandle)
Definition: lsarpc.c:2090
NTSTATUS WINAPI LsaSetInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_INFORMATION_CLASS InformationClass, IN PVOID Buffer)
Definition: lsa.c:1946
NTSTATUS WINAPI LsarEnumerateAccountRights(LSAPR_HANDLE PolicyHandle, PRPC_SID AccountSid, PLSAPR_USER_RIGHT_SET UserRights)
Definition: lsarpc.c:2853
RPC_STATUS WINAPI RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr, RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR *StringBinding)
Definition: rpc_binding.c:511
NTSTATUS WINAPI LsarGetUserName(LPWSTR SystemName, PRPC_UNICODE_STRING *UserName, PRPC_UNICODE_STRING *DomainName)
Definition: lsarpc.c:3739
PLSA_TRANSLATED_SID Sids
Definition: lsa.idl:144
NTSTATUS WINAPI LsarCreateTrustedDomain(LSAPR_HANDLE PolicyHandle, PLSAPR_TRUST_INFORMATION TrustedDomainInformation, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *TrustedDomainHandle)
Definition: lsarpc.c:1158
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
NTSTATUS WINAPI LsaOpenTrustedDomain(IN LSA_HANDLE PolicyHandle, IN PSID TrustedDomainSid, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE TrustedDomainHandle)
Definition: lsa.c:1299
NTSTATUS WINAPI LsaOpenPolicy(IN PLSA_UNICODE_STRING SystemName OPTIONAL, IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE PolicyHandle)
Definition: lsa.c:1181
long RPC_STATUS
Definition: rpc.h:52
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
NTSTATUS WINAPI LsaLookupPrivilegeName(IN LSA_HANDLE PolicyHandle, IN PLUID Value, OUT PUNICODE_STRING *Name)
Definition: lsa.c:998
NTSTATUS WINAPI LsaGetSystemAccessAccount(IN LSA_HANDLE AccountHandle, OUT PULONG SystemAccess)
Definition: lsa.c:783
NTSTATUS WINAPI LsarAddAccountRights(LSAPR_HANDLE PolicyHandle, PRPC_SID AccountSid, PLSAPR_USER_RIGHT_SET UserRights)
Definition: lsarpc.c:3003
NTSTATUS WINAPI LsarQuerySecret(LSAPR_HANDLE SecretHandle, PLSAPR_CR_CIPHER_VALUE *EncryptedCurrentValue, PLARGE_INTEGER CurrentValueSetTime, PLSAPR_CR_CIPHER_VALUE *EncryptedOldValue, PLARGE_INTEGER OldValueSetTime)
Definition: lsarpc.c:2246
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD SECURITY_INFORMATION
Definition: ms-dtyp.idl:311
#define debugstr_w
Definition: kernel32.h:32
NTSTATUS WINAPI LsarAddPrivilegesToAccount(LSAPR_HANDLE AccountHandle, PLSAPR_PRIVILEGE_SET Privileges)
Definition: lsarpc.c:1563
NTSTATUS WINAPI LsarCreateSecret(LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING SecretName, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *SecretHandle)
Definition: lsarpc.c:1319
#define FIXME(fmt,...)
Definition: debug.h:110
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
NTSTATUS WINAPI LsaLookupPrivilegeValue(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING Name, OUT PLUID Value)
Definition: lsa.c:1034
NTSTATUS WINAPI LsaRetrievePrivateData(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING KeyName, OUT PLSA_UNICODE_STRING *PrivateData)
Definition: lsa.c:1812
struct _LSA_TRANSLATED_SID * PLSA_TRANSLATED_SID
unsigned char BOOLEAN
NTSTATUS WINAPI LsarSetSecurityObject(LSAPR_HANDLE ObjectHandle, SECURITY_INFORMATION SecurityInformation, PLSAPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor)
Definition: lsarpc.c:323
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS WINAPI LsarCreateAccount(LSAPR_HANDLE PolicyHandle, PRPC_SID AccountSid, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *AccountHandle)
Definition: lsarpc.c:883
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
NTSTATUS WINAPI LsarOpenTrustedDomain(LSAPR_HANDLE PolicyHandle, PRPC_SID TrustedDomainSid, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *TrustedDomainHandle)
Definition: lsarpc.c:2046
NTSTATUS WINAPI LsarGetQuotasForAccount(LSAPR_HANDLE AccountHandle, PQUOTA_LIMITS QuotaLimits)
Definition: lsarpc.c:1878
NTSTATUS WINAPI LsaCreateSecret(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING SecretName, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE SecretHandle)
Definition: lsa.c:249
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION SecurityInformation
Definition: fltkernel.h:1339
static BOOL LsapIsLocalComputer(PLSA_UNICODE_STRING ServerName)
Definition: lsa.c:21
Definition: bufpool.h:45
WINE_DEFAULT_DEBUG_CHANNEL(advapi)
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
Definition: lsa.c:699
NTSTATUS WINAPI LsaClearAuditLog(IN LSA_HANDLE PolicyHandle)
Definition: lsa.c:167
#define __RPC_USER
Definition: rpc.h:65
NTSTATUS WINAPI LsarOpenAccount(LSAPR_HANDLE PolicyHandle, PRPC_SID AccountSid, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *AccountHandle)
Definition: lsarpc.c:1465
NTSTATUS WINAPI LsarRetrievePrivateData(LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING KeyName, PLSAPR_CR_CIPHER_VALUE *EncryptedData)
Definition: lsarpc.c:3618
NTSTATUS WINAPI LsarDelete(LSAPR_HANDLE ObjectHandle)
Definition: lsarpc.c:154
struct _LSA_UNICODE_STRING LSA_UNICODE_STRING
NTSTATUS WINAPI LsarSetQuotasForAccount(LSAPR_HANDLE AccountHandle, PQUOTA_LIMITS QuotaLimits)
Definition: lsarpc.c:1913
NTSTATUS WINAPI LsaQuerySecurityObject(IN LSA_HANDLE ObjectHandle, IN SECURITY_INFORMATION SecurityInformation, OUT PSECURITY_DESCRIPTOR *SecurityDescriptor)
Definition: lsa.c:1631
NTSTATUS WINAPI LsarQueryInformationPolicy(LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: lsarpc.c:531
NTSTATUS WINAPI LsarLookupSids(LSAPR_HANDLE PolicyHandle, PLSAPR_SID_ENUM_BUFFER SidEnumBuffer, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_NAMES TranslatedNames, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount)
Definition: lsarpc.c:1256
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
struct _LSA_TRANSLATED_SID2 * PLSA_TRANSLATED_SID2
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
PLSAPR_TRANSLATED_NAME Names
Definition: lsa.idl:174
enum _TRUSTED_INFORMATION_CLASS TRUSTED_INFORMATION_CLASS
NTSTATUS WINAPI LsaEnumerateAccountsWithUserRight(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING UserRight OPTIONAL, OUT PVOID *Buffer, OUT PULONG CountReturned)
Definition: lsa.c:489
NTSTATUS WINAPI LsaEnumerateAccounts(IN LSA_HANDLE PolicyHandle, IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext, OUT PVOID *Buffer, IN ULONG PreferedMaximumLength, OUT PULONG CountReturned)
Definition: lsa.c:445
__wchar_t WCHAR
Definition: xmlstorage.h:180
ULONG WINAPI LsaNtStatusToWinError(IN NTSTATUS Status)
Definition: lsa.c:1129
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS WINAPI LsaQueryInfoTrustedDomain(IN LSA_HANDLE TrustedDomainHandle, IN TRUSTED_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
Definition: lsa.c:1430
PLSAPR_TRANSLATED_SID_EX2 Sids
Definition: lsa.idl:210
NTSTATUS WINAPI LsarLookupNames(LSAPR_HANDLE PolicyHandle, DWORD Count, PRPC_UNICODE_STRING Names, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_SIDS TranslatedSids, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount)
Definition: lsarpc.c:1192
NTSTATUS WINAPI LsarQueryTrustedDomainInfo(LSAPR_HANDLE PolicyHandle, PRPC_SID TrustedDomainSid, TRUSTED_INFORMATION_CLASS InformationClass, PLSAPR_TRUSTED_DOMAIN_INFO *TrustedDomainInformation)
Definition: lsarpc.c:3410
NTSTATUS WINAPI LsaCreateAccount(IN LSA_HANDLE PolicyHandle, IN PSID AccountSid, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE AccountHandle)
Definition: lsa.c:217
NTSTATUS WINAPI LsaQueryForestTrustInformation(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING TrustedDomainName, OUT PLSA_FOREST_TRUST_INFORMATION *ForestTrustInfo)
Definition: lsa.c:1399
NTSTATUS WINAPI LsarEnumerateTrustedDomainsEx(LSAPR_HANDLE PolicyHandle, DWORD *EnumerationContext, PLSAPR_TRUSTED_ENUM_BUFFER_EX EnumerationBuffer, DWORD PreferedMaximumLength)
Definition: lsarpc.c:3816
NTSTATUS WINAPI LsarEnumerateTrustedDomains(LSAPR_HANDLE PolicyHandle, DWORD *EnumerationContext, PLSAPR_TRUSTED_ENUM_BUFFER EnumerationBuffer, DWORD PreferedMaximumLength)
Definition: lsarpc.c:1176
#define WINAPI
Definition: msvc.h:8
enum _POLICY_INFORMATION_CLASS POLICY_INFORMATION_CLASS
NTSTATUS WINAPI LsaDeleteTrustedDomain(IN LSA_HANDLE PolicyHandle, IN PSID TrustedDomainSid)
Definition: lsa.c:376
NTSTATUS WINAPI LsaSetTrustedDomainInformation(IN LSA_HANDLE PolicyHandle, IN PSID TrustedDomainSid, IN TRUSTED_INFORMATION_CLASS InformationClass, IN PVOID Buffer)
Definition: lsa.c:2191
#define BufferSize
Definition: classpnp.h:419
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSTATUS WINAPI LsaGetRemoteUserName(IN PLSA_UNICODE_STRING SystemName OPTIONAL, OUT PLSA_UNICODE_STRING *UserName, OUT PLSA_UNICODE_STRING *DomainName OPTIONAL)
Definition: lsa.c:739
NTSTATUS WINAPI LsarDeleteTrustedDomain(LSAPR_HANDLE PolicyHandle, PRPC_SID TrustedDomainSid)
Definition: lsarpc.c:3446
NTSTATUS WINAPI LsaSetInformationTrustedDomain(IN LSA_HANDLE TrustedDomainHandle, IN TRUSTED_INFORMATION_CLASS InformationClass, IN PVOID Buffer)
Definition: lsa.c:1976
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET * Privileges
Definition: sefuncs.h:13
NTSTATUS WINAPI LsaEnumerateTrustedDomainsEx(IN LSA_HANDLE PolicyHandle, IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext, OUT PVOID *Buffer, IN ULONG PreferedMaximumLength, OUT PULONG CountReturned)
Definition: lsa.c:651
NTSTATUS WINAPI LsarClose(LSAPR_HANDLE *ObjectHandle)
Definition: lsarpc.c:125
NTSTATUS WINAPI LsaOpenPolicySce(IN PLSA_UNICODE_STRING SystemName OPTIONAL, IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE PolicyHandle)
Definition: lsa.c:1222
NTSTATUS WINAPI LsarSetDomainInformationPolicy(LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_DOMAIN_INFORMATION PolicyInformation)
Definition: lsarpc.c:3879
NTSTATUS WINAPI LsarLookupPrivilegeName(LSAPR_HANDLE PolicyHandle, PLUID Value, PRPC_UNICODE_STRING *Name)
Definition: lsarpc.c:2464
NTSTATUS WINAPI LsaQueryDomainInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_DOMAIN_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
Definition: lsa.c:1363
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:226
NTSTATUS WINAPI LsaSetTrustedDomainInfoByName(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING TrustedDomainName, IN TRUSTED_INFORMATION_CLASS InformationClass, IN PVOID Buffer)
Definition: lsa.c:2175
static const WCHAR L[]
Definition: oid.c:1250
NTSTATUS WINAPI LsaOpenAccount(IN LSA_HANDLE PolicyHandle, IN PSID AccountSid, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE AccountHandle)
Definition: lsa.c:1141
NTSTATUS WINAPI LsaDelete(IN LSA_HANDLE ObjectHandle)
Definition: lsa.c:351
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
NTSTATUS WINAPI LsarQuerySecurityObject(LSAPR_HANDLE ObjectHandle, SECURITY_INFORMATION SecurityInformation, PLSAPR_SR_SECURITY_DESCRIPTOR *SecurityDescriptor)
Definition: lsarpc.c:198
NTSTATUS WINAPI LsaQuerySecret(IN LSA_HANDLE SecretHandle, OUT PLSA_UNICODE_STRING *CurrentValue OPTIONAL, OUT PLARGE_INTEGER CurrentValueSetTime OPTIONAL, OUT PLSA_UNICODE_STRING *OldValue OPTIONAL, OUT PLARGE_INTEGER OldValueSetTime OPTIONAL)
Definition: lsa.c:1508
NTSTATUS WINAPI LsaAddPrivilegesToAccount(IN LSA_HANDLE AccountHandle, IN PPRIVILEGE_SET PrivilegeSet)
Definition: lsa.c:139
struct _LSA_UNICODE_STRING * PLSA_UNICODE_STRING
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
NTSTATUS WINAPI LsarRemoveAccountRights(LSAPR_HANDLE PolicyHandle, PRPC_SID AccountSid, BOOLEAN AllRights, PLSAPR_USER_RIGHT_SET UserRights)
Definition: lsarpc.c:3214
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
NTSTATUS WINAPI LsaAddAccountRights(IN LSA_HANDLE PolicyHandle, IN PSID AccountSid, IN PLSA_UNICODE_STRING UserRights, IN ULONG CountOfRights)
Definition: lsa.c:103
ULONG_PTR SIZE_T
Definition: typedefs.h:78
NTSTATUS WINAPI LsarQueryTrustedDomainInfoByName(LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING TrustedDomainName, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_TRUSTED_DOMAIN_INFO *PolicyInformation)
Definition: lsarpc.c:3780
NTSTATUS WINAPI LsaEnumeratePrivileges(IN LSA_HANDLE PolicyHandle, IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext, OUT PVOID *Buffer, IN ULONG PreferedMaximumLength, OUT PULONG CountReturned)
Definition: lsa.c:530
NTSTATUS WINAPI LsaRemoveAccountRights(IN LSA_HANDLE PolicyHandle, IN PSID AccountSid, IN BOOLEAN AllRights, IN PLSA_UNICODE_STRING UserRights, IN ULONG CountOfRights)
Definition: lsa.c:1748
PLSAPR_TRUST_INFORMATION Information
Definition: lsa.idl:344
NTSTATUS WINAPI LsaOpenSecret(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING SecretName, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE SecretHandle)
Definition: lsa.c:1263
USHORT MaximumLength
Definition: ntsecapi.h:164
NTSTATUS WINAPI LsarOpenPolicySce(LPWSTR SystemName, PLSAPR_OBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *PolicyHandle)
Definition: lsarpc.c:4346
unsigned short USHORT
Definition: pedump.c:61
PLSAPR_POLICY_PRIVILEGE_DEF Privileges
Definition: lsa.idl:88
NTSTATUS WINAPI LsarEnumerateAccounts(LSAPR_HANDLE PolicyHandle, DWORD *EnumerationContext, PLSAPR_ACCOUNT_ENUM_BUFFER EnumerationBuffer, DWORD PreferedMaximumLength)
Definition: lsarpc.c:928
NTSTATUS WINAPI LsaSetForestTrustInformation(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING TrustedDomainName, IN PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo, IN BOOLEAN CheckOnly, OUT PLSA_FOREST_TRUST_COLLISION_INFORMATION *CollisionInfo)
Definition: lsa.c:1911
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
unsigned int * PULONG
Definition: retypes.h:1
NTSTATUS WINAPI LsarStorePrivateData(LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING KeyName, PLSAPR_CR_CIPHER_VALUE EncryptedData)
Definition: lsarpc.c:3462
NTSTATUS WINAPI LsarCreateTrustedDomainEx2(LSAPR_HANDLE PolicyHandle, PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation, PLSAPR_TRUSTED_DOMAIN_AUTH_INFORMATION_INTERNAL AuthentificationInformation, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *TrustedDomainHandle)
Definition: lsarpc.c:4025
NTSTATUS WINAPI LsarOpenPolicy(LPWSTR SystemName, PLSAPR_OBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *PolicyHandle)
Definition: lsarpc.c:495
NTSTATUS WINAPI LsaEnumerateAccountRights(IN LSA_HANDLE PolicyHandle, IN PSID AccountSid, OUT PLSA_UNICODE_STRING *UserRights, OUT PULONG CountOfRights)
Definition: lsa.c:404
UNICODE_STRING * PUNICODE_STRING
Definition: env_spec_w32.h:373
struct _LSAPR_CR_CIPHER_VALUE LSAPR_CR_CIPHER_VALUE
PLSAPR_ACCOUNT_INFORMATION Information
Definition: lsa.idl:97
struct _LSAPR_SID_INFORMATION * PLSAPR_SID_INFORMATION
NTSTATUS WINAPI LsaRemovePrivilegesFromAccount(IN LSA_HANDLE AccountHandle, IN BOOLEAN AllPrivileges, IN PPRIVILEGE_SET Privileges OPTIONAL)
Definition: lsa.c:1785
#define OUT
Definition: typedefs.h:39
struct _LSA_TRANSLATED_NAME * PLSA_TRANSLATED_NAME
NTSTATUS WINAPI LsarLookupPrivilegeDisplayName(LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING Name, USHORT ClientLanguage, USHORT ClientSystemDefaultLanguage, PRPC_UNICODE_STRING *DisplayName, USHORT *LanguageReturned)
Definition: lsarpc.c:2494
struct _RPC_UNICODE_STRING * PRPC_UNICODE_STRING
NTSTATUS WINAPI LsaSetDomainInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_DOMAIN_INFORMATION_CLASS InformationClass, IN PVOID Buffer OPTIONAL)
Definition: lsa.c:1881
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS WINAPI LsaLookupNames2(IN LSA_HANDLE PolicyHandle, IN ULONG Flags, IN ULONG Count, IN PLSA_UNICODE_STRING Names, OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, OUT PLSA_TRANSLATED_SID2 *Sids)
Definition: lsa.c:904
void *__RPC_USER MIDL_user_allocate(SIZE_T size)
Definition: irotp.c:371
NTSTATUS WINAPI LsaQueryTrustedDomainInfoByName(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING TrustedDomainName, IN TRUSTED_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
Definition: lsa.c:1712
NTSTATUS WINAPI LsaGetQuotasForAccount(IN LSA_HANDLE AccountHandle, OUT PQUOTA_LIMITS QuotaLimits)
Definition: lsa.c:711
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1714
NTSTATUS WINAPI LsaQueryTrustedDomainInfo(IN LSA_HANDLE PolicyHandle, IN PSID TrustedDomainSid, IN TRUSTED_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
Definition: lsa.c:1676
NTSTATUS WINAPI LsaSetSecurityObject(IN LSA_HANDLE ObjectHandle, IN SECURITY_INFORMATION SecurityInformation, IN PSECURITY_DESCRIPTOR SecurityDescriptor)
Definition: lsa.c:2093
return STATUS_SUCCESS
Definition: btrfs.c:2966
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
NTSTATUS WINAPI LsaGetUserName(OUT PUNICODE_STRING *UserName, OUT PUNICODE_STRING *DomainName OPTIONAL)
Definition: lsa.c:811
NTSTATUS WINAPI LsarGetSystemAccessAccount(LSAPR_HANDLE AccountHandle, ACCESS_MASK *SystemAccess)
Definition: lsarpc.c:1977
NTSTATUS WINAPI LsaLookupPrivilegeDisplayName(IN LSA_HANDLE PolicyHandle, IN PLSA_UNICODE_STRING Name, OUT PLSA_UNICODE_STRING *DisplayName, OUT PUSHORT LanguageReturned)
Definition: lsa.c:958
NTSYSAPI NTSTATUS NTAPI RtlMakeSelfRelativeSD(_In_ PSECURITY_DESCRIPTOR AbsoluteSD, _Out_ PSECURITY_DESCRIPTOR SelfRelativeSD, _Inout_ PULONG BufferLength)
PLSAPR_SID_INFORMATION SidInfo
Definition: lsa.idl:163
static SERVICE_STATUS status
Definition: service.c:31
NTSTATUS WINAPI LsarEnumerateAccountsWithUserRight(LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING UserRight, PLSAPR_ACCOUNT_ENUM_BUFFER EnumerationBuffer)
Definition: lsarpc.c:2574
void __RPC_USER PLSAPR_SERVER_NAME_unbind(PLSAPR_SERVER_NAME pszSystemName, handle_t hBinding)
Definition: lsa.c:83
NTSTATUS WINAPI LsarSetInformationPolicy(LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_INFORMATION PolicyInformation)
Definition: lsarpc.c:663
#define HeapFree(x, y, z)
Definition: compat.h:394
PRPC_UNICODE_STRING UserRights
Definition: lsa.idl:393
unsigned short * PUSHORT
Definition: retypes.h:2
ULONG ACCESS_MASK
Definition: nt_native.h:40
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
NTSTATUS WINAPI LsarQueryForestTrustInformation(LSAPR_HANDLE PolicyHandle, PLSA_UNICODE_STRING TrustedDomainName, LSA_FOREST_TRUST_RECORD_TYPE HighestRecordType, PLSA_FOREST_TRUST_INFORMATION *ForestTrustInfo)
Definition: lsarpc.c:4224
NTSTATUS WINAPI LsarClearAuditLog(LSAPR_HANDLE ObjectHandle)
Definition: lsarpc.c:804
#define RPC_NT_SERVER_UNAVAILABLE
Definition: ntstatus.h:982
#define RpcExcept(expr)
Definition: rpc.h:127
NTSTATUS WINAPI LsarLookupPrivilegeValue(LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING Name, PLUID Value)
Definition: lsarpc.c:2428
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:741
Definition: ps.c:97
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68