PopNotifyDevice

VOID __fastcall PopNotifyDevice(_POP_DEVICE_SYS_STATE *DevState, _PO_DEVICE_NOTIFY *NotifyDevice){
  bool v4; 
  __int64 v5; 
  _DEVICE_OBJECT **v6; 
  POWER_ACTION v7; 
  int v8; 
  int SystemState; 
  __int64 v10; 
  PIRP v11; 
  __int64 v12; 
  __int64 v13; 
  DEVICE_OBJECT *DeviceAttachmentBaseRefWithTag; 
  __int64 v15; 
  PIRP Irp; 
  Irp = 0i64;
  v15 = 0i64;
  v4 = DevState->Waking || *DevState->Order.WarmEjectPdoPointer != NotifyDevice->DeviceObject;
  v7 = PopMapInternalActionToIrpAction(SDWORD2(PopCurrentBroadcast), DevState->SystemState, v4);
  SystemState = v8;
  if( v7 == PowerActionWarmEject && *v6 == NotifyDevice->DeviceObject && DevState->IrpMinor == 2 )
  {
    *v6 = 0i64;
    SystemState = DevState->SystemState;
  }
  PopAllocateIrp(
    NotifyDevice->TargetDevice,
    v5,
    DevState->IrpMinor,
    0,
    SystemState,
    1,
    0,
    0i64,
    0i64,
    (__int64)&Irp,
    (__int64)&v15);
  v10 = v15;
  v11 = Irp;
  *(_QWORD *)(v15 + 216) = NotifyDevice;
  *(_BYTE *)(v10 + 224) = 0;
  v12 = *((_QWORD *)v11 + 23);
  *(_DWORD *)(v12 - 56) = 0;
  *(_DWORD *)(v12 - 48) = SystemState;
  *(_DWORD *)(v12 - 40) = v7;
  *(_DWORD *)(v12 - 64) = DWORD1(PopCurrentBroadcast);
  v13 = *((_QWORD *)v11 + 23);
  *(_QWORD *)(v13 - 16) = PopSystemIrpCompletion;
  *(_QWORD *)(v13 - 8) = v10;
  *(_BYTE *)(v13 - 69) = -32;
  if( (*(_WORD *)(&PerfGlobalGroupMask + 2) & 0x8000) != 0 )
    PopLogNotifyDevice((__int64)NotifyDevice->TargetDevice, (__int64)NotifyDevice, (__int64)v11);
  if( SystemState > 1 && (unsigned __int8)(DevState->IrpMinor - 2) <= 1u )
  {
    DeviceAttachmentBaseRefWithTag = IoGetDeviceAttachmentBaseRefWithTag(NotifyDevice->TargetDevice, 0x72496F50ui64);
    PoFxActivateDeviceForSystemTransition(DeviceAttachmentBaseRefWithTag);
    *(_BYTE *)(v10 + 224) = 1;
  }
  PopQueueQuerySetIrp(v11);
}

Referenced by:

PopSleepDeviceList
PopWakeDeviceList