PnpSetPowerVetoEvent

INT64 __stdcall PnpSetPowerVetoEvent(
        POWER_ACTION VetoedPowerOperation,
        DEVICE_OBJECT *DeviceObject,
        PNP_VETO_TYPE VetoType,
        UNICODE_STRING *VetoName){
  __int64 v7; 
  int v8; 
  int v9; 
  _DWORD *DeviceEventEntry; 
  unsigned __int64 v11; 
  UINT8 *v12; 
  GUID v13; 
  int v14; 
  UINT8 **v15; 
  if( PnpShutdownEvent.Header.SignalState )
    return 3221225865i64;
  v7 = *((_QWORD *)VetoName[19].Buffer + 5);
  if( !v7 )
    return 3221225712i64;
  if( v15 )
    v8 = *(unsigned __int16 *)v15;
  else
    v8 = 0;
  v9 = v8 + *(unsigned __int16 *)(v7 + 40) + 84;
  DeviceEventEntry = PnpCreateDeviceEventEntry((unsigned int)(v9 + 112));
  if( !DeviceEventEntry )
    return 3221225626i64;
  ObfReferenceObjectWithTag(VetoName, 0x56706E50u);
  DeviceEventEntry[40] = v14;
  *((_QWORD *)DeviceEventEntry + 3) = 0i64;
  DeviceEventEntry[37] = v9;
  *((_QWORD *)DeviceEventEntry + 19) = VetoName;
  *((_QWORD *)DeviceEventEntry + 17) = 0i64;
  memmove((UINT8 *)DeviceEventEntry + 164, *(UINT8 **)(v7 + 48), *(unsigned __int16 *)(v7 + 40));
  v11 = (unsigned __int64)*(unsigned __int16 *)(v7 + 40) >> 1;
  *((_WORD *)DeviceEventEntry + v11 + 82) = 0;
  if( v15 )
  {
    v12 = (UINT8 *)DeviceEventEntry + 2 * v11;
    memmove(v12 + 166, v15[1], *(unsigned __int16 *)v15);
    *(_WORD *)&v12[2 * ((unsigned __int64)*(unsigned __int16 *)v15 >> 1) + 166] = 0;
  }
  if( VetoedPowerOperation == PowerActionWarmEject )
  {
    v13 = GUID_DEVICE_WARM_EJECT_VETOED;
  }
  else if( VetoedPowerOperation == PowerActionHibernate )
  {
    v13 = GUID_DEVICE_HIBERNATE_VETOED;
  }
  else
  {
    v13 = GUID_DEVICE_STANDBY_VETOED;
  }
  DeviceEventEntry[32] = 6;
  *((GUID *)DeviceEventEntry + 7) = v13;
  return PnpInsertEventInQueue((__int64)DeviceEventEntry);
}

Referenced by:

IoNotifyPowerOperationVetoed
IopWarmEjectDevice