VfRemoveContext

INT64 __fastcall VfRemoveContext(UINT16 *a1){
  int v2; 
  unsigned int v4; 
  CHAR *ContextPointer; 
  volatile INT64 *v6; 
  volatile signed __int32 *v7; 
  __int64 v8; 
  unsigned int v9; 
  v2 = -1073741275;
  if( !ViVerifierEnabled )
    return 3221225473i64;
  if( !ViIsContextIdValid((VF_OBJECT_TYPE)*a1, a1[1]) )
    return 3221225485i64;
  ContextPointer = ViGetContextPointer(*((_QWORD *)a1 + 1), v4);
  v6 = (volatile INT64 *)ContextPointer;
  if( !ContextPointer )
    return 3221225659i64;
  if( !ViLockContextPointer((INT64 *)ContextPointer) )
    return(unsigned int)v2;
  v7 = (volatile signed __int32 *)*v6;
  v8 = a1[1];
  if( *(UINT16 **)(*v6 + 8 * v8 + 8) != a1
    || (*(_QWORD *)&v7[2 * v8 + 2] = 0i64, v2 = 0, _InterlockedExchangeAdd(v7 + 1, 0xFFFFFFFF) != 1) )
  {
    ViUnlockContextPointer(v6);
    if( v2 >= 0 && !(v9 + _InterlockedExchangeAdd((volatile signed __int32 *)a1 + 1, v9)) )
      (*((void(__fastcall **)(UINT16 *))a1 + 2))(a1);
    return(unsigned int)v2;
  }
  _InterlockedExchange64(v6, 0i64);
  if( _InterlockedExchangeAdd((volatile signed __int32 *)a1 + 1, 0xFFFFFFFF) == 1 )
    (*((void(__fastcall **)(UINT16 *, __int64))a1 + 2))(a1, 0xFFFFFFFFi64);
  ViFreeContextTable((PVOID)v7);
  return 0i64;
}

Referenced by:

No references.