ViAvlAcquireTableLockAtDpcLevelSafe

VOID __stdcall ViAvlAcquireTableLockAtDpcLevelSafe(_VF_AVL_TABLE *Table, _VF_AVL_LOCK_CONTEXT *Context){
  char v2; 
  INT64 *p_Lock; 

  v2 = *((_BYTE *)Context + 9);
  if( (v2 & 2) == 0 )
    goto LABEL_2;
  if( *(_VF_AVL_TABLE **)Context != Table )
  {
    ViAvlReleaseTableLockFromDpcLevel(*(_VF_AVL_TABLE **)Context, Context);
    v2 = *((_BYTE *)Context + 9);
  }
  if( (v2 & 2) == 0 )
  {
LABEL_2:
    p_Lock = (INT64 *)&Table->Lock;
    if( (v2 & 4) != 0 )
      ExAcquireSpinLockExclusiveAtDpcLevel(p_Lock);
    else
      ExAcquireSpinLockSharedAtDpcLevel((PEX_SPIN_LOCK)p_Lock);
    *((_BYTE *)Context + 9) |= 2u;
    *(_QWORD *)Context = Table;
  }
}

Referenced by:

VfAvlDeleteTreeNode
VfAvlEnumerateNodes
VfAvlInsertReservedTreeNode
VfAvlLookupTreeNode