FsRtlFastUnlockSingleExclusive
NTSTATUS __stdcall FsRtlFastUnlockSingleExclusive(
_LOCK_INFO *LockInfo,
_RTL_SPLAY_LINKS *FileObject,
_LARGE_INTEGER *FileOffset,
_RTL_SPLAY_LINKS **Length,
_RTL_SPLAY_LINKS *ProcessId,
UINT64 Key,
VOID *Context,
UINT8 IgnoreUnlockRoutine,
UINT8 CheckForWaiters){
unsigned __int64 QuadPart;
UINT64 *v10;
unsigned __int8 v14;
_RTL_SPLAY_LINKS *v15;
NTSTATUS v16;
unsigned __int64 v17;
_RTL_SPLAY_LINKS *FirstOverlappingExclusiveNode;
int v20;
bool v21;
_LARGE_INTEGER EndingByte;
_LARGE_INTEGER StartingByte;
_RTL_SPLAY_LINKS **v24;
v24 = Length;
QuadPart = FileOffset->QuadPart;
v10 = (UINT64 *)(LockInfo + 6);
StartingByte = *FileOffset;
v14 = KeAcquireSpinLockRaiseToDpc((UINT64 *)LockInfo + 3);
v15 = (_RTL_SPLAY_LINKS *)v10[2];
v16 = 0;
v17 = v14;
if( !v15
|| (EndingByte.QuadPart = (LONGLONG)*Length + QuadPart - 1,
(FirstOverlappingExclusiveNode = FsRtlFindFirstOverlappingExclusiveNode(
v15,
&StartingByte,
&EndingByte,
0i64,
0i64)) == 0i64) )
{
LABEL_2:
KxReleaseSpinLock(v10);
v16 = -1073741698;
goto LABEL_3;
}
v20 = Key;
while( 1 )
{
if( FirstOverlappingExclusiveNode[2].Parent == FileObject
&& FirstOverlappingExclusiveNode[2].LeftChild == ProcessId
&& HIDWORD(FirstOverlappingExclusiveNode[1].RightChild) == v20 )
{
v21 = FirstOverlappingExclusiveNode[1].Parent <= (_RTL_SPLAY_LINKS *)QuadPart;
if( FirstOverlappingExclusiveNode[1].Parent != (_RTL_SPLAY_LINKS *)QuadPart )
goto LABEL_23;
if( FirstOverlappingExclusiveNode[1].LeftChild == *v24 )
break;
}
v21 = FirstOverlappingExclusiveNode[1].Parent <= (_RTL_SPLAY_LINKS *)QuadPart;
LABEL_23:
if( v21 )
{
FirstOverlappingExclusiveNode = RtlRealSuccessor(FirstOverlappingExclusiveNode);
if( FirstOverlappingExclusiveNode )
continue;
}
goto LABEL_2;
}
if( FileObject[5].Parent == &FirstOverlappingExclusiveNode[1] )
FileObject[5].Parent = 0i64;
v10[2] = (UINT64)RtlDelete(FirstOverlappingExclusiveNode);
if( *(_RTL_SPLAY_LINKS **)LockInfo == FirstOverlappingExclusiveNode[1].Parent )
FsRtlPrivateResetLowestLockOffset(LockInfo);
if( !IgnoreUnlockRoutine && *((_QWORD *)LockInfo + 2) )
{
KxReleaseSpinLock(v10);
__writecr8(v17);
(*((void(__fastcall **)(VOID *, _RTL_SPLAY_LINKS *))LockInfo + 2))(Context, FirstOverlappingExclusiveNode + 1);
LOBYTE(v17) = KeAcquireSpinLockRaiseToDpc(v10);
}
ExFreeToNPagedLookasideList(
(_NPAGED_LOOKASIDE_LIST *)((char *)&WheapErrorSourceTable + 2728),
FirstOverlappingExclusiveNode);
if( CheckForWaiters && v10[3] )
FsRtlPrivateCheckWaitingLocks(LockInfo, (_LOCK_QUEUE *)v10, v17);
KxReleaseSpinLock(v10);
LABEL_3:
__writecr8((unsigned __int8)v17);
return v16;
}Referenced by:
FsRtlFastUnlockSingle
FsRtlPrivateRemoveLock