POWER_STATE __stdcall PoSetPowerState(PDEVICE_OBJECT DeviceObject, POWER_STATE_TYPE Type, POWER_STATE State)
{
void *v3; // ecx
unsigned int v6; // edx
char *v7; // ecx
unsigned int v8; // eax
_DEVOBJ_EXTENSION *devObjExt; // esi
_POWER_STATE *v10; // edi
KIRQL v11; // al
unsigned int v12; // ecx
int v13; // edx
devObjExt = DeviceObject->DeviceObjectExtension;
v10 = 0;
v11 = KfAcquireSpinLock(&PopIrpSerialLock);
if ( Type == DevicePowerState )
{
v10 = (_POWER_STATE *)(((unsigned int)devObjExt->PowerFlags >> 4) & 0xF);
if ( v10 != State.SystemState )
{
v12 = devObjExt->PowerFlags & 0xFFFFFF0F;
devObjExt->PowerFlags = v12;
v13 = 16 * (State.DeviceState & 0xF);
}
}
else //Type == SystemPowerState
{
v10 = (_POWER_STATE *)(devObjExt->PowerFlags & 0xF);
if ( v10 != State.SystemState )
{
v12 = devObjExt->PowerFlags & 0xFFFFFFF0;
devObjExt->PowerFlags = v12;
v13 = (_DWORD)State.SystemState & 0xF;
}
}
devObjExt->PowerFlags = v12 | v13;
LABEL_21:
KfReleaseSpinLock(&PopIrpSerialLock, v11);
return (POWER_STATE)v10;
}