[NTOSKRNL]
authorCameron Gutman <aicommander@gmail.com>
Sun, 11 Apr 2010 16:21:29 +0000 (16:21 +0000)
committerCameron Gutman <aicommander@gmail.com>
Sun, 11 Apr 2010 16:21:29 +0000 (16:21 +0000)
- Store the allocated resources for reported devices

svn path=/trunk/; revision=46842

reactos/ntoskrnl/io/pnpmgr/pnpreport.c

index 239dcb0..4995b16 100644 (file)
@@ -266,9 +266,6 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject,
     /* Write the resource information to the registry */
     IopSetDeviceInstanceData(InstanceKey, DeviceNode);
 
     /* Write the resource information to the registry */
     IopSetDeviceInstanceData(InstanceKey, DeviceNode);
 
-    /* Close the instance key handle */
-    ZwClose(InstanceKey);
-
     /* If the caller didn't get the resources assigned for us, do it now */
     if (!ResourceAssigned)
     {
     /* If the caller didn't get the resources assigned for us, do it now */
     if (!ResourceAssigned)
     {
@@ -278,7 +275,19 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject,
        {
           Status = IopTranslateDeviceResources(DeviceNode, RequiredLength);
           if (NT_SUCCESS(Status))
        {
           Status = IopTranslateDeviceResources(DeviceNode, RequiredLength);
           if (NT_SUCCESS(Status))
+          {
               Status = IopUpdateResourceMapForPnPDevice(DeviceNode);
               Status = IopUpdateResourceMapForPnPDevice(DeviceNode);
+              if (NT_SUCCESS(Status) && DeviceNode->ResourceList)
+              {
+                 RtlInitUnicodeString(&ValueName, L"AllocConfig");
+                 Status = ZwSetValueKey(InstanceKey,
+                                        &ValueName,
+                                        0,
+                                        REG_RESOURCE_LIST,
+                                        DeviceNode->ResourceList,
+                                        CM_RESOURCE_LIST_SIZE(DeviceNode->ResourceList));
+              }
+          }
        }
        IopDeviceNodeClearFlag(DeviceNode, DNF_ASSIGNING_RESOURCES);
 
        }
        IopDeviceNodeClearFlag(DeviceNode, DNF_ASSIGNING_RESOURCES);
 
@@ -286,10 +295,14 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject,
        if (!NT_SUCCESS(Status))
        {
            DPRINT("Assigning resources failed: 0x%x\n", Status);
        if (!NT_SUCCESS(Status))
        {
            DPRINT("Assigning resources failed: 0x%x\n", Status);
+           ZwClose(InstanceKey);
            return Status;
        }
     }
 
            return Status;
        }
     }
 
+    /* Close the instance key handle */
+    ZwClose(InstanceKey);
+
     /* Report the device's enumeration to umpnpmgr */
     IopQueueTargetDeviceEvent(&GUID_DEVICE_ENUMERATED,
                               &DeviceNode->InstancePath);
     /* Report the device's enumeration to umpnpmgr */
     IopQueueTargetDeviceEvent(&GUID_DEVICE_ENUMERATED,
                               &DeviceNode->InstancePath);