PnpSetDeviceInstanceRemovalEvent

__int64 __fastcall PnpSetDeviceInstanceRemovalEvent(__int64 a1){
  int v2; 
  VOID **DeviceEventEntry; 
  __int64 v4; 
  const VOID *v5; 

  if( *(&PnpReplaceEvent + 1665) )
    return 3221225865i64;
  v2 = *(unsigned __int16 *)(a1 + 40) + 82;
  DeviceEventEntry = PnpCreateDeviceEventEntry((unsigned int)*(unsigned __int16 *)(a1 + 40) + 194);
  v4 = (__int64)DeviceEventEntry;
  if( !DeviceEventEntry )
    return 3221225626i64;
  DeviceEventEntry[3] = 0i64;
  *((_DWORD *)DeviceEventEntry + 4) = 0;
  *((GUID *)DeviceEventEntry + 7) = GUID_DEVINST_REMOVE_COMPLETE;
  DeviceEventEntry[6] = 0i64;
  DeviceEventEntry[7] = 0i64;
  *((_DWORD *)DeviceEventEntry + 32) = 10;
  DeviceEventEntry[17] = 0i64;
  *((_DWORD *)DeviceEventEntry + 36) = 0;
  *((_DWORD *)DeviceEventEntry + 37) = v2;
  DeviceEventEntry[19] = 0i64;
  v5 = *(const VOID **)(a1 + 48);
  if( v5 )
    memmove(DeviceEventEntry + 20, v5, *(unsigned __int16 *)(a1 + 40));
  *(_WORD *)(v4 + 2 * ((unsigned __int64)*(unsigned __int16 *)(a1 + 40) >> 1) + 160) = 0;
  return PnpInsertEventInQueue(v4);
}

Referenced by:

PnpUnlinkDeviceRemovalRelations