[NTOSKRNL]
authorEric Kohl <eric.kohl@reactos.org>
Sun, 8 May 2011 21:37:00 +0000 (21:37 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 8 May 2011 21:37:00 +0000 (21:37 +0000)
Implement CmpSetVersionData: Set the CurrentType value in the HKLM\Software\Microsoft\Windows NT\CurrentVersion key.

svn path=/trunk/; revision=51653

reactos/ntoskrnl/config/cmsysini.c
reactos/ntoskrnl/config/ntapi.c
reactos/ntoskrnl/include/internal/cm.h

index 164b45f..1d22e87 100644 (file)
@@ -1938,4 +1938,71 @@ CmShutdownSystem(VOID)
     CmpDoFlushAll(TRUE);
 }
 
+VOID
+NTAPI
+CmpSetVersionData(VOID)
+{
+    OBJECT_ATTRIBUTES ObjectAttributes;
+    UNICODE_STRING KeyName;
+    UNICODE_STRING ValueName;
+    UNICODE_STRING ValueData;
+    HANDLE KeyHandle;
+    WCHAR Buffer[128];
+    NTSTATUS Status;
+
+    /* Open the 'CurrentVersion' key */
+    RtlInitUnicodeString(&KeyName,
+                         L"\\REGISTRY\\MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion");
+
+    InitializeObjectAttributes(&ObjectAttributes,
+                               &KeyName,
+                               OBJ_CASE_INSENSITIVE,
+                               0,
+                               NULL);
+
+    Status = NtCreateKey(&KeyHandle,
+                         KEY_CREATE_SUB_KEY,
+                         &ObjectAttributes,
+                         0,
+                         NULL,
+                         0,
+                         NULL);
+    if (!NT_SUCCESS(Status))
+    {
+        DPRINT1("Failed to create key &wZ (Status: %08lx)\n", &KeyName, Status);
+        return;
+    }
+
+    /* Set the 'CurrentType' value */
+    RtlInitUnicodeString(&ValueName,
+                         L"CurrentType");
+
+#ifdef CONFIG_SMP
+    wcscpy(Buffer, L"Multiprocessor");
+#else
+    wcscpy(Buffer, L"Uniprocessor");
+#endif
+
+    wcscat(Buffer, L" ");
+
+#if (DBG == 1)
+    wcscat(Buffer, L"Checked");
+#else
+    wcscat(Buffer, L"Free");
+#endif
+
+    RtlInitUnicodeString(&ValueData,
+                         Buffer);
+
+    NtSetValueKey(KeyHandle,
+                  &ValueName,
+                  0,
+                  REG_SZ,
+                  ValueData.Buffer,
+                  ValueData.Length + sizeof(WCHAR));
+
+    /* Close the key */
+    NtClose(KeyHandle);
+}
+
 /* EOF */
index 0e76f7c..95f6116 100644 (file)
@@ -937,8 +937,8 @@ NtInitializeRegistry(IN USHORT Flag)
     /* Initialize the hives and lazy flusher */
     CmpCmdInit(SetupBoot);
 
-    /* FIXME: Save version data */
-    //CmpSetVersionData();
+    /* Save version data */
+    CmpSetVersionData();
 
     /* Release the registry lock */
     //CmpUnlockRegistry();
index 9a0dd90..d7d118c 100644 (file)
@@ -1529,6 +1529,12 @@ CmSetLazyFlushState(
     IN BOOLEAN Enable
 );
 
+VOID
+NTAPI
+CmpSetVersionData(
+    VOID
+);
+
 //
 // Driver List Routines
 //