FsRtlFastUnlockSingleShared

__int64 __fastcall FsRtlFastUnlockSingleShared(
        __int64 a1,
        __int64 a2,
        unsigned __int64 *a3,
        _RTL_SPLAY_LINKS **a4,
        _RTL_SPLAY_LINKS *a5,
        int a6,
        __int64 a7,
        char a8,
        char a9){
  unsigned __int64 v9; 
  UINT64 *v10; 
  _RTL_SPLAY_LINKS *v13; 
  unsigned int v14; 
  unsigned __int8 v15; 
  unsigned __int64 v16; 
  _RTL_SPLAY_LINKS *FirstOverlappingSharedNode; 
  RTL_SPLAY_LINKS *v18; 
  _RTL_SPLAY_LINKS *v19; 
  _RTL_SPLAY_LINKS *v20; 
  _RTL_SPLAY_LINKS *Parent; 
  _RTL_SPLAY_LINKS *v22; 
  bool v23; 
  _RTL_SPLAY_LINKS *v25; 
  UINT64 v26; 
  char v27; 
  _LARGE_INTEGER StartingByte[11]; 
  _RTL_SPLAY_LINKS *v29; 
  _RTL_SPLAY_LINKS *v30; 
  _LARGE_INTEGER EndingByte; 
  _RTL_SPLAY_LINKS **v32; 
  v32 = a4;
  v30 = (_RTL_SPLAY_LINKS *)a2;
  v9 = *a3;
  v10 = (UINT64 *)(a1 + 24);
  StartingByte[0].QuadPart = *a3;
  KeAcquireSpinLockRaiseToDpc((UINT64 *)(a1 + 24), a2);
  v13 = (_RTL_SPLAY_LINKS *)v10[1];
  v14 = 0;
  v16 = v15;
  if( !v13 )
    goto LABEL_33;
  EndingByte.QuadPart = (LONGLONG)*a4 + v9 - 1;
  FirstOverlappingSharedNode = FsRtlFindFirstOverlappingSharedNode(v13, StartingByte, &EndingByte, 0i64, 0i64);
  v18 = FirstOverlappingSharedNode;
  if( !FirstOverlappingSharedNode
    || (v19 = FirstOverlappingSharedNode - 1, v20 = 0i64, Parent = v19->Parent, v22 = v19, v29 = 0i64, !Parent) )
  {
LABEL_33:
    KxReleaseSpinLock(v10);
    v14 = -1073741698;
    goto LABEL_27;
  }
  while( 1 )
  {
    if( Parent[1].LeftChild == v30 && Parent[1].RightChild == a5 && HIDWORD(Parent[1].Parent) == a6 )
    {
      v23 = Parent->LeftChild <= (_RTL_SPLAY_LINKS *)v9;
      if( Parent->LeftChild != (_RTL_SPLAY_LINKS *)v9 )
        goto LABEL_29;
      if( Parent->RightChild == *v32 )
        break;
    }
    v23 = Parent->LeftChild <= (_RTL_SPLAY_LINKS *)v9;
LABEL_29:
    if( v23 )
    {
      v25 = Parent[2].Parent;
      v22 = Parent;
      Parent = Parent->Parent;
      if( v20 < v25 )
        v20 = v25;
      v29 = v20;
      if( Parent )
        continue;
    }
    goto LABEL_33;
  }
  if( v30[5].Parent == (_RTL_SPLAY_LINKS *)&Parent->LeftChild )
    v30[5].Parent = 0i64;
  if( v22->Parent == v19[2].Parent )
    v19[2].Parent = v22;
  v22->Parent = Parent->Parent;
  if( v22 == v19 )
  {
    if( !v19->Parent )
    {
      v10[1] = (UINT64)RtlDelete(v18);
      ExFreeToNPagedLookasideList((NPAGED_LOOKASIDE_LIST *)FsRtlLockTreeNodeLookasideList, v19);
      v19 = 0i64;
    }
    if( *(_RTL_SPLAY_LINKS **)a1 == Parent->LeftChild )
      FsRtlPrivateResetLowestLockOffset((__int64 *)a1);
  }
  if( v19 )
    FsRtlSplitLocks((__int64)v19, v22, (unsigned __int64 *)&Parent[2], &v29);
  if( !a8 && *(_QWORD *)(a1 + 16) )
  {
    KxReleaseSpinLock(v10);
    __writecr8(v16);
    (*(void(__fastcall **)(__int64, _RTL_SPLAY_LINKS **))(a1 + 16))(a7, &Parent->LeftChild);
    KeAcquireSpinLockRaiseToDpc(v10, v26);
    LOBYTE(v16) = v27;
  }
  ExFreeToNPagedLookasideList((NPAGED_LOOKASIDE_LIST *)FsRtlSharedLockLookasideList, Parent);
  if( a9 && v10[3] )
    FsRtlPrivateCheckWaitingLocks(a1, v10, v16);
  KxReleaseSpinLock(v10);
LABEL_27:
  __writecr8((unsigned __int8)v16);
  return v14;
}

Referenced by:

FsRtlFastUnlockSingle
FsRtlPrivateRemoveLock