PnpSetDeviceInstanceRemovalEvent

__int64 __fastcall PnpSetDeviceInstanceRemovalEvent(__int64 a1){
  int v2; 
  _DWORD *DeviceEventEntry; 
  __int64 v4; 
  UINT8 *v5; 
  if( PnpShutdownEvent.Header.SignalState )
    return 3221225865i64;
  v2 = *(unsigned __int16 *)(a1 + 40) + 82;
  DeviceEventEntry = PnpCreateDeviceEventEntry((unsigned int)*(unsigned __int16 *)(a1 + 40) + 194);
  v4 = (__int64)DeviceEventEntry;
  if( !DeviceEventEntry )
    return 3221225626i64;
  *((_QWORD *)DeviceEventEntry + 3) = 0i64;
  DeviceEventEntry[4] = 0;
  *((GUID *)DeviceEventEntry + 7) = GUID_DEVINST_REMOVE_COMPLETE;
  *((_QWORD *)DeviceEventEntry + 6) = 0i64;
  *((_QWORD *)DeviceEventEntry + 7) = 0i64;
  DeviceEventEntry[32] = 10;
  *((_QWORD *)DeviceEventEntry + 17) = 0i64;
  DeviceEventEntry[36] = 0;
  DeviceEventEntry[37] = v2;
  *((_QWORD *)DeviceEventEntry + 19) = 0i64;
  v5 = *(UINT8 **)(a1 + 48);
  if( v5 )
    memmove((UINT8 *)DeviceEventEntry + 160, v5, *(unsigned __int16 *)(a1 + 40));
  *(_WORD *)(v4 + 2 * ((unsigned __int64)*(unsigned __int16 *)(a1 + 40) >> 1) + 160) = 0;
  return PnpInsertEventInQueue(v4);
}

Referenced by:

PnpUnlinkDeviceRemovalRelations