RtlRunOnceBeginInitialize
NTSTATUS __stdcall RtlRunOnceBeginInitialize(RTL_RUN_ONCE *RunOnce, UINT64 Flags, PVOID *Context){
unsigned __int64 Value;
NTSTATUS v6;
int v8;
unsigned __int64 v9;
unsigned __int64 v10;
if( (((_DWORD)Flags - 1) & (unsigned int)Flags) != 0 || (Flags & 0xFFFFFFFC) != 0 )
return -1073741584;
Value = RunOnce->Value;
v6 = 0;
if( (RunOnce->Value & 3) == 2 )
goto LABEL_3;
if( (Flags & 1) == 0 )
{
v8 = Flags & 2;
while( 1 )
{
while( 1 )
{
v9 = Value & 3;
if( (Value & 3) != 0 )
break;
v10 = Value;
Value = _InterlockedCompareExchange64((volatile signed __int64 *)RunOnce, v8 != 0 ? 3i64 : 1i64, Value);
if( v10 == Value )
return 259;
}
if( v9 != 1 )
break;
if( v8 )
return -1073741584;
Value = RtlpRunOnceWaitForInit(Value, RunOnce);
}
if( v9 == 3 )
return v8 != 0 ? 259 : -1073741584;
LABEL_3:
if( Context )
*Context = (PVOID)(Value & 0xFFFFFFFFFFFFFFFCui64);
return v6;
}
return -1073741823;
}Referenced by:
RtlRunOnceExecuteOnce