Author: tfaber Date: Wed Jul 27 11:15:52 2016 New Revision: 72017
URL: http://svn.reactos.org/svn/reactos?rev=72017&view=rev Log: [NTOS:PO] - Send power IRPs to the top of the device stack instead of the PDO CORE-10110 #resolve
Modified: trunk/reactos/ntoskrnl/po/power.c
Modified: trunk/reactos/ntoskrnl/po/power.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/po/power.c?rev=720... ============================================================================== --- trunk/reactos/ntoskrnl/po/power.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/po/power.c [iso-8859-1] Wed Jul 27 11:15:52 2016 @@ -153,6 +153,7 @@ PVOID Context) { PPOWER_STATE_TRAVERSE_CONTEXT PowerStateContext = Context; + PDEVICE_OBJECT TopDeviceObject; NTSTATUS Status;
DPRINT("PopQuerySystemPowerStateTraverse(%p, %p)\n", DeviceNode, Context); @@ -163,13 +164,16 @@ if (DeviceNode->Flags & DNF_LEGACY_DRIVER) return STATUS_SUCCESS;
- Status = PopSendQuerySystemPowerState(DeviceNode->PhysicalDeviceObject, + TopDeviceObject = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject); + + Status = PopSendQuerySystemPowerState(TopDeviceObject, PowerStateContext->SystemPowerState, PowerStateContext->PowerAction); if (!NT_SUCCESS(Status)) { DPRINT1("Device '%wZ' failed IRP_MN_QUERY_POWER\n", &DeviceNode->InstancePath); } + ObDereferenceObject(TopDeviceObject);
#if 0 return Status; @@ -183,6 +187,7 @@ PVOID Context) { PPOWER_STATE_TRAVERSE_CONTEXT PowerStateContext = Context; + PDEVICE_OBJECT TopDeviceObject; NTSTATUS Status;
DPRINT("PopSetSystemPowerStateTraverse(%p, %p)\n", DeviceNode, Context); @@ -196,13 +201,22 @@ if (DeviceNode->Flags & DNF_LEGACY_DRIVER) return STATUS_SUCCESS;
- Status = PopSendSetSystemPowerState(DeviceNode->PhysicalDeviceObject, + TopDeviceObject = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject); + if (TopDeviceObject == PowerStateContext->PowerDevice) + { + ObDereferenceObject(TopDeviceObject); + return STATUS_SUCCESS; + } + + Status = PopSendSetSystemPowerState(TopDeviceObject, PowerStateContext->SystemPowerState, PowerStateContext->PowerAction); if (!NT_SUCCESS(Status)) { DPRINT1("Device '%wZ' failed IRP_MN_SET_POWER\n", &DeviceNode->InstancePath); } + + ObDereferenceObject(TopDeviceObject);
#if 0 return Status;