ReactOS 0.4.16-dev-303-g11d5cb8
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
24static 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,
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,
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
89static
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",
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
156done:
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
175static
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",
241 MembersBuffer,
242 Length);
243
244done:
245 if (MembersBuffer != NULL)
246 midl_user_free(MembersBuffer);
247
248 SampRegCloseKey(&hGroupKey);
249
250 return Status;
251}
252
253
254static
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",
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",
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
336done:
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
355static
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;
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",
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",
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",
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",
533 if (!NT_SUCCESS(Status))
534 goto done;
535
536 /* Set NTPwd attribute*/
537 Status = SampRegSetValue(hAccountKey,
538 L"NTPwd",
542 if (!NT_SUCCESS(Status))
543 goto done;
544
545 /* Set LMPwdHistory attribute*/
546 Status = SampRegSetValue(hAccountKey,
547 L"LMPwdHistory",
549 NULL,
550 0);
551 if (!NT_SUCCESS(Status))
552 goto done;
553
554 /* Set NTPwdHistory attribute*/
555 Status = SampRegSetValue(hAccountKey,
556 L"NTPwdHistory",
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",
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
594done:
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
616static
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;
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",
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",
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",
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
788done:
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
803static
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",
838 Sd,
839 SdSize);
840 if (!NT_SUCCESS(Status))
841 goto done;
842
843 SampRegCloseKey(&hDomainsKey);
844
845 *lpServerKey = hServerKey;
846
847done:
848 if (Sd != NULL)
849 RtlFreeHeap(RtlGetProcessHeap(), 0, Sd);
850
851 return Status;
852}
853
854
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
887BOOL
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 */
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);
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
989 /* Create the Administrators alias */
992
993 SampSetupCreateAliasAccount(hBuiltinDomainKey,
994 szName,
995 szComment,
997
998 /* Create the Users alias */
1001
1002 SampSetupCreateAliasAccount(hBuiltinDomainKey,
1003 szName,
1004 szComment,
1006
1007 /* Create the Guests alias */
1010
1011 SampSetupCreateAliasAccount(hBuiltinDomainKey,
1012 szName,
1013 szComment,
1015
1016 /* Create the Power Users alias */
1019
1020 SampSetupCreateAliasAccount(hBuiltinDomainKey,
1021 szName,
1022 szComment,
1024
1026 {
1027 /* Create the Print Operators alias (Server only) */
1030
1031 SampSetupCreateAliasAccount(hBuiltinDomainKey,
1032 szName,
1033 szComment,
1035 }
1036
1037 /* Create the Backup Operators alias */
1040
1041 SampSetupCreateAliasAccount(hBuiltinDomainKey,
1042 szName,
1043 szComment,
1045
1046 /* Create the Replicator alias */
1049
1050 SampSetupCreateAliasAccount(hBuiltinDomainKey,
1051 szName,
1052 szComment,
1054
1055 /* Create the Remote Desktop Users alias */
1058
1059 SampSetupCreateAliasAccount(hBuiltinDomainKey,
1060 szName,
1061 szComment,
1063
1064 /* Create the Network Configuration Operators alias */
1067
1068 SampSetupCreateAliasAccount(hBuiltinDomainKey,
1069 szName,
1070 szComment,
1072
1074 {
1075 /* Create the Performance Monitor Users alias (Server only) */
1078
1079 SampSetupCreateAliasAccount(hBuiltinDomainKey,
1080 szName,
1081 szComment,
1083
1084 /* Create the Performance Log Users alias (Server only) */
1087
1088 SampSetupCreateAliasAccount(hBuiltinDomainKey,
1089 szName,
1090 szComment,
1092 }
1093
1094 /* Add the Administrator user to the Administrators alias */
1095 pSid = AppendRidToSid(AccountDomainInfo->DomainSid,
1097 if (pSid != NULL)
1098 {
1099 SampSetupAddMemberToAlias(hBuiltinDomainKey,
1101 pSid);
1102
1103 RtlFreeHeap(RtlGetProcessHeap(), 0, pSid);
1104 }
1105
1106 /* Add the Guest user to the Guests alias */
1107 pSid = AppendRidToSid(AccountDomainInfo->DomainSid,
1109 if (pSid != NULL)
1110 {
1111 SampSetupAddMemberToAlias(hBuiltinDomainKey,
1113 pSid);
1114
1115 RtlFreeHeap(RtlGetProcessHeap(), 0, pSid);
1116 }
1117
1118 /* Add the Interactive SID to the Users alias */
1119 SampSetupAddMemberToAlias(hBuiltinDomainKey,
1121 pInteractiveSid);
1122
1123 /* Add the Authenticated User SID to the Users alias */
1124 SampSetupAddMemberToAlias(hBuiltinDomainKey,
1127
1128 /* Create the Account domain */
1129 Status = SampSetupCreateDomain(hServerKey,
1130 L"Account",
1131 L"",
1132 AccountDomainInfo->DomainSid,
1133 FALSE,
1134 &hAccountDomainKey);
1135 if (!NT_SUCCESS(Status))
1136 {
1137 bResult = FALSE;
1138 goto done;
1139 }
1140
1141 /* Create the None group */
1144
1145 SampSetupCreateGroupAccount(hAccountDomainKey,
1146 szName,
1147 szComment,
1149
1150 /* Create the Administrator user */
1153
1154 SampSetupCreateUserAccount(hAccountDomainKey,
1155 szName,
1156 szComment,
1157 AccountDomainInfo->DomainSid,
1160
1161 /* Add the Adminitrator user to the Administrators alias */
1162 SampSetupAddMemberToGroup(hAccountDomainKey,
1165
1166 /* Create the Guest user */
1169
1170 SampSetupCreateUserAccount(hAccountDomainKey,
1171 szName,
1172 szComment,
1173 AccountDomainInfo->DomainSid,
1176
1177 /* Add the Guest user to the Guests alias */
1178 SampSetupAddMemberToGroup(hAccountDomainKey,
1181
1182done:
1183 if (AccountDomainInfo)
1184 LsaFreeMemory(AccountDomainInfo);
1185
1187 RtlFreeHeap(RtlGetProcessHeap(), 0, pAuthenticatedUserSid);
1188
1189 if (pInteractiveSid)
1190 RtlFreeHeap(RtlGetProcessHeap(), 0, pInteractiveSid);
1191
1192 if (pBuiltinSid)
1193 RtlFreeHeap(RtlGetProcessHeap(), 0, pBuiltinSid);
1194
1195 SampRegCloseKey(&hAccountDomainKey);
1196 SampRegCloseKey(&hBuiltinDomainKey);
1197 SampRegCloseKey(&hServerKey);
1198 SampRegCloseKey(&hSamKey);
1199
1200 TRACE("SampInitializeSAM() done\n");
1201
1202 return bResult;
1203}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define ERR(fmt,...)
Definition: precomp.h:57
static PSID pAuthenticatedUserSid
Definition: security.c:19
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
#define RegCloseKey(hKey)
Definition: registry.h:49
HINSTANCE hInstance
Definition: charmap.c:19
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
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:1096
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:1183
NTSTATUS WINAPI LsaQueryInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
Definition: lsa.c:1473
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
Definition: lsa.c:701
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
Definition: lsa.c:194
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3583
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
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
NTSTATUS SampRegCloseKey(IN OUT PHANDLE KeyHandle)
Definition: registry.c:26
NTSTATUS SampRegSetValue(HANDLE KeyHandle, LPCWSTR ValueName, ULONG Type, LPVOID Data, ULONG DataLength)
Definition: registry.c:402
NTSTATUS SampRegDeleteKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName)
Definition: registry.c:71
NTSTATUS SampRegOpenKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE KeyHandle)
Definition: registry.c:158
NTSTATUS SampRegCreateKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE KeyHandle)
Definition: registry.c:42
#define IDS_ALIAS_REPLICATOR_COMMENT
Definition: resources.h:29
#define IDS_ALIAS_ADMINISTRATORS_COMMENT
Definition: resources.h:17
#define IDS_ALIAS_USERS_COMMENT
Definition: resources.h:23
#define IDS_ALIAS_BACKUP_OPS_COMMENT
Definition: resources.h:27
#define IDS_ALIAS_REPLICATOR_NAME
Definition: resources.h:28
#define IDS_ALIAS_NETWORK_CONFIGURATION_OPS_NAME
Definition: resources.h:32
#define IDS_ALIAS_POWER_USERS_NAME
Definition: resources.h:20
#define IDS_ALIAS_USERS_NAME
Definition: resources.h:22
#define IDS_ALIAS_LOGGING_USERS_COMMENT
Definition: resources.h:37
#define IDS_ALIAS_ADMINISTRATORS_NAME
Definition: resources.h:16
#define IDS_ALIAS_LOGGING_USERS_NAME
Definition: resources.h:36
#define IDS_ALIAS_PRINT_OPS_NAME
Definition: resources.h:24
#define IDS_USER_ADMINISTRATOR_NAME
Definition: resources.h:39
#define IDS_ALIAS_GUESTS_COMMENT
Definition: resources.h:19
#define IDS_USER_GUEST_COMMENT
Definition: resources.h:42
#define IDS_ALIAS_MONITORING_USERS_NAME
Definition: resources.h:34
#define IDS_ALIAS_BACKUP_OPS_NAME
Definition: resources.h:26
#define IDS_ALIAS_POWER_USERS_COMMENT
Definition: resources.h:21
#define IDS_ALIAS_PRINT_OPS_COMMENT
Definition: resources.h:25
#define IDS_USER_ADMINISTRATOR_COMMENT
Definition: resources.h:40
#define IDS_ALIAS_NETWORK_CONFIGURATION_OPS_COMMENT
Definition: resources.h:33
#define IDS_GROUP_NONE_COMMENT
Definition: resources.h:14
#define IDS_ALIAS_GUESTS_NAME
Definition: resources.h:18
#define IDS_ALIAS_MONITORING_USERS_COMMENT
Definition: resources.h:35
#define IDS_ALIAS_REMOTE_DESKTOP_USERS_COMMENT
Definition: resources.h:31
#define IDS_USER_GUEST_NAME
Definition: resources.h:41
#define IDS_ALIAS_REMOTE_DESKTOP_USERS_NAME
Definition: resources.h:30
#define IDS_DOMAIN_BUILTIN_NAME
Definition: resources.h:11
#define IDS_GROUP_NONE_NAME
Definition: resources.h:13
NTSTATUS SampCreateGroupSD(OUT PSECURITY_DESCRIPTOR *GroupSd, OUT PULONG Size)
Definition: security.c:1146
NTSTATUS SampCreateAccountDomainSD(OUT PSECURITY_DESCRIPTOR *DomainSd, OUT PULONG Size)
Definition: security.c:545
NTSTATUS SampCreateBuiltinDomainSD(OUT PSECURITY_DESCRIPTOR *DomainSd, OUT PULONG Size)
Definition: security.c:283
NTSTATUS SampCreateServerSD(OUT PSECURITY_DESCRIPTOR *ServerSd, OUT PULONG Size)
Definition: security.c:21
NTSTATUS SampCreateAliasSD(OUT PSECURITY_DESCRIPTOR *AliasSd, OUT PULONG Size)
Definition: security.c:859
NTSTATUS SampCreateUserSD(IN PSID UserSid, OUT PSECURITY_DESCRIPTOR *UserSd, OUT PULONG Size)
Definition: security.c:1433
INT SampLoadString(HINSTANCE hInstance, UINT uId, LPWSTR lpBuffer, INT nBufferMax)
Definition: utils.c:17
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 TICKS_PER_SECOND
Definition: setup.c:18
static NTSTATUS SampSetupCreateServer(IN HANDLE hSamKey, OUT HANDLE *lpServerKey)
Definition: setup.c:805
static NTSTATUS SampSetupCreateGroupAccount(HANDLE hDomainKey, LPCWSTR lpAccountName, LPCWSTR lpComment, ULONG ulRelativeId)
Definition: setup.c:256
static NTSTATUS SampSetupCreateAliasAccount(HANDLE hDomainKey, LPCWSTR lpAccountName, LPCWSTR lpDescription, ULONG ulRelativeId)
Definition: setup.c:91
NTSTATUS SampGetAccountDomainInfo(PPOLICY_ACCOUNT_DOMAIN_INFO *AccountDomainInfo)
Definition: setup.c:856
static NTSTATUS SampSetupAddMemberToGroup(IN HANDLE hDomainKey, IN ULONG GroupId, IN ULONG MemberId)
Definition: setup.c:177
static BOOL SampSetupAddMemberToAlias(HKEY hDomainKey, ULONG AliasId, PSID MemberSid)
Definition: setup.c:25
SID_IDENTIFIER_AUTHORITY SecurityNtAuthority
Definition: setup.c:20
BOOL SampInitializeSAM(VOID)
Definition: setup.c:888
static NTSTATUS SampSetupCreateUserAccount(HANDLE hDomainKey, LPCWSTR lpAccountName, LPCWSTR lpComment, PSID lpDomainSid, ULONG ulRelativeId, ULONG UserAccountControl)
Definition: setup.c:357
@ NtProductWinNt
Definition: shellpath.c:64
#define swprintf
Definition: precomp.h:40
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
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
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define LLONG_MAX
Definition: limits.h:45
#define REG_SZ
Definition: layer.c:22
static PSID pSid
Definition: security.c:74
static const WCHAR szComment[]
Definition: domdoc.c:1167
static PSID AppendRidToSid(PSID SrcSid, ULONG Rid)
Definition: msv1_0.c:292
NTSYSAPI PULONG NTAPI RtlSubAuthoritySid(_In_ PSID Sid, _In_ ULONG SubAuthority)
NTSYSAPI ULONG NTAPI RtlLengthRequiredSid(IN ULONG SubAuthorityCount)
Definition: sid.c:54
NTSYSAPI ULONG NTAPI RtlLengthSid(IN PSID Sid)
Definition: sid.c:150
#define SE_GROUP_MANDATORY
Definition: setypes.h:90
#define SE_GROUP_ENABLED_BY_DEFAULT
Definition: setypes.h:91
#define SE_GROUP_ENABLED
Definition: setypes.h:92
#define REG_BINARY
Definition: nt_native.h:1496
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
#define MAXLONGLONG
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
NTSYSAPI NTSTATUS NTAPI RtlInitializeSid(IN OUT PSID Sid, IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, IN UCHAR SubAuthorityCount)
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
Definition: time.c:569
#define USER_NORMAL_ACCOUNT
Definition: ntsam.h:171
@ DomainServerEnabled
Definition: ntsam.h:358
@ DomainServerRolePrimary
Definition: ntsam.h:365
#define USER_DONT_EXPIRE_PASSWORD
Definition: ntsam.h:176
#define USER_ACCOUNT_DISABLED
Definition: ntsam.h:167
@ PolicyAccountDomainInformation
Definition: ntsecapi.h:247
struct _LSA_OBJECT_ATTRIBUTES LSA_OBJECT_ATTRIBUTES
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
#define STATUS_MEMBER_IN_GROUP
Definition: ntstatus.h:339
#define L(x)
Definition: ntvdm.h:50
static const WCHAR szName[]
Definition: powrprof.c:45
ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash
Definition: samsrv.c:27
ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash
Definition: samsrv.c:26
NT_PRODUCT_TYPE SampProductType
Definition: samsrv.c:29
#define REG_DWORD
Definition: sdbapi.c:596
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define midl_user_free
Definition: rpc.h:45
#define midl_user_allocate
Definition: rpc.h:44
#define memset(x, y, z)
Definition: compat.h:39
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE(s)
Definition: solgame.cpp:4
ULONG RelativeId
Definition: ntsam.h:496
ULONG Attributes
Definition: ntsam.h:497
DOMAIN_SERVER_ENABLE_STATE DomainServerState
Definition: samsrv.h:85
LARGE_INTEGER CreationTime
Definition: samsrv.h:72
USHORT PasswordHistoryLength
Definition: samsrv.h:83
LARGE_INTEGER LockoutObservationWindow
Definition: samsrv.h:78
DOMAIN_SERVER_ROLE DomainServerRole
Definition: samsrv.h:86
LARGE_INTEGER MaxPasswordAge
Definition: samsrv.h:74
LARGE_INTEGER LockoutDuration
Definition: samsrv.h:77
USHORT LockoutThreshold
Definition: samsrv.h:84
BOOLEAN UasCompatibilityRequired
Definition: samsrv.h:87
USHORT MinPasswordLength
Definition: samsrv.h:82
LARGE_INTEGER ModifiedCountAtLastPromotion
Definition: samsrv.h:79
LARGE_INTEGER MinPasswordAge
Definition: samsrv.h:75
LARGE_INTEGER DomainModifiedCount
Definition: samsrv.h:73
LARGE_INTEGER ForceLogoff
Definition: samsrv.h:76
ULONG PasswordProperties
Definition: samsrv.h:81
LARGE_INTEGER LastBadPasswordTime
Definition: samsrv.h:106
LARGE_INTEGER AccountExpires
Definition: samsrv.h:105
ULONG UserAccountControl
Definition: samsrv.h:109
LARGE_INTEGER LastLogon
Definition: samsrv.h:102
ULONG PrimaryGroupId
Definition: samsrv.h:108
LARGE_INTEGER PasswordLastSet
Definition: samsrv.h:104
USHORT BadPasswordCount
Definition: samsrv.h:112
USHORT CountryCode
Definition: samsrv.h:110
LARGE_INTEGER LastLogoff
Definition: samsrv.h:103
USHORT OperatorCount
Definition: samsrv.h:115
uint32_t * PULONG
Definition: typedefs.h:59
uint16_t * PUSHORT
Definition: typedefs.h:56
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ LPCSTR lpAccountName
Definition: winbase.h:2766
#define RegSetValueEx
Definition: winreg.h:533
#define DOMAIN_ALIAS_RID_USERS
Definition: setypes.h:653
#define DOMAIN_ALIAS_RID_GUESTS
Definition: setypes.h:654
#define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS
Definition: setypes.h:666
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:581
#define DOMAIN_USER_RID_ADMIN
Definition: setypes.h:631
#define SECURITY_INTERACTIVE_RID
Definition: setypes.h:559
#define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS
Definition: setypes.h:665
#define DOMAIN_ALIAS_RID_MONITORING_USERS
Definition: setypes.h:669
#define SECURITY_AUTHENTICATED_USER_RID
Definition: setypes.h:568
#define DOMAIN_ALIAS_RID_LOGGING_USERS
Definition: setypes.h:670
#define DOMAIN_USER_RID_GUEST
Definition: setypes.h:632
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:554
#define DOMAIN_ALIAS_RID_BACKUP_OPS
Definition: setypes.h:660
#define DOMAIN_ALIAS_RID_PRINT_OPS
Definition: setypes.h:659
#define DOMAIN_ALIAS_RID_REPLICATOR
Definition: setypes.h:662
#define DOMAIN_ALIAS_RID_POWER_USERS
Definition: setypes.h:655
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:652
#define DOMAIN_GROUP_RID_USERS
Definition: setypes.h:640
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185