ReactOS  0.4.14-dev-98-gb0d4763
setup.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: Security Account Manager (SAM) Server
4  * FILE: reactos/dll/win32/samsrv/setup.c
5  * PURPOSE: Registry setup routines
6  *
7  * PROGRAMMERS: Eric Kohl
8  */
9 
10 #include "samsrv.h"
11 
12 #include <ntsecapi.h>
13 
14 #include "resources.h"
15 
16 /* GLOBALS *****************************************************************/
17 
18 #define TICKS_PER_SECOND 10000000LL
19 
21 
22 /* FUNCTIONS ***************************************************************/
23 
24 static BOOL
26  ULONG AliasId,
27  PSID MemberSid)
28 {
29  DWORD dwDisposition;
30  LPWSTR MemberSidString = NULL;
31  WCHAR szKeyName[256];
32  HKEY hMembersKey;
33 
34  ConvertSidToStringSidW(MemberSid, &MemberSidString);
35 
36  swprintf(szKeyName, L"Aliases\\%08lX\\Members", AliasId);
37 
38  if (!RegCreateKeyExW(hDomainKey,
39  szKeyName,
40  0,
41  NULL,
44  NULL,
45  &hMembersKey,
46  &dwDisposition))
47  {
48  RegSetValueEx(hMembersKey,
49  MemberSidString,
50  0,
51  REG_BINARY,
52  (LPVOID)MemberSid,
53  RtlLengthSid(MemberSid));
54 
55  RegCloseKey(hMembersKey);
56  }
57 
58  swprintf(szKeyName, L"Aliases\\Members\\%s", MemberSidString);
59 
60  if (!RegCreateKeyExW(hDomainKey,
61  szKeyName,
62  0,
63  NULL,
66  NULL,
67  &hMembersKey,
68  &dwDisposition))
69  {
70  swprintf(szKeyName, L"%08lX", AliasId);
71 
72  RegSetValueEx(hMembersKey,
73  szKeyName,
74  0,
75  REG_BINARY,
76  (LPVOID)MemberSid,
77  RtlLengthSid(MemberSid));
78 
79  RegCloseKey(hMembersKey);
80  }
81 
82  if (MemberSidString != NULL)
83  LocalFree(MemberSidString);
84 
85  return TRUE;
86 }
87 
88 
89 static
93  LPCWSTR lpDescription,
94  ULONG ulRelativeId)
95 {
96  WCHAR szAccountKeyName[32];
97  HANDLE hAccountKey = NULL;
98  HANDLE hNamesKey = NULL;
100  ULONG SdSize = 0;
102 
103  swprintf(szAccountKeyName, L"Aliases\\%08lX", ulRelativeId);
104 
105  Status = SampRegCreateKey(hDomainKey,
106  szAccountKeyName,
108  &hAccountKey);
109  if (!NT_SUCCESS(Status))
110  return Status;
111 
112  Status = SampRegSetValue(hAccountKey,
113  L"Name",
114  REG_SZ,
116  (wcslen(lpAccountName) + 1) * sizeof(WCHAR));
117  if (!NT_SUCCESS(Status))
118  goto done;
119 
120  Status = SampRegSetValue(hAccountKey,
121  L"Description",
122  REG_SZ,
123  (LPVOID)lpDescription,
124  (wcslen(lpDescription) + 1) * sizeof(WCHAR));
125  if (!NT_SUCCESS(Status))
126  goto done;
127 
128  /* Create the server SD */
130  &SdSize);
131  if (!NT_SUCCESS(Status))
132  goto done;
133 
134  /* Set SecDesc attribute*/
135  Status = SampRegSetValue(hAccountKey,
136  L"SecDesc",
137  REG_BINARY,
138  Sd,
139  SdSize);
140  if (!NT_SUCCESS(Status))
141  goto done;
142 
143  Status = SampRegOpenKey(hDomainKey,
144  L"Aliases\\Names",
146  &hNamesKey);
147  if (!NT_SUCCESS(Status))
148  goto done;
149 
150  Status = SampRegSetValue(hNamesKey,
152  REG_DWORD,
153  (LPVOID)&ulRelativeId,
154  sizeof(ULONG));
155 
156 done:
157  SampRegCloseKey(&hNamesKey);
158 
159  if (Sd != NULL)
160  RtlFreeHeap(RtlGetProcessHeap(), 0, Sd);
161 
162  if (hAccountKey != NULL)
163  {
164  SampRegCloseKey(&hAccountKey);
165 
166  if (!NT_SUCCESS(Status))
167  SampRegDeleteKey(hDomainKey,
168  szAccountKeyName);
169  }
170 
171  return Status;
172 }
173 
174 
175 static
176 NTSTATUS
178  IN ULONG GroupId,
179  IN ULONG MemberId)
180 {
181  WCHAR szKeyName[256];
182  HANDLE hGroupKey = NULL;
183  PULONG MembersBuffer = NULL;
184  ULONG MembersCount = 0;
185  ULONG Length = 0;
186  ULONG i;
188 
189  swprintf(szKeyName, L"Groups\\%08lX", GroupId);
190 
191  Status = SampRegOpenKey(hDomainKey,
192  szKeyName,
194  &hGroupKey);
195  if (!NT_SUCCESS(Status))
196  return Status;
197 
198  Status = SampRegQueryValue(hGroupKey,
199  L"Members",
200  NULL,
201  NULL,
202  &Length);
204  goto done;
205 
206  MembersBuffer = midl_user_allocate(Length + sizeof(ULONG));
207  if (MembersBuffer == NULL)
208  {
210  goto done;
211  }
212 
214  {
215  Status = SampRegQueryValue(hGroupKey,
216  L"Members",
217  NULL,
218  MembersBuffer,
219  &Length);
220  if (!NT_SUCCESS(Status))
221  goto done;
222 
223  MembersCount = Length / sizeof(ULONG);
224  }
225 
226  for (i = 0; i < MembersCount; i++)
227  {
228  if (MembersBuffer[i] == MemberId)
229  {
231  goto done;
232  }
233  }
234 
235  MembersBuffer[MembersCount] = MemberId;
236  Length += sizeof(ULONG);
237 
238  Status = SampRegSetValue(hGroupKey,
239  L"Members",
240  REG_BINARY,
241  MembersBuffer,
242  Length);
243 
244 done:
245  if (MembersBuffer != NULL)
246  midl_user_free(MembersBuffer);
247 
248  SampRegCloseKey(&hGroupKey);
249 
250  return Status;
251 }
252 
253 
254 static
255 NTSTATUS
258  LPCWSTR lpComment,
259  ULONG ulRelativeId)
260 {
261  SAM_GROUP_FIXED_DATA FixedGroupData;
262  WCHAR szAccountKeyName[32];
263  HANDLE hAccountKey = NULL;
264  HANDLE hNamesKey = NULL;
266  ULONG SdSize = 0;
268 
269  /* Initialize fixed group data */
270  FixedGroupData.Version = 1;
271  FixedGroupData.Reserved = 0;
272  FixedGroupData.GroupId = ulRelativeId;
273  FixedGroupData.Attributes = 0;
274 
275  swprintf(szAccountKeyName, L"Groups\\%08lX", ulRelativeId);
276 
277  Status = SampRegCreateKey(hDomainKey,
278  szAccountKeyName,
280  &hAccountKey);
281  if (!NT_SUCCESS(Status))
282  return Status;
283 
284  Status = SampRegSetValue(hAccountKey,
285  L"F",
286  REG_BINARY,
287  (LPVOID)&FixedGroupData,
288  sizeof(SAM_GROUP_FIXED_DATA));
289  if (!NT_SUCCESS(Status))
290  goto done;
291 
292  Status = SampRegSetValue(hAccountKey,
293  L"Name",
294  REG_SZ,
296  (wcslen(lpAccountName) + 1) * sizeof(WCHAR));
297  if (!NT_SUCCESS(Status))
298  goto done;
299 
300  Status = SampRegSetValue(hAccountKey,
301  L"AdminComment",
302  REG_SZ,
303  (LPVOID)lpComment,
304  (wcslen(lpComment) + 1) * sizeof(WCHAR));
305  if (!NT_SUCCESS(Status))
306  goto done;
307 
308  /* Create the security descriptor */
310  &SdSize);
311  if (!NT_SUCCESS(Status))
312  goto done;
313 
314  /* Set the SecDesc attribute*/
315  Status = SampRegSetValue(hAccountKey,
316  L"SecDesc",
317  REG_BINARY,
318  Sd,
319  SdSize);
320  if (!NT_SUCCESS(Status))
321  goto done;
322 
323  Status = SampRegOpenKey(hDomainKey,
324  L"Groups\\Names",
326  &hNamesKey);
327  if (!NT_SUCCESS(Status))
328  goto done;
329 
330  Status = SampRegSetValue(hNamesKey,
332  REG_DWORD,
333  (LPVOID)&ulRelativeId,
334  sizeof(ULONG));
335 
336 done:
337  SampRegCloseKey(&hNamesKey);
338 
339  if (Sd != NULL)
340  RtlFreeHeap(RtlGetProcessHeap(), 0, Sd);
341 
342  if (hAccountKey != NULL)
343  {
344  SampRegCloseKey(&hAccountKey);
345 
346  if (!NT_SUCCESS(Status))
347  SampRegDeleteKey(hDomainKey,
348  szAccountKeyName);
349  }
350 
351  return Status;
352 }
353 
354 
355 static
356 NTSTATUS
359  LPCWSTR lpComment,
360  PSID lpDomainSid,
361  ULONG ulRelativeId,
362  ULONG UserAccountControl)
363 {
364  SAM_USER_FIXED_DATA FixedUserData;
365  GROUP_MEMBERSHIP GroupMembership;
366  UCHAR LogonHours[23];
367  LPWSTR lpEmptyString = L"";
368  WCHAR szAccountKeyName[32];
369  HANDLE hAccountKey = NULL;
370  HANDLE hNamesKey = NULL;
372  ULONG SdSize = 0;
373  PSID UserSid = NULL;
375 
376  UserSid = AppendRidToSid(lpDomainSid,
377  ulRelativeId);
378 
379  /* Create the security descriptor */
380  Status = SampCreateUserSD(UserSid,
381  &Sd,
382  &SdSize);
383  if (!NT_SUCCESS(Status))
384  goto done;
385 
386  /* Initialize fixed user data */
387  FixedUserData.Version = 1;
388  FixedUserData.Reserved = 0;
389  FixedUserData.LastLogon.QuadPart = 0;
390  FixedUserData.LastLogoff.QuadPart = 0;
391  FixedUserData.PasswordLastSet.QuadPart = 0;
392  FixedUserData.AccountExpires.QuadPart = MAXLONGLONG;
393  FixedUserData.LastBadPasswordTime.QuadPart = 0;
394  FixedUserData.UserId = ulRelativeId;
395  FixedUserData.PrimaryGroupId = DOMAIN_GROUP_RID_USERS;
396  FixedUserData.UserAccountControl = UserAccountControl;
397  FixedUserData.CountryCode = 0;
398  FixedUserData.CodePage = 0;
399  FixedUserData.BadPasswordCount = 0;
400  FixedUserData.LogonCount = 0;
401  FixedUserData.AdminCount = 0;
402  FixedUserData.OperatorCount = 0;
403 
404  swprintf(szAccountKeyName, L"Users\\%08lX", ulRelativeId);
405 
406  Status = SampRegCreateKey(hDomainKey,
407  szAccountKeyName,
409  &hAccountKey);
410  if (!NT_SUCCESS(Status))
411  return Status;
412 
413  Status = SampRegSetValue(hAccountKey,
414  L"F",
415  REG_BINARY,
416  (LPVOID)&FixedUserData,
417  sizeof(SAM_USER_FIXED_DATA));
418  if (!NT_SUCCESS(Status))
419  goto done;
420 
421  Status = SampRegSetValue(hAccountKey,
422  L"Name",
423  REG_SZ,
425  (wcslen(lpAccountName) + 1) * sizeof(WCHAR));
426  if (!NT_SUCCESS(Status))
427  goto done;
428 
429  Status = SampRegSetValue(hAccountKey,
430  L"FullName",
431  REG_SZ,
432  (LPVOID)lpEmptyString,
433  sizeof(WCHAR));
434  if (!NT_SUCCESS(Status))
435  goto done;
436 
437  Status = SampRegSetValue(hAccountKey,
438  L"HomeDirectory",
439  REG_SZ,
440  (LPVOID)lpEmptyString,
441  sizeof(WCHAR));
442  if (!NT_SUCCESS(Status))
443  goto done;
444 
445  Status = SampRegSetValue(hAccountKey,
446  L"HomeDirectoryDrive",
447  REG_SZ,
448  (LPVOID)lpEmptyString,
449  sizeof(WCHAR));
450  if (!NT_SUCCESS(Status))
451  goto done;
452 
453  Status = SampRegSetValue(hAccountKey,
454  L"ScriptPath",
455  REG_SZ,
456  (LPVOID)lpEmptyString,
457  sizeof(WCHAR));
458  if (!NT_SUCCESS(Status))
459  goto done;
460 
461  Status = SampRegSetValue(hAccountKey,
462  L"ProfilePath",
463  REG_SZ,
464  (LPVOID)lpEmptyString,
465  sizeof(WCHAR));
466  if (!NT_SUCCESS(Status))
467  goto done;
468 
469  Status = SampRegSetValue(hAccountKey,
470  L"AdminComment",
471  REG_SZ,
472  (LPVOID)lpComment,
473  (wcslen(lpComment) + 1) * sizeof(WCHAR));
474  if (!NT_SUCCESS(Status))
475  goto done;
476 
477  Status = SampRegSetValue(hAccountKey,
478  L"UserComment",
479  REG_SZ,
480  (LPVOID)lpEmptyString,
481  sizeof(WCHAR));
482  if (!NT_SUCCESS(Status))
483  goto done;
484 
485  Status = SampRegSetValue(hAccountKey,
486  L"WorkStations",
487  REG_SZ,
488  (LPVOID)lpEmptyString,
489  sizeof(WCHAR));
490  if (!NT_SUCCESS(Status))
491  goto done;
492 
493  Status = SampRegSetValue(hAccountKey,
494  L"Parameters",
495  REG_SZ,
496  (LPVOID)lpEmptyString,
497  sizeof(WCHAR));
498  if (!NT_SUCCESS(Status))
499  goto done;
500 
501  /* Set LogonHours attribute*/
502  *((PUSHORT)LogonHours) = 168;
503  memset(&(LogonHours[2]), 0xff, 21);
504 
505  Status = SampRegSetValue(hAccountKey,
506  L"LogonHours",
507  REG_BINARY,
508  (LPVOID)LogonHours,
509  sizeof(LogonHours));
510  if (!NT_SUCCESS(Status))
511  goto done;
512 
513  /* Set Groups attribute*/
514  GroupMembership.RelativeId = DOMAIN_GROUP_RID_USERS;
515  GroupMembership.Attributes = SE_GROUP_MANDATORY |
518 
519  Status = SampRegSetValue(hAccountKey,
520  L"Groups",
521  REG_BINARY,
522  (LPVOID)&GroupMembership,
523  sizeof(GROUP_MEMBERSHIP));
524  if (!NT_SUCCESS(Status))
525  goto done;
526 
527  /* Set LMPwd attribute*/
528  Status = SampRegSetValue(hAccountKey,
529  L"LMPwd",
530  REG_BINARY,
532  sizeof(ENCRYPTED_LM_OWF_PASSWORD));
533  if (!NT_SUCCESS(Status))
534  goto done;
535 
536  /* Set NTPwd attribute*/
537  Status = SampRegSetValue(hAccountKey,
538  L"NTPwd",
539  REG_BINARY,
541  sizeof(ENCRYPTED_NT_OWF_PASSWORD));
542  if (!NT_SUCCESS(Status))
543  goto done;
544 
545  /* Set LMPwdHistory attribute*/
546  Status = SampRegSetValue(hAccountKey,
547  L"LMPwdHistory",
548  REG_BINARY,
549  NULL,
550  0);
551  if (!NT_SUCCESS(Status))
552  goto done;
553 
554  /* Set NTPwdHistory attribute*/
555  Status = SampRegSetValue(hAccountKey,
556  L"NTPwdHistory",
557  REG_BINARY,
558  NULL,
559  0);
560  if (!NT_SUCCESS(Status))
561  goto done;
562 
563  /* Set PrivateData attribute*/
564  Status = SampRegSetValue(hAccountKey,
565  L"PrivateData",
566  REG_SZ,
567  (LPVOID)lpEmptyString,
568  sizeof(WCHAR));
569  if (!NT_SUCCESS(Status))
570  goto done;
571 
572  /* Set the SecDesc attribute*/
573  Status = SampRegSetValue(hAccountKey,
574  L"SecDesc",
575  REG_BINARY,
576  Sd,
577  SdSize);
578  if (!NT_SUCCESS(Status))
579  goto done;
580 
581  Status = SampRegOpenKey(hDomainKey,
582  L"Users\\Names",
584  &hNamesKey);
585  if (!NT_SUCCESS(Status))
586  goto done;
587 
588  Status = SampRegSetValue(hNamesKey,
590  REG_DWORD,
591  (LPVOID)&ulRelativeId,
592  sizeof(ULONG));
593 
594 done:
595  SampRegCloseKey(&hNamesKey);
596 
597  if (Sd != NULL)
598  RtlFreeHeap(RtlGetProcessHeap(), 0, Sd);
599 
600  if (UserSid != NULL)
601  RtlFreeHeap(RtlGetProcessHeap(), 0, UserSid);
602 
603  if (hAccountKey != NULL)
604  {
605  SampRegCloseKey(&hAccountKey);
606 
607  if (!NT_SUCCESS(Status))
608  SampRegDeleteKey(hDomainKey,
609  szAccountKeyName);
610  }
611 
612  return Status;
613 }
614 
615 
616 static
617 NTSTATUS
619  IN LPCWSTR lpKeyName,
620  IN LPCWSTR lpDomainName,
621  IN PSID lpDomainSid,
622  IN BOOLEAN bBuiltinDomain,
623  OUT HANDLE *lpDomainKey)
624 {
625  SAM_DOMAIN_FIXED_DATA FixedData;
626  WCHAR szDomainKeyName[32];
627  LPWSTR lpEmptyString = L"";
628  HANDLE hDomainKey = NULL;
629  HANDLE hAliasesKey = NULL;
630  HANDLE hGroupsKey = NULL;
631  HANDLE hUsersKey = NULL;
632  HANDLE hNamesKey = NULL;
634  ULONG SdSize = 0;
636 
637  if (lpDomainKey != NULL)
638  *lpDomainKey = NULL;
639 
640  /* Initialize the fixed domain data */
641  memset(&FixedData, 0, sizeof(SAM_DOMAIN_FIXED_DATA));
642  FixedData.Version = 1;
643  NtQuerySystemTime(&FixedData.CreationTime);
644  FixedData.DomainModifiedCount.QuadPart = 0;
645  FixedData.MaxPasswordAge.QuadPart = -(6LL * 7LL * 24LL * 60LL * 60LL * TICKS_PER_SECOND); /* 6 weeks */
646  FixedData.MinPasswordAge.QuadPart = 0; /* right now */
647  FixedData.ForceLogoff.QuadPart = LLONG_MAX; /* very far in the future aka never */
648  FixedData.LockoutDuration.QuadPart = -(30LL * 60LL * TICKS_PER_SECOND); /* 30 minutes */
649  FixedData.LockoutObservationWindow.QuadPart = -(30LL * 60LL * TICKS_PER_SECOND); /* 30 minutes */
651  FixedData.NextRid = 1000;
652  FixedData.PasswordProperties = 0;
653  FixedData.MinPasswordLength = 0;
654  FixedData.PasswordHistoryLength = 0;
655  FixedData.LockoutThreshold = 0;
658  FixedData.UasCompatibilityRequired = TRUE;
659 
660  wcscpy(szDomainKeyName, L"Domains\\");
661  wcscat(szDomainKeyName, lpKeyName);
662 
663  Status = SampRegCreateKey(hServerKey,
664  szDomainKeyName,
666  &hDomainKey);
667  if (!NT_SUCCESS(Status))
668  return Status;
669 
670  /* Set the fixed data value */
671  Status = SampRegSetValue(hDomainKey,
672  L"F",
673  REG_BINARY,
674  (LPVOID)&FixedData,
675  sizeof(SAM_DOMAIN_FIXED_DATA));
676  if (!NT_SUCCESS(Status))
677  goto done;
678 
679  if (lpDomainSid != NULL)
680  {
681  Status = SampRegSetValue(hDomainKey,
682  L"Name",
683  REG_SZ,
684  (LPVOID)lpDomainName,
685  (wcslen(lpDomainName) + 1) * sizeof(WCHAR));
686  if (!NT_SUCCESS(Status))
687  goto done;
688 
689  Status = SampRegSetValue(hDomainKey,
690  L"SID",
691  REG_BINARY,
692  (LPVOID)lpDomainSid,
693  RtlLengthSid(lpDomainSid));
694  if (!NT_SUCCESS(Status))
695  goto done;
696  }
697 
698  Status = SampRegSetValue(hDomainKey,
699  L"OemInformation",
700  REG_SZ,
701  (LPVOID)lpEmptyString,
702  sizeof(WCHAR));
703  if (!NT_SUCCESS(Status))
704  goto done;
705 
706  Status = SampRegSetValue(hDomainKey,
707  L"ReplicaSourceNodeName",
708  REG_SZ,
709  (LPVOID)lpEmptyString,
710  sizeof(WCHAR));
711  if (!NT_SUCCESS(Status))
712  goto done;
713 
714  /* Create the Alias container */
715  Status = SampRegCreateKey(hDomainKey,
716  L"Aliases",
718  &hAliasesKey);
719  if (!NT_SUCCESS(Status))
720  goto done;
721 
722  Status = SampRegCreateKey(hAliasesKey,
723  L"Names",
725  &hNamesKey);
726  if (!NT_SUCCESS(Status))
727  goto done;
728 
729  SampRegCloseKey(&hNamesKey);
730 
731  /* Create the Groups container */
732  Status = SampRegCreateKey(hDomainKey,
733  L"Groups",
735  &hGroupsKey);
736  if (!NT_SUCCESS(Status))
737  goto done;
738 
739  Status = SampRegCreateKey(hGroupsKey,
740  L"Names",
742  &hNamesKey);
743  if (!NT_SUCCESS(Status))
744  goto done;
745 
746  SampRegCloseKey(&hNamesKey);
747 
748  /* Create the Users container */
749  Status = SampRegCreateKey(hDomainKey,
750  L"Users",
752  &hUsersKey);
753  if (!NT_SUCCESS(Status))
754  goto done;
755 
756  Status = SampRegCreateKey(hUsersKey,
757  L"Names",
759  &hNamesKey);
760  if (!NT_SUCCESS(Status))
761  goto done;
762 
763  /* Create the server SD */
764  if (bBuiltinDomain != FALSE)
766  &SdSize);
767  else
769  &SdSize);
770 
771  if (!NT_SUCCESS(Status))
772  goto done;
773 
774  /* Set SecDesc attribute*/
775  Status = SampRegSetValue(hServerKey,
776  L"SecDesc",
777  REG_BINARY,
778  Sd,
779  SdSize);
780  if (!NT_SUCCESS(Status))
781  goto done;
782 
783  SampRegCloseKey(&hNamesKey);
784 
785  if (lpDomainKey != NULL)
786  *lpDomainKey = hDomainKey;
787 
788 done:
789  if (Sd != NULL)
790  RtlFreeHeap(RtlGetProcessHeap(), 0, Sd);
791 
792  SampRegCloseKey(&hAliasesKey);
793  SampRegCloseKey(&hGroupsKey);
794  SampRegCloseKey(&hUsersKey);
795 
796  if (!NT_SUCCESS(Status))
797  SampRegCloseKey(&hDomainKey);
798 
799  return Status;
800 }
801 
802 
803 static
804 NTSTATUS
806  OUT HANDLE *lpServerKey)
807 {
808  HANDLE hServerKey = NULL;
809  HANDLE hDomainsKey = NULL;
811  ULONG SdSize = 0;
813 
814  Status = SampRegCreateKey(hSamKey,
815  L"SAM",
817  &hServerKey);
818  if (!NT_SUCCESS(Status))
819  return Status;
820 
821  Status = SampRegCreateKey(hServerKey,
822  L"Domains",
824  &hDomainsKey);
825  if (!NT_SUCCESS(Status))
826  goto done;
827 
828  /* Create the server SD */
830  &SdSize);
831  if (!NT_SUCCESS(Status))
832  goto done;
833 
834  /* Set SecDesc attribute*/
835  Status = SampRegSetValue(hServerKey,
836  L"SecDesc",
837  REG_BINARY,
838  Sd,
839  SdSize);
840  if (!NT_SUCCESS(Status))
841  goto done;
842 
843  SampRegCloseKey(&hDomainsKey);
844 
845  *lpServerKey = hServerKey;
846 
847 done:
848  if (Sd != NULL)
849  RtlFreeHeap(RtlGetProcessHeap(), 0, Sd);
850 
851  return Status;
852 }
853 
854 
855 NTSTATUS
857 {
859  LSA_HANDLE PolicyHandle;
861 
862  TRACE("SampGetAccountDomainInfo\n");
863 
866 
870  &PolicyHandle);
871  if (Status != STATUS_SUCCESS)
872  {
873  ERR("LsaOpenPolicy failed (Status: 0x%08lx)\n", Status);
874  return Status;
875  }
876 
877  Status = LsaQueryInformationPolicy(PolicyHandle,
879  (PVOID *)AccountDomainInfo);
880 
881  LsaClose(PolicyHandle);
882 
883  return Status;
884 }
885 
886 
887 BOOL
889 {
890  PPOLICY_ACCOUNT_DOMAIN_INFO AccountDomainInfo = NULL;
891  HANDLE hSamKey = NULL;
892  HANDLE hServerKey = NULL;
893  HANDLE hBuiltinDomainKey = NULL;
894  HANDLE hAccountDomainKey = NULL;
895  PSID pBuiltinSid = NULL;
896  PSID pInteractiveSid = NULL;
898  BOOL bResult = TRUE;
899  PSID pSid;
901  WCHAR szComment[256];
902  WCHAR szName[80];
904 
905  TRACE("SampInitializeSAM() called\n");
906 
907  hInstance = GetModuleHandleW(L"samsrv.dll");
908 
909  /* Open the SAM key */
911  L"\\Registry\\Machine\\SAM",
913  &hSamKey);
914  if (!NT_SUCCESS(Status))
915  {
916  ERR("Failed to open the SAM key (Status: 0x%08lx)\n", Status);
917  return FALSE;
918  }
919 
920  /* Create the SAM Server object */
921  Status = SampSetupCreateServer(hSamKey,
922  &hServerKey);
923  if (!NT_SUCCESS(Status))
924  {
925  bResult = FALSE;
926  goto done;
927  }
928 
929  /* Create and initialize the Builtin Domain SID */
930  pBuiltinSid = RtlAllocateHeap(RtlGetProcessHeap(), 0, RtlLengthRequiredSid(1));
931  if (pBuiltinSid == NULL)
932  {
933  ERR("Failed to allocate the Builtin Domain SID\n");
934  bResult = FALSE;
935  goto done;
936  }
937 
938  RtlInitializeSid(pBuiltinSid, &SecurityNtAuthority, 1);
939  *(RtlSubAuthoritySid(pBuiltinSid, 0)) = SECURITY_BUILTIN_DOMAIN_RID;
940 
941  /* Create and initialize the Interactive SID */
942  pInteractiveSid = RtlAllocateHeap(RtlGetProcessHeap(), 0, RtlLengthRequiredSid(1));
943  if (pInteractiveSid == NULL)
944  {
945  ERR("Failed to allocate the Interactive SID\n");
946  bResult = FALSE;
947  goto done;
948  }
949 
950  RtlInitializeSid(pInteractiveSid, &SecurityNtAuthority, 1);
951  *(RtlSubAuthoritySid(pInteractiveSid, 0)) = SECURITY_INTERACTIVE_RID;
952 
953  /* Create and initialize the Authenticated User SID */
954  pAuthenticatedUserSid = RtlAllocateHeap(RtlGetProcessHeap(), 0, RtlLengthRequiredSid(1));
956  {
957  ERR("Failed to allocate the Authenticated User SID\n");
958  bResult = FALSE;
959  goto done;
960  }
961 
964 
965  /* Get account domain information */
966  Status = SampGetAccountDomainInfo(&AccountDomainInfo);
967  if (!NT_SUCCESS(Status))
968  {
969  ERR("SampGetAccountDomainInfo failed (Status %08lx)\n", Status);
970  bResult = FALSE;
971  goto done;
972  }
973 
975 
976  /* Create the Builtin domain */
977  Status = SampSetupCreateDomain(hServerKey,
978  L"Builtin",
979  szName,
980  pBuiltinSid,
981  TRUE,
982  &hBuiltinDomainKey);
983  if (!NT_SUCCESS(Status))
984  {
985  bResult = FALSE;
986  goto done;
987  }
988 
991 
992  SampSetupCreateAliasAccount(hBuiltinDomainKey,
993  szName,
994  szComment,
996 
999 
1000  SampSetupCreateAliasAccount(hBuiltinDomainKey,
1001  szName,
1002  szComment,
1004 
1007 
1008  SampSetupCreateAliasAccount(hBuiltinDomainKey,
1009  szName,
1010  szComment,
1012 
1015 
1016  SampSetupCreateAliasAccount(hBuiltinDomainKey,
1017  szName,
1018  szComment,
1020 
1021  /* Add the Administrator user to the Administrators alias */
1022  pSid = AppendRidToSid(AccountDomainInfo->DomainSid,
1024  if (pSid != NULL)
1025  {
1026  SampSetupAddMemberToAlias(hBuiltinDomainKey,
1028  pSid);
1029 
1030  RtlFreeHeap(RtlGetProcessHeap(), 0, pSid);
1031  }
1032 
1033  /* Add the Guest user to the Guests alias */
1034  pSid = AppendRidToSid(AccountDomainInfo->DomainSid,
1036  if (pSid != NULL)
1037  {
1038  SampSetupAddMemberToAlias(hBuiltinDomainKey,
1040  pSid);
1041 
1042  RtlFreeHeap(RtlGetProcessHeap(), 0, pSid);
1043  }
1044 
1045  /* Add the Interactive SID to the Users alias */
1046  SampSetupAddMemberToAlias(hBuiltinDomainKey,
1048  pInteractiveSid);
1049 
1050  /* Add the Authenticated User SID to the Users alias */
1051  SampSetupAddMemberToAlias(hBuiltinDomainKey,
1054 
1055  /* Create the Account domain */
1056  Status = SampSetupCreateDomain(hServerKey,
1057  L"Account",
1058  L"",
1059  AccountDomainInfo->DomainSid,
1060  FALSE,
1061  &hAccountDomainKey);
1062  if (!NT_SUCCESS(Status))
1063  {
1064  bResult = FALSE;
1065  goto done;
1066  }
1067 
1070 
1071  SampSetupCreateGroupAccount(hAccountDomainKey,
1072  szName,
1073  szComment,
1075 
1078 
1079  SampSetupCreateUserAccount(hAccountDomainKey,
1080  szName,
1081  szComment,
1082  AccountDomainInfo->DomainSid,
1085 
1086  SampSetupAddMemberToGroup(hAccountDomainKey,
1089 
1092 
1093  SampSetupCreateUserAccount(hAccountDomainKey,
1094  szName,
1095  szComment,
1096  AccountDomainInfo->DomainSid,
1099 
1100  SampSetupAddMemberToGroup(hAccountDomainKey,
1103 
1104 done:
1105  if (AccountDomainInfo)
1106  LsaFreeMemory(AccountDomainInfo);
1107 
1109  RtlFreeHeap(RtlGetProcessHeap(), 0, pAuthenticatedUserSid);
1110 
1111  if (pInteractiveSid)
1112  RtlFreeHeap(RtlGetProcessHeap(), 0, pInteractiveSid);
1113 
1114  if (pBuiltinSid)
1115  RtlFreeHeap(RtlGetProcessHeap(), 0, pBuiltinSid);
1116 
1117  SampRegCloseKey(&hAccountDomainKey);
1118  SampRegCloseKey(&hBuiltinDomainKey);
1119  SampRegCloseKey(&hServerKey);
1120  SampRegCloseKey(&hSamKey);
1121 
1122  TRACE("SampInitializeSAM() done\n");
1123 
1124  return bResult;
1125 }
NTSTATUS SampCreateAccountDomainSD(OUT PSECURITY_DESCRIPTOR *DomainSd, OUT PULONG Size)
Definition: security.c:545
ULONG Attributes
Definition: ntsam.h:469
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
USHORT CountryCode
Definition: samsrv.h:109
#define IDS_USER_ADMINISTRATOR_NAME
Definition: resources.h:25
#define IN
Definition: typedefs.h:38
#define SECURITY_AUTHENTICATED_USER_RID
Definition: setypes.h:540
#define midl_user_free
Definition: rpc.h:45
#define IDS_GROUP_NONE_NAME
Definition: resources.h:13
#define TRUE
Definition: types.h:120
#define DOMAIN_ALIAS_RID_GUESTS
Definition: setypes.h:626
#define LL
Definition: tui.h:85
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
ULONG RelativeId
Definition: ntsam.h:468
NTSTATUS SampCreateServerSD(OUT PSECURITY_DESCRIPTOR *ServerSd, OUT PULONG Size)
Definition: security.c:21
static NTSTATUS SampSetupCreateDomain(IN HANDLE hServerKey, IN LPCWSTR lpKeyName, IN LPCWSTR lpDomainName, IN PSID lpDomainSid, IN BOOLEAN bBuiltinDomain, OUT HANDLE *lpDomainKey)
Definition: setup.c:618
#define IDS_ALIAS_POWER_USERS_NAME
Definition: resources.h:20
NTSTATUS WINAPI LsaQueryInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
Definition: lsa.c:1471
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define IDS_DOMAIN_BUILTIN_NAME
Definition: resources.h:11
#define IDS_ALIAS_ADMINISTRATORS_NAME
Definition: resources.h:16
LARGE_INTEGER AccountExpires
Definition: samsrv.h:104
#define REG_BINARY
Definition: nt_native.h:1496
#define KEY_READ
Definition: nt_native.h:1023
#define midl_user_allocate
Definition: rpc.h:44
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
static PSID pAuthenticatedUserSid
Definition: security.c:19
LARGE_INTEGER LastBadPasswordTime
Definition: samsrv.h:105
USHORT MinPasswordLength
Definition: samsrv.h:81
#define IDS_ALIAS_ADMINISTRATORS_COMMENT
Definition: resources.h:17
ULONG PrimaryGroupId
Definition: samsrv.h:107
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
Definition: lsa.c:192
static PSID AppendRidToSid(PSID SrcSid, ULONG Rid)
Definition: msv1_0.c:245
DOMAIN_SERVER_ENABLE_STATE DomainServerState
Definition: samsrv.h:84
LARGE_INTEGER DomainModifiedCount
Definition: samsrv.h:72
NTSYSAPI PULONG NTAPI RtlSubAuthoritySid(_In_ PSID Sid, _In_ ULONG SubAuthority)
#define IDS_USER_ADMINISTRATOR_COMMENT
Definition: resources.h:26
#define DOMAIN_ALIAS_RID_POWER_USERS
Definition: setypes.h:627
#define SECURITY_INTERACTIVE_RID
Definition: setypes.h:531
#define MAXLONGLONG
LARGE_INTEGER MinPasswordAge
Definition: samsrv.h:74
NTSTATUS SampCreateUserSD(IN PSID UserSid, OUT PSECURITY_DESCRIPTOR *UserSd, OUT PULONG Size)
Definition: security.c:1433
static NTSTATUS SampSetupCreateUserAccount(HANDLE hDomainKey, LPCWSTR lpAccountName, LPCWSTR lpComment, PSID lpDomainSid, ULONG ulRelativeId, ULONG UserAccountControl)
Definition: setup.c:357
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3259
_In_ LPCSTR lpAccountName
Definition: winbase.h:2688
ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash
Definition: samsrv.c:26
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
static NTSTATUS SampSetupCreateServer(IN HANDLE hSamKey, OUT HANDLE *lpServerKey)
Definition: setup.c:805
#define USER_ACCOUNT_DISABLED
Definition: ntsam.h:167
NTSTATUS SampRegCloseKey(IN OUT PHANDLE KeyHandle)
Definition: registry.c:26
BOOLEAN UasCompatibilityRequired
Definition: samsrv.h:86
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
NTSYSAPI NTSTATUS NTAPI RtlInitializeSid(IN OUT PSID Sid, IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, IN UCHAR SubAuthorityCount)
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
HINSTANCE hInstance
Definition: charmap.c:20
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define LLONG_MAX
Definition: limits.h:45
unsigned int BOOL
Definition: ntddk_ex.h:94
USHORT OperatorCount
Definition: samsrv.h:114
#define DOMAIN_USER_RID_ADMIN
Definition: setypes.h:603
ULONG PasswordProperties
Definition: samsrv.h:80
#define IDS_GROUP_NONE_COMMENT
Definition: resources.h:14
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define SE_GROUP_ENABLED_BY_DEFAULT
Definition: setypes.h:91
#define IDS_USER_GUEST_COMMENT
Definition: resources.h:28
LARGE_INTEGER LockoutObservationWindow
Definition: samsrv.h:77
#define IDS_ALIAS_USERS_COMMENT
Definition: resources.h:23
NTSYSAPI ULONG NTAPI RtlLengthSid(IN PSID Sid)
Definition: sid.c:150
LARGE_INTEGER ForceLogoff
Definition: samsrv.h:75
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
Definition: lsa.c:699
NTSTATUS SampCreateBuiltinDomainSD(OUT PSECURITY_DESCRIPTOR *DomainSd, OUT PULONG Size)
Definition: security.c:283
NTSTATUS SampCreateGroupSD(OUT PSECURITY_DESCRIPTOR *GroupSd, OUT PULONG Size)
Definition: security.c:1146
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define STATUS_MEMBER_IN_GROUP
Definition: ntstatus.h:325
#define DOMAIN_USER_RID_GUEST
Definition: setypes.h:604
#define TRACE(s)
Definition: solgame.cpp:4
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:553
__wchar_t WCHAR
Definition: xmlstorage.h:180
LARGE_INTEGER PasswordLastSet
Definition: samsrv.h:103
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SE_GROUP_ENABLED
Definition: setypes.h:92
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
#define USER_NORMAL_ACCOUNT
Definition: ntsam.h:171
INT SampLoadString(HINSTANCE hInstance, UINT uId, LPWSTR lpBuffer, INT nBufferMax)
Definition: utils.c:17
static BOOL SampSetupAddMemberToAlias(HKEY hDomainKey, ULONG AliasId, PSID MemberSid)
Definition: setup.c:25
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define SE_GROUP_MANDATORY
Definition: setypes.h:90
static NTSTATUS SampSetupCreateAliasAccount(HANDLE hDomainKey, LPCWSTR lpAccountName, LPCWSTR lpDescription, ULONG ulRelativeId)
Definition: setup.c:91
unsigned char UCHAR
Definition: xmlstorage.h:181
LARGE_INTEGER LockoutDuration
Definition: samsrv.h:76
NTSTATUS SampRegDeleteKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName)
Definition: registry.c:71
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
NTSTATUS SampRegQueryValue(IN HANDLE KeyHandle, IN LPCWSTR ValueName, OUT PULONG Type OPTIONAL, OUT PVOID Data OPTIONAL, IN OUT PULONG DataLength OPTIONAL)
Definition: registry.c:332
static const WCHAR L[]
Definition: oid.c:1250
NTSTATUS SampGetAccountDomainInfo(PPOLICY_ACCOUNT_DOMAIN_INFO *AccountDomainInfo)
Definition: setup.c:856
LARGE_INTEGER LastLogon
Definition: samsrv.h:101
#define TICKS_PER_SECOND
Definition: setup.c:18
#define IDS_ALIAS_GUESTS_NAME
Definition: resources.h:18
struct _LSA_OBJECT_ATTRIBUTES LSA_OBJECT_ATTRIBUTES
Status
Definition: gdiplustypes.h:24
BOOL SampInitializeSAM(VOID)
Definition: setup.c:888
#define ERR(fmt,...)
Definition: debug.h:109
ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash
Definition: samsrv.c:27
USHORT BadPasswordCount
Definition: samsrv.h:111
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define IDS_ALIAS_POWER_USERS_COMMENT
Definition: resources.h:21
NTSTATUS SampRegOpenKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE KeyHandle)
Definition: registry.c:158
#define DOMAIN_ALIAS_RID_USERS
Definition: setypes.h:625
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define IDS_USER_GUEST_NAME
Definition: resources.h:27
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
LARGE_INTEGER MaxPasswordAge
Definition: samsrv.h:73
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static NTSTATUS SampSetupAddMemberToGroup(IN HANDLE hDomainKey, IN ULONG GroupId, IN ULONG MemberId)
Definition: setup.c:177
#define DOMAIN_GROUP_RID_USERS
Definition: setypes.h:612
unsigned int * PULONG
Definition: retypes.h:1
static PSID pSid
Definition: security.c:74
NTSTATUS SampRegSetValue(HANDLE KeyHandle, LPCWSTR ValueName, ULONG Type, LPVOID Data, ULONG DataLength)
Definition: registry.c:402
USHORT LockoutThreshold
Definition: samsrv.h:83
LARGE_INTEGER ModifiedCountAtLastPromotion
Definition: samsrv.h:78
static const WCHAR szName[]
Definition: msipriv.h:1194
DOMAIN_SERVER_ROLE DomainServerRole
Definition: samsrv.h:85
#define OUT
Definition: typedefs.h:39
ULONG UserAccountControl
Definition: samsrv.h:108
LARGE_INTEGER CreationTime
Definition: samsrv.h:71
unsigned int ULONG
Definition: retypes.h:1
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:847
NTSTATUS SampCreateAliasSD(OUT PSECURITY_DESCRIPTOR *AliasSd, OUT PULONG Size)
Definition: security.c:859
USHORT PasswordHistoryLength
Definition: samsrv.h:82
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
Definition: time.c:417
#define IDS_ALIAS_GUESTS_COMMENT
Definition: resources.h:19
static NTSTATUS SampSetupCreateGroupAccount(HANDLE hDomainKey, LPCWSTR lpAccountName, LPCWSTR lpComment, ULONG ulRelativeId)
Definition: setup.c:256
NTSTATUS SampRegCreateKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE KeyHandle)
Definition: registry.c:42
WCHAR * LPWSTR
Definition: xmlstorage.h:184
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define memset(x, y, z)
Definition: compat.h:39
#define REG_DWORD
Definition: sdbapi.c:596
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:624
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
LARGE_INTEGER LastLogoff
Definition: samsrv.h:102
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
unsigned short * PUSHORT
Definition: retypes.h:2
#define RegSetValueEx
Definition: winreg.h:533
#define USER_DONT_EXPIRE_PASSWORD
Definition: ntsam.h:176
SID_IDENTIFIER_AUTHORITY SecurityNtAuthority
Definition: setup.c:20
#define IDS_ALIAS_USERS_NAME
Definition: resources.h:22
LONGLONG QuadPart
Definition: typedefs.h:112
NTSYSAPI ULONG NTAPI RtlLengthRequiredSid(IN ULONG SubAuthorityCount)
Definition: sid.c:54
static const WCHAR szComment[]
Definition: domdoc.c:1167
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
#define REG_SZ
Definition: layer.c:22