[ros-diffs] [cgutman] 46500: [NTOSKRNL] - Don't always use the value name as the device description - Fixes bug 3416

cgutman at svn.reactos.org cgutman at svn.reactos.org
Sat Mar 27 22:45:36 CET 2010


Author: cgutman
Date: Sat Mar 27 22:45:35 2010
New Revision: 46500

URL: http://svn.reactos.org/svn/reactos?rev=46500&view=rev
Log:
[NTOSKRNL]
- Don't always use the value name as the device description
- Fixes bug 3416

Modified:
    trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c

Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c?rev=46500&r1=46499&r2=46500&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Sat Mar 27 22:45:35 2010
@@ -2192,6 +2192,7 @@
    UNICODE_STRING HardwareIdKey;
    PUNICODE_STRING pHardwareId;
    ULONG DeviceIndex = 0;
+   BOOLEAN IsDeviceDesc;
 
     if (RelativePath)
     {
@@ -2418,16 +2419,19 @@
       {
          pHardwareId = &HardwareIdSerial;
          DeviceIndex = DeviceIndexSerial++;
+         IsDeviceDesc = TRUE;
       }
       else if (RelativePath && RtlCompareUnicodeString(RelativePath, &IdentifierKeyboard, FALSE) == 0)
       {
          pHardwareId = &HardwareIdKeyboard;
          DeviceIndex = DeviceIndexKeyboard++;
+         IsDeviceDesc = FALSE;
       }
       else if (RelativePath && RtlCompareUnicodeString(RelativePath, &IdentifierMouse, FALSE) == 0)
       {
          pHardwareId = &HardwareIdMouse;
          DeviceIndex = DeviceIndexMouse++;
+         IsDeviceDesc = FALSE;
       }
       else if (NT_SUCCESS(Status))
       {
@@ -2436,17 +2440,20 @@
          {
             pHardwareId = &HardwareIdPci;
             DeviceIndex = DeviceIndexPci++;
+            IsDeviceDesc = FALSE;
          }
          else if (RtlCompareUnicodeString(&ValueName, &IdentifierIsa, FALSE) == 0)
          {
             pHardwareId = &HardwareIdIsa;
             DeviceIndex = DeviceIndexIsa++;
+            IsDeviceDesc = FALSE;
          }
 #ifdef ENABLE_ACPI
          else if (RtlCompareUnicodeString(&ValueName, &IdentifierAcpi, FALSE) == 0)
          {
             pHardwareId = &HardwareIdAcpi;
             DeviceIndex = DeviceIndexAcpi++;
+            IsDeviceDesc = FALSE;
          }
 #endif
          else /* Now let's detect devices with a device number at the end */
@@ -2459,12 +2466,14 @@
             {
                 pHardwareId = &HardwareIdFloppy;
                 DeviceIndex = DeviceIndexFloppy++;
+                IsDeviceDesc = FALSE;
             }
             /* Nope, is it a parallel port? */
             else if (RtlCompareUnicodeString(&ValueName, &IdentifierParallel, FALSE) == 0)
             {
                 pHardwareId = &HardwareIdParallel;
                 DeviceIndex = DeviceIndexParallel++;
+                IsDeviceDesc = FALSE;
             }
             /* Nope, out of ideas so let's skip this one */
             else
@@ -2522,12 +2531,15 @@
          goto nextdevice;
       }
       DPRINT("Found %wZ #%lu (%wZ)\n", &ValueName, DeviceIndex, &HardwareIdKey);
-      Status = ZwSetValueKey(hLevel2Key, &DeviceDescU, 0, REG_SZ, ValueName.Buffer, ValueName.MaximumLength);
-      if (!NT_SUCCESS(Status))
-      {
-         DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status);
-         ZwDeleteKey(hLevel2Key);
-         goto nextdevice;
+      if (IsDeviceDesc)
+      {
+         Status = ZwSetValueKey(hLevel2Key, &DeviceDescU, 0, REG_SZ, ValueName.Buffer, ValueName.MaximumLength);
+         if (!NT_SUCCESS(Status))
+         {
+            DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status);
+            ZwDeleteKey(hLevel2Key);
+            goto nextdevice;
+         }
       }
       Status = ZwSetValueKey(hLevel2Key, &HardwareIDU, 0, REG_MULTI_SZ, pHardwareId->Buffer, pHardwareId->MaximumLength);
       if (!NT_SUCCESS(Status))




More information about the Ros-diffs mailing list