PpProfileIncludeInHardwareProfileTransition

void __fastcall PpProfileIncludeInHardwareProfileTransition(__int64 a1, int a2){
  __int64 *v4; 
  __int64 v5; 
  PVOID P; 
  P = 0i64;
  if( a2 == 2 )
  {
    v4 = (__int64 *)(a1 + 576);
    if( (__int64 *)*v4 == v4 )
    {
      ExAcquireFastMutex(&PiProfileDeviceListLock);
      v5 = PiProfileDeviceListHead;
      if( *(__int64 **)(PiProfileDeviceListHead + 8) != &PiProfileDeviceListHead )
        __fastfail(3u);
      v4[1] = (__int64)&PiProfileDeviceListHead;
      *v4 = v5;
      *(_QWORD *)(v5 + 8) = v4;
      ++PiProfileDeviceCount;
      PiProfileDeviceListHead = (__int64)v4;
      KeReleaseGuardedMutex(&PiProfileDeviceListLock);
    }
    if( (int)PnpIrpQueryID(*(DEVICE_OBJECT **)(a1 + 32), BusQueryDeviceSerialNumber, (WCHAR **)&P) >= 0 && P )
      ExFreePoolWithTag(P, 0);
  }
  _InterlockedIncrement(&PiProfileDevicesInTransition);
  *(_DWORD *)(a1 + 568) = a2;
}

Referenced by:

PipProcessStartPhase1
PnpProcessQueryRemoveAndEject