PnpSetCustomTargetEvent

__int64 __fastcall PnpSetCustomTargetEvent(PVOID Object, __int64 a2, _DWORD *a3, __int64 a4, __int64 a5, VOID *Src){
  __int64 v9; 
  unsigned int v10; 
  VOID **DeviceEventEntry; 
  const VOID *v12; 
  char *v13; 

  if( a2 )
    *a3 = 259;
  if( *(&PnpReplaceEvent + 1665) )
    return 3221225865i64;
  if( Object )
    v9 = *(_QWORD *)(*((_QWORD *)Object + 39) + 40i64);
  else
    v9 = 0i64;
  v10 = *((unsigned __int16 *)Src + 1) + ((*(unsigned __int16 *)(v9 + 40) + 89) & 0xFFFFFFF8);
  DeviceEventEntry = PnpCreateDeviceEventEntry(v10 + 112);
  if( !DeviceEventEntry )
    return 3221225626i64;
  ObfReferenceObjectWithTag(Object, 0x56706E50ui64);
  DeviceEventEntry[4] = (VOID *)a4;
  DeviceEventEntry[5] = (VOID *)a5;
  DeviceEventEntry[3] = (VOID *)a2;
  *((_DWORD *)DeviceEventEntry + 36) = 0;
  *((_DWORD *)DeviceEventEntry + 32) = 3;
  *((GUID *)DeviceEventEntry + 7) = GUID_PNP_CUSTOM_NOTIFICATION;
  DeviceEventEntry[17] = a3;
  *((_DWORD *)DeviceEventEntry + 37) = v10;
  DeviceEventEntry[19] = Object;
  v12 = *(const VOID **)(v9 + 48);
  if( v12 )
    memmove(DeviceEventEntry + 21, v12, *(unsigned __int16 *)(v9 + 40));
  v13 = (char *)DeviceEventEntry + v10 + 112 - (unsigned __int64)*((unsigned __int16 *)Src + 1);
  DeviceEventEntry[20] = v13;
  memmove(v13, Src, *((unsigned __int16 *)Src + 1));
  return PnpInsertEventInQueue((__int64)DeviceEventEntry);
}

Referenced by:

IoReportTargetDeviceChange
IoReportTargetDeviceChangeAsynchronous
PnpReportTargetDeviceChangeAsyncWorker