FsRtlPrivateFastUnlockAll
VOID __fastcall FsRtlPrivateFastUnlockAll(
_FILE_LOCK *FileLock,
_FILE_OBJECT *FileObject,
_EPROCESS *ProcessId,
UINT64 Key,
UINT8 MatchKey,
VOID *Context){
char *LockInformation;
unsigned __int64 v7;
UINT64 *v8;
UINT8 v9;
_RTL_SPLAY_LINKS *v10;
UINT8 v11;
_RTL_SPLAY_LINKS *i;
_RTL_SPLAY_LINKS *v13;
_RTL_SPLAY_LINKS *v14;
_RTL_SPLAY_LINKS *Parent;
_RTL_SPLAY_LINKS *v16;
_RTL_SPLAY_LINKS *v17;
_RTL_SPLAY_LINKS *v18;
_FILE_OBJECT *v19;
_RTL_SPLAY_LINKS *v20;
__int64 v21;
_RTL_SPLAY_LINKS *v22;
VOID *v23;
VOID **v24;
_RTL_SPLAY_LINKS *j;
_RTL_SPLAY_LINKS *v26;
bool v27;
_RTL_SPLAY_LINKS *v28;
VOID *v29;
__int64 v30;
UINT8 v31;
_RTL_SPLAY_LINKS *k;
__int64 v33;
__int64 v34;
INT64 v35;
INT64 v36;
UINT8 v37;
int v38;
_LOCK_INFO *LockInfo;
_RTL_SPLAY_LINKS *v40;
__int64 v41;
_RTL_SPLAY_LINKS *v42;
unsigned __int64 v43;
VOID *Entry;
char v45;
int v48;
v48 = Key;
LockInformation = (char *)FileLock->LockInformation;
v7 = 0i64;
v38 = 0;
v40 = 0i64;
Entry = 0i64;
LockInfo = (_LOCK_INFO *)LockInformation;
if( !LockInformation )
return;
v8 = (UINT64 *)(LockInformation + 24);
FileObject->LastLock = 0i64;
v9 = KeAcquireSpinLockRaiseToDpc((UINT64 *)LockInformation + 3);
v10 = (_RTL_SPLAY_LINKS *)*((_QWORD *)LockInformation + 4);
v11 = v9;
if( *((_OWORD *)LockInformation + 2) == 0i64 )
{
KxReleaseSpinLock((UINT64 *)LockInformation + 3);
goto LABEL_25;
}
if( !v10 )
goto LABEL_22;
for( i = v10->LeftChild; i; i = i->LeftChild )
v10 = i;
v45 = 0;
do
{
v13 = RtlRealSuccessor(v10);
v14 = v10 - 1;
v41 = (__int64)v13;
Parent = v10[-1].Parent;
v16 = 0i64;
v43 = 0i64;
v17 = 0i64;
v40 = 0i64;
v18 = v10 - 1;
v42 = v10 - 1;
if( !Parent )
{
v7 = 0i64;
goto LABEL_18;
}
v19 = FileObject;
while( 1 )
{
v20 = v17;
Entry = Parent;
if( (_FILE_OBJECT *)Parent[1].LeftChild == v19
&& (_EPROCESS *)Parent[1].RightChild == ProcessId
&& (!MatchKey || HIDWORD(Parent[1].Parent) == v48) )
{
break;
}
v18 = Parent;
v42 = Parent;
LABEL_12:
if( !v17 )
{
if( Parent[2].Parent > v16 )
v16 = Parent[2].Parent;
v40 = v16;
}
Parent = v18->Parent;
if( !v18->Parent )
goto LABEL_17;
}
v27 = v17 == 0i64;
v17 = v18;
if( !v27 )
v17 = v20;
if( Parent[2].Parent > (_RTL_SPLAY_LINKS *)v7 )
v7 = (unsigned __int64)Parent[2].Parent;
v28 = v14[2].Parent;
v43 = v7;
if( v18->Parent == v28 )
v14[2].Parent = v18;
v18->Parent = Parent->Parent;
if( !*((_QWORD *)LockInfo + 2) )
{
ExFreeToNPagedLookasideList((_NPAGED_LOOKASIDE_LIST *)((char *)&WheapErrorSourceTable + 2600), Parent);
v18 = v42;
v14 = v10 - 1;
v19 = FileObject;
goto LABEL_12;
}
v45 = 1;
LABEL_17:
v7 = 0i64;
if( v17 )
{
if( v14->Parent )
{
FsRtlSplitLocks((__int64)v14, v17, &v43, &v40);
}
else
{
v8[1] = (UINT64)RtlDelete(v10);
ExFreeToNPagedLookasideList((_NPAGED_LOOKASIDE_LIST *)((char *)&WheapErrorSourceTable + 2472), &v10[-1]);
}
}
LABEL_18:
if( !v45 )
{
LockInformation = (char *)LockInfo;
goto LABEL_20;
}
KxReleaseSpinLock(v8);
__writecr8(v11);
v29 = Entry;
LockInformation = (char *)LockInfo;
(*((void(__fastcall **)(VOID *, char *))LockInfo + 2))(Context, (char *)Entry + 8);
v11 = KeAcquireSpinLockRaiseToDpc(v8);
ExFreeToNPagedLookasideList((_NPAGED_LOOKASIDE_LIST *)((char *)&WheapErrorSourceTable + 2600), v29);
v21 = v8[1];
v45 = 0;
if( v21 )
{
v30 = *(_QWORD *)(v21 + 8);
if( v30 )
{
do
{
v41 = v30;
v30 = *(_QWORD *)(v30 + 8);
}
while( v30 );
LABEL_20:
v21 = v41;
}
}
v10 = (_RTL_SPLAY_LINKS *)v21;
}
while( v21 );
LABEL_22:
v22 = (_RTL_SPLAY_LINKS *)v8[2];
if( v22 )
{
for( j = v22->LeftChild; j; j = j->LeftChild )
v22 = j;
do
{
v26 = RtlRealSuccessor(v22);
if( (_FILE_OBJECT *)v22[2].Parent == FileObject
&& (_EPROCESS *)v22[2].LeftChild == ProcessId
&& (!MatchKey || HIDWORD(v22[1].RightChild) == v48) )
{
v8[2] = (UINT64)RtlDelete(v22);
if( *((_QWORD *)LockInformation + 2) )
{
KxReleaseSpinLock(v8);
__writecr8(v11);
(*((void(__fastcall **)(VOID *, _RTL_SPLAY_LINKS *))LockInformation + 2))(Context, v22 + 1);
v31 = KeAcquireSpinLockRaiseToDpc(v8);
v26 = (_RTL_SPLAY_LINKS *)v8[2];
v11 = v31;
if( v26 )
{
for( k = v26->LeftChild; k; k = k->LeftChild )
v26 = k;
}
}
ExFreeToNPagedLookasideList((_NPAGED_LOOKASIDE_LIST *)((char *)&WheapErrorSourceTable + 2728), v22);
}
v22 = v26;
}
while( v26 );
}
v23 = (VOID *)v8[3];
v24 = (VOID **)(v8 + 3);
if( v23 )
{
do
{
v33 = *((_QWORD *)v23 + 3);
v34 = *(_QWORD *)(v33 + 184);
if( FileObject != *(_FILE_OBJECT **)(v34 + 48)
|| ProcessId != (_EPROCESS *)IoGetRequestorProcess(*((PIRP *)v23 + 3))
|| MatchKey && v48 != *(_DWORD *)(v34 + 16) )
{
goto LABEL_76;
}
*(_BYTE *)(v33 + 69) = KeAcquireQueuedSpinLock(7i64, v35, v36);
_InterlockedExchange64((volatile __int64 *)(v33 + 104), 0i64);
v37 = *(_BYTE *)(v33 + 69);
if( *(_BYTE *)(v33 + 68) )
v33 = 0i64;
KeReleaseQueuedSpinLock(LockQueueIoCancelLock, v37);
if( v33 )
{
*(_QWORD *)(v33 + 56) = 0i64;
*v24 = *(VOID **)v23;
if( v23 == (VOID *)v8[4] )
v8[4] = (UINT64)v24;
KxReleaseSpinLock(v8);
__writecr8(v11);
FsRtlCompleteLockIrpReal(
*((__int64(__fastcall **)(__int64, _IRP *))LockInfo + 1),
*((_QWORD *)v23 + 2),
(_IRP *)v33,
-1073741698,
&v38,
0i64);
v11 = KeAcquireSpinLockRaiseToDpc(v8);
v24 = (VOID **)(v8 + 3);
ExFreeToNPagedLookasideList((_NPAGED_LOOKASIDE_LIST *)((char *)&WheapErrorSourceTable + 2344), v23);
}
else
{
LABEL_76:
v24 = (VOID **)v23;
}
v23 = *v24;
}
while( *v24 );
}
FsRtlPrivateCheckWaitingLocks(LockInfo, (_LOCK_QUEUE *)v8, v11);
FsRtlPrivateResetLowestLockOffset(LockInfo);
KxReleaseSpinLock(v8);
LABEL_25:
__writecr8(v11);
}Referenced by:
FsRtlFastUnlockAll
FsRtlFastUnlockAllByKey
FsRtlProcessFileLock