Sync with trunk for console graphics palettes.
[reactos.git] / dll / win32 / samsrv / setup.c
index ce96c7a..ad758ca 100644 (file)
@@ -98,6 +98,8 @@ SampSetupCreateAliasAccount(HANDLE hDomainKey,
     WCHAR szAccountKeyName[32];
     HANDLE hAccountKey = NULL;
     HANDLE hNamesKey = NULL;
+    PSECURITY_DESCRIPTOR Sd = NULL;
+    ULONG SdSize = 0;
     NTSTATUS Status;
 
     swprintf(szAccountKeyName, L"Aliases\\%08lX", ulRelativeId);
@@ -125,6 +127,20 @@ SampSetupCreateAliasAccount(HANDLE hDomainKey,
     if (!NT_SUCCESS(Status))
         goto done;
 
+    /* Create the server SD */
+    Status = SampCreateAliasSD(&Sd,
+                               &SdSize);
+    if (!NT_SUCCESS(Status))
+        goto done;
+
+    /* Set SecDesc attribute*/
+    Status = SampRegSetValue(hAccountKey,
+                             L"SecDesc",
+                             REG_BINARY,
+                             Sd,
+                             SdSize);
+    if (!NT_SUCCESS(Status))
+        goto done;
 
     Status = SampRegOpenKey(hDomainKey,
                             L"Aliases\\Names",
@@ -142,6 +158,9 @@ SampSetupCreateAliasAccount(HANDLE hDomainKey,
 done:
     SampRegCloseKey(&hNamesKey);
 
+    if (Sd != NULL)
+        RtlFreeHeap(RtlGetProcessHeap(), 0, Sd);
+
     if (hAccountKey != NULL)
     {
         SampRegCloseKey(&hAccountKey);
@@ -245,6 +264,8 @@ SampSetupCreateGroupAccount(HANDLE hDomainKey,
     WCHAR szAccountKeyName[32];
     HANDLE hAccountKey = NULL;
     HANDLE hNamesKey = NULL;
+    PSECURITY_DESCRIPTOR Sd = NULL;
+    ULONG SdSize = 0;
     NTSTATUS Status;
 
     /* Initialize fixed group data */
@@ -286,6 +307,21 @@ SampSetupCreateGroupAccount(HANDLE hDomainKey,
     if (!NT_SUCCESS(Status))
         goto done;
 
+    /* Create the security descriptor */
+    Status = SampCreateGroupSD(&Sd,
+                               &SdSize);
+    if (!NT_SUCCESS(Status))
+        goto done;
+
+    /* Set the SecDesc attribute*/
+    Status = SampRegSetValue(hAccountKey,
+                             L"SecDesc",
+                             REG_BINARY,
+                             Sd,
+                             SdSize);
+    if (!NT_SUCCESS(Status))
+        goto done;
+
     Status = SampRegOpenKey(hDomainKey,
                             L"Groups\\Names",
                             KEY_ALL_ACCESS,
@@ -302,6 +338,9 @@ SampSetupCreateGroupAccount(HANDLE hDomainKey,
 done:
     SampRegCloseKey(&hNamesKey);
 
+    if (Sd != NULL)
+        RtlFreeHeap(RtlGetProcessHeap(), 0, Sd);
+
     if (hAccountKey != NULL)
     {
         SampRegCloseKey(&hAccountKey);
@@ -510,6 +549,16 @@ SampSetupCreateUserAccount(HANDLE hDomainKey,
     if (!NT_SUCCESS(Status))
         goto done;
 
+    /* Set PrivateData attribute*/
+    Status = SampRegSetValue(hAccountKey,
+                             L"PrivateData",
+                             REG_SZ,
+                             (LPVOID)lpEmptyString,
+                             sizeof(WCHAR));
+    if (!NT_SUCCESS(Status))
+        goto done;
+
+
     /* FIXME: Set SecDesc attribute*/