VfInsertContext
NTSTATUS __stdcall VfInsertContext(_VF_CONTEXT_HEADER *Context){
NTSTATUS v1;
_VF_OBJECT_TYPE v4;
_VF_CONTEXT_POINTER *ContextPointer;
_VF_CONTEXT_TABLE *ContextTable;
volatile signed __int64 v7;
__int64 v8;
v1 = 0;
if( !ViVerifierEnabled )
return -1073741823;
if( !ViIsContextIdValid((_VF_OBJECT_TYPE)*(unsigned __int16 *)Context, *((unsigned __int16 *)Context + 1)) )
return -1073741811;
ContextPointer = ViGetContextPointer(*((VOID **)Context + 1), v4);
if( !ContextPointer )
return -1073741637;
while( !ViLockContextPointer(ContextPointer) )
{
ContextTable = ViAllocateContextTable((_VF_OBJECT_TYPE)*(unsigned __int16 *)Context);
if( !ContextTable )
return -1073741670;
if( !_InterlockedCompareExchange64((volatile signed __int64 *)ContextPointer, (signed __int64)ContextTable, 0i64) )
break;
ViFreeContextTable(ContextTable);
}
v7 = *(_QWORD *)ContextPointer;
v8 = *((unsigned __int16 *)Context + 1);
if( *(_QWORD *)(*(_QWORD *)ContextPointer + 8 * v8 + 8) )
{
v1 = -1073741270;
}
else
{
*(_QWORD *)(v7 + 8 * v8 + 8) = Context;
_InterlockedIncrement((volatile signed __int32 *)(v7 + 4));
_InterlockedIncrement(Context + 1);
}
ViUnlockContextPointer(ContextPointer);
return v1;
}Referenced by:
No references.