[PORTCLS]

- Don't attempt broken pointer magic on power states

svn path=/trunk/; revision=69495
This commit is contained in:
Thomas Faber 2015-10-11 08:19:18 +00:00
parent 8b6a867b02
commit 8fc986080b

View file

@ -112,7 +112,7 @@ PortClsPnp(
DeviceExt->SystemPowerState = PowerSystemWorking; DeviceExt->SystemPowerState = PowerSystemWorking;
// notify power manager of current state // notify power manager of current state
PowerState = *((POWER_STATE*)&DeviceExt->DevicePowerState); PowerState.DeviceState = DeviceExt->DevicePowerState;
PoSetPowerState(DeviceObject, DevicePowerState, PowerState); PoSetPowerState(DeviceObject, DevicePowerState, PowerState);
Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Status = STATUS_SUCCESS;
@ -271,7 +271,7 @@ PortClsPower(
if (DeviceExtension->AdapterPowerManagement) if (DeviceExtension->AdapterPowerManagement)
{ {
// it is query if the change can be changed // it is query if the change can be changed
PowerState = *((POWER_STATE*)&IoStack->Parameters.Power.State.DeviceState); PowerState = IoStack->Parameters.Power.State;
Status = DeviceExtension->AdapterPowerManagement->QueryPowerChangeState(PowerState); Status = DeviceExtension->AdapterPowerManagement->QueryPowerChangeState(PowerState);
// sanity check // sanity check
@ -294,7 +294,7 @@ PortClsPower(
else else
{ {
// set power state // set power state
PowerState = *((POWER_STATE*)&IoStack->Parameters.Power.State.DeviceState); PowerState = IoStack->Parameters.Power.State;
PoSetPowerState(DeviceObject, DevicePowerState, PowerState); PoSetPowerState(DeviceObject, DevicePowerState, PowerState);
// check if there is a registered adapter power management // check if there is a registered adapter power management
@ -307,7 +307,7 @@ PortClsPower(
// FIXME call all registered IPowerNotify interfaces via ISubdevice interface // FIXME call all registered IPowerNotify interfaces via ISubdevice interface
// store new power state // store new power state
DeviceExtension->DevicePowerState = IoStack->Parameters.Power.State.DeviceState; DeviceExtension->DevicePowerState = IoStack->Parameters.Power.State.DeviceState;
// complete request // complete request
Irp->IoStatus.Status = Status; Irp->IoStatus.Status = Status;
@ -348,7 +348,7 @@ PortClsPower(
PwrContext->DeviceObject = DeviceObject; PwrContext->DeviceObject = DeviceObject;
// pass the irp down // pass the irp down
PowerState = *((POWER_STATE*)IoStack->Parameters.Power.State.SystemState); PowerState = IoStack->Parameters.Power.State;
Status = PoRequestPowerIrp(DeviceExtension->PhysicalDeviceObject, IoStack->MinorFunction, PowerState, PwrCompletionFunction, (PVOID)PwrContext, NULL); Status = PoRequestPowerIrp(DeviceExtension->PhysicalDeviceObject, IoStack->MinorFunction, PowerState, PwrCompletionFunction, (PVOID)PwrContext, NULL);
// check for success // check for success