From f7dbb49d4c4d562c9a605a78a054b00dfea3a4a4 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 5 Jan 2013 20:30:06 +0000 Subject: [PATCH] [SAMSRV] Implement SamrQueryInformationUser.UserParametersInformation and set the Parameters attribute when a new user is created. svn path=/trunk/; revision=58117 --- reactos/dll/win32/samsrv/samrpc.c | 67 +++++++++++++++++++++++++++++++ reactos/dll/win32/samsrv/setup.c | 7 ++++ 2 files changed, 74 insertions(+) diff --git a/reactos/dll/win32/samsrv/samrpc.c b/reactos/dll/win32/samsrv/samrpc.c index ebc6020faad..d996c8c68d6 100644 --- a/reactos/dll/win32/samsrv/samrpc.c +++ b/reactos/dll/win32/samsrv/samrpc.c @@ -2297,6 +2297,18 @@ SamrCreateUserInDomain(IN SAMPR_HANDLE DomainHandle, return Status; } + /* Set the Parameters attribute */ + Status = SampSetObjectAttribute(UserObject, + L"Parameters", + REG_SZ, + EmptyString.Buffer, + EmptyString.MaximumLength); + if (!NT_SUCCESS(Status)) + { + TRACE("failed with status 0x%08lx\n", Status); + return Status; + } + /* FIXME: Set default user attributes */ if (NT_SUCCESS(Status)) @@ -5654,6 +5666,47 @@ done: } +static NTSTATUS +SampQueryUserParameters(PSAM_DB_OBJECT UserObject, + PSAMPR_USER_INFO_BUFFER *Buffer) +{ + PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL; + NTSTATUS Status; + + *Buffer = NULL; + + InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER)); + if (InfoBuffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + /* Get the Parameters string */ + Status = SampGetObjectAttributeString(UserObject, + L"Parameters", + &InfoBuffer->Parameters.Parameters); + if (!NT_SUCCESS(Status)) + { + TRACE("Status 0x%08lx\n", Status); + goto done; + } + + *Buffer = InfoBuffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (InfoBuffer != NULL) + { + if (InfoBuffer->Parameters.Parameters.Buffer != NULL) + midl_user_free(InfoBuffer->Parameters.Parameters.Buffer); + + midl_user_free(InfoBuffer); + } + } + + return Status; +} + + /* Function 36 */ NTSTATUS NTAPI @@ -5689,6 +5742,7 @@ SamrQueryInformationUser(IN SAMPR_HANDLE UserHandle, case UserControlInformation: case UserExpiresInformation: + case UserParametersInformation: DesiredAccess = USER_READ_ACCOUNT; break; @@ -5801,6 +5855,19 @@ SamrQueryInformationUser(IN SAMPR_HANDLE UserHandle, Buffer); break; +// case UserInternal1Information: + + case UserParametersInformation: + Status = SampQueryUserParameters(UserObject, + Buffer); + break; + +// case UserAllInformation: +// case UserInternal4Information: +// case UserInternal5Information: +// case UserInternal4InformationNew: +// case UserInternal5InformationNew: + default: Status = STATUS_INVALID_INFO_CLASS; } diff --git a/reactos/dll/win32/samsrv/setup.c b/reactos/dll/win32/samsrv/setup.c index 28a1d4bc5f3..e9944a81863 100644 --- a/reactos/dll/win32/samsrv/setup.c +++ b/reactos/dll/win32/samsrv/setup.c @@ -318,6 +318,13 @@ SampCreateUserAccount(HKEY hDomainKey, (LPVOID)lpEmptyString, sizeof(WCHAR)); + RegSetValueEx(hAccountKey, + L"Parameters", + 0, + REG_SZ, + (LPVOID)lpEmptyString, + sizeof(WCHAR)); + RegCloseKey(hAccountKey); }