From bbb19308eaafb0341624d725c8d2d97d9adf52b0 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Tue, 22 Jun 2010 18:51:22 +0000 Subject: [PATCH] [NTOSKRNL] Move the PDO check in IoOpenDeviceRegistryKey() to the function begin. Requested by sir_richard. svn path=/trunk/; revision=47829 --- reactos/ntoskrnl/io/pnpmgr/pnpmgr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c index 055f9351d1d..f288d263457 100644 --- a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c +++ b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c @@ -3507,6 +3507,10 @@ IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject, return STATUS_INVALID_PARAMETER; } + if (!IopIsValidPhysicalDeviceObject(DeviceObject)) + return STATUS_INVALID_DEVICE_REQUEST; + DeviceNode = IopGetDeviceNode(DeviceObject); + /* * Calculate the length of the base key name. This is the full * name for driver key or the name excluding "Device Parameters" @@ -3527,9 +3531,6 @@ IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject, } else { - if (!IopIsValidPhysicalDeviceObject(DeviceObject)) - return STATUS_INVALID_DEVICE_REQUEST; - DeviceNode = IopGetDeviceNode(DeviceObject); KeyNameLength += sizeof(EnumKeyName) - sizeof(UNICODE_NULL) + DeviceNode->InstancePath.Length; }