ReactOS  0.4.15-dev-3017-g1d9542d
samlib.c
Go to the documentation of this file.
1 /*
2  * ReactOS kernel
3  * Copyright (C) 2004 ReactOS Team
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 /*
20  * COPYRIGHT: See COPYING in the top level directory
21  * PROJECT: ReactOS system libraries
22  * PURPOSE: SAM interface library
23  * FILE: lib/samlib/samlib.c
24  * PROGRAMER: Eric Kohl
25  */
26 
27 #include "precomp.h"
28 
29 #define NTOS_MODE_USER
30 #include <ndk/rtlfuncs.h>
31 #include <ntsam.h>
32 #include <sam_c.h>
33 
34 #include <wine/debug.h>
35 
37 
39 WINAPI
41  LPSTR hash);
42 
44 WINAPI
46  LPBYTE hash);
47 
49 WINAPI
51  const BYTE *key,
52  LPBYTE out);
53 
54 /* GLOBALS *******************************************************************/
55 
56 
57 /* FUNCTIONS *****************************************************************/
58 
60 {
62 }
63 
64 
66 {
68 }
69 
70 
73 {
75  LPWSTR pszStringBinding;
77 
78  TRACE("PSAMPR_SERVER_NAME_bind(%S)\n", pszSystemName);
79 
80  /* Check the server name prefix and server name length */
81  if (pszSystemName != NULL)
82  {
83  int nLength = wcslen(pszSystemName);
84  int nNameLength = nLength;
85 
86  if (nLength >= 1 && pszSystemName[0] == L'\\')
87  nNameLength--;
88 
89  if (nLength >= 2 && pszSystemName[1] == L'\\')
90  nNameLength--;
91 
92  if (((nLength - nNameLength != 0) &&
93  (nLength - nNameLength != 2)) ||
94  (nNameLength == 0))
95  {
96  WARN("Invalid server name %S", pszSystemName);
98  }
99  }
100 
102  L"ncacn_np",
103  pszSystemName,
104  L"\\pipe\\samr",
105  NULL,
106  &pszStringBinding);
107  if (status)
108  {
109  TRACE("RpcStringBindingCompose returned 0x%x\n", status);
110  return NULL;
111  }
112 
113  /* Set the binding handle that will be used to bind to the server. */
114  status = RpcBindingFromStringBindingW(pszStringBinding,
115  &hBinding);
116  if (status)
117  {
118  TRACE("RpcBindingFromStringBinding returned 0x%x\n", status);
119  }
120 
121  status = RpcStringFreeW(&pszStringBinding);
122  if (status)
123  {
124 // TRACE("RpcStringFree returned 0x%x\n", status);
125  }
126 
127  return hBinding;
128 }
129 
130 
131 void __RPC_USER
134 {
136 
137  TRACE("PSAMPR_SERVER_NAME_unbind(%S)\n", pszSystemName);
138 
140  if (status)
141  {
142  TRACE("RpcBindingFree returned 0x%x\n", status);
143  }
144 }
145 
146 
147 NTSTATUS
150 {
152  LPWORD CharTypeBuffer = NULL;
153  ULONG PasswordLength;
154  ULONG i;
155  ULONG Upper = 0, Lower = 0, Digit = 0, Punct = 0, Alpha = 0;
157 
158  TRACE("SampCheckPassword(%p %p)\n", UserHandle, Password);
159 
160  /* Get the domain password information */
163  if (!NT_SUCCESS(Status))
164  {
165  TRACE("SamrGetUserDomainPasswordInformation failed (Status 0x%08lx)\n", Status);
166  return Status;
167  }
168 
169  PasswordLength = (ULONG)(Password->Length / sizeof(WCHAR));
170 
171  /* Fail if the password is too short or too long */
172  if ((PasswordLength < DomainPasswordInformation.MinPasswordLength) ||
173  (PasswordLength > 256))
175 
176  /* Check the password complexity */
177  if (DomainPasswordInformation.PasswordProperties & DOMAIN_PASSWORD_COMPLEX)
178  {
179  CharTypeBuffer = midl_user_allocate(PasswordLength * sizeof(WORD));
180  if (CharTypeBuffer == NULL)
182 
184  Password->Buffer,
185  PasswordLength,
186  CharTypeBuffer);
187 
188  for (i = 0; i < PasswordLength; i++)
189  {
190  TRACE("%lu: %C %s %s %s %s\n", i, Password->Buffer[i],
191  (CharTypeBuffer[i] & C1_UPPER) ? "C1_UPPER" : " ",
192  (CharTypeBuffer[i] & C1_LOWER) ? "C1_LOWER" : " ",
193  (CharTypeBuffer[i] & C1_DIGIT) ? "C1_DIGIT" : " ",
194  (CharTypeBuffer[i] & C1_PUNCT) ? "C1_PUNCT" : " ",
195  (CharTypeBuffer[i] & C1_ALPHA) ? "C1_ALPHA" : " ");
196 
197  if (CharTypeBuffer[i] & C1_UPPER)
198  Upper = 1;
199 
200  if (CharTypeBuffer[i] & C1_LOWER)
201  Lower = 1;
202 
203  if (CharTypeBuffer[i] & C1_DIGIT)
204  Digit = 1;
205 
206  if (CharTypeBuffer[i] & C1_PUNCT)
207  Punct = 1;
208 
209  if ((CharTypeBuffer[i] & C1_ALPHA) &&
210  !(CharTypeBuffer[i] & C1_UPPER) &&
211  !(CharTypeBuffer[i] & C1_LOWER))
212  Alpha = 1;
213  }
214 
215  TRACE("Upper: %lu\n", Upper);
216  TRACE("Lower: %lu\n", Lower);
217  TRACE("Digit: %lu\n", Digit);
218  TRACE("Punct: %lu\n", Punct);
219  TRACE("Alpha: %lu\n", Alpha);
220 
221  TRACE("Total: %lu\n", Upper + Lower + Digit + Punct + Alpha);
222  if (Upper + Lower + Digit + Punct + Alpha < 3)
224  }
225 
226  if (CharTypeBuffer != NULL)
227  midl_user_free(CharTypeBuffer);
228 
229  return Status;
230 }
231 
232 
233 NTSTATUS
234 NTAPI
236  IN PSID MemberId)
237 {
239 
240  TRACE("SamAddMemberToAlias(%p %p)\n",
241  AliasHandle, MemberId);
242 
244  {
246  (PRPC_SID)MemberId);
247  }
249  {
251  }
252  RpcEndExcept;
253 
254  return Status;
255 }
256 
257 
258 NTSTATUS
259 NTAPI
261  IN ULONG MemberId,
263 {
265 
266  TRACE("SamAddMemberToGroup(%p %lu %lx)\n",
267  GroupHandle, MemberId, Attributes);
268 
270  {
272  MemberId,
273  Attributes);
274  }
276  {
278  }
279  RpcEndExcept;
280 
281  return Status;
282 }
283 
284 
285 NTSTATUS
286 NTAPI
288  IN PSID *MemberIds,
289  IN ULONG MemberCount)
290 {
293 
294  TRACE("SamAddMultipleMembersToAlias(%p %p %lu)\n",
295  AliasHandle, MemberIds, MemberCount);
296 
297  if (MemberIds == NULL)
299 
300  Buffer.Count = MemberCount;
301  Buffer.Sids = (PSAMPR_SID_INFORMATION)MemberIds;
302 
304  {
306  &Buffer);
307  }
309  {
311  }
312  RpcEndExcept;
313 
314  return Status;
315 }
316 
317 
318 NTSTATUS
319 NTAPI
321  IN PUNICODE_STRING OldPassword,
322  IN PUNICODE_STRING NewPassword)
323 {
324  NT_OWF_PASSWORD OldNtPassword;
325  NT_OWF_PASSWORD NewNtPassword;
326  LM_OWF_PASSWORD OldLmPassword;
327  LM_OWF_PASSWORD NewLmPassword;
328  OEM_STRING LmPwdString;
329  CHAR LmPwdBuffer[15];
330  BOOLEAN OldLmPasswordPresent = FALSE;
331  BOOLEAN NewLmPasswordPresent = FALSE;
333 
334  ENCRYPTED_LM_OWF_PASSWORD OldLmEncryptedWithNewLm;
335  ENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithOldLm;
336  ENCRYPTED_NT_OWF_PASSWORD OldNtEncryptedWithNewNt;
337  ENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithOldNt;
338  PENCRYPTED_LM_OWF_PASSWORD pOldLmEncryptedWithNewLm = NULL;
339  PENCRYPTED_LM_OWF_PASSWORD pNewLmEncryptedWithOldLm = NULL;
340 
341  /* Calculate the NT hash for the old password */
342  Status = SystemFunction007(OldPassword,
343  (LPBYTE)&OldNtPassword);
344  if (!NT_SUCCESS(Status))
345  {
346  TRACE("SystemFunction007 failed (Status 0x%08lx)\n", Status);
347  return Status;
348  }
349 
350  /* Calculate the NT hash for the new password */
351  Status = SystemFunction007(NewPassword,
352  (LPBYTE)&NewNtPassword);
353  if (!NT_SUCCESS(Status))
354  {
355  TRACE("SystemFunction007 failed (Status 0x%08lx)\n", Status);
356  return Status;
357  }
358 
359  /* Calculate the LM password and hash for the old password */
360  LmPwdString.Length = 15;
361  LmPwdString.MaximumLength = 15;
362  LmPwdString.Buffer = LmPwdBuffer;
363  ZeroMemory(LmPwdString.Buffer, LmPwdString.MaximumLength);
364 
366  OldPassword,
367  FALSE);
368  if (NT_SUCCESS(Status))
369  {
370  /* Calculate the LM hash value of the password */
371  Status = SystemFunction006(LmPwdString.Buffer,
372  (LPSTR)&OldLmPassword);
373  if (NT_SUCCESS(Status))
374  {
375  OldLmPasswordPresent = TRUE;
376  }
377  }
378 
379  /* Calculate the LM password and hash for the new password */
380  LmPwdString.Length = 15;
381  LmPwdString.MaximumLength = 15;
382  LmPwdString.Buffer = LmPwdBuffer;
383  ZeroMemory(LmPwdString.Buffer, LmPwdString.MaximumLength);
384 
386  NewPassword,
387  FALSE);
388  if (NT_SUCCESS(Status))
389  {
390  /* Calculate the LM hash value of the password */
391  Status = SystemFunction006(LmPwdString.Buffer,
392  (LPSTR)&NewLmPassword);
393  if (NT_SUCCESS(Status))
394  {
395  NewLmPasswordPresent = TRUE;
396  }
397  }
398 
399  if (OldLmPasswordPresent && NewLmPasswordPresent)
400  {
401  /* Encrypt the old LM hash with the new LM hash */
402  Status = SystemFunction012((const BYTE *)&OldLmPassword,
403  (const BYTE *)&NewLmPassword,
404  (LPBYTE)&OldLmEncryptedWithNewLm);
405  if (!NT_SUCCESS(Status))
406  {
407  TRACE("SystemFunction012 failed (Status 0x%08lx)\n", Status);
408  return Status;
409  }
410 
411  /* Encrypt the new LM hash with the old LM hash */
412  Status = SystemFunction012((const BYTE *)&NewLmPassword,
413  (const BYTE *)&OldLmPassword,
414  (LPBYTE)&NewLmEncryptedWithOldLm);
415  if (!NT_SUCCESS(Status))
416  {
417  TRACE("SystemFunction012 failed (Status 0x%08lx)\n", Status);
418  return Status;
419  }
420 
421  pOldLmEncryptedWithNewLm = &OldLmEncryptedWithNewLm;
422  pNewLmEncryptedWithOldLm = &NewLmEncryptedWithOldLm;
423  }
424 
425  /* Encrypt the old NT hash with the new NT hash */
426  Status = SystemFunction012((const BYTE *)&OldNtPassword,
427  (const BYTE *)&NewNtPassword,
428  (LPBYTE)&OldNtEncryptedWithNewNt);
429  if (!NT_SUCCESS(Status))
430  {
431  TRACE("SystemFunction012 failed (Status 0x%08lx)\n", Status);
432  return Status;
433  }
434 
435  /* Encrypt the new NT hash with the old NT hash */
436  Status = SystemFunction012((const BYTE *)&NewNtPassword,
437  (const BYTE *)&OldNtPassword,
438  (LPBYTE)&NewNtEncryptedWithOldNt);
439  if (!NT_SUCCESS(Status))
440  {
441  TRACE("SystemFunction012 failed (Status 0x%08lx)\n", Status);
442  return Status;
443  }
444 
446  {
448  OldLmPasswordPresent && NewLmPasswordPresent,
449  pOldLmEncryptedWithNewLm,
450  pNewLmEncryptedWithOldLm,
451  TRUE,
452  &OldNtEncryptedWithNewNt,
453  &NewNtEncryptedWithOldNt,
454  FALSE,
455  NULL,
456  FALSE,
457  NULL);
458  }
460  {
462  }
463  RpcEndExcept;
464 
465  return Status;
466 }
467 
468 
469 NTSTATUS
470 NTAPI
472  IN PUNICODE_STRING UserName,
473  IN PUNICODE_STRING OldPassword,
474  IN PUNICODE_STRING NewPassword)
475 {
477  return STATUS_NOT_IMPLEMENTED;
478 }
479 
480 
481 NTSTATUS
482 NTAPI
484  IN PUNICODE_STRING UserName,
485  IN PUNICODE_STRING OldPassword,
486  IN PUNICODE_STRING NewPassword,
487  OUT PDOMAIN_PASSWORD_INFORMATION *EffectivePasswordPolicy,
488  OUT PUSER_PWD_CHANGE_FAILURE_INFORMATION *PasswordChangeFailureInfo)
489 {
491  return STATUS_NOT_IMPLEMENTED;
492 }
493 
494 
495 NTSTATUS
496 NTAPI
498 {
500 
501  TRACE("SamCloseHandle(%p)\n", SamHandle);
502 
504  {
505  Status = SamrCloseHandle((SAMPR_HANDLE *)&SamHandle);
506  }
508  {
510  }
511  RpcEndExcept;
512 
513  return Status;
514 }
515 
516 
517 NTSTATUS
518 NTAPI
520  OUT PSAM_HANDLE ServerHandle,
523 {
524  PSAMPR_SERVER_NAME pServerName = NULL;
526 
527  TRACE("SamConnect(%p %p 0x%08x %p)\n",
528  ServerName, ServerHandle, DesiredAccess, ObjectAttributes);
529 
530  if (ServerName != NULL && ServerName->Length > 0 && ServerName->Buffer != NULL)
531  {
532  /* Create a zero-terminated server name */
533  pServerName = midl_user_allocate(ServerName->Length + sizeof(WCHAR));
534  if (pServerName == NULL)
536 
537  CopyMemory(pServerName, ServerName->Buffer, ServerName->Length);
538  pServerName[ServerName->Length / sizeof(WCHAR)] = UNICODE_NULL;
539  }
540 
542  {
543  Status = SamrConnect(pServerName,
544  (SAMPR_HANDLE *)ServerHandle,
545  DesiredAccess);
546  }
548  {
550  }
551  RpcEndExcept;
552 
553  if (pServerName)
554  midl_user_free(pServerName);
555 
556  return Status;
557 }
558 
559 
560 NTSTATUS
561 NTAPI
563  IN PUNICODE_STRING AccountName,
565  OUT PSAM_HANDLE AliasHandle,
566  OUT PULONG RelativeId)
567 {
569 
570  TRACE("SamCreateAliasInDomain(%p %p 0x%08x %p %p)\n",
571  DomainHandle, AccountName, DesiredAccess, AliasHandle, RelativeId);
572 
573  *AliasHandle = NULL;
574  *RelativeId = 0;
575 
577  {
579  (PRPC_UNICODE_STRING)AccountName,
581  (SAMPR_HANDLE *)AliasHandle,
582  RelativeId);
583  }
585  {
587  }
588  RpcEndExcept;
589 
590  return Status;
591 }
592 
593 
594 NTSTATUS
595 NTAPI
597  IN PUNICODE_STRING AccountName,
599  OUT PSAM_HANDLE GroupHandle,
600  OUT PULONG RelativeId)
601 {
603 
604  TRACE("SamCreateGroupInDomain(%p %p 0x%08x %p %p)\n",
605  DomainHandle, AccountName, DesiredAccess, GroupHandle, RelativeId);
606 
607  *GroupHandle = NULL;
608  *RelativeId = 0;
609 
611  {
613  (PRPC_UNICODE_STRING)AccountName,
615  (SAMPR_HANDLE *)GroupHandle,
616  RelativeId);
617  }
619  {
621  }
622  RpcEndExcept;
623 
624  return Status;
625 }
626 
627 
628 NTSTATUS
629 NTAPI
631  IN PUNICODE_STRING AccountName,
632  IN ULONG AccountType,
634  OUT PSAM_HANDLE UserHandle,
636  OUT PULONG RelativeId)
637 {
639 
640  TRACE("SamCreateUser2InDomain(%p %p %lu 0x%08x %p %p %p)\n",
641  DomainHandle, AccountName, AccountType, DesiredAccess,
642  UserHandle, GrantedAccess, RelativeId);
643 
644  *UserHandle = NULL;
645  *RelativeId = 0;
646 
648  {
650  (PRPC_UNICODE_STRING)AccountName,
651  AccountType,
653  (SAMPR_HANDLE *)UserHandle,
655  RelativeId);
656 
657  }
659  {
661  }
662  RpcEndExcept;
663 
664  return Status;
665 }
666 
667 
668 NTSTATUS
669 NTAPI
671  IN PUNICODE_STRING AccountName,
673  OUT PSAM_HANDLE UserHandle,
674  OUT PULONG RelativeId)
675 {
677 
678  TRACE("SamCreateUserInDomain(%p %p 0x%08x %p %p)\n",
679  DomainHandle, AccountName, DesiredAccess, UserHandle, RelativeId);
680 
681  *UserHandle = NULL;
682  *RelativeId = 0;
683 
685  {
687  (PRPC_UNICODE_STRING)AccountName,
689  (SAMPR_HANDLE *)UserHandle,
690  RelativeId);
691  }
693  {
695  }
696  RpcEndExcept;
697 
698  return Status;
699 }
700 
701 
702 NTSTATUS
703 NTAPI
705 {
706  SAMPR_HANDLE LocalAliasHandle;
708 
709  TRACE("SamDeleteAlias(%p)\n", AliasHandle);
710 
711  LocalAliasHandle = (SAMPR_HANDLE)AliasHandle;
712 
713  if (LocalAliasHandle == NULL)
714  return STATUS_INVALID_HANDLE;
715 
717  {
718  Status = SamrDeleteAlias(&LocalAliasHandle);
719  }
721  {
723  }
724  RpcEndExcept;
725 
726  return Status;
727 }
728 
729 
730 NTSTATUS
731 NTAPI
733 {
734  SAMPR_HANDLE LocalGroupHandle;
736 
737  TRACE("SamDeleteGroup(%p)\n", GroupHandle);
738 
739  LocalGroupHandle = (SAMPR_HANDLE)GroupHandle;
740 
741  if (LocalGroupHandle == NULL)
742  return STATUS_INVALID_HANDLE;
743 
745  {
746  Status = SamrDeleteGroup(&LocalGroupHandle);
747  }
749  {
751  }
752  RpcEndExcept;
753 
754  return Status;
755 }
756 
757 
758 NTSTATUS
759 NTAPI
761 {
762  SAMPR_HANDLE LocalUserHandle;
764 
765  TRACE("SamDeleteUser(%p)\n", UserHandle);
766 
767  LocalUserHandle = (SAMPR_HANDLE)UserHandle;
768 
769  if (LocalUserHandle == NULL)
770  return STATUS_INVALID_HANDLE;
771 
773  {
774  Status = SamrDeleteUser(&LocalUserHandle);
775  }
777  {
779  }
780  RpcEndExcept;
781 
782  return Status;
783 }
784 
785 
786 NTSTATUS
787 NTAPI
789  IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext,
790  OUT PVOID *Buffer,
791  IN ULONG PreferedMaximumLength,
792  OUT PULONG CountReturned)
793 {
794  PSAMPR_ENUMERATION_BUFFER EnumBuffer = NULL;
796 
797  TRACE("SamEnumerateAliasesInDomain(%p %p %p %lu %p)\n",
798  DomainHandle, EnumerationContext, Buffer, PreferedMaximumLength,
799  CountReturned);
800 
801  if ((EnumerationContext == NULL) ||
802  (Buffer == NULL) ||
803  (CountReturned == NULL))
805 
806  *Buffer = NULL;
807 
809  {
811  EnumerationContext,
812  &EnumBuffer,
813  PreferedMaximumLength,
814  CountReturned);
815 
816  if (EnumBuffer != NULL)
817  {
818  if (EnumBuffer->Buffer != NULL)
819  {
820  *Buffer = EnumBuffer->Buffer;
821  }
822 
823  midl_user_free(EnumBuffer);
824  }
825  }
827  {
829  }
830  RpcEndExcept;
831 
832  return Status;
833 }
834 
835 
836 NTSTATUS
837 NTAPI
839  IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext,
840  OUT PVOID *Buffer,
841  IN ULONG PreferedMaximumLength,
842  OUT PULONG CountReturned)
843 {
844  PSAMPR_ENUMERATION_BUFFER EnumBuffer = NULL;
846 
847  TRACE("SamEnumerateDomainsInSamServer(%p %p %p %lu %p)\n",
848  ServerHandle, EnumerationContext, Buffer, PreferedMaximumLength,
849  CountReturned);
850 
851  if ((EnumerationContext == NULL) ||
852  (Buffer == NULL) ||
853  (CountReturned == NULL))
855 
856  *Buffer = NULL;
857 
859  {
861  EnumerationContext,
862  &EnumBuffer,
863  PreferedMaximumLength,
864  CountReturned);
865 
866  if (EnumBuffer != NULL)
867  {
868  if (EnumBuffer->Buffer != NULL)
869  {
870  *Buffer = EnumBuffer->Buffer;
871  }
872 
873  midl_user_free(EnumBuffer);
874  }
875  }
877  {
879  }
880  RpcEndExcept;
881 
882  return Status;
883 }
884 
885 
886 NTSTATUS
887 NTAPI
889  IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext,
890  IN PVOID *Buffer,
891  IN ULONG PreferedMaximumLength,
892  OUT PULONG CountReturned)
893 {
894  PSAMPR_ENUMERATION_BUFFER EnumBuffer = NULL;
896 
897  TRACE("SamEnumerateGroupsInDomain(%p %p %p %lu %p)\n",
898  DomainHandle, EnumerationContext, Buffer,
899  PreferedMaximumLength, CountReturned);
900 
901  if (EnumerationContext == NULL || Buffer == NULL || CountReturned == NULL)
903 
904  *Buffer = NULL;
905 
907  {
909  EnumerationContext,
910  &EnumBuffer,
911  PreferedMaximumLength,
912  CountReturned);
913  if (EnumBuffer != NULL)
914  {
915  if (EnumBuffer->Buffer != NULL)
916  *Buffer = EnumBuffer->Buffer;
917 
918  midl_user_free(EnumBuffer);
919  }
920  }
922  {
924  }
925  RpcEndExcept;
926 
927  return Status;
928 }
929 
930 
931 NTSTATUS
932 NTAPI
934  IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext,
935  IN ULONG UserAccountControl,
936  OUT PVOID *Buffer,
937  IN ULONG PreferedMaximumLength,
938  OUT PULONG CountReturned)
939 {
940  PSAMPR_ENUMERATION_BUFFER EnumBuffer = NULL;
942 
943  TRACE("SamEnumerateUsersInDomain(%p %p %lx %p %lu %p)\n",
944  DomainHandle, EnumerationContext, UserAccountControl, Buffer,
945  PreferedMaximumLength, CountReturned);
946 
947  if (EnumerationContext == NULL || Buffer == NULL || CountReturned == NULL)
949 
950  *Buffer = NULL;
951 
953  {
955  EnumerationContext,
956  UserAccountControl,
957  &EnumBuffer,
958  PreferedMaximumLength,
959  CountReturned);
960  if (EnumBuffer != NULL)
961  {
962  if (EnumBuffer->Buffer != NULL)
963  {
964  *Buffer = EnumBuffer->Buffer;
965  }
966 
967  midl_user_free(EnumBuffer);
968  }
969 
970  }
972  {
974  }
975  RpcEndExcept;
976 
977  return Status;
978 }
979 
980 
981 NTSTATUS
982 NTAPI
984 {
985  if (Buffer != NULL)
987 
988  return STATUS_SUCCESS;
989 }
990 
991 
992 NTSTATUS
993 NTAPI
995  IN ULONG PassedCount,
996  IN PSID *Sids,
997  OUT PULONG MembershipCount,
998  OUT PULONG *Aliases)
999 {
1000  SAMPR_PSID_ARRAY SidArray;
1001  SAMPR_ULONG_ARRAY Membership;
1002  NTSTATUS Status;
1003 
1004  TRACE("SamAliasMembership(%p %lu %p %p %p)\n",
1005  DomainHandle, PassedCount, Sids, MembershipCount, Aliases);
1006 
1007  if (Sids == NULL ||
1008  MembershipCount == NULL ||
1009  Aliases == NULL)
1010  return STATUS_INVALID_PARAMETER;
1011 
1012  Membership.Element = NULL;
1013 
1014  RpcTryExcept
1015  {
1016  SidArray.Count = PassedCount;
1017  SidArray.Sids = (PSAMPR_SID_INFORMATION)Sids;
1018 
1019  Status = SamrGetAliasMembership((SAMPR_HANDLE)DomainHandle,
1020  &SidArray,
1021  &Membership);
1022  if (NT_SUCCESS(Status))
1023  {
1024  *MembershipCount = Membership.Count;
1025  *Aliases = Membership.Element;
1026  }
1027  else
1028  {
1029  if (Membership.Element != NULL)
1030  midl_user_free(Membership.Element);
1031  }
1032  }
1034  {
1036  }
1037  RpcEndExcept;
1038 
1039  return Status;
1040 }
1041 
1042 
1043 NTSTATUS
1044 NTAPI
1046  OUT PULONG Mode)
1047 {
1048  TRACE("SamGetCompatibilityMode(%p %p)\n", ObjectHandle, Mode);
1049 
1050  if (Mode == NULL)
1051  return STATUS_INVALID_PARAMETER;
1052 
1054 
1055  return STATUS_SUCCESS;
1056 }
1057 
1058 
1059 NTSTATUS
1060 NTAPI
1062  IN DOMAIN_DISPLAY_INFORMATION DisplayInformation,
1064  OUT PULONG Index)
1065 {
1066  NTSTATUS Status;
1067 
1068  TRACE("SamGetDisplayEnumerationIndex(%p %lu %wZ %p)\n",
1069  DomainHandle, DisplayInformation, Prefix, Index);
1070 
1071  if ((Prefix == NULL) ||
1072  (Index == NULL))
1073  return STATUS_INVALID_PARAMETER;
1074 
1075  RpcTryExcept
1076  {
1078  DisplayInformation,
1080  Index);
1081  }
1083  {
1085  }
1086  RpcEndExcept;
1087 
1088  return Status;
1089 }
1090 
1091 
1092 NTSTATUS
1093 NTAPI
1096  OUT PULONG MembershipCount)
1097 {
1098  PSAMPR_GET_GROUPS_BUFFER GroupsBuffer = NULL;
1099  NTSTATUS Status;
1100 
1101  TRACE("SamGetGroupsForUser(%p %p %p)\n",
1102  UserHandle, Groups, MembershipCount);
1103 
1104  RpcTryExcept
1105  {
1107  &GroupsBuffer);
1108  if (NT_SUCCESS(Status))
1109  {
1110  *Groups = GroupsBuffer->Groups;
1111  *MembershipCount = GroupsBuffer->MembershipCount;
1112 
1113  MIDL_user_free(GroupsBuffer);
1114  }
1115  else
1116  {
1117  if (GroupsBuffer != NULL)
1118  {
1119  if (GroupsBuffer->Groups != NULL)
1120  MIDL_user_free(GroupsBuffer->Groups);
1121 
1122  MIDL_user_free(GroupsBuffer);
1123  }
1124  }
1125  }
1127  {
1129  }
1130  RpcEndExcept;
1131 
1132  return Status;
1133 }
1134 
1135 
1136 NTSTATUS
1137 NTAPI
1139  OUT PSID **MemberIds,
1140  OUT PULONG MemberCount)
1141 {
1142  SAMPR_PSID_ARRAY_OUT SidArray;
1143  NTSTATUS Status;
1144 
1145  TRACE("SamGetMembersInAlias(%p %p %p)\n",
1146  AliasHandle, MemberIds, MemberCount);
1147 
1148  if ((MemberIds == NULL) ||
1149  (MemberCount == NULL))
1150  return STATUS_INVALID_PARAMETER;
1151 
1152  *MemberIds = NULL;
1153  *MemberCount = 0;
1154 
1155  SidArray.Sids = NULL;
1156 
1157  RpcTryExcept
1158  {
1159  Status = SamrGetMembersInAlias((SAMPR_HANDLE)AliasHandle,
1160  &SidArray);
1161  if (NT_SUCCESS(Status))
1162  {
1163  *MemberCount = SidArray.Count;
1164  *MemberIds = (PSID *)SidArray.Sids;
1165  }
1166 
1167  }
1169  {
1171  }
1172  RpcEndExcept;
1173 
1174  return Status;
1175 }
1176 
1177 
1178 NTSTATUS
1179 NTAPI
1181  OUT PULONG *MemberIds,
1183  OUT PULONG MemberCount)
1184 {
1185  PSAMPR_GET_MEMBERS_BUFFER MembersBuffer = NULL;
1186  NTSTATUS Status;
1187 
1188  TRACE("SamGetMembersInGroup(%p %p %p %p)\n",
1189  GroupHandle, MemberIds, Attributes, MemberCount);
1190 
1191  RpcTryExcept
1192  {
1193  Status = SamrGetMembersInGroup((SAMPR_HANDLE)GroupHandle,
1194  &MembersBuffer);
1195  if (NT_SUCCESS(Status))
1196  {
1197  *MemberIds = MembersBuffer->Members;
1198  *Attributes = MembersBuffer->Attributes;
1199  *MemberCount = MembersBuffer->MemberCount;
1200 
1201  MIDL_user_free(MembersBuffer);
1202  }
1203  else
1204  {
1205  if (MembersBuffer != NULL)
1206  {
1207  if (MembersBuffer->Members != NULL)
1208  MIDL_user_free(MembersBuffer->Members);
1209 
1210  if (MembersBuffer->Attributes != NULL)
1211  MIDL_user_free(MembersBuffer->Attributes);
1212 
1213  MIDL_user_free(MembersBuffer);
1214  }
1215  }
1216  }
1218  {
1220  }
1221  RpcEndExcept;
1222 
1223  return Status;
1224 }
1225 
1226 
1227 NTSTATUS
1228 NTAPI
1231  OUT PSID *DomainId)
1232 {
1233  NTSTATUS Status;
1234 
1235  TRACE("SamLookupDomainInSamServer(%p %p %p)\n",
1236  ServerHandle, Name, DomainId);
1237 
1238  RpcTryExcept
1239  {
1242  (PRPC_SID *)DomainId);
1243  }
1245  {
1247  }
1248  RpcEndExcept;
1249 
1250  return Status;
1251 }
1252 
1253 
1254 NTSTATUS
1255 NTAPI
1257  IN ULONG Count,
1258  IN PULONG RelativeIds,
1260  OUT PSID_NAME_USE *Use OPTIONAL)
1261 {
1262  SAMPR_RETURNED_USTRING_ARRAY NamesBuffer = {0, NULL};
1263  SAMPR_ULONG_ARRAY UseBuffer = {0, NULL};
1264  ULONG i;
1265  NTSTATUS Status;
1266 
1267  TRACE("SamLookupIdsInDomain(%p %lu %p %p %p)\n",
1268  DomainHandle, Count, RelativeIds, Names, Use);
1269 
1270  *Names = NULL;
1271 
1272  if (Use != NULL)
1273  *Use = NULL;
1274 
1275  RpcTryExcept
1276  {
1277  Status = SamrLookupIdsInDomain((SAMPR_HANDLE)DomainHandle,
1278  Count,
1279  RelativeIds,
1280  &NamesBuffer,
1281  &UseBuffer);
1282  }
1284  {
1286  }
1287  RpcEndExcept;
1288 
1289  if (NT_SUCCESS(Status))
1290  {
1292  if (*Names == NULL)
1293  {
1295  goto done;
1296  }
1297 
1298  for (i = 0; i < Count; i++)
1299  {
1300  (*Names)[i].Buffer = midl_user_allocate(NamesBuffer.Element[i].MaximumLength);
1301  if ((*Names)[i].Buffer == NULL)
1302  {
1304  goto done;
1305  }
1306  }
1307 
1308  for (i = 0; i < Count; i++)
1309  {
1310  (*Names)[i].Length = NamesBuffer.Element[i].Length;
1311  (*Names)[i].MaximumLength = NamesBuffer.Element[i].MaximumLength;
1312 
1314  NamesBuffer.Element[i].Buffer,
1315  NamesBuffer.Element[i].Length);
1316  }
1317 
1318  if (Use != NULL)
1319  {
1320  *Use = midl_user_allocate(Count * sizeof(SID_NAME_USE));
1321  if (*Use == NULL)
1322  {
1324  goto done;
1325  }
1326 
1327  RtlCopyMemory(*Use,
1328  UseBuffer.Element,
1329  Count * sizeof(SID_NAME_USE));
1330  }
1331  }
1332 
1333 done:
1334  if (!NT_SUCCESS(Status))
1335  {
1336  if (*Names != NULL)
1337  {
1338  for (i = 0; i < Count; i++)
1339  {
1340  if ((*Names)[i].Buffer != NULL)
1342  }
1343 
1345  }
1346 
1347  if (Use != NULL && *Use != NULL)
1348  midl_user_free(*Use);
1349  }
1350 
1351  if (NamesBuffer.Element != NULL)
1352  {
1353  for (i = 0; i < NamesBuffer.Count; i++)
1354  {
1355  if (NamesBuffer.Element[i].Buffer != NULL)
1356  midl_user_free(NamesBuffer.Element[i].Buffer);
1357  }
1358 
1359  midl_user_free(NamesBuffer.Element);
1360  }
1361 
1362  if (UseBuffer.Element != NULL)
1363  midl_user_free(UseBuffer.Element);
1364 
1365  return 0;
1366 }
1367 
1368 
1369 NTSTATUS
1370 NTAPI
1372  IN ULONG Count,
1374  OUT PULONG *RelativeIds,
1375  OUT PSID_NAME_USE *Use)
1376 {
1377  SAMPR_ULONG_ARRAY RidBuffer = {0, NULL};
1378  SAMPR_ULONG_ARRAY UseBuffer = {0, NULL};
1379  NTSTATUS Status;
1380 
1381  TRACE("SamLookupNamesInDomain(%p %lu %p %p %p)\n",
1382  DomainHandle, Count, Names, RelativeIds, Use);
1383 
1384  *RelativeIds = NULL;
1385  *Use = NULL;
1386 
1387  RpcTryExcept
1388  {
1390  Count,
1392  &RidBuffer,
1393  &UseBuffer);
1394  }
1396  {
1398  }
1399  RpcEndExcept;
1400 
1401  if (NT_SUCCESS(Status))
1402  {
1403  *RelativeIds = midl_user_allocate(Count * sizeof(ULONG));
1404  if (*RelativeIds == NULL)
1405  {
1407  goto done;
1408  }
1409 
1410  *Use = midl_user_allocate(Count * sizeof(SID_NAME_USE));
1411  if (*Use == NULL)
1412  {
1414  goto done;
1415  }
1416 
1417  RtlCopyMemory(*RelativeIds,
1418  RidBuffer.Element,
1419  Count * sizeof(ULONG));
1420 
1421  RtlCopyMemory(*Use,
1422  UseBuffer.Element,
1423  Count * sizeof(SID_NAME_USE));
1424  }
1425 
1426 done:
1427  if (!NT_SUCCESS(Status))
1428  {
1429  if (*RelativeIds != NULL)
1430  midl_user_free(*RelativeIds);
1431 
1432  if (*Use != NULL)
1433  midl_user_free(*Use);
1434  }
1435 
1436  if (RidBuffer.Element != NULL)
1437  midl_user_free(RidBuffer.Element);
1438 
1439  if (UseBuffer.Element != NULL)
1440  midl_user_free(UseBuffer.Element);
1441 
1442  return Status;
1443 }
1444 
1445 
1446 NTSTATUS
1447 NTAPI
1450  IN ULONG AliasId,
1451  OUT PSAM_HANDLE AliasHandle)
1452 {
1453  NTSTATUS Status;
1454 
1455  TRACE("SamOpenAlias(%p 0x%08x %lx %p)\n",
1456  DomainHandle, DesiredAccess, AliasId, AliasHandle);
1457 
1458  RpcTryExcept
1459  {
1460  Status = SamrOpenAlias((SAMPR_HANDLE)DomainHandle,
1461  DesiredAccess,
1462  AliasId,
1463  (SAMPR_HANDLE *)AliasHandle);
1464  }
1466  {
1468  }
1469  RpcEndExcept;
1470 
1471  return Status;
1472 }
1473 
1474 
1475 NTSTATUS
1476 NTAPI
1479  IN PSID DomainId,
1480  OUT PSAM_HANDLE DomainHandle)
1481 {
1482  NTSTATUS Status;
1483 
1484  TRACE("SamOpenDomain(%p 0x%08x %p %p)\n",
1485  ServerHandle, DesiredAccess, DomainId, DomainHandle);
1486 
1487  RpcTryExcept
1488  {
1489  Status = SamrOpenDomain((SAMPR_HANDLE)ServerHandle,
1490  DesiredAccess,
1491  (PRPC_SID)DomainId,
1492  (SAMPR_HANDLE *)DomainHandle);
1493  }
1495  {
1497  }
1498  RpcEndExcept;
1499 
1500  return Status;
1501 }
1502 
1503 
1504 NTSTATUS
1505 NTAPI
1508  IN ULONG GroupId,
1509  OUT PSAM_HANDLE GroupHandle)
1510 {
1511  NTSTATUS Status;
1512 
1513  TRACE("SamOpenGroup(%p 0x%08x %p %p)\n",
1514  DomainHandle, DesiredAccess, GroupId, GroupHandle);
1515 
1516  RpcTryExcept
1517  {
1518  Status = SamrOpenGroup((SAMPR_HANDLE)DomainHandle,
1519  DesiredAccess,
1520  GroupId,
1521  (SAMPR_HANDLE *)GroupHandle);
1522  }
1524  {
1526  }
1527  RpcEndExcept;
1528 
1529  return Status;
1530 }
1531 
1532 
1533 NTSTATUS
1534 NTAPI
1537  IN ULONG UserId,
1538  OUT PSAM_HANDLE UserHandle)
1539 {
1540  NTSTATUS Status;
1541 
1542  TRACE("SamOpenUser(%p 0x%08x %lx %p)\n",
1543  DomainHandle, DesiredAccess, UserId, UserHandle);
1544 
1545  RpcTryExcept
1546  {
1547  Status = SamrOpenUser((SAMPR_HANDLE)DomainHandle,
1548  DesiredAccess,
1549  UserId,
1550  (SAMPR_HANDLE *)UserHandle);
1551  }
1553  {
1555  }
1556  RpcEndExcept;
1557 
1558  return Status;
1559 }
1560 
1561 
1562 NTSTATUS
1563 NTAPI
1565  IN DOMAIN_DISPLAY_INFORMATION DisplayInformation,
1566  IN ULONG Index,
1567  IN ULONG EntryCount,
1568  IN ULONG PreferredMaximumLength,
1569  OUT PULONG TotalAvailable,
1570  OUT PULONG TotalReturned,
1571  OUT PULONG ReturnedEntryCount,
1572  OUT PVOID *SortedBuffer)
1573 {
1574  SAMPR_DISPLAY_INFO_BUFFER LocalBuffer;
1575  NTSTATUS Status;
1576 
1577  TRACE("SamQueryDisplayInformation(%p %lu %lu %lu %lu %p %p %p %p)\n",
1578  DomainHandle, DisplayInformation, Index, EntryCount,
1579  PreferredMaximumLength, TotalAvailable, TotalReturned,
1580  ReturnedEntryCount, SortedBuffer);
1581 
1582  if ((TotalAvailable == NULL) ||
1583  (TotalReturned == NULL) ||
1584  (ReturnedEntryCount == NULL) ||
1585  (SortedBuffer == NULL))
1586  return STATUS_INVALID_PARAMETER;
1587 
1588  RpcTryExcept
1589  {
1591  DisplayInformation,
1592  Index,
1593  EntryCount,
1594  PreferredMaximumLength,
1595  TotalAvailable,
1596  TotalReturned,
1597  &LocalBuffer);
1598  if (NT_SUCCESS(Status))
1599  {
1600  switch (DisplayInformation)
1601  {
1602  case DomainDisplayUser:
1603  *ReturnedEntryCount = LocalBuffer.UserInformation.EntriesRead;
1604  *SortedBuffer = LocalBuffer.UserInformation.Buffer;
1605  break;
1606 
1607  case DomainDisplayMachine:
1608  *ReturnedEntryCount = LocalBuffer.MachineInformation.EntriesRead;
1609  *SortedBuffer = LocalBuffer.MachineInformation.Buffer;
1610  break;
1611 
1612  case DomainDisplayGroup:
1613  *ReturnedEntryCount = LocalBuffer.GroupInformation.EntriesRead;
1614  *SortedBuffer = LocalBuffer.GroupInformation.Buffer;
1615  break;
1616 
1617  case DomainDisplayOemUser:
1618  *ReturnedEntryCount = LocalBuffer.OemUserInformation.EntriesRead;
1619  *SortedBuffer = LocalBuffer.OemUserInformation.Buffer;
1620  break;
1621 
1622  case DomainDisplayOemGroup:
1623  *ReturnedEntryCount = LocalBuffer.OemGroupInformation.EntriesRead;
1624  *SortedBuffer = LocalBuffer.OemGroupInformation.Buffer;
1625  break;
1626 
1627  case DomainDisplayServer:
1628  /* FIXME */
1629  break;
1630  }
1631  }
1632  else
1633  {
1634  *ReturnedEntryCount = 0;
1635  *SortedBuffer = NULL;
1636  }
1637  }
1639  {
1641  }
1642  RpcEndExcept;
1643 
1644  return Status;
1645 }
1646 
1647 
1648 NTSTATUS
1649 NTAPI
1651  IN ALIAS_INFORMATION_CLASS AliasInformationClass,
1652  OUT PVOID *Buffer)
1653 {
1654  NTSTATUS Status;
1655 
1656  TRACE("SamQueryInformationAlias(%p %lu %p)\n",
1657  AliasHandle, AliasInformationClass, Buffer);
1658 
1659  RpcTryExcept
1660  {
1662  AliasInformationClass,
1664  }
1666  {
1668  }
1669  RpcEndExcept;
1670 
1671  return Status;
1672 }
1673 
1674 
1675 NTSTATUS
1676 NTAPI
1678  IN DOMAIN_INFORMATION_CLASS DomainInformationClass,
1679  OUT PVOID *Buffer)
1680 {
1681  NTSTATUS Status;
1682 
1683  TRACE("SamQueryInformationDomain(%p %lu %p)\n",
1684  DomainHandle, DomainInformationClass, Buffer);
1685 
1686  RpcTryExcept
1687  {
1689  DomainInformationClass,
1691  }
1693  {
1695  }
1696  RpcEndExcept;
1697 
1698  return Status;
1699 }
1700 
1701 
1702 NTSTATUS
1703 NTAPI
1705  IN GROUP_INFORMATION_CLASS GroupInformationClass,
1706  OUT PVOID *Buffer)
1707 {
1708  NTSTATUS Status;
1709 
1710  TRACE("SamQueryInformationGroup(%p %lu %p)\n",
1711  GroupHandle, GroupInformationClass, Buffer);
1712 
1713  RpcTryExcept
1714  {
1716  GroupInformationClass,
1718  }
1720  {
1722  }
1723  RpcEndExcept;
1724 
1725  return Status;
1726 }
1727 
1728 
1729 NTSTATUS
1730 NTAPI
1732  IN USER_INFORMATION_CLASS UserInformationClass,
1733  OUT PVOID *Buffer)
1734 {
1735  NTSTATUS Status;
1736 
1737  TRACE("SamQueryInformationUser(%p %lu %p)\n",
1738  UserHandle, UserInformationClass, Buffer);
1739 
1740  RpcTryExcept
1741  {
1743  UserInformationClass,
1745  }
1747  {
1749  }
1750  RpcEndExcept;
1751 
1752  return Status;
1753 }
1754 
1755 
1756 NTSTATUS
1757 NTAPI
1761 {
1762  PSAMPR_SR_SECURITY_DESCRIPTOR SamSecurityDescriptor = NULL;
1763  NTSTATUS Status;
1764 
1765  TRACE("SamQuerySecurityObject(%p %lu %p)\n",
1766  ObjectHandle, SecurityInformation, SecurityDescriptor);
1767 
1769 
1770  RpcTryExcept
1771  {
1774  &SamSecurityDescriptor);
1775  }
1777  {
1779  }
1780  RpcEndExcept;
1781 
1782  TRACE("SamSecurityDescriptor: %p\n", SamSecurityDescriptor);
1783 
1784  if (SamSecurityDescriptor != NULL)
1785  {
1786  TRACE("SamSecurityDescriptor->Length: %lu\n", SamSecurityDescriptor->Length);
1787  TRACE("SamSecurityDescriptor->SecurityDescriptor: %p\n", SamSecurityDescriptor->SecurityDescriptor);
1788 
1789  *SecurityDescriptor = SamSecurityDescriptor->SecurityDescriptor;
1790 
1791  midl_user_free(SamSecurityDescriptor);
1792  }
1793 
1794  return Status;
1795 }
1796 
1797 
1798 NTSTATUS
1799 NTAPI
1801  IN PSID MemberId)
1802 {
1803  NTSTATUS Status;
1804 
1805  TRACE("SamRemoveMemberFromAlias(%p %ul)\n",
1806  AliasHandle, MemberId);
1807 
1808  RpcTryExcept
1809  {
1811  MemberId);
1812  }
1814  {
1816  }
1817  RpcEndExcept;
1818 
1819  return Status;
1820 }
1821 
1822 
1823 NTSTATUS
1824 NTAPI
1826  IN PSID MemberId)
1827 {
1828  NTSTATUS Status;
1829 
1830  TRACE("SamRemoveMemberFromForeignDomain(%p %ul)\n",
1831  DomainHandle, MemberId);
1832 
1833  RpcTryExcept
1834  {
1836  MemberId);
1837  }
1839  {
1841  }
1842  RpcEndExcept;
1843 
1844  return Status;
1845 }
1846 
1847 
1848 NTSTATUS
1849 NTAPI
1851  IN ULONG MemberId)
1852 {
1853  NTSTATUS Status;
1854 
1855  TRACE("SamRemoveMemberFromGroup(%p %ul)\n",
1856  GroupHandle, MemberId);
1857 
1858  RpcTryExcept
1859  {
1861  MemberId);
1862  }
1864  {
1866  }
1867  RpcEndExcept;
1868 
1869  return Status;
1870 }
1871 
1872 
1873 NTSTATUS
1874 NTAPI
1876  IN PSID *MemberIds,
1877  IN ULONG MemberCount)
1878 {
1880  NTSTATUS Status;
1881 
1882  TRACE("SamRemoveMultipleMembersFromAlias(%p %p %lu)\n",
1883  AliasHandle, MemberIds, MemberCount);
1884 
1885  if (MemberIds == NULL)
1887 
1888  Buffer.Count = MemberCount;
1889  Buffer.Sids = (PSAMPR_SID_INFORMATION)MemberIds;
1890 
1891  RpcTryExcept
1892  {
1894  &Buffer);
1895  }
1897  {
1899  }
1900  RpcEndExcept;
1901 
1902  return Status;
1903 }
1904 
1905 
1906 NTSTATUS
1907 NTAPI
1909  IN ULONG Rid,
1910  OUT PSID *Sid)
1911 {
1912  UNIMPLEMENTED;
1913  return STATUS_NOT_IMPLEMENTED;
1914 }
1915 
1916 
1917 NTSTATUS
1918 NTAPI
1920  IN ALIAS_INFORMATION_CLASS AliasInformationClass,
1921  IN PVOID Buffer)
1922 {
1923  NTSTATUS Status;
1924 
1925  TRACE("SamSetInformationAlias(%p %lu %p)\n",
1926  AliasHandle, AliasInformationClass, Buffer);
1927 
1928  RpcTryExcept
1929  {
1931  AliasInformationClass,
1932  Buffer);
1933  }
1935  {
1937  }
1938  RpcEndExcept;
1939 
1940  return Status;
1941 }
1942 
1943 
1944 NTSTATUS
1945 NTAPI
1947  IN DOMAIN_INFORMATION_CLASS DomainInformationClass,
1948  IN PVOID Buffer)
1949 {
1950  NTSTATUS Status;
1951 
1952  TRACE("SamSetInformationDomain(%p %lu %p)\n",
1953  DomainHandle, DomainInformationClass, Buffer);
1954 
1955  RpcTryExcept
1956  {
1958  DomainInformationClass,
1959  Buffer);
1960  }
1962  {
1964  }
1965  RpcEndExcept;
1966 
1967  return Status;
1968 }
1969 
1970 
1971 NTSTATUS
1972 NTAPI
1974  IN GROUP_INFORMATION_CLASS GroupInformationClass,
1975  IN PVOID Buffer)
1976 {
1977  NTSTATUS Status;
1978 
1979  TRACE("SamSetInformationGroup(%p %lu %p)\n",
1980  GroupHandle, GroupInformationClass, Buffer);
1981 
1982  RpcTryExcept
1983  {
1985  GroupInformationClass,
1986  Buffer);
1987  }
1989  {
1991  }
1992  RpcEndExcept;
1993 
1994  return Status;
1995 }
1996 
1997 
1998 NTSTATUS
1999 NTAPI
2001  IN USER_INFORMATION_CLASS UserInformationClass,
2002  IN PVOID Buffer)
2003 {
2004  PSAMPR_USER_SET_PASSWORD_INFORMATION PasswordBuffer;
2005  SAMPR_USER_INTERNAL1_INFORMATION Internal1Buffer;
2006  USER_ALL_INFORMATION InternalAllBuffer;
2007  OEM_STRING LmPwdString;
2008  CHAR LmPwdBuffer[15];
2009  NTSTATUS Status;
2010 
2011  TRACE("SamSetInformationUser(%p %lu %p)\n",
2012  UserHandle, UserInformationClass, Buffer);
2013 
2014  if (UserInformationClass == UserSetPasswordInformation)
2015  {
2016  PasswordBuffer = (PSAMPR_USER_SET_PASSWORD_INFORMATION)Buffer;
2017 
2018  Status = SampCheckPassword(UserHandle,
2019  (PUNICODE_STRING)&PasswordBuffer->Password);
2020  if (!NT_SUCCESS(Status))
2021  {
2022  TRACE("SampCheckPassword failed (Status 0x%08lx)\n", Status);
2023  return Status;
2024  }
2025 
2026  /* Calculate the NT hash value of the password */
2027  Status = SystemFunction007((PUNICODE_STRING)&PasswordBuffer->Password,
2028  (LPBYTE)&Internal1Buffer.EncryptedNtOwfPassword);
2029  if (!NT_SUCCESS(Status))
2030  {
2031  TRACE("SystemFunction007 failed (Status 0x%08lx)\n", Status);
2032  return Status;
2033  }
2034 
2035  Internal1Buffer.NtPasswordPresent = TRUE;
2036  Internal1Buffer.LmPasswordPresent = FALSE;
2037 
2038  /* Build the LM password */
2039  LmPwdString.Length = 15;
2040  LmPwdString.MaximumLength = 15;
2041  LmPwdString.Buffer = LmPwdBuffer;
2042  ZeroMemory(LmPwdString.Buffer, LmPwdString.MaximumLength);
2043 
2045  (PUNICODE_STRING)&PasswordBuffer->Password,
2046  FALSE);
2047  if (NT_SUCCESS(Status))
2048  {
2049  /* Calculate the LM hash value of the password */
2050  Status = SystemFunction006(LmPwdString.Buffer,
2051  (LPSTR)&Internal1Buffer.EncryptedLmOwfPassword);
2052  if (NT_SUCCESS(Status))
2053  Internal1Buffer.LmPasswordPresent = TRUE;
2054  }
2055 
2056  Internal1Buffer.PasswordExpired = PasswordBuffer->PasswordExpired;
2057 
2058  RpcTryExcept
2059  {
2062  (PVOID)&Internal1Buffer);
2063  }
2065  {
2067  }
2068  RpcEndExcept;
2069 
2070  if (!NT_SUCCESS(Status))
2071  {
2072  TRACE("SamrSetInformation() failed (Status 0x%08lx)\n", Status);
2073  }
2074 
2075  return Status;
2076  }
2077  else if (UserInformationClass == UserAllInformation)
2078  {
2079  RtlCopyMemory(&InternalAllBuffer,
2080  Buffer,
2081  sizeof(USER_ALL_INFORMATION));
2082 
2084  {
2085  if (InternalAllBuffer.WhichFields & USER_ALL_OWFPASSWORD)
2086  {
2087  /* Check NT password hash */
2088  if (InternalAllBuffer.WhichFields & USER_ALL_NTPASSWORDPRESENT)
2089  {
2090  if (InternalAllBuffer.NtPassword.Length != sizeof(ENCRYPTED_NT_OWF_PASSWORD))
2091  return STATUS_INVALID_PARAMETER;
2092  }
2093 
2094  /* Check LM password hash */
2095  if (InternalAllBuffer.WhichFields & USER_ALL_LMPASSWORDPRESENT)
2096  {
2097  if (InternalAllBuffer.LmPassword.Length != sizeof(ENCRYPTED_LM_OWF_PASSWORD))
2098  return STATUS_INVALID_PARAMETER;
2099  }
2100  }
2101  else
2102  {
2103  /*
2104  * Only allow the NT password to be set.
2105  * The LM password will be created here.
2106  */
2107  if (InternalAllBuffer.WhichFields & USER_ALL_LMPASSWORDPRESENT)
2108  {
2109  TRACE("Do not try to set a clear text LM password!\n");
2110  return STATUS_INVALID_PARAMETER;
2111  }
2112 
2113  if (InternalAllBuffer.WhichFields & USER_ALL_NTPASSWORDPRESENT)
2114  {
2115  Status = SampCheckPassword(UserHandle,
2116  &InternalAllBuffer.NtPassword);
2117  if (!NT_SUCCESS(Status))
2118  {
2119  TRACE("SampCheckPassword failed (Status 0x%08lx)\n", Status);
2120  return Status;
2121  }
2122 
2123  /* Calculate the NT password hash */
2124  Status = SystemFunction007((PUNICODE_STRING)&InternalAllBuffer.NtPassword,
2125  (LPBYTE)&Internal1Buffer.EncryptedNtOwfPassword);
2126  if (!NT_SUCCESS(Status))
2127  {
2128  TRACE("SystemFunction007 failed (Status 0x%08lx)\n", Status);
2129  return Status;
2130  }
2131 
2132  InternalAllBuffer.NtPasswordPresent = TRUE;
2133  InternalAllBuffer.LmPasswordPresent = FALSE;
2134 
2135  InternalAllBuffer.NtPassword.Length = sizeof(ENCRYPTED_NT_OWF_PASSWORD);
2136  InternalAllBuffer.NtPassword.MaximumLength = sizeof(ENCRYPTED_NT_OWF_PASSWORD);
2137  InternalAllBuffer.NtPassword.Buffer = (LPWSTR)&Internal1Buffer.EncryptedNtOwfPassword;
2138 
2139  /* Build the LM password */
2140  LmPwdString.Length = 15;
2141  LmPwdString.MaximumLength = 15;
2142  LmPwdString.Buffer = LmPwdBuffer;
2143  ZeroMemory(LmPwdString.Buffer, LmPwdString.MaximumLength);
2144 
2146  (PUNICODE_STRING)&InternalAllBuffer.NtPassword,
2147  FALSE);
2148  if (NT_SUCCESS(Status))
2149  {
2150  /* Calculate the LM password hash */
2151  Status = SystemFunction006(LmPwdString.Buffer,
2152  (LPSTR)&Internal1Buffer.EncryptedLmOwfPassword);
2153  if (NT_SUCCESS(Status))
2154  {
2155  InternalAllBuffer.WhichFields |= USER_ALL_LMPASSWORDPRESENT;
2156  InternalAllBuffer.LmPasswordPresent = TRUE;
2157 
2158  InternalAllBuffer.LmPassword.Length = sizeof(ENCRYPTED_LM_OWF_PASSWORD);
2159  InternalAllBuffer.LmPassword.MaximumLength = sizeof(ENCRYPTED_LM_OWF_PASSWORD);
2160  InternalAllBuffer.LmPassword.Buffer = (LPWSTR)&Internal1Buffer.EncryptedLmOwfPassword;
2161  }
2162  }
2163  }
2164  }
2165  }
2166 
2167  RpcTryExcept
2168  {
2171  (PVOID)&InternalAllBuffer);
2172  }
2174  {
2176  }
2177  RpcEndExcept;
2178 
2179  if (!NT_SUCCESS(Status))
2180  {
2181  TRACE("SamrSetInformation() failed (Status 0x%08lx)\n", Status);
2182  }
2183 
2184  return Status;
2185  }
2186 
2187  RpcTryExcept
2188  {
2190  UserInformationClass,
2191  Buffer);
2192  }
2194  {
2196  }
2197  RpcEndExcept;
2198 
2199  return Status;
2200 }
2201 
2202 
2203 NTSTATUS
2204 NTAPI
2206  IN ULONG MemberId,
2208 {
2209  NTSTATUS Status;
2210 
2211  TRACE("SamSetMemberAttributesOfGroup(%p %lu 0x%lx)\n",
2212  GroupHandle, MemberId, Attributes);
2213 
2214  RpcTryExcept
2215  {
2217  MemberId,
2218  Attributes);
2219  }
2221  {
2223  }
2224  RpcEndExcept;
2225 
2226  return Status;
2227 }
2228 
2229 
2230 NTSTATUS
2231 NTAPI
2235 {
2236  SAMPR_SR_SECURITY_DESCRIPTOR DescriptorToPass;
2237  ULONG Length;
2238  NTSTATUS Status;
2239 
2240  TRACE("SamSetSecurityObject(%p %lu %p)\n",
2241  ObjectHandle, SecurityInformation, SecurityDescriptor);
2242 
2243  /* Retrieve the length of the relative security descriptor */
2244  Length = 0;
2246  NULL,
2247  &Length);
2249  return STATUS_INVALID_PARAMETER;
2250 
2251 
2252  /* Allocate a buffer for the security descriptor */
2253  DescriptorToPass.Length = Length;
2254  DescriptorToPass.SecurityDescriptor = MIDL_user_allocate(Length);
2255  if (DescriptorToPass.SecurityDescriptor == NULL)
2257 
2258  /* Convert the given security descriptor to a relative security descriptor */
2260  (PSECURITY_DESCRIPTOR)DescriptorToPass.SecurityDescriptor,
2261  &Length);
2262  if (!NT_SUCCESS(Status))
2263  goto done;
2264 
2265  RpcTryExcept
2266  {
2267  Status = SamrSetSecurityObject((SAMPR_HANDLE)ObjectHandle,
2269  &DescriptorToPass);
2270  }
2272  {
2274  }
2275  RpcEndExcept;
2276 
2277 done:
2278  if (DescriptorToPass.SecurityDescriptor != NULL)
2279  MIDL_user_free(DescriptorToPass.SecurityDescriptor);
2280 
2281  return Status;
2282 }
2283 
2284 
2285 NTSTATUS
2286 NTAPI
2288 {
2289  NTSTATUS Status;
2290 
2291  TRACE("SamShutdownSamServer(%p)\n", ServerHandle);
2292 
2293  RpcTryExcept
2294  {
2295  Status = SamrShutdownSamServer((SAMPR_HANDLE)ServerHandle);
2296  }
2298  {
2300  }
2301  RpcEndExcept;
2302 
2303  return Status;
2304 }
2305 
2306 
2307 NTSTATUS
2308 NTAPI
2310  _In_ SAM_HANDLE DomainHandle)
2311 {
2312  TRACE("SamTestPrivateFunctionsDomain(%p)\n",
2313  DomainHandle);
2314  return STATUS_NOT_IMPLEMENTED;
2315 }
2316 
2317 
2318 NTSTATUS
2319 NTAPI
2321  _In_ SAM_HANDLE UserHandle)
2322 {
2323  TRACE("SamTestPrivateFunctionsUser(%p)\n",
2324  UserHandle);
2325  return STATUS_NOT_IMPLEMENTED;
2326 }
2327 
2328 /* EOF */
NTSTATUS NTAPI SamRemoveMemberFromGroup(IN SAM_HANDLE GroupHandle, IN ULONG MemberId)
Definition: samlib.c:1850
NTSTATUS NTAPI SamrRemoveMemberFromForeignDomain(IN SAMPR_HANDLE DomainHandle, IN PRPC_SID MemberSid)
Definition: samrpc.c:8402
NTSTATUS NTAPI SamCloseHandle(IN SAM_HANDLE SamHandle)
Definition: samlib.c:497
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:876
unsigned long * Element
Definition: lsasrv.h:88
NTSTATUS NTAPI SamrGetDisplayEnumerationIndex2(IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN PRPC_UNICODE_STRING Prefix, OUT unsigned long *Index)
Definition: samrpc.c:8809
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
NTSTATUS NTAPI SamGetGroupsForUser(IN SAM_HANDLE UserHandle, OUT PGROUP_MEMBERSHIP *Groups, OUT PULONG MembershipCount)
Definition: samlib.c:1094
#define IN
Definition: typedefs.h:39
#define RpcEndExcept
Definition: rpc.h:128
NTSTATUS NTAPI SamCreateGroupInDomain(IN SAM_HANDLE DomainHandle, IN PUNICODE_STRING AccountName, IN ACCESS_MASK DesiredAccess, OUT PSAM_HANDLE GroupHandle, OUT PULONG RelativeId)
Definition: samlib.c:596
enum _DOMAIN_DISPLAY_INFORMATION DOMAIN_DISPLAY_INFORMATION
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:783
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2654
NTSTATUS __stdcall SamrGetAliasMembership(SAMPR_HANDLE DomainHandle, PSAMPR_PSID_ARRAY SidArray, PSAMPR_ULONG_ARRAY Membership)
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1630
NTSTATUS NTAPI SamSetMemberAttributesOfGroup(IN SAM_HANDLE GroupHandle, IN ULONG MemberId, IN ULONG Attributes)
Definition: samlib.c:2205
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI SamrShutdownSamServer(IN SAMPR_HANDLE ServerHandle)
Definition: samrpc.c:466
enum _SID_NAME_USE SID_NAME_USE
NTSTATUS NTAPI SamGetMembersInAlias(IN SAM_HANDLE AliasHandle, OUT PSID **MemberIds, OUT PULONG MemberCount)
Definition: samlib.c:1138
NTSTATUS NTAPI SamAddMemberToAlias(IN SAM_HANDLE AliasHandle, IN PSID MemberId)
Definition: samlib.c:235
NTSTATUS NTAPI SamTestPrivateFunctionsUser(_In_ SAM_HANDLE UserHandle)
Definition: samlib.c:2320
NTSTATUS NTAPI SamGetDisplayEnumerationIndex(IN SAM_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformation, IN PUNICODE_STRING Prefix, OUT PULONG Index)
Definition: samlib.c:1061
_In_ ULONG Mode
Definition: hubbusif.h:303
NTSTATUS __stdcall SamrOpenDomain(SAMPR_HANDLE ServerHandle, ACCESS_MASK DesiredAccess, PRPC_SID DomainId, SAMPR_HANDLE *DomainHandle)
NTSTATUS NTAPI SamDeleteGroup(IN SAM_HANDLE GroupHandle)
Definition: samlib.c:732
handle_t hBinding
Definition: ctx_c.c:54
NTSTATUS NTAPI SamrGetMembersInAlias(IN SAMPR_HANDLE AliasHandle, OUT PSAMPR_PSID_ARRAY_OUT Members)
Definition: samrpc.c:5360
USHORT MaximumLength
Definition: env_spec_w32.h:370
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:174
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
PWSTR Names[]
NTSTATUS NTAPI SamRidToSid(IN SAM_HANDLE ObjectHandle, IN ULONG Rid, OUT PSID *Sid)
Definition: samlib.c:1908
NTSTATUS NTAPI SamrSetMemberAttributesOfGroup(IN SAMPR_HANDLE GroupHandle, IN unsigned long MemberId, IN unsigned long Attributes)
Definition: samrpc.c:4778
#define TRUE
Definition: types.h:120
_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 STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
NTSTATUS NTAPI SamrEnumerateGroupsInDomain(IN SAMPR_HANDLE DomainHandle, IN OUT unsigned long *EnumerationContext, OUT PSAMPR_ENUMERATION_BUFFER *Buffer, IN unsigned long PreferedMaximumLength, OUT unsigned long *CountReturned)
Definition: samrpc.c:2088
SAMPR_DOMAIN_DISPLAY_MACHINE_BUFFER MachineInformation
Definition: sam.idl:366
NTSTATUS NTAPI SamQueryDisplayInformation(IN SAM_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformation, IN ULONG Index, IN ULONG EntryCount, IN ULONG PreferredMaximumLength, OUT PULONG TotalAvailable, OUT PULONG TotalReturned, OUT PULONG ReturnedEntryCount, OUT PVOID *SortedBuffer)
Definition: samlib.c:1564
wchar_t * PSAMPR_SERVER_NAME
Definition: authpackage.c:112
NTSTATUS NTAPI SamrQueryInformationDomain(IN SAMPR_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
Definition: samrpc.c:1615
PSAMPR_RID_ENUMERATION Buffer
Definition: sam.idl:96
char CHAR
Definition: xmlstorage.h:175
NTSTATUS NTAPI SamOpenDomain(IN SAM_HANDLE ServerHandle, IN ACCESS_MASK DesiredAccess, IN PSID DomainId, OUT PSAM_HANDLE DomainHandle)
Definition: samlib.c:1477
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:186
#define WARN(fmt,...)
Definition: debug.h:112
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI SamQueryInformationAlias(IN SAM_HANDLE AliasHandle, IN ALIAS_INFORMATION_CLASS AliasInformationClass, OUT PVOID *Buffer)
Definition: samlib.c:1650
_In_ DWORD nLength
Definition: wincon.h:473
BOOLEAN LmPasswordPresent
Definition: ntsam.h:715
NTSTATUS NTAPI SamCreateUserInDomain(IN SAM_HANDLE DomainHandle, IN PUNICODE_STRING AccountName, IN ACCESS_MASK DesiredAccess, OUT PSAM_HANDLE UserHandle, OUT PULONG RelativeId)
Definition: samlib.c:670
NTSTATUS NTAPI SamrSetInformationGroup(IN SAMPR_HANDLE GroupHandle, IN GROUP_INFORMATION_CLASS GroupInformationClass, IN PSAMPR_GROUP_INFO_BUFFER Buffer)
Definition: samrpc.c:4416
#define ZeroMemory
Definition: winbase.h:1664
NTSTATUS NTAPI SamrLookupNamesInDomain(IN SAMPR_HANDLE DomainHandle, IN ULONG Count, IN RPC_UNICODE_STRING Names[], OUT PSAMPR_ULONG_ARRAY RelativeIds, OUT PSAMPR_ULONG_ARRAY Use)
Definition: samrpc.c:3464
NTSTATUS NTAPI SamrQueryInformationGroup(IN SAMPR_HANDLE GroupHandle, IN GROUP_INFORMATION_CLASS GroupInformationClass, OUT PSAMPR_GROUP_INFO_BUFFER *Buffer)
Definition: samrpc.c:4252
NTSTATUS NTAPI SamQueryInformationDomain(IN SAM_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, OUT PVOID *Buffer)
Definition: samlib.c:1677
NTSTATUS NTAPI SamOpenAlias(IN SAM_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN ULONG AliasId, OUT PSAM_HANDLE AliasHandle)
Definition: samlib.c:1448
PSAMPR_DOMAIN_DISPLAY_OEM_USER Buffer
Definition: sam.idl:354
SAMPR_DOMAIN_DISPLAY_GROUP_BUFFER GroupInformation
Definition: sam.idl:367
NTSTATUS NTAPI SamrChangePasswordUser(IN SAMPR_HANDLE UserHandle, IN unsigned char LmPresent, IN PENCRYPTED_LM_OWF_PASSWORD OldLmEncryptedWithNewLm, IN PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithOldLm, IN unsigned char NtPresent, IN PENCRYPTED_NT_OWF_PASSWORD OldNtEncryptedWithNewNt, IN PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithOldNt, IN unsigned char NtCrossEncryptionPresent, IN PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithNewLm, IN unsigned char LmCrossEncryptionPresent, IN PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithNewNt)
Definition: samrpc.c:7864
NTSTATUS NTAPI SamEnumerateUsersInDomain(IN SAM_HANDLE DomainHandle, IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext, IN ULONG UserAccountControl, OUT PVOID *Buffer, IN ULONG PreferedMaximumLength, OUT PULONG CountReturned)
Definition: samlib.c:933
NTSTATUS WINAPI SystemFunction006(LPCSTR password, LPSTR hash)
Definition: crypt_lmhash.c:53
NTSTATUS NTAPI SamrGetGroupsForUser(IN SAMPR_HANDLE UserHandle, OUT PSAMPR_GET_GROUPS_BUFFER *Groups)
Definition: samrpc.c:8145
NTSTATUS WINAPI SystemFunction007(PUNICODE_STRING string, LPBYTE hash)
STRING OEM_STRING
Definition: umtypes.h:203
NTSTATUS NTAPI SamrCreateGroupInDomain(IN SAMPR_HANDLE DomainHandle, IN PRPC_UNICODE_STRING Name, IN ACCESS_MASK DesiredAccess, OUT SAMPR_HANDLE *GroupHandle, OUT unsigned long *RelativeId)
Definition: samrpc.c:1894
TOpcodeData Groups[17][8]
char * LPSTR
Definition: xmlstorage.h:182
NTSTATUS NTAPI SamrLookupDomainInSamServer(IN SAMPR_HANDLE ServerHandle, IN PRPC_UNICODE_STRING Name, OUT PRPC_SID *DomainId)
Definition: samrpc.c:504
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:510
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
UNICODE_STRING LmPassword
Definition: ntsam.h:702
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define C1_LOWER
Definition: unicode.h:32
#define USER_ALL_OWFPASSWORD
Definition: ntsam.h:225
#define STATUS_PASSWORD_RESTRICTION
Definition: ntstatus.h:344
unsigned long Length
Definition: msv1_0.h:45
NTSTATUS NTAPI SamSetInformationGroup(IN SAM_HANDLE GroupHandle, IN GROUP_INFORMATION_CLASS GroupInformationClass, IN PVOID Buffer)
Definition: samlib.c:1973
return STATUS_NOT_IMPLEMENTED
long RPC_STATUS
Definition: rpc.h:52
struct _ENCRYPTED_LM_OWF_PASSWORD ENCRYPTED_LM_OWF_PASSWORD
NTSTATUS NTAPI SamrDeleteUser(IN OUT SAMPR_HANDLE *UserHandle)
Definition: samrpc.c:5482
#define DOMAIN_PASSWORD_COMPLEX
Definition: ntsam.h:254
NTSTATUS NTAPI SamChangePasswordUser3(IN PUNICODE_STRING ServerName, IN PUNICODE_STRING UserName, IN PUNICODE_STRING OldPassword, IN PUNICODE_STRING NewPassword, OUT PDOMAIN_PASSWORD_INFORMATION *EffectivePasswordPolicy, OUT PUSER_PWD_CHANGE_FAILURE_INFORMATION *PasswordChangeFailureInfo)
Definition: samlib.c:483
NTSTATUS NTAPI SamrGetMembersInGroup(IN SAMPR_HANDLE GroupHandle, OUT PSAMPR_GET_MEMBERS_BUFFER *Members)
Definition: samrpc.c:4664
unsigned char * LPBYTE
Definition: typedefs.h:53
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
SAMPR_DOMAIN_DISPLAY_OEM_GROUP_BUFFER OemGroupInformation
Definition: sam.idl:369
NTSTATUS NTAPI SamrAddMultipleMembersToAlias(IN SAMPR_HANDLE AliasHandle, IN PSAMPR_PSID_ARRAY MembersBuffer)
Definition: samrpc.c:9292
enum _GROUP_INFORMATION_CLASS GROUP_INFORMATION_CLASS
DWORD SECURITY_INFORMATION
Definition: ms-dtyp.idl:311
NTSTATUS NTAPI SamCreateUser2InDomain(IN SAM_HANDLE DomainHandle, IN PUNICODE_STRING AccountName, IN ULONG AccountType, IN ACCESS_MASK DesiredAccess, OUT PSAM_HANDLE UserHandle, OUT PULONG GrantedAccess, OUT PULONG RelativeId)
Definition: samlib.c:630
NTSTATUS NTAPI SamGetMembersInGroup(IN SAM_HANDLE GroupHandle, OUT PULONG *MemberIds, OUT PULONG *Attributes, OUT PULONG MemberCount)
Definition: samlib.c:1180
NTSYSAPI NTSTATUS NTAPI RtlUpcaseUnicodeStringToOemString(POEM_STRING DestinationString, PCUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSTATUS NTAPI SamrLookupIdsInDomain(IN SAMPR_HANDLE DomainHandle, IN ULONG Count, IN ULONG *RelativeIds, OUT PSAMPR_RETURNED_USTRING_ARRAY Names, OUT PSAMPR_ULONG_ARRAY Use)
Definition: samrpc.c:3693
NTSTATUS NTAPI SamLookupIdsInDomain(IN SAM_HANDLE DomainHandle, IN ULONG Count, IN PULONG RelativeIds, OUT PUNICODE_STRING *Names, OUT PSID_NAME_USE *Use OPTIONAL)
Definition: samlib.c:1256
static PVOID ptr
Definition: dispmode.c:27
#define RpcTryExcept
Definition: rpc.h:126
#define SAM_SID_COMPATIBILITY_ALL
Definition: ntsam.h:728
NTSTATUS NTAPI SamLookupNamesInDomain(IN SAM_HANDLE DomainHandle, IN ULONG Count, IN PUNICODE_STRING Names, OUT PULONG *RelativeIds, OUT PSID_NAME_USE *Use)
Definition: samlib.c:1371
NTSTATUS NTAPI SamChangePasswordUser(IN SAM_HANDLE UserHandle, IN PUNICODE_STRING OldPassword, IN PUNICODE_STRING NewPassword)
Definition: samlib.c:320
PRPC_UNICODE_STRING Element
Definition: lookup.c:22
unsigned char BOOLEAN
unsigned char * SecurityDescriptor
Definition: msv1_0.h:46
enum _DOMAIN_INFORMATION_CLASS DOMAIN_INFORMATION_CLASS
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
NTSTATUS NTAPI SamrCreateUserInDomain(IN SAMPR_HANDLE DomainHandle, IN PRPC_UNICODE_STRING Name, IN ACCESS_MASK DesiredAccess, OUT SAMPR_HANDLE *UserHandle, OUT unsigned long *RelativeId)
Definition: samrpc.c:2296
#define _In_
Definition: ms_sal.h:308
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1103
NTSTATUS NTAPI SamrAddMemberToAlias(IN SAMPR_HANDLE AliasHandle, IN PRPC_SID MemberId)
Definition: samrpc.c:5280
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION SecurityInformation
Definition: fltkernel.h:1339
Definition: bufpool.h:45
NTSTATUS NTAPI SamrQueryInformationAlias(IN SAMPR_HANDLE AliasHandle, IN ALIAS_INFORMATION_CLASS AliasInformationClass, OUT PSAMPR_ALIAS_INFO_BUFFER *Buffer)
Definition: samrpc.c:5044
NTSTATUS NTAPI SamrDeleteAlias(IN OUT SAMPR_HANDLE *AliasHandle)
Definition: samrpc.c:5222
NTSTATUS NTAPI SamSetInformationUser(IN SAM_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, IN PVOID Buffer)
Definition: samlib.c:2000
#define __RPC_FAR
Definition: rpc.h:56
const char * LPCSTR
Definition: xmlstorage.h:183
unsigned long Count
Definition: lsasrv.h:87
NTSTATUS NTAPI SamrGetUserDomainPasswordInformation(IN SAMPR_HANDLE UserHandle, OUT PUSER_DOMAIN_PASSWORD_INFORMATION PasswordInformation)
Definition: samrpc.c:8314
#define __RPC_USER
Definition: rpc.h:65
NTSTATUS NTAPI SamRemoveMultipleMembersFromAlias(IN SAM_HANDLE AliasHandle, IN PSID *MemberIds, IN ULONG MemberCount)
Definition: samlib.c:1875
Status
Definition: gdiplustypes.h:24
PSAMPR_DOMAIN_DISPLAY_OEM_GROUP Buffer
Definition: sam.idl:360
RPC_UNICODE_STRING Password
Definition: sam.idl:629
int Count
Definition: noreturn.cpp:7
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samlib.c:59
NTSTATUS NTAPI SamCreateAliasInDomain(IN SAM_HANDLE DomainHandle, IN PUNICODE_STRING AccountName, IN ACCESS_MASK DesiredAccess, OUT PSAM_HANDLE AliasHandle, OUT PULONG RelativeId)
Definition: samlib.c:562
#define RpcExceptionCode()
Definition: rpc.h:132
enum _SID_NAME_USE * PSID_NAME_USE
#define TRACE(s)
Definition: solgame.cpp:4
NTSTATUS NTAPI SamDeleteUser(IN SAM_HANDLE UserHandle)
Definition: samlib.c:760
NTSTATUS NTAPI SamEnumerateDomainsInSamServer(IN SAM_HANDLE ServerHandle, IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext, OUT PVOID *Buffer, IN ULONG PreferedMaximumLength, OUT PULONG CountReturned)
Definition: samlib.c:838
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
NTSTATUS NTAPI SamDeleteAlias(IN SAM_HANDLE AliasHandle)
Definition: samlib.c:704
NTSTATUS NTAPI SamrEnumerateAliasesInDomain(IN SAMPR_HANDLE DomainHandle, IN OUT unsigned long *EnumerationContext, OUT PSAMPR_ENUMERATION_BUFFER *Buffer, IN unsigned long PreferedMaximumLength, OUT unsigned long *CountReturned)
Definition: samrpc.c:3085
#define C1_ALPHA
Definition: unicode.h:39
NTSTATUS NTAPI SamSetInformationDomain(IN SAM_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, IN PVOID Buffer)
Definition: samlib.c:1946
NTSTATUS NTAPI SamrEnumerateDomainsInSamServer(IN SAMPR_HANDLE ServerHandle, IN OUT unsigned long *EnumerationContext, OUT PSAMPR_ENUMERATION_BUFFER *Buffer, IN ULONG PreferedMaximumLength, OUT PULONG CountReturned)
Definition: samrpc.c:621
unsigned long Count
Definition: sam.idl:55
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI SamrRemoveMemberFromGroup(IN SAMPR_HANDLE GroupHandle, IN unsigned long MemberId)
Definition: samrpc.c:4602
ENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword
Definition: sam.idl:640
_In_ WDFCOLLECTION _In_ ULONG Index
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: lang.c:1699
NTSTATUS NTAPI SamEnumerateGroupsInDomain(IN SAM_HANDLE DomainHandle, IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext, IN PVOID *Buffer, IN ULONG PreferedMaximumLength, OUT PULONG CountReturned)
Definition: samlib.c:888
#define C1_DIGIT
Definition: unicode.h:33
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samlib.c:65
#define WINAPI
Definition: msvc.h:6
#define CopyMemory
Definition: winbase.h:1662
unsigned short WORD
Definition: ntddk_ex.h:93
static FILE * out
Definition: regtests2xml.c:44
NTSTATUS NTAPI SamLookupDomainInSamServer(IN SAM_HANDLE ServerHandle, IN PUNICODE_STRING Name, OUT PSID *DomainId)
Definition: samlib.c:1229
PSAMPR_SID_INFORMATION Sids
Definition: authpackage.c:123
NTSTATUS NTAPI SamrDeleteGroup(IN OUT SAMPR_HANDLE *GroupHandle)
Definition: samrpc.c:4534
SAMPR_DOMAIN_DISPLAY_OEM_USER_BUFFER OemUserInformation
Definition: sam.idl:368
NTSTATUS NTAPI SamGetCompatibilityMode(IN SAM_HANDLE ObjectHandle, OUT PULONG Mode)
Definition: samlib.c:1045
enum _ALIAS_INFORMATION_CLASS ALIAS_INFORMATION_CLASS
#define CT_CTYPE1
Definition: winnls.h:237
handle_t __RPC_USER PSAMPR_SERVER_NAME_bind(PSAMPR_SERVER_NAME pszSystemName)
Definition: samlib.c:72
#define C1_PUNCT
Definition: unicode.h:35
NTSTATUS NTAPI SamrSetInformationDomain(IN SAMPR_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, IN PSAMPR_DOMAIN_INFO_BUFFER DomainInformation)
Definition: samrpc.c:1790
static const WCHAR L[]
Definition: oid.c:1250
PSAMPR_SID_INFORMATION Sids
Definition: sam.idl:56
T1_FIELD_DICT_PRIVATE password
Definition: t1tokens.h:64
NTSTATUS NTAPI SamFreeMemory(IN PVOID Buffer)
Definition: samlib.c:983
#define C1_UPPER
Definition: unicode.h:31
#define USER_ALL_NTPASSWORDPRESENT
Definition: ntsam.h:220
GLenum GLsizei len
Definition: glext.h:6722
NTSTATUS NTAPI SamrOpenGroup(IN SAMPR_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN unsigned long GroupId, OUT SAMPR_HANDLE *GroupHandle)
Definition: samrpc.c:3978
NTSTATUS NTAPI SamAddMemberToGroup(IN SAM_HANDLE GroupHandle, IN ULONG MemberId, IN ULONG Attributes)
Definition: samlib.c:260
NTSTATUS NTAPI SamrAddMemberToGroup(IN SAMPR_HANDLE GroupHandle, IN unsigned long MemberId, IN unsigned long Attributes)
Definition: samrpc.c:4470
NTSTATUS NTAPI SamrOpenAlias(IN SAMPR_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN ULONG AliasId, OUT SAMPR_HANDLE *AliasHandle)
Definition: samrpc.c:4821
unsigned short Length
Definition: msv1_0.h:22
PSAMPR_DOMAIN_DISPLAY_GROUP Buffer
Definition: sam.idl:348
NTSTATUS NTAPI SamShutdownSamServer(IN SAM_HANDLE ServerHandle)
Definition: samlib.c:2287
SAMPR_DOMAIN_DISPLAY_USER_BUFFER UserInformation
Definition: sam.idl:365
NTSTATUS NTAPI SamrRemoveMultipleMembersFromAlias(IN SAMPR_HANDLE AliasHandle, IN PSAMPR_PSID_ARRAY MembersBuffer)
Definition: samrpc.c:9320
unsigned char BYTE
Definition: xxhash.c:193
BOOLEAN NtPasswordPresent
Definition: ntsam.h:716
NTSTATUS NTAPI SamSetSecurityObject(IN SAM_HANDLE ObjectHandle, IN SECURITY_INFORMATION SecurityInformation, IN PSECURITY_DESCRIPTOR SecurityDescriptor)
Definition: samlib.c:2232
NTSTATUS NTAPI SamrConnect(IN PSAMPR_SERVER_NAME ServerName, OUT SAMPR_HANDLE *ServerHandle, IN ACCESS_MASK DesiredAccess)
Definition: samrpc.c:135
NTSTATUS NTAPI SamTestPrivateFunctionsDomain(_In_ SAM_HANDLE DomainHandle)
Definition: samlib.c:2309
uint16_t * LPWORD
Definition: typedefs.h:56
NTSTATUS NTAPI SamrRemoveMemberFromAlias(IN SAMPR_HANDLE AliasHandle, IN PRPC_SID MemberId)
Definition: samrpc.c:5320
NTSTATUS NTAPI SamSetInformationAlias(IN SAM_HANDLE AliasHandle, IN ALIAS_INFORMATION_CLASS AliasInformationClass, IN PVOID Buffer)
Definition: samlib.c:1919
unsigned long Count
Definition: authpackage.c:122
ULONG_PTR SIZE_T
Definition: typedefs.h:80
PSAMPR_DOMAIN_DISPLAY_MACHINE Buffer
Definition: sam.idl:342
struct _SAMPR_USER_SET_PASSWORD_INFORMATION * PSAMPR_USER_SET_PASSWORD_INFORMATION
ENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword
Definition: sam.idl:641
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLuint in
Definition: glext.h:9616
PGROUP_MEMBERSHIP Groups
Definition: sam.idl:116
NTSTATUS NTAPI SamQuerySecurityObject(IN SAM_HANDLE ObjectHandle, IN SECURITY_INFORMATION SecurityInformation, OUT PSECURITY_DESCRIPTOR *SecurityDescriptor)
Definition: samlib.c:1758
NTSTATUS WINAPI SystemFunction012(const BYTE *in, const BYTE *key, LPBYTE out)
Definition: sysfunc.c:353
NTSTATUS NTAPI SamrSetInformationAlias(IN SAMPR_HANDLE AliasHandle, IN ALIAS_INFORMATION_CLASS AliasInformationClass, IN PSAMPR_ALIAS_INFO_BUFFER Buffer)
Definition: samrpc.c:5173
NTSTATUS NTAPI SamrSetInformationUser(IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, IN PSAMPR_USER_INFO_BUFFER Buffer)
Definition: samrpc.c:7848
NTSTATUS __stdcall SamrCloseHandle(SAMPR_HANDLE *SamHandle)
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
unsigned int * PULONG
Definition: retypes.h:1
NTSTATUS NTAPI SamEnumerateAliasesInDomain(IN SAM_HANDLE DomainHandle, IN OUT PSAM_ENUMERATE_HANDLE EnumerationContext, OUT PVOID *Buffer, IN ULONG PreferedMaximumLength, OUT PULONG CountReturned)
Definition: samlib.c:788
unsigned long * Members
Definition: sam.idl:122
NTSTATUS NTAPI SamrSetSecurityObject(IN SAMPR_HANDLE ObjectHandle, IN SECURITY_INFORMATION SecurityInformation, IN PSAMPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor)
Definition: samrpc.c:192
#define NULL
Definition: types.h:112
unsigned long * Attributes
Definition: sam.idl:123
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define USER_ALL_LMPASSWORDPRESENT
Definition: ntsam.h:221
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSTATUS NTAPI SamrOpenUser(IN SAMPR_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN ULONG UserId, OUT SAMPR_HANDLE *UserHandle)
NTSTATUS NTAPI SamrCreateAliasInDomain(IN SAMPR_HANDLE DomainHandle, IN PRPC_UNICODE_STRING AccountName, IN ACCESS_MASK DesiredAccess, OUT SAMPR_HANDLE *AliasHandle, OUT unsigned long *RelativeId)
Definition: samrpc.c:2909
struct _ENCRYPTED_LM_OWF_PASSWORD ENCRYPTED_NT_OWF_PASSWORD
NTSTATUS NTAPI SamRemoveMemberFromForeignDomain(IN SAM_HANDLE DomainHandle, IN PSID MemberId)
Definition: samlib.c:1825
unsigned long MemberCount
Definition: sam.idl:121
NTSTATUS SampCheckPassword(IN SAMPR_HANDLE UserHandle, IN PUNICODE_STRING Password)
Definition: samlib.c:148
unsigned long MembershipCount
Definition: sam.idl:115
#define OUT
Definition: typedefs.h:40
NTSTATUS NTAPI SamRemoveMemberFromAlias(IN SAM_HANDLE AliasHandle, IN PSID MemberId)
Definition: samlib.c:1800
NTSTATUS NTAPI SamGetAliasMembership(IN SAM_HANDLE DomainHandle, IN ULONG PassedCount, IN PSID *Sids, OUT PULONG MembershipCount, OUT PULONG *Aliases)
Definition: samlib.c:994
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI SamrQuerySecurityObject(IN SAMPR_HANDLE ObjectHandle, IN SECURITY_INFORMATION SecurityInformation, OUT PSAMPR_SR_SECURITY_DESCRIPTOR *SecurityDescriptor)
Definition: samrpc.c:329
#define UNIMPLEMENTED
Definition: debug.h:115
void __RPC_USER PSAMPR_SERVER_NAME_unbind(PSAMPR_SERVER_NAME pszSystemName, handle_t hBinding)
Definition: samlib.c:132
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
void *__RPC_USER MIDL_user_allocate(SIZE_T size)
Definition: irotp.c:371
#define STATUS_SUCCESS
Definition: shellext.h:65
NTSTATUS NTAPI SamrCreateUser2InDomain(IN SAMPR_HANDLE DomainHandle, IN PRPC_UNICODE_STRING Name, IN unsigned long AccountType, IN ACCESS_MASK DesiredAccess, OUT SAMPR_HANDLE *UserHandle, OUT unsigned long *GrantedAccess, OUT unsigned long *RelativeId)
Definition: samrpc.c:8825
NTSTATUS NTAPI SamOpenGroup(IN SAM_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN ULONG GroupId, OUT PSAM_HANDLE GroupHandle)
Definition: samlib.c:1506
NTSTATUS NTAPI SamrQueryInformationUser(IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, OUT PSAMPR_USER_INFO_BUFFER *Buffer)
Definition: samrpc.c:7234
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UNICODE_STRING NtPassword
Definition: ntsam.h:703
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK GrantedAccess
Definition: sefuncs.h:13
NTSTATUS NTAPI SamQueryInformationUser(IN SAM_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, OUT PVOID *Buffer)
Definition: samlib.c:1731
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
PSAMPR_DOMAIN_DISPLAY_USER Buffer
Definition: sam.idl:336
Definition: _hash_fun.h:40
NTSYSAPI NTSTATUS NTAPI RtlMakeSelfRelativeSD(_In_ PSECURITY_DESCRIPTOR AbsoluteSD, _Out_ PSECURITY_DESCRIPTOR SelfRelativeSD, _Inout_ PULONG BufferLength)
static SERVICE_STATUS status
Definition: service.c:31
NTSTATUS NTAPI SamConnect(IN OUT PUNICODE_STRING ServerName OPTIONAL, OUT PSAM_HANDLE ServerHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: samlib.c:519
NTSTATUS NTAPI SamrQueryDisplayInformation3(IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN unsigned long Index, IN unsigned long EntryCount, IN unsigned long PreferredMaximumLength, OUT unsigned long *TotalAvailable, OUT unsigned long *TotalReturned, OUT PSAMPR_DISPLAY_INFO_BUFFER Buffer)
Definition: samrpc.c:9240
NTSTATUS NTAPI SamChangePasswordUser2(IN PUNICODE_STRING ServerName, IN PUNICODE_STRING UserName, IN PUNICODE_STRING OldPassword, IN PUNICODE_STRING NewPassword)
Definition: samlib.c:471
NTSTATUS NTAPI SamQueryInformationGroup(IN SAM_HANDLE GroupHandle, IN GROUP_INFORMATION_CLASS GroupInformationClass, OUT PVOID *Buffer)
Definition: samlib.c:1704
#define HeapFree(x, y, z)
Definition: compat.h:594
ULONG ACCESS_MASK
Definition: nt_native.h:40
ULONG * PSAM_ENUMERATE_HANDLE
Definition: ntsam.h:263
WINE_DEFAULT_DEBUG_CHANNEL(samlib)
NTSTATUS NTAPI SamAddMultipleMembersToAlias(IN SAM_HANDLE AliasHandle, IN PSID *MemberIds, IN ULONG MemberCount)
Definition: samlib.c:287
unsigned short MaximumLength
Definition: msv1_0.h:23
struct _SAMPR_SID_INFORMATION * PSAMPR_SID_INFORMATION
#define RpcExcept(expr)
Definition: rpc.h:127
enum _USER_INFORMATION_CLASS USER_INFORMATION_CLASS
Definition: path.c:41
wchar_t * Buffer
Definition: msv1_0.h:24
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
void * SAMPR_HANDLE
Definition: authpackage.c:113
NTSTATUS NTAPI SamOpenUser(IN SAM_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN ULONG UserId, OUT PSAM_HANDLE UserHandle)
Definition: samlib.c:1535
NTSTATUS NTAPI SamrEnumerateUsersInDomain(IN SAMPR_HANDLE DomainHandle, IN OUT unsigned long *EnumerationContext, IN unsigned long UserAccountControl, OUT PSAMPR_ENUMERATION_BUFFER *Buffer, IN unsigned long PreferedMaximumLength, OUT unsigned long *CountReturned)
Definition: samrpc.c:2700
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:738
Definition: ps.c:97
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68