ViQueryObjectContext

signed __int64 *__fastcall ViQueryObjectContext(__int64 a1, INT64 a2, unsigned int a3){
  __int64 v3; 
  __int64 v4; 
  signed __int64 *result; 
  signed __int64 *v6; 
  __int64 v7; 
  v3 = a3;
  v4 = 0i64;
  result = (signed __int64 *)ViGetContextPointer(a1, a2);
  v6 = result;
  if( result )
  {
    if( ViLockContextPointer(result) )
    {
      v7 = *(_QWORD *)(*v6 + 8 * v3 + 8);
      if( v7 )
      {
        v4 = *(_QWORD *)(*v6 + 8 * v3 + 8);
        _InterlockedAdd((volatile signed __int32 *)(v7 + 4), 1u);
      }
      _InterlockedExchangeAdd64(v6, 1ui64);
    }
    return(signed __int64 *)v4;
  }
  return result;
}

Referenced by:

VfQueryDeviceContext
VfQueryDriverContext
VfQueryIrpContext
VfQueryThreadContext