PiRegisterKernelSoftRestartNotification

INT64 __fastcall PiRegisterKernelSoftRestartNotification(INT64 a1, VOID *a2, INT64 a3, CHAR **a4){
  int v8; 
  _QWORD *PoolWithTag; 
  _QWORD *v10; 
  _QWORD *v11; 
  if( PnpKsrEnabled )
  {
    if( PnpKsrPrepared )
    {
      return(unsigned int)-1073741058;
    }
    else
    {
      PoolWithTag = ExAllocatePoolWithTag(PagedPool, 0x58ui64, 0x61706E50ui64);
      v10 = PoolWithTag;
      if( PoolWithTag )
      {
        memset((INT64)PoolWithTag, 0i64);
        v8 = PnpInitializeNotifyEntry((__int64)v10, 4, (unsigned __int64)a2, a3, a1, (__int64)&PnpKsrNotifyLock);
        if( v8 < 0 || (v8 = PnpDeferNotification((__int64)v10), v8 < 0) )
        {
          ExFreePoolWithTag(v10, 0x61706E50u);
        }
        else
        {
          ExAcquireFastMutex(&PnpKsrNotifyLock);
          v11 = (_QWORD *)qword_140C42EB8;
          if( *(PVOID **)qword_140C42EB8 != &PnpKsrNotifyList )
            __fastfail(3u);
          *v10 = &PnpKsrNotifyList;
          v10[1] = v11;
          *v11 = v10;
          qword_140C42EB8 = (__int64)v10;
          KeReleaseGuardedMutex(&PnpKsrNotifyLock);
          *a4 = (CHAR *)v10;
        }
      }
      else
      {
        return(unsigned int)-1073741670;
      }
    }
  }
  else
  {
    return(unsigned int)-1073741637;
  }
  return(unsigned int)v8;
}

Referenced by:

IoRegisterPlugPlayNotification