PiRegisterKernelSoftRestartNotification

NTSTATUS __stdcall PiRegisterKernelSoftRestartNotification(INT64 a1, VOID *a2, INT64 a3, CHAR **a4){
  NTSTATUS v8; 
  VOID **PoolWithTag; 
  VOID **v10; 
  VOID ***v11; 

  if( !PnpKsrEnabled )
    return -1073741637;
  if( PnpKsrPrepared )
    return -1073741058;
  PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x58ui64, 1634758224i64);
  v10 = PoolWithTag;
  if( !PoolWithTag )
    return -1073741670;
  memset(PoolWithTag, 0i64, 0x58u);
  v8 = PnpInitializeNotifyEntry((__int64)v10, 4, a2, a3, a1, (__int64)&PnpKsrNotifyLock);
  if( v8 < 0 || (v8 = PnpDeferNotification((__int64)v10), v8 < 0) )
  {
    ExFreePoolWithTag(v10, 0x61706E50u);
  }
  else
  {
    ExAcquireFastMutex(&PnpKsrNotifyLock);
    v11 = (VOID ***)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;
  }
  return v8;
}

Referenced by:

IoRegisterPlugPlayNotification