Author: ion Date: Tue Aug 6 01:42:43 2013 New Revision: 59653
URL: http://svn.reactos.org/svn/reactos?rev=59653&view=rev Log: [NDK]: Update DNF_NEED_TO_ENUM to DNF_LEGACY_RESOURCE_DEVICENODE. The former wasn't used and doesn't seem to exist, the latter is the actual real flag with that value. [NTOSKRNL]: Commit an old patch of mine that sets up the right frontend code in IoAssignResources. All it does is add some error checking before calling the old halfplemented backend.
Modified: trunk/reactos/include/ndk/iotypes.h trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
Modified: trunk/reactos/include/ndk/iotypes.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/iotypes.h?rev=5... ============================================================================== --- trunk/reactos/include/ndk/iotypes.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/iotypes.h [iso-8859-1] Tue Aug 6 01:42:43 2013 @@ -174,7 +174,7 @@ #define DNF_LEGACY_DRIVER 0x00004000 #define DNF_STOPPED 0x00008000 #define DNF_WILL_BE_REMOVED 0x00010000 -#define DNF_NEED_TO_ENUM 0x00020000 +#define DNF_LEGACY_RESOURCE_DEVICENODE 0x00020000 #define DNF_NOT_CONFIGURED 0x00040000 #define DNF_REINSTALL 0x00080000 #define DNF_RESOURCE_REQUIREMENTS_NEED_FILTERED 0x00100000 // ???
Modified: trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c [iso-8859-1] Tue Aug 6 01:42:43 2013 @@ -908,35 +908,84 @@ return STATUS_SUCCESS; }
-/* - * @halfplemented - */ -NTSTATUS NTAPI -IoAssignResources(PUNICODE_STRING RegistryPath, - PUNICODE_STRING DriverClassName, - PDRIVER_OBJECT DriverObject, - PDEVICE_OBJECT DeviceObject, - PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources, - PCM_RESOURCE_LIST* AllocatedResources) +NTSTATUS +NTAPI +IopLegacyResourceAllocation(IN ARBITER_REQUEST_SOURCE AllocationType, + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT DeviceObject OPTIONAL, + IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements, + IN OUT PCM_RESOURCE_LIST *AllocatedResources) { NTSTATUS Status; - - DPRINT1("IoAssignResources is halfplemented!\n"); - - *AllocatedResources = NULL; - Status = IopFixupResourceListWithRequirements(RequestedResources, + + DPRINT1("IopLegacyResourceAllocation is halfplemented!\n"); + + Status = IopFixupResourceListWithRequirements(ResourceRequirements, 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; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +IoAssignResources(IN PUNICODE_STRING RegistryPath, + IN PUNICODE_STRING DriverClassName, + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT DeviceObject, + IN PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources, + IN OUT PCM_RESOURCE_LIST* AllocatedResources) +{ + PDEVICE_NODE DeviceNode; + + /* Do we have a DO? */ + if (DeviceObject) + { + /* Get its device node */ + DeviceNode = IopGetDeviceNode(DeviceObject); + if ((DeviceNode) && !(DeviceNode->Flags & DNF_LEGACY_RESOURCE_DEVICENODE)) + { + /* New drivers should not call this API */ + KeBugCheckEx(PNP_DETECTED_FATAL_ERROR, + 0, + 0, + (ULONG_PTR)DeviceObject, + (ULONG_PTR)DriverObject); + } + } + + /* Did the driver supply resources? */ + if (RequestedResources) + { + /* Make sure there's actually something useful in them */ + if (!(RequestedResources->AlternativeLists) || !(RequestedResources->List[0].Count)) + { + /* Empty resources are no resources */ + RequestedResources = NULL; + } + } + + /* Initialize output if given */ + if (AllocatedResources) *AllocatedResources = NULL; + + /* Call internal helper function */ + return IopLegacyResourceAllocation(ArbiterRequestLegacyAssigned, + DriverObject, + DeviceObject, + RequestedResources, + AllocatedResources); }
/*
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c... ============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Tue Aug 6 01:42:43 2013 @@ -2267,8 +2267,6 @@ IopQueueTargetDeviceEvent(&GUID_DEVICE_ARRIVAL, &DeviceNode->InstancePath); } - - DeviceNode->Flags &= ~DNF_NEED_TO_ENUM;
DPRINT("Sending IRP_MN_QUERY_DEVICE_RELATIONS to device stack\n");