[ros-diffs] [cgutman] 49251: [PNPMGR] - Check that we got a valid vector back from HAL when translating an interrupt resource - Add some debugging messages for failure paths in device resource handling code

cgutman at svn.reactos.org cgutman at svn.reactos.org
Sun Oct 24 06:16:36 UTC 2010


Author: cgutman
Date: Sun Oct 24 06:16:35 2010
New Revision: 49251

URL: http://svn.reactos.org/svn/reactos?rev=49251&view=rev
Log:
[PNPMGR]
- Check that we got a valid vector back from HAL when translating an interrupt resource
- Add some debugging messages for failure paths in device resource handling code

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

Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.c?rev=49251&r1=49250&r2=49251&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.c [iso-8859-1] Sun Oct 24 06:16:35 2010
@@ -733,7 +733,7 @@
    DeviceNode->ResourceListTranslated = ExAllocatePool(PagedPool, ListSize);
    if (!DeviceNode->ResourceListTranslated)
    {
-      Status =STATUS_NO_MEMORY;
+      Status = STATUS_NO_MEMORY;
       goto cleanup;
    }
    RtlCopyMemory(DeviceNode->ResourceListTranslated, DeviceNode->ResourceList, ListSize);
@@ -758,6 +758,7 @@
                   &DescriptorTranslated->u.Port.Start))
                {
                   Status = STATUS_UNSUCCESSFUL;
+                  DPRINT1("Failed to translate port resource (Start: 0xI64x)\n", DescriptorRaw->u.Port.Start.QuadPart);
                   goto cleanup;
                }
                break;
@@ -771,6 +772,14 @@
                   DescriptorRaw->u.Interrupt.Vector,
                   (PKIRQL)&DescriptorTranslated->u.Interrupt.Level,
                   &DescriptorTranslated->u.Interrupt.Affinity);
+                
+               if (!DescriptorTranslated->u.Interrupt.Vector)
+               {
+                   Status = STATUS_UNSUCCESSFUL;
+                   DPRINT1("Failed to translate interrupt resource (Vector: 0x%x | Level: 0x%x)\n", DescriptorRaw->u.Interrupt.Vector,
+                                                                                                   DescriptorRaw->u.Interrupt.Level);
+                   goto cleanup;
+               }
                break;
             }
             case CmResourceTypeMemory:
@@ -784,6 +793,7 @@
                   &DescriptorTranslated->u.Memory.Start))
                {
                   Status = STATUS_UNSUCCESSFUL;
+                  DPRINT1("Failed to translate memory resource (Start: 0xI64x)\n", DescriptorRaw->u.Memory.Start.QuadPart);
                   goto cleanup;
                }
             }
@@ -879,16 +889,21 @@
    Status = IopCreateResourceListFromRequirements(DeviceNode->ResourceRequirements,
                                                   &DeviceNode->ResourceList);
    if (!NT_SUCCESS(Status))
+   {
+       DPRINT1("Failed to create a resource list from supplied resources for %wZ\n", &DeviceNode->InstancePath);
        goto ByeBye;
-
-   Status = IopDetectResourceConflict(DeviceNode->ResourceList, FALSE, NULL);
-   if (!NT_SUCCESS(Status))
-       goto ByeBye;
+   }
+
+   /* IopCreateResourceListFromRequirements should NEVER succeed with a conflicting list */
+   ASSERT(IopDetectResourceConflict(DeviceNode->ResourceList, FALSE, NULL) != STATUS_CONFLICTING_ADDRESSES);
 
 Finish:
    Status = IopTranslateDeviceResources(DeviceNode);
    if (!NT_SUCCESS(Status))
+   {
+       DPRINT1("Failed to translate resources for %wZ\n", &DeviceNode->InstancePath);
        goto ByeBye;
+   }
 
    Status = IopUpdateResourceMapForPnPDevice(DeviceNode);
    if (!NT_SUCCESS(Status))




More information about the Ros-diffs mailing list