[ros-diffs] [cgutman] 49249: [NTOSKRNL] - Partially implement IoAssignResources so that it creates a non-conflicting resource list from the requirements but it doesn't claim the resources for the device in the...

cgutman at svn.reactos.org cgutman at svn.reactos.org
Sun Oct 24 02:51:49 UTC 2010


Author: cgutman
Date: Sun Oct 24 02:51:48 2010
New Revision: 49249

URL: http://svn.reactos.org/svn/reactos?rev=49249&view=rev
Log:
[NTOSKRNL]
- Partially implement IoAssignResources so that it creates a non-conflicting resource list from the requirements but it doesn't claim the resources for the device in the registry
- Partially implement IoReportResourceUsage so that it checks the resource list for conflicts but doesn't claim the resources in the registry
- Please test this revision with a variety of hardware and drivers because it activates several code paths in the PnP manager
- If this causes problems, look for "Denying an attempt to claim resources currently in use by another device!" in the debug log and report the bug to me

Modified:
    trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c

Modified: trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c?rev=49249&r1=49248&r2=49249&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c [iso-8859-1] Sun Oct 24 02:51:48 2010
@@ -841,7 +841,7 @@
 }
 
 /*
- * @unimplemented
+ * @halfplemented
  */
 NTSTATUS NTAPI
 IoReportResourceUsage(PUNICODE_STRING DriverClassName,
@@ -876,13 +876,48 @@
       *       a conflict is detected with another driver.
       */
 {
-   UNIMPLEMENTED;
-   *ConflictDetected = FALSE;
-   return STATUS_SUCCESS;
+    NTSTATUS Status;
+    PCM_RESOURCE_LIST ResourceList;
+    
+    DPRINT1("IoReportResourceUsage is halfplemented!\n");
+    
+    if (!DriverList && !DeviceList)
+        return STATUS_INVALID_PARAMETER;
+    
+    if (DeviceList)
+        ResourceList = DeviceList;
+    else
+        ResourceList = DriverList;
+    
+    Status = IopDetectResourceConflict(ResourceList, FALSE, NULL);
+    if (Status == STATUS_CONFLICTING_ADDRESSES)
+    {
+        *ConflictDetected = TRUE;
+        
+        if (!OverrideConflict)
+        {
+            DPRINT1("Denying an attempt to claim resources currently in use by another device!\n");
+            return STATUS_CONFLICTING_ADDRESSES;
+        }
+        else
+        {
+            DPRINT1("Proceeding with conflicting resources\n");
+        }
+    }
+    else if (!NT_SUCCESS(Status))
+    {
+        return Status;
+    }
+
+    /* TODO: Claim resources in registry */
+    
+    *ConflictDetected = FALSE;
+    
+    return STATUS_SUCCESS;
 }
 
 /*
- * @unimplemented
+ * @halfplemented
  */
 NTSTATUS NTAPI
 IoAssignResources(PUNICODE_STRING RegistryPath,
@@ -892,8 +927,23 @@
 		  PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
 		  PCM_RESOURCE_LIST* AllocatedResources)
 {
-   UNIMPLEMENTED;
-   return(STATUS_NOT_IMPLEMENTED);
+    NTSTATUS Status;
+    
+    DPRINT1("IoAssignResources is halfplemented!\n");
+    
+    Status = IopCreateResourceListFromRequirements(RequestedResources,
+                                                   AllocatedResources);
+    if (!NT_SUCCESS(Status))
+    {
+        if (Status == STATUS_CONFLICTING_ADDRESSES)
+            DPRINT1("Denying an attempt to claim resources currently in use by another device!\n");
+        
+        return Status;
+    }
+    
+    /* TODO: Claim resources in registry */
+    
+    return STATUS_SUCCESS;
 }
 
 /*




More information about the Ros-diffs mailing list