RtlRunOnceExecuteOnce

NTSTATUS __fastcall RtlRunOnceExecuteOnce(
        _RTL_RUN_ONCE *RunOnce,
        UINT64 a2,
        INT64 *InitFn,
        _RTL_RUN_ONCE *a4,
        VOID *a5,
        VOID **a6,
        VOID *Parameter,
        VOID **Context){
  _ETHREAD *CurrentThread; 
  NTSTATUS v13; 
  int v14; 
  VOID *Value; 
  NTSTATUS v17; 

  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --CurrentThread->Tcb.KernelApcDisable;
  v13 = RtlRunOnceBeginInitialize(RunOnce, 0i64, &a4->Ptr);
  v14 = v13;
  if( v13 < 0 )
    goto LABEL_12;
  if( v13 == 259 )
  {
    if( ((unsigned int(__fastcall *)(_RTL_RUN_ONCE *, INT64 *, _RTL_RUN_ONCE *))a2)(RunOnce, InitFn, a4) )
    {
      if( a4 )
        Value = (VOID *)a4->Value;
      else
        Value = 0i64;
      v14 = RtlRunOnceComplete(RunOnce, 0i64, Value);
      if( v14 >= 0 )
      {
        v14 = 0;
        goto LABEL_3;
      }
    }
    else
    {
      v14 = -1073741823;
      v17 = RtlRunOnceComplete(RunOnce, 4ui64, 0i64);
      if( v17 >= 0 )
        goto LABEL_3;
      v14 = v17;
    }
LABEL_12:
    KeLeaveCriticalRegionThread(KeGetCurrentThread());
    RtlRaiseStatus(v14);
  }
LABEL_3:
  KeLeaveCriticalRegionThread(KeGetCurrentThread());
  return v14;
}

Referenced by:

ExpFirmwareAccessAppContainerCheck
RtlpLogCapabilityCheckLatency
SdbGetIndex
SdbpGetStringTableItemFromStringRef