PnpDeferNotification

__int64 __fastcall PnpDeferNotification(__int64 a1){
  char v2; 
  unsigned int v3; 
  VOID **PoolWithTag; 
  VOID **v5; 
  VOID ***v6; 

  v2 = 0;
  v3 = 0;
  ExAcquireFastMutex((PFAST_MUTEX)((char *)&PnpReplaceEvent + 64));
  if( BYTE2(NlsMbCodePageTag) || *(_DWORD *)(a1 + 16) == 3 )
  {
    PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x18ui64, 930115152i64);
    v5 = PoolWithTag;
    if( PoolWithTag )
    {
      PoolWithTag[2] = (VOID *)a1;
      ++*(_WORD *)(a1 + 56);
      *(_BYTE *)(a1 + 58) = 1;
      ExAcquireFastMutex((PFAST_MUTEX)((char *)&stru_140C452E0 + 128));
      v6 = (VOID ***)qword_140D2DB28;
      if( *(PVOID **)qword_140D2DB28 != &PnpDeferredRegistrationList )
        __fastfail(3u);
      *v5 = &PnpDeferredRegistrationList;
      v5[1] = v6;
      *v6 = v5;
      qword_140D2DB28 = (__int64)v5;
      KeReleaseGuardedMutex((PKGUARDED_MUTEX)((char *)&stru_140C452E0 + 128));
      if( !BYTE2(NlsMbCodePageTag) )
        v2 = 1;
    }
    else
    {
      v3 = -1073741670;
    }
  }
  KeReleaseGuardedMutex((PKGUARDED_MUTEX)((char *)&PnpReplaceEvent + 64));
  if( v2 )
  {
    PnpInsertNoopEvent(0i64, 0i64);
    return 0;
  }
  return v3;
}

Referenced by:

IoRegisterPlugPlayNotification
PiRegisterKernelSoftRestartNotification