[SAMSRV]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 27 Oct 2012 19:38:12 +0000 (19:38 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 27 Oct 2012 19:38:12 +0000 (19:38 +0000)
- 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
reactos/dll/win32/samsrv/samrpc.c
reactos/dll/win32/samsrv/setup.c

index 199b549..95811fb 100644 (file)
@@ -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)
     {
index bcaba9c..826bdc7 100644 (file)
@@ -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
index fed2772..28a1d4b 100644 (file)
@@ -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);
     }