From 3d046e0ed2a8aa0a380fe6c008c6bc207d53ec9e Mon Sep 17 00:00:00 2001 From: Victor Perevertkin Date: Sat, 16 Nov 2019 23:52:03 +0300 Subject: [PATCH] [NTOS:IO] Fix result length for DevicePropertyRemovalPolicy request in IoGetDeviceProperty. Classpnp expects it to be sizeof(DEVICE_REMOVAL_POLICY) see ClasspInitializeHotplugInfo in classpnp.sys CORE-6264 --- ntoskrnl/io/pnpmgr/pnpmgr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ntoskrnl/io/pnpmgr/pnpmgr.c b/ntoskrnl/io/pnpmgr/pnpmgr.c index 56b3561fefe..b08f63eb289 100644 --- a/ntoskrnl/io/pnpmgr/pnpmgr.c +++ b/ntoskrnl/io/pnpmgr/pnpmgr.c @@ -4240,6 +4240,7 @@ IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, GUID BusTypeGuid; POBJECT_NAME_INFORMATION ObjectNameInfo = NULL; BOOLEAN NullTerminate = FALSE; + DEVICE_REMOVAL_POLICY Policy; DPRINT("IoGetDeviceProperty(0x%p %d)\n", DeviceObject, DeviceProperty); @@ -4357,7 +4358,9 @@ IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, break; case DevicePropertyRemovalPolicy: - PIP_RETURN_DATA(sizeof(UCHAR), &DeviceNode->RemovalPolicy); + + Policy = DeviceNode->RemovalPolicy; + PIP_RETURN_DATA(sizeof(Policy), &Policy); /* Handle the registry-based properties */ case DevicePropertyUINumber: