From 5958a4e877580beaef84563cba034c6efb7f071c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 24 Oct 2010 02:51:48 +0000 Subject: [PATCH] [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 svn path=/trunk/; revision=49249 --- reactos/ntoskrnl/io/iomgr/iorsrce.c | 64 +++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/reactos/ntoskrnl/io/iomgr/iorsrce.c b/reactos/ntoskrnl/io/iomgr/iorsrce.c index af5913146c6..9d52881ce12 100644 --- a/reactos/ntoskrnl/io/iomgr/iorsrce.c +++ b/reactos/ntoskrnl/io/iomgr/iorsrce.c @@ -841,7 +841,7 @@ IoGetConfigurationInformation(VOID) } /* - * @unimplemented + * @halfplemented */ NTSTATUS NTAPI IoReportResourceUsage(PUNICODE_STRING DriverClassName, @@ -876,13 +876,48 @@ IoReportResourceUsage(PUNICODE_STRING DriverClassName, * 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 @@ IoAssignResources(PUNICODE_STRING RegistryPath, 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; } /*