mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 08:25:53 +00:00
[NTOSKRNL]
Add a macro to check for a valid PDO and use it in IoOpenDeviceRegistryKey(). Requested by sir_richard. svn path=/trunk/; revision=47828
This commit is contained in:
parent
b362a62a7e
commit
0ad7647067
|
@ -208,6 +208,16 @@
|
|||
(_DeviceTreeTraverseContext)->Action = (_Action); \
|
||||
(_DeviceTreeTraverseContext)->Context = (_Context); }
|
||||
|
||||
/*
|
||||
* BOOLEAN
|
||||
* IopIsValidPhysicalDeviceObject(
|
||||
* IN PDEVICE_OBJECT PhysicalDeviceObject);
|
||||
*/
|
||||
#define IopIsValidPhysicalDeviceObject(PhysicalDeviceObject) \
|
||||
(((PEXTENDED_DEVOBJ_EXTENSION)PhysicalDeviceObject) && \
|
||||
(((PEXTENDED_DEVOBJ_EXTENSION)PhysicalDeviceObject->DeviceObjectExtension)->DeviceNode) && \
|
||||
(((PEXTENDED_DEVOBJ_EXTENSION)PhysicalDeviceObject->DeviceObjectExtension)->DeviceNode->Flags & DNF_ENUMERATED))
|
||||
|
||||
//
|
||||
// Device List Operations
|
||||
//
|
||||
|
|
|
@ -3527,9 +3527,9 @@ IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
else
|
||||
{
|
||||
DeviceNode = IopGetDeviceNode(DeviceObject);
|
||||
if (!DeviceNode)
|
||||
if (!IopIsValidPhysicalDeviceObject(DeviceObject))
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
DeviceNode = IopGetDeviceNode(DeviceObject);
|
||||
KeyNameLength += sizeof(EnumKeyName) - sizeof(UNICODE_NULL) +
|
||||
DeviceNode->InstancePath.Length;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue