PpProfileQueryHardwareProfileChange

INT64 __fastcall PpProfileQueryHardwareProfileChange(CHAR a1, INT64 a2, PNP_VETO_TYPE *a3, UNICODE_STRING *a4){
  int v7; 
  __int64 *v8; 
  char v9; 
  bool v10; 
  INT64 result; 
  v7 = a2;
  ExAcquireFastMutex(&PiProfileDeviceListLock);
  v8 = (__int64 *)PiProfileDeviceListHead;
  v9 = 0;
  while( v8 != &PiProfileDeviceListHead )
  {
    v10 = *((_DWORD *)v8 - 2) == 2;
    v8 = (__int64 *)*v8;
    if( v10 )
      v9 = 1;
  }
  KeReleaseGuardedMutex(&PiProfileDeviceListLock);
  if( a1 )
    return 0i64;
  if( v9 )
  {
    PiProfileChangeCancelRequired = 0;
    return 0i64;
  }
  result = PnpRequestHwProfileChangeNotification(&GUID_HWPROFILE_QUERY_CHANGE, v7, a3, a4);
  PiProfileChangeCancelRequired = (int)result >= 0;
  return result;
}

Referenced by:

PipProcessStartPhase1
PnpProcessQueryRemoveAndEject