From bd8c5df1b0975162589fb34671b3c8fb6edec6d1 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 27 Oct 2012 19:38:12 +0000 Subject: [PATCH] [SAMSRV] - Fix MSVC build warnings. - Implement SamrAddMultipeMembersToAlias. - Add missing user attributes to the user setup code. svn path=/trunk/; revision=57626 --- reactos/dll/win32/samsrv/database.c | 4 +- reactos/dll/win32/samsrv/samrpc.c | 43 +++++++++++++++++----- reactos/dll/win32/samsrv/setup.c | 57 +++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 12 deletions(-) diff --git a/reactos/dll/win32/samsrv/database.c b/reactos/dll/win32/samsrv/database.c index 199b549a9db..95811fb14b9 100644 --- a/reactos/dll/win32/samsrv/database.c +++ b/reactos/dll/win32/samsrv/database.c @@ -764,8 +764,8 @@ SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, goto done; } - String->Length = Length - sizeof(WCHAR); - String->MaximumLength = Length; + String->Length = (USHORT)(Length - sizeof(WCHAR)); + String->MaximumLength = (USHORT)Length; String->Buffer = midl_user_allocate(Length); if (String->Buffer == NULL) { diff --git a/reactos/dll/win32/samsrv/samrpc.c b/reactos/dll/win32/samsrv/samrpc.c index bcaba9c2229..826bdc7f7f2 100644 --- a/reactos/dll/win32/samsrv/samrpc.c +++ b/reactos/dll/win32/samsrv/samrpc.c @@ -17,6 +17,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(samsrv); static SID_IDENTIFIER_AUTHORITY NtSidAuthority = {SECURITY_NT_AUTHORITY}; + /* FUNCTIONS ***************************************************************/ VOID @@ -3051,6 +3052,8 @@ done: Use->Count = 0; } + TRACE("Returned Status %lx\n", Status); + return Status; } @@ -3145,8 +3148,8 @@ SamrLookupIdsInDomain(IN SAMPR_HANDLE DomainHandle, if (NT_SUCCESS(Status)) { - Names->Element[i].MaximumLength = DataLength; - Names->Element[i].Length = DataLength - sizeof(WCHAR); + Names->Element[i].MaximumLength = (USHORT)DataLength; + Names->Element[i].Length = (USHORT)(DataLength - sizeof(WCHAR)); Status = SampRegQueryValue(AccountKeyHandle, L"Name", @@ -3201,8 +3204,8 @@ SamrLookupIdsInDomain(IN SAMPR_HANDLE DomainHandle, if (NT_SUCCESS(Status)) { - Names->Element[i].MaximumLength = DataLength; - Names->Element[i].Length = DataLength - sizeof(WCHAR); + Names->Element[i].MaximumLength = (USHORT)DataLength; + Names->Element[i].Length = (USHORT)(DataLength - sizeof(WCHAR)); Status = SampRegQueryValue(AccountKeyHandle, L"Name", @@ -3259,8 +3262,8 @@ SamrLookupIdsInDomain(IN SAMPR_HANDLE DomainHandle, if (NT_SUCCESS(Status)) { - Names->Element[i].MaximumLength = DataLength; - Names->Element[i].Length = DataLength - sizeof(WCHAR); + Names->Element[i].MaximumLength = (USHORT)DataLength; + Names->Element[i].Length = (USHORT)(DataLength - sizeof(WCHAR)); Status = SampRegQueryValue(AccountKeyHandle, L"Name", @@ -4319,6 +4322,7 @@ done: return Status; } + /* Function 34 */ NTSTATUS NTAPI @@ -4367,6 +4371,7 @@ SamrOpenUser(IN SAMPR_HANDLE DomainHandle, return STATUS_SUCCESS; } + /* Function 35 */ NTSTATUS NTAPI @@ -4678,8 +4683,6 @@ done: } - - static NTSTATUS SampQueryUserAccount(PSAM_DB_OBJECT UserObject, @@ -6283,6 +6286,7 @@ SamrCreateUser2InDomain(IN SAMPR_HANDLE DomainHandle, return Status; } + /* Function 51 */ NTSTATUS NTAPI @@ -6299,16 +6303,35 @@ SamrQueryDisplayInformation3(IN SAMPR_HANDLE DomainHandle, return STATUS_NOT_IMPLEMENTED; } + /* Function 52 */ NTSTATUS NTAPI SamrAddMultipleMembersToAlias(IN SAMPR_HANDLE AliasHandle, IN PSAMPR_PSID_ARRAY MembersBuffer) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + ULONG i; + NTSTATUS Status = STATUS_SUCCESS; + + TRACE("SamrAddMultipleMembersToAlias(%p %p)\n", + AliasHandle, MembersBuffer); + + for (i = 0; i < MembersBuffer->Count; i++) + { + Status = SamrAddMemberToAlias(AliasHandle, + ((PSID *)MembersBuffer->Sids)[i]); + + if (Status == STATUS_MEMBER_IN_ALIAS) + Status = STATUS_SUCCESS; + + if (!NT_SUCCESS(Status)) + break; + } + + return Status; } + /* Function 53 */ NTSTATUS NTAPI diff --git a/reactos/dll/win32/samsrv/setup.c b/reactos/dll/win32/samsrv/setup.c index fed27722434..28a1d4bc5f3 100644 --- a/reactos/dll/win32/samsrv/setup.c +++ b/reactos/dll/win32/samsrv/setup.c @@ -224,6 +224,7 @@ SampCreateUserAccount(HKEY hDomainKey, ULONG ulRelativeId) { SAM_USER_FIXED_DATA FixedUserData; + LPWSTR lpEmptyString = L""; DWORD dwDisposition; WCHAR szAccountKeyName[32]; HKEY hAccountKey = NULL; @@ -261,6 +262,62 @@ SampCreateUserAccount(HKEY hDomainKey, (LPVOID)lpAccountName, (wcslen(lpAccountName) + 1) * sizeof(WCHAR)); + RegSetValueEx(hAccountKey, + L"FullName", + 0, + REG_SZ, + (LPVOID)lpEmptyString, + sizeof(WCHAR)); + + RegSetValueEx(hAccountKey, + L"HomeDirectory", + 0, + REG_SZ, + (LPVOID)lpEmptyString, + sizeof(WCHAR)); + + RegSetValueEx(hAccountKey, + L"HomeDirectoryDrive", + 0, + REG_SZ, + (LPVOID)lpEmptyString, + sizeof(WCHAR)); + + RegSetValueEx(hAccountKey, + L"ScriptPath", + 0, + REG_SZ, + (LPVOID)lpEmptyString, + sizeof(WCHAR)); + + RegSetValueEx(hAccountKey, + L"ProfilePath", + 0, + REG_SZ, + (LPVOID)lpEmptyString, + sizeof(WCHAR)); + + RegSetValueEx(hAccountKey, + L"AdminComment", + 0, + REG_SZ, + (LPVOID)lpEmptyString, + sizeof(WCHAR)); + + RegSetValueEx(hAccountKey, + L"UserComment", + 0, + REG_SZ, + (LPVOID)lpEmptyString, + sizeof(WCHAR)); + + RegSetValueEx(hAccountKey, + L"WorkStations", + 0, + REG_SZ, + (LPVOID)lpEmptyString, + sizeof(WCHAR)); + RegCloseKey(hAccountKey); } -- 2.17.1