SAM Setup: Set the UserAccountControl flags when user accounts are created.

svn path=/trunk/; revision=58128
This commit is contained in:
Eric Kohl 2013-01-06 13:03:01 +00:00
parent 40d30b8b21
commit e31ab5ce32

View file

@ -221,7 +221,8 @@ SampCreateAliasAccount(HKEY hDomainKey,
static BOOL
SampCreateUserAccount(HKEY hDomainKey,
LPCWSTR lpAccountName,
ULONG ulRelativeId)
ULONG ulRelativeId,
ULONG UserAccountControl)
{
SAM_USER_FIXED_DATA FixedUserData;
LPWSTR lpEmptyString = L"";
@ -235,6 +236,7 @@ SampCreateUserAccount(HKEY hDomainKey,
FixedUserData.Version = 1;
FixedUserData.UserId = ulRelativeId;
FixedUserData.UserAccountControl = UserAccountControl;
swprintf(szAccountKeyName, L"Users\\%08lX", ulRelativeId);
@ -673,11 +675,13 @@ SampInitializeSAM(VOID)
{
SampCreateUserAccount(hDomainKey,
L"Administrator",
DOMAIN_USER_RID_ADMIN);
DOMAIN_USER_RID_ADMIN,
USER_DONT_EXPIRE_PASSWORD | USER_NORMAL_ACCOUNT);
SampCreateUserAccount(hDomainKey,
L"Guest",
DOMAIN_USER_RID_GUEST);
DOMAIN_USER_RID_GUEST,
USER_ACCOUNT_DISABLED | USER_DONT_EXPIRE_PASSWORD | USER_NORMAL_ACCOUNT);
RegCloseKey(hDomainKey);
}