PopNotifyDevice

VOID __stdcall PopNotifyDevice(_POP_DEVICE_SYS_STATE *DevState, _PO_DEVICE_NOTIFY *NotifyDevice){
  bool v4; 
  _IRP *v5; 
  INT64 v6; 
  _DEVICE_OBJECT **v7; 
  POWER_ACTION v8; 
  _SYSTEM_POWER_STATE v9; 
  _SYSTEM_POWER_STATE PowerState; 
  __int64 v11; 
  _IRP *v12; 
  _IO_STACK_LOCATION *CurrentStackLocation; 
  _IO_STACK_LOCATION *v14; 
  _DEVICE_OBJECT *DeviceAttachmentBaseRefWithTag; 
  INT64 MustSucceed; 
  INT64 AllocatePendingIrp; 
  VOID *v18; 
  _IO_STATUS_BLOCK *v19; 
  VOID *v20; 
  _IRP **v21; 
  POP_IRP_DATA **v22; 
  __int64 v23; 
  _IRP *v24; 

  v24 = 0i64;
  v23 = 0i64;
  v4 = DevState->Waking || *DevState->Order.WarmEjectPdoPointer != NotifyDevice->DeviceObject;
  v8 = PopMapInternalActionToIrpAction(SDWORD2(PopCurrentBroadcast), DevState->SystemState, v4);
  PowerState = v9;
  if( v8 == PowerActionWarmEject && *v7 == NotifyDevice->DeviceObject && DevState->IrpMinor == 2 )
  {
    *v7 = 0i64;
    PowerState = DevState->SystemState;
  }
  LOBYTE(v6) = DevState->IrpMinor;
  LOBYTE(AllocatePendingIrp) = 0;
  LOBYTE(MustSucceed) = 1;
  PopAllocateIrp(
    NotifyDevice->TargetDevice,
    v5,
    v6,
    SystemPowerState,
    (POWER_STATE)PowerState,
    MustSucceed,
    AllocatePendingIrp,
    0i64,
    0i64,
    (UINT8)&v24,
    (POWER_STATE)&v23,
    v18,
    v19,
    v20,
    v21,
    v22);
  v11 = v23;
  v12 = v24;
  *(_QWORD *)(v23 + 216) = NotifyDevice;
  *(_BYTE *)(v11 + 224) = 0;
  CurrentStackLocation = v12->Tail.CurrentStackLocation;
  CurrentStackLocation[-1].Parameters.Options = 0;
  *(_DWORD *)&CurrentStackLocation[-1].Parameters.FileAttributes = PowerState;
  CurrentStackLocation[-1].Parameters.EaLength = v8;
  LODWORD(CurrentStackLocation[-1].Parameters.SecurityContext) = DWORD1(PopCurrentBroadcast);
  v14 = v12->Tail.CurrentStackLocation;
  v14[-1].CompletionRoutine = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *, void *))PopSystemIrpCompletion;
  v14[-1].Context = (void *)v11;
  v14[-1].Control = -32;
  if( (xmmword_140CFB490 & 0x8000) != 0 )
    PopLogNotifyDevice(NotifyDevice->TargetDevice, NotifyDevice, v12);
  if( PowerState > PowerSystemWorking && (unsigned __int8)(DevState->IrpMinor - 2) <= 1u )
  {
    DeviceAttachmentBaseRefWithTag = IoGetDeviceAttachmentBaseRefWithTag(NotifyDevice->TargetDevice, 0x72496F50ui64);
    PoFxActivateDeviceForSystemTransition(DeviceAttachmentBaseRefWithTag);
    *(_BYTE *)(v11 + 224) = 1;
  }
  PopQueueQuerySetIrp(v12);
}

Referenced by:

PopSleepDeviceList
PopWakeDeviceList