https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ccde294b24c166b5e30ae…
commit ccde294b24c166b5e30aed914c261fffebca53df
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Jul 11 12:54:28 2021 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Jul 11 12:54:28 2021 +0200
[SAMSRV] Older functions should call newer functions
---
dll/win32/samsrv/samrpc.c | 886 +++++++++++++++++++++++-----------------------
1 file changed, 443 insertions(+), 443 deletions(-)
diff --git a/dll/win32/samsrv/samrpc.c b/dll/win32/samsrv/samrpc.c
index a693324f1d3..d67c84b7312 100644
--- a/dll/win32/samsrv/samrpc.c
+++ b/dll/win32/samsrv/samrpc.c
@@ -7345,190 +7345,12 @@ SamrQueryInformationUser(IN SAMPR_HANDLE UserHandle,
IN USER_INFORMATION_CLASS UserInformationClass,
OUT PSAMPR_USER_INFO_BUFFER *Buffer)
{
- PSAM_DB_OBJECT UserObject;
- ACCESS_MASK DesiredAccess;
- NTSTATUS Status;
-
TRACE("SamrQueryInformationUser(%p %lu %p)\n",
UserHandle, UserInformationClass, Buffer);
- switch (UserInformationClass)
- {
- case UserGeneralInformation:
- case UserNameInformation:
- case UserAccountNameInformation:
- case UserFullNameInformation:
- case UserPrimaryGroupInformation:
- case UserAdminCommentInformation:
- DesiredAccess = USER_READ_GENERAL;
- break;
-
- case UserLogonHoursInformation:
- case UserHomeInformation:
- case UserScriptInformation:
- case UserProfileInformation:
- case UserWorkStationsInformation:
- DesiredAccess = USER_READ_LOGON;
- break;
-
- case UserControlInformation:
- case UserExpiresInformation:
- case UserParametersInformation:
- DesiredAccess = USER_READ_ACCOUNT;
- break;
-
- case UserPreferencesInformation:
- DesiredAccess = USER_READ_GENERAL |
- USER_READ_PREFERENCES;
- break;
-
- case UserLogonInformation:
- case UserAccountInformation:
- DesiredAccess = USER_READ_GENERAL |
- USER_READ_PREFERENCES |
- USER_READ_LOGON |
- USER_READ_ACCOUNT;
- break;
-
- case UserInternal1Information:
- case UserInternal2Information:
- case UserAllInformation:
- DesiredAccess = 0;
- break;
-
- default:
- return STATUS_INVALID_INFO_CLASS;
- }
-
- RtlAcquireResourceShared(&SampResource,
- TRUE);
-
- /* Validate the domain handle */
- Status = SampValidateDbObject(UserHandle,
- SamDbUserObject,
- DesiredAccess,
- &UserObject);
- if (!NT_SUCCESS(Status))
- {
- TRACE("failed with status 0x%08lx\n", Status);
- goto done;
- }
-
- switch (UserInformationClass)
- {
- case UserGeneralInformation:
- Status = SampQueryUserGeneral(UserObject,
- Buffer);
- break;
-
- case UserPreferencesInformation:
- Status = SampQueryUserPreferences(UserObject,
- Buffer);
- break;
-
- case UserLogonInformation:
- Status = SampQueryUserLogon(UserObject,
- Buffer);
- break;
-
- case UserLogonHoursInformation:
- Status = SampQueryUserLogonHours(UserObject,
- Buffer);
- break;
-
- case UserAccountInformation:
- Status = SampQueryUserAccount(UserObject,
- Buffer);
- break;
-
- case UserNameInformation:
- Status = SampQueryUserName(UserObject,
- Buffer);
- break;
-
- case UserAccountNameInformation:
- Status = SampQueryUserAccountName(UserObject,
- Buffer);
- break;
-
- case UserFullNameInformation:
- Status = SampQueryUserFullName(UserObject,
- Buffer);
- break;
-
- case UserPrimaryGroupInformation:
- Status = SampQueryUserPrimaryGroup(UserObject,
- Buffer);
- break;
-
- case UserHomeInformation:
- Status = SampQueryUserHome(UserObject,
- Buffer);
- break;
-
- case UserScriptInformation:
- Status = SampQueryUserScript(UserObject,
- Buffer);
- break;
-
- case UserProfileInformation:
- Status = SampQueryUserProfile(UserObject,
- Buffer);
- break;
-
- case UserAdminCommentInformation:
- Status = SampQueryUserAdminComment(UserObject,
- Buffer);
- break;
-
- case UserWorkStationsInformation:
- Status = SampQueryUserWorkStations(UserObject,
- Buffer);
- break;
-
- case UserControlInformation:
- Status = SampQueryUserControl(UserObject,
- Buffer);
- break;
-
- case UserExpiresInformation:
- Status = SampQueryUserExpires(UserObject,
- Buffer);
- break;
-
- case UserInternal1Information:
- Status = SampQueryUserInternal1(UserObject,
- Buffer);
- break;
-
- case UserInternal2Information:
- Status = SampQueryUserInternal2(UserObject,
- Buffer);
- break;
-
- case UserParametersInformation:
- Status = SampQueryUserParameters(UserObject,
- Buffer);
- break;
-
- case UserAllInformation:
- Status = SampQueryUserAll(UserObject,
- Buffer);
- break;
-
-// case UserInternal4Information:
-// case UserInternal5Information:
-// case UserInternal4InformationNew:
-// case UserInternal5InformationNew:
-
- default:
- Status = STATUS_INVALID_INFO_CLASS;
- }
-
-done:
- RtlReleaseResource(&SampResource);
-
- return Status;
+ return SamrQueryInformationUser2(UserHandle,
+ UserInformationClass,
+ Buffer);
}
@@ -8137,244 +7959,55 @@ SamrSetInformationUser(IN SAMPR_HANDLE UserHandle,
IN USER_INFORMATION_CLASS UserInformationClass,
IN PSAMPR_USER_INFO_BUFFER Buffer)
{
- PSAM_DB_OBJECT UserObject;
- ACCESS_MASK DesiredAccess;
- NTSTATUS Status;
-
TRACE("SamrSetInformationUser(%p %lu %p)\n",
UserHandle, UserInformationClass, Buffer);
- switch (UserInformationClass)
- {
- case UserLogonHoursInformation:
- case UserNameInformation:
- case UserAccountNameInformation:
- case UserFullNameInformation:
- case UserPrimaryGroupInformation:
- case UserHomeInformation:
- case UserScriptInformation:
- case UserProfileInformation:
- case UserAdminCommentInformation:
- case UserWorkStationsInformation:
- case UserControlInformation:
- case UserExpiresInformation:
- case UserParametersInformation:
- DesiredAccess = USER_WRITE_ACCOUNT;
- break;
+ return SamrSetInformationUser2(UserHandle,
+ UserInformationClass,
+ Buffer);
+}
- case UserGeneralInformation:
- DesiredAccess = USER_WRITE_ACCOUNT |
- USER_WRITE_PREFERENCES;
- break;
- case UserPreferencesInformation:
- DesiredAccess = USER_WRITE_PREFERENCES;
- break;
+/* Function 38 */
+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)
+{
+ ENCRYPTED_LM_OWF_PASSWORD StoredLmPassword;
+ ENCRYPTED_NT_OWF_PASSWORD StoredNtPassword;
+ LM_OWF_PASSWORD OldLmPassword;
+ LM_OWF_PASSWORD NewLmPassword;
+ NT_OWF_PASSWORD OldNtPassword;
+ NT_OWF_PASSWORD NewNtPassword;
+ BOOLEAN StoredLmPresent = FALSE;
+ BOOLEAN StoredNtPresent = FALSE;
+ BOOLEAN StoredLmEmpty = TRUE;
+ BOOLEAN StoredNtEmpty = TRUE;
+ PSAM_DB_OBJECT UserObject;
+ ULONG Length;
+ SAM_USER_FIXED_DATA UserFixedData;
+ SAM_DOMAIN_FIXED_DATA DomainFixedData;
+ LARGE_INTEGER SystemTime;
+ NTSTATUS Status;
- case UserSetPasswordInformation:
- case UserInternal1Information:
- DesiredAccess = USER_FORCE_PASSWORD_CHANGE;
- break;
+ DBG_UNREFERENCED_LOCAL_VARIABLE(StoredLmPresent);
+ DBG_UNREFERENCED_LOCAL_VARIABLE(StoredNtPresent);
+ DBG_UNREFERENCED_LOCAL_VARIABLE(StoredLmEmpty);
- case UserAllInformation:
- case UserInternal2Information:
- DesiredAccess = 0; /* FIXME */
- break;
-
- default:
- return STATUS_INVALID_INFO_CLASS;
- }
-
- RtlAcquireResourceExclusive(&SampResource,
- TRUE);
-
- /* Validate the domain handle */
- Status = SampValidateDbObject(UserHandle,
- SamDbUserObject,
- DesiredAccess,
- &UserObject);
- if (!NT_SUCCESS(Status))
- {
- TRACE("failed with status 0x%08lx\n", Status);
- goto done;
- }
-
- switch (UserInformationClass)
- {
- case UserGeneralInformation:
- Status = SampSetUserGeneral(UserObject,
- Buffer);
- break;
-
- case UserPreferencesInformation:
- Status = SampSetUserPreferences(UserObject,
- Buffer);
- break;
-
- case UserLogonHoursInformation:
- Status = SampSetLogonHoursAttribute(UserObject,
- &Buffer->LogonHours.LogonHours);
- break;
-
- case UserNameInformation:
- Status = SampSetUserName(UserObject,
- &Buffer->Name.UserName);
- if (!NT_SUCCESS(Status))
- break;
-
- Status = SampSetObjectAttributeString(UserObject,
- L"FullName",
- &Buffer->Name.FullName);
- break;
-
- case UserAccountNameInformation:
- Status = SampSetUserName(UserObject,
- &Buffer->AccountName.UserName);
- break;
-
- case UserFullNameInformation:
- Status = SampSetObjectAttributeString(UserObject,
- L"FullName",
- &Buffer->FullName.FullName);
- break;
-
- case UserPrimaryGroupInformation:
- Status = SampSetUserPrimaryGroup(UserObject,
- Buffer);
- break;
-
- case UserHomeInformation:
- Status = SampSetObjectAttributeString(UserObject,
- L"HomeDirectory",
- &Buffer->Home.HomeDirectory);
- if (!NT_SUCCESS(Status))
- break;
-
- Status = SampSetObjectAttributeString(UserObject,
- L"HomeDirectoryDrive",
-
&Buffer->Home.HomeDirectoryDrive);
- break;
-
- case UserScriptInformation:
- Status = SampSetObjectAttributeString(UserObject,
- L"ScriptPath",
- &Buffer->Script.ScriptPath);
- break;
-
- case UserProfileInformation:
- Status = SampSetObjectAttributeString(UserObject,
- L"ProfilePath",
- &Buffer->Profile.ProfilePath);
- break;
-
- case UserAdminCommentInformation:
- Status = SampSetObjectAttributeString(UserObject,
- L"AdminComment",
-
&Buffer->AdminComment.AdminComment);
- break;
-
- case UserWorkStationsInformation:
- Status = SampSetObjectAttributeString(UserObject,
- L"WorkStations",
-
&Buffer->WorkStations.WorkStations);
- break;
-
- case UserSetPasswordInformation:
- TRACE("Password: %S\n", Buffer->SetPassword.Password.Buffer);
- TRACE("PasswordExpired: %d\n",
Buffer->SetPassword.PasswordExpired);
-
- Status = SampSetObjectAttributeString(UserObject,
- L"Password",
- &Buffer->SetPassword.Password);
- break;
-
- case UserControlInformation:
- Status = SampSetUserControl(UserObject,
- Buffer);
- break;
-
- case UserExpiresInformation:
- Status = SampSetUserExpires(UserObject,
- Buffer);
- break;
-
- case UserInternal1Information:
- Status = SampSetUserInternal1(UserObject,
- Buffer);
- break;
-
- case UserInternal2Information:
- Status = SampSetUserInternal2(UserObject,
- Buffer);
- break;
-
- case UserParametersInformation:
- Status = SampSetObjectAttributeString(UserObject,
- L"Parameters",
-
&Buffer->Parameters.Parameters);
- break;
-
- case UserAllInformation:
- Status = SampSetUserAll(UserObject,
- Buffer);
- break;
-
-// case UserInternal4Information:
-// case UserInternal5Information:
-// case UserInternal4InformationNew:
-// case UserInternal5InformationNew:
-
- default:
- Status = STATUS_INVALID_INFO_CLASS;
- }
-
-done:
- RtlReleaseResource(&SampResource);
-
- return Status;
-}
-
-
-/* Function 38 */
-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)
-{
- ENCRYPTED_LM_OWF_PASSWORD StoredLmPassword;
- ENCRYPTED_NT_OWF_PASSWORD StoredNtPassword;
- LM_OWF_PASSWORD OldLmPassword;
- LM_OWF_PASSWORD NewLmPassword;
- NT_OWF_PASSWORD OldNtPassword;
- NT_OWF_PASSWORD NewNtPassword;
- BOOLEAN StoredLmPresent = FALSE;
- BOOLEAN StoredNtPresent = FALSE;
- BOOLEAN StoredLmEmpty = TRUE;
- BOOLEAN StoredNtEmpty = TRUE;
- PSAM_DB_OBJECT UserObject;
- ULONG Length;
- SAM_USER_FIXED_DATA UserFixedData;
- SAM_DOMAIN_FIXED_DATA DomainFixedData;
- LARGE_INTEGER SystemTime;
- NTSTATUS Status;
-
- DBG_UNREFERENCED_LOCAL_VARIABLE(StoredLmPresent);
- DBG_UNREFERENCED_LOCAL_VARIABLE(StoredNtPresent);
- DBG_UNREFERENCED_LOCAL_VARIABLE(StoredLmEmpty);
-
- TRACE("SamrChangePasswordUser(%p %u %p %p %u %p %p %u %p %u %p)\n",
- UserHandle, LmPresent, OldLmEncryptedWithNewLm, NewLmEncryptedWithOldLm,
- NtPresent, OldNtEncryptedWithNewNt, NewNtEncryptedWithOldNt,
NtCrossEncryptionPresent,
- NewNtEncryptedWithNewLm, LmCrossEncryptionPresent, NewLmEncryptedWithNewNt);
+ TRACE("SamrChangePasswordUser(%p %u %p %p %u %p %p %u %p %u %p)\n",
+ UserHandle, LmPresent, OldLmEncryptedWithNewLm, NewLmEncryptedWithOldLm,
+ NtPresent, OldNtEncryptedWithNewNt, NewNtEncryptedWithOldNt,
NtCrossEncryptionPresent,
+ NewNtEncryptedWithNewLm, LmCrossEncryptionPresent, NewLmEncryptedWithNewNt);
RtlAcquireResourceExclusive(&SampResource,
TRUE);
@@ -8925,42 +8558,220 @@ SamrRemoveMemberFromForeignDomain(IN SAMPR_HANDLE DomainHandle,
TRACE("SampRemoveMemberFromAllAliases failed with status 0x%08lx\n",
Status);
}
-done:
- RtlReleaseResource(&SampResource);
+done:
+ RtlReleaseResource(&SampResource);
+
+ return Status;
+}
+
+
+/* Function 46 */
+NTSTATUS
+NTAPI
+SamrQueryInformationDomain2(IN SAMPR_HANDLE DomainHandle,
+ IN DOMAIN_INFORMATION_CLASS DomainInformationClass,
+ OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
+{
+ TRACE("SamrQueryInformationDomain2(%p %lu %p)\n",
+ DomainHandle, DomainInformationClass, Buffer);
+
+ return SamrQueryInformationDomain(DomainHandle,
+ DomainInformationClass,
+ Buffer);
+}
+
+
+/* Function 47 */
+NTSTATUS
+NTAPI
+SamrQueryInformationUser2(IN SAMPR_HANDLE UserHandle,
+ IN USER_INFORMATION_CLASS UserInformationClass,
+ OUT PSAMPR_USER_INFO_BUFFER *Buffer)
+{
+ PSAM_DB_OBJECT UserObject;
+ ACCESS_MASK DesiredAccess;
+ NTSTATUS Status;
+
+ TRACE("SamrQueryInformationUser2(%p %lu %p)\n",
+ UserHandle, UserInformationClass, Buffer);
+
+ switch (UserInformationClass)
+ {
+ case UserGeneralInformation:
+ case UserNameInformation:
+ case UserAccountNameInformation:
+ case UserFullNameInformation:
+ case UserPrimaryGroupInformation:
+ case UserAdminCommentInformation:
+ DesiredAccess = USER_READ_GENERAL;
+ break;
+
+ case UserLogonHoursInformation:
+ case UserHomeInformation:
+ case UserScriptInformation:
+ case UserProfileInformation:
+ case UserWorkStationsInformation:
+ DesiredAccess = USER_READ_LOGON;
+ break;
+
+ case UserControlInformation:
+ case UserExpiresInformation:
+ case UserParametersInformation:
+ DesiredAccess = USER_READ_ACCOUNT;
+ break;
+
+ case UserPreferencesInformation:
+ DesiredAccess = USER_READ_GENERAL |
+ USER_READ_PREFERENCES;
+ break;
+
+ case UserLogonInformation:
+ case UserAccountInformation:
+ DesiredAccess = USER_READ_GENERAL |
+ USER_READ_PREFERENCES |
+ USER_READ_LOGON |
+ USER_READ_ACCOUNT;
+ break;
+
+ case UserInternal1Information:
+ case UserInternal2Information:
+ case UserAllInformation:
+ DesiredAccess = 0;
+ break;
+
+ default:
+ return STATUS_INVALID_INFO_CLASS;
+ }
+
+ RtlAcquireResourceShared(&SampResource,
+ TRUE);
+
+ /* Validate the domain handle */
+ Status = SampValidateDbObject(UserHandle,
+ SamDbUserObject,
+ DesiredAccess,
+ &UserObject);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("failed with status 0x%08lx\n", Status);
+ goto done;
+ }
+
+ switch (UserInformationClass)
+ {
+ case UserGeneralInformation:
+ Status = SampQueryUserGeneral(UserObject,
+ Buffer);
+ break;
+
+ case UserPreferencesInformation:
+ Status = SampQueryUserPreferences(UserObject,
+ Buffer);
+ break;
+
+ case UserLogonInformation:
+ Status = SampQueryUserLogon(UserObject,
+ Buffer);
+ break;
+
+ case UserLogonHoursInformation:
+ Status = SampQueryUserLogonHours(UserObject,
+ Buffer);
+ break;
+
+ case UserAccountInformation:
+ Status = SampQueryUserAccount(UserObject,
+ Buffer);
+ break;
+
+ case UserNameInformation:
+ Status = SampQueryUserName(UserObject,
+ Buffer);
+ break;
+
+ case UserAccountNameInformation:
+ Status = SampQueryUserAccountName(UserObject,
+ Buffer);
+ break;
+
+ case UserFullNameInformation:
+ Status = SampQueryUserFullName(UserObject,
+ Buffer);
+ break;
+
+ case UserPrimaryGroupInformation:
+ Status = SampQueryUserPrimaryGroup(UserObject,
+ Buffer);
+ break;
+
+ case UserHomeInformation:
+ Status = SampQueryUserHome(UserObject,
+ Buffer);
+ break;
+
+ case UserScriptInformation:
+ Status = SampQueryUserScript(UserObject,
+ Buffer);
+ break;
+
+ case UserProfileInformation:
+ Status = SampQueryUserProfile(UserObject,
+ Buffer);
+ break;
+
+ case UserAdminCommentInformation:
+ Status = SampQueryUserAdminComment(UserObject,
+ Buffer);
+ break;
+
+ case UserWorkStationsInformation:
+ Status = SampQueryUserWorkStations(UserObject,
+ Buffer);
+ break;
+
+ case UserControlInformation:
+ Status = SampQueryUserControl(UserObject,
+ Buffer);
+ break;
- return Status;
-}
+ case UserExpiresInformation:
+ Status = SampQueryUserExpires(UserObject,
+ Buffer);
+ break;
+ case UserInternal1Information:
+ Status = SampQueryUserInternal1(UserObject,
+ Buffer);
+ break;
-/* Function 46 */
-NTSTATUS
-NTAPI
-SamrQueryInformationDomain2(IN SAMPR_HANDLE DomainHandle,
- IN DOMAIN_INFORMATION_CLASS DomainInformationClass,
- OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
-{
- TRACE("SamrQueryInformationDomain2(%p %lu %p)\n",
- DomainHandle, DomainInformationClass, Buffer);
+ case UserInternal2Information:
+ Status = SampQueryUserInternal2(UserObject,
+ Buffer);
+ break;
- return SamrQueryInformationDomain(DomainHandle,
- DomainInformationClass,
+ case UserParametersInformation:
+ Status = SampQueryUserParameters(UserObject,
+ Buffer);
+ break;
+
+ case UserAllInformation:
+ Status = SampQueryUserAll(UserObject,
Buffer);
-}
+ break;
+// case UserInternal4Information:
+// case UserInternal5Information:
+// case UserInternal4InformationNew:
+// case UserInternal5InformationNew:
-/* Function 47 */
-NTSTATUS
-NTAPI
-SamrQueryInformationUser2(IN SAMPR_HANDLE UserHandle,
- IN USER_INFORMATION_CLASS UserInformationClass,
- OUT PSAMPR_USER_INFO_BUFFER *Buffer)
-{
- TRACE("SamrQueryInformationUser2(%p %lu %p)\n",
- UserHandle, UserInformationClass, Buffer);
+ default:
+ Status = STATUS_INVALID_INFO_CLASS;
+ }
- return SamrQueryInformationUser(UserHandle,
- UserInformationClass,
- Buffer);
+done:
+ RtlReleaseResource(&SampResource);
+
+ return Status;
}
@@ -9658,12 +9469,201 @@ SamrSetInformationUser2(IN SAMPR_HANDLE UserHandle,
IN USER_INFORMATION_CLASS UserInformationClass,
IN PSAMPR_USER_INFO_BUFFER Buffer)
{
+ PSAM_DB_OBJECT UserObject;
+ ACCESS_MASK DesiredAccess;
+ NTSTATUS Status;
+
TRACE("SamrSetInformationUser2(%p %lu %p)\n",
UserHandle, UserInformationClass, Buffer);
- return SamrSetInformationUser(UserHandle,
- UserInformationClass,
- Buffer);
+ switch (UserInformationClass)
+ {
+ case UserLogonHoursInformation:
+ case UserNameInformation:
+ case UserAccountNameInformation:
+ case UserFullNameInformation:
+ case UserPrimaryGroupInformation:
+ case UserHomeInformation:
+ case UserScriptInformation:
+ case UserProfileInformation:
+ case UserAdminCommentInformation:
+ case UserWorkStationsInformation:
+ case UserControlInformation:
+ case UserExpiresInformation:
+ case UserParametersInformation:
+ DesiredAccess = USER_WRITE_ACCOUNT;
+ break;
+
+ case UserGeneralInformation:
+ DesiredAccess = USER_WRITE_ACCOUNT |
+ USER_WRITE_PREFERENCES;
+ break;
+
+ case UserPreferencesInformation:
+ DesiredAccess = USER_WRITE_PREFERENCES;
+ break;
+
+ case UserSetPasswordInformation:
+ case UserInternal1Information:
+ DesiredAccess = USER_FORCE_PASSWORD_CHANGE;
+ break;
+
+ case UserAllInformation:
+ case UserInternal2Information:
+ DesiredAccess = 0; /* FIXME */
+ break;
+
+ default:
+ return STATUS_INVALID_INFO_CLASS;
+ }
+
+ RtlAcquireResourceExclusive(&SampResource,
+ TRUE);
+
+ /* Validate the domain handle */
+ Status = SampValidateDbObject(UserHandle,
+ SamDbUserObject,
+ DesiredAccess,
+ &UserObject);
+ if (!NT_SUCCESS(Status))
+ {
+ TRACE("failed with status 0x%08lx\n", Status);
+ goto done;
+ }
+
+ switch (UserInformationClass)
+ {
+ case UserGeneralInformation:
+ Status = SampSetUserGeneral(UserObject,
+ Buffer);
+ break;
+
+ case UserPreferencesInformation:
+ Status = SampSetUserPreferences(UserObject,
+ Buffer);
+ break;
+
+ case UserLogonHoursInformation:
+ Status = SampSetLogonHoursAttribute(UserObject,
+ &Buffer->LogonHours.LogonHours);
+ break;
+
+ case UserNameInformation:
+ Status = SampSetUserName(UserObject,
+ &Buffer->Name.UserName);
+ if (!NT_SUCCESS(Status))
+ break;
+
+ Status = SampSetObjectAttributeString(UserObject,
+ L"FullName",
+ &Buffer->Name.FullName);
+ break;
+
+ case UserAccountNameInformation:
+ Status = SampSetUserName(UserObject,
+ &Buffer->AccountName.UserName);
+ break;
+
+ case UserFullNameInformation:
+ Status = SampSetObjectAttributeString(UserObject,
+ L"FullName",
+ &Buffer->FullName.FullName);
+ break;
+
+ case UserPrimaryGroupInformation:
+ Status = SampSetUserPrimaryGroup(UserObject,
+ Buffer);
+ break;
+
+ case UserHomeInformation:
+ Status = SampSetObjectAttributeString(UserObject,
+ L"HomeDirectory",
+ &Buffer->Home.HomeDirectory);
+ if (!NT_SUCCESS(Status))
+ break;
+
+ Status = SampSetObjectAttributeString(UserObject,
+ L"HomeDirectoryDrive",
+
&Buffer->Home.HomeDirectoryDrive);
+ break;
+
+ case UserScriptInformation:
+ Status = SampSetObjectAttributeString(UserObject,
+ L"ScriptPath",
+ &Buffer->Script.ScriptPath);
+ break;
+
+ case UserProfileInformation:
+ Status = SampSetObjectAttributeString(UserObject,
+ L"ProfilePath",
+ &Buffer->Profile.ProfilePath);
+ break;
+
+ case UserAdminCommentInformation:
+ Status = SampSetObjectAttributeString(UserObject,
+ L"AdminComment",
+
&Buffer->AdminComment.AdminComment);
+ break;
+
+ case UserWorkStationsInformation:
+ Status = SampSetObjectAttributeString(UserObject,
+ L"WorkStations",
+
&Buffer->WorkStations.WorkStations);
+ break;
+
+ case UserSetPasswordInformation:
+ TRACE("Password: %S\n", Buffer->SetPassword.Password.Buffer);
+ TRACE("PasswordExpired: %d\n",
Buffer->SetPassword.PasswordExpired);
+
+ Status = SampSetObjectAttributeString(UserObject,
+ L"Password",
+ &Buffer->SetPassword.Password);
+ break;
+
+ case UserControlInformation:
+ Status = SampSetUserControl(UserObject,
+ Buffer);
+ break;
+
+ case UserExpiresInformation:
+ Status = SampSetUserExpires(UserObject,
+ Buffer);
+ break;
+
+ case UserInternal1Information:
+ Status = SampSetUserInternal1(UserObject,
+ Buffer);
+ break;
+
+ case UserInternal2Information:
+ Status = SampSetUserInternal2(UserObject,
+ Buffer);
+ break;
+
+ case UserParametersInformation:
+ Status = SampSetObjectAttributeString(UserObject,
+ L"Parameters",
+
&Buffer->Parameters.Parameters);
+ break;
+
+ case UserAllInformation:
+ Status = SampSetUserAll(UserObject,
+ Buffer);
+ break;
+
+// case UserInternal4Information:
+// case UserInternal5Information:
+// case UserInternal4InformationNew:
+// case UserInternal5InformationNew:
+
+ default:
+ Status = STATUS_INVALID_INFO_CLASS;
+ }
+
+done:
+ RtlReleaseResource(&SampResource);
+
+ return Status;
}