Author: ekohl
Date: Sun May  8 21:37:00 2011
New Revision: 51653

URL: http://svn.reactos.org/svn/reactos?rev=51653&view=rev
Log:
[NTOSKRNL]
Implement CmpSetVersionData: Set the CurrentType value in the 
HKLM\Software\Microsoft\Windows NT\CurrentVersion key.

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

Modified: trunk/reactos/ntoskrnl/config/cmsysini.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c?rev=51653&r1=51652&r2=51653&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmsysini.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmsysini.c [iso-8859-1] Sun May  8 21:37:00 
2011
@@ -1938,4 +1938,71 @@
     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 */

Modified: trunk/reactos/ntoskrnl/config/ntapi.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/ntapi.c?rev=51653&r1=51652&r2=51653&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] Sun May  8 21:37:00 2011
@@ -937,8 +937,8 @@
     /* Initialize the hives and lazy flusher */
     CmpCmdInit(SetupBoot);
 
-    /* FIXME: Save version data */
-    //CmpSetVersionData();
+    /* Save version data */
+    CmpSetVersionData();
 
     /* Release the registry lock */
     //CmpUnlockRegistry();

Modified: trunk/reactos/ntoskrnl/include/internal/cm.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/cm.h?rev=51653&r1=51652&r2=51653&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/cm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/cm.h [iso-8859-1] Sun May  8 
21:37:00 2011
@@ -1527,6 +1527,12 @@
 NTAPI
 CmSetLazyFlushState(
     IN BOOLEAN Enable
+);
+
+VOID
+NTAPI
+CmpSetVersionData(
+    VOID
 );
 
 //


Reply via email to