[ros-diffs] [ekohl] 47336: [SMSS] - Add the system environment variables PROCESSOR_LEVEL and PROCESSOR_REVISION.

ekohl at svn.reactos.org ekohl at svn.reactos.org
Mon May 24 01:41:16 CEST 2010


Author: ekohl
Date: Mon May 24 01:41:16 2010
New Revision: 47336

URL: http://svn.reactos.org/svn/reactos?rev=47336&view=rev
Log:
[SMSS]
- Add the system environment variables PROCESSOR_LEVEL and PROCESSOR_REVISION.

Modified:
    trunk/reactos/base/system/smss/initenv.c

Modified: trunk/reactos/base/system/smss/initenv.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/initenv.c?rev=47336&r1=47335&r2=47336&view=diff
==============================================================================
--- trunk/reactos/base/system/smss/initenv.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/smss/initenv.c [iso-8859-1] Mon May 24 01:41:16 2010
@@ -66,20 +66,27 @@
 SmSetEnvironmentVariables(VOID)
 {
     SYSTEM_BASIC_INFORMATION BasicInformation;
-
+    SYSTEM_PROCESSOR_INFORMATION ProcessorInformation;
     RTL_QUERY_REGISTRY_TABLE QueryTable[3];
     UNICODE_STRING Identifier;
     UNICODE_STRING VendorIdentifier;
     WCHAR Buffer[256];
-
     UNICODE_STRING EnvironmentKeyName;
     OBJECT_ATTRIBUTES ObjectAttributes;
     HANDLE EnvironmentKey;
     UNICODE_STRING VariableName;
     PWSTR VariableData;
-
     NTSTATUS Status;
 
+    Status = NtQuerySystemInformation(SystemProcessorInformation,
+                                      &ProcessorInformation,
+                                      sizeof(SYSTEM_PROCESSOR_INFORMATION),
+                                      NULL);
+    if (!NT_SUCCESS(Status))
+    {
+        DPRINT1("SM: Failed to retrieve system processor information (Status %08lx)", Status);
+        return Status;
+    }
 
     Status = NtQuerySystemInformation(SystemBasicInformation,
                                       &BasicInformation,
@@ -149,17 +156,28 @@
     RtlInitUnicodeString(&VariableName,
                          L"PROCESSOR_ARCHITECTURE");
 
-#ifdef _M_IX86
-    VariableData = L"x86";
-#elif _M_MD64
-    VariableData = L"AMD64";
-#elif _M_ARM
-    VariableData = L"ARM";
-#elif _M_PPC
-    VariableData = L"PPC";
-#else
-    #error "Unsupported Architecture!\n"
-#endif
+    switch (ProcessorInformation.ProcessorArchitecture)
+    {
+        case PROCESSOR_ARCHITECTURE_INTEL:
+            VariableData = L"x86";
+            break;
+
+        case PROCESSOR_ARCHITECTURE_PPC:
+            VariableData = L"PPC";
+            break;
+
+        case PROCESSOR_ARCHITECTURE_ARM:
+            VariableData = L"ARM";
+            break;
+
+        case PROCESSOR_ARCHITECTURE_AMD64:
+            VariableData = L"AMD64";
+            break;
+
+        default:
+            VariableData = L"Unknown";
+            break;
+    }
 
     Status = NtSetValueKey(EnvironmentKey,
                            &VariableName,
@@ -170,6 +188,42 @@
     if (!NT_SUCCESS(Status))
     {
         DPRINT1("SM: Failed to set the PROCESSOR_ARCHITECTURE environment variable (Status %08lx)", Status);
+        goto done;
+    }
+
+    /* Set the 'PROCESSOR_LEVEL' system environment variable */
+    RtlInitUnicodeString(&VariableName,
+                         L"PROCESSOR_LEVEL");
+
+    swprintf(Buffer, L"%lu", ProcessorInformation.ProcessorLevel);
+
+    Status = NtSetValueKey(EnvironmentKey,
+                           &VariableName,
+                           0,
+                           REG_SZ,
+                           Buffer,
+                           (wcslen(Buffer) + 1) * sizeof(WCHAR));
+    if (!NT_SUCCESS(Status))
+    {
+        DPRINT1("SM: Failed to set the PROCESSOR_LEVEL environment variable (Status %08lx)", Status);
+        goto done;
+    }
+
+    /* Set the 'PROCESSOR_REVISION' system environment variable */
+    RtlInitUnicodeString(&VariableName,
+                         L"PROCESSOR_REVISION");
+
+    swprintf(Buffer, L"%04x", ProcessorInformation.ProcessorRevision);
+
+    Status = NtSetValueKey(EnvironmentKey,
+                           &VariableName,
+                           0,
+                           REG_SZ,
+                           Buffer,
+                           (wcslen(Buffer) + 1) * sizeof(WCHAR));
+    if (!NT_SUCCESS(Status))
+    {
+        DPRINT1("SM: Failed to set the PROCESSOR_REVISION environment variable (Status %08lx)", Status);
         goto done;
     }
 




More information about the Ros-diffs mailing list