FsRtlRemoveBaseMcbEntry
VOID __stdcall FsRtlRemoveBaseMcbEntry(_BASE_MCB *Mcb, INT64 Vbn, INT64 SectorCount){
INT64 v3;
INT64 v4;
char v6;
__int64 v7;
__int64 v8;
_DWORD *Mapping;
int v10;
int v11;
__int64 v12;
ULONG v13;
__int64 v14;
int v15;
UINT64 v16;
UINT64 v17;
ULONG PairCount;
__int64 v19;
_DWORD *v20;
__int64 v21;
int v22;
int v23;
char v24;
__int64 v25;
int v26;
int v27;
__int64 v28;
int v29;
__int64 v30;
int v31;
int v32;
INT64 v33;
int v34;
__int64 v35;
unsigned int v36;
ULONG v37;
__int64 v38;
__int64 v39;
char v40;
char v41;
__int64 v42;
_DWORD *v43;
int v44;
int v45;
UINT64 Index;
LODWORD(Index) = 0;
v3 = SectorCount;
v4 = Vbn;
if( !Vbn )
{
PairCount = Mcb->PairCount;
if( PairCount )
{
if( SectorCount >= *((unsigned int *)Mcb->Mapping + 2 * PairCount - 2) )
{
Mcb->PairCount = 0;
return;
}
}
}
if( SectorCount > 0 )
{
while( 1 )
{
FsRtlFindLargeIndex(Mcb, (unsigned int)v4, &Index);
if( !v6 )
return;
v7 = (unsigned int)Index;
v8 = (_DWORD)Index ? *((unsigned int *)Mcb->Mapping + 2 * (unsigned int)(Index - 1)) : 0i64;
if( v8 == v4 )
{
Mapping = Mcb->Mapping;
v10 = Mapping[2 * (unsigned int)Index];
if( (unsigned int)(v10 - 1) < v4 + v3 )
break;
}
if( (_DWORD)Index )
v19 = *((unsigned int *)Mcb->Mapping + 2 * (unsigned int)(Index - 1));
else
v19 = 0i64;
v20 = Mcb->Mapping;
if( v19 == v4 )
{
if( v20[2 * (unsigned int)Index + 1] != -1 )
{
if( (_DWORD)Index
&& ((v21 = (unsigned int)(Index - 1), v22 = v20[2 * v21 + 1], v22 == -1)
|| ((_DWORD)v21 ? (v23 = v20[2 * (unsigned int)(Index - 2)]) : (v23 = 0), !(v22 + v20[2 * v21] - v23))) )
{
v20[2 * v21] += v3;
*((_DWORD *)Mcb->Mapping + 2 * v7 + 1) += v3;
}
else
{
FsRtlAddEntry(Mcb, (unsigned int)Index, 1ui64);
if( v24 )
{
*((_DWORD *)Mcb->Mapping + 2 * v7 + 1) = -1;
*((_DWORD *)Mcb->Mapping + 2 * v7) = v4 + v3;
*((_DWORD *)Mcb->Mapping + 2 * (unsigned int)(v7 + 1) + 1) += v3;
}
}
}
return;
}
v32 = v20[2 * (unsigned int)Index];
v33 = v4 + v3;
v34 = v20[2 * (unsigned int)Index + 1];
v35 = (unsigned int)Index;
if( (unsigned int)(v32 - 1) >= v4 + v3 )
{
if( v34 != -1 )
{
FsRtlAddEntry(Mcb, (unsigned int)Index, 2ui64);
if( !v41 )
return;
v42 = (unsigned int)(v7 + 1);
*((_DWORD *)Mcb->Mapping + 2 * v7 + 1) = *((_DWORD *)Mcb->Mapping + 2 * (unsigned int)(v7 + 2) + 1);
*((_DWORD *)Mcb->Mapping + 2 * v7) = v4;
*((_DWORD *)Mcb->Mapping + 2 * v42 + 1) = -1;
*((_DWORD *)Mcb->Mapping + 2 * v42) = v4 + v3;
v43 = Mcb->Mapping;
if( (_DWORD)v7 )
v44 = v43[2 * (unsigned int)(v7 - 1)];
else
v44 = 0;
if( (_DWORD)v7 == -1 )
v45 = 0;
else
v45 = v43[2 * v7];
v43[2 * (unsigned int)(v7 + 2) + 1] += v43[2 * v7] + v43[2 * v42] - v45 - v44;
}
v3 = 0i64;
v4 = v33;
}
else
{
v36 = v32 - v4;
if( v34 != -1 )
{
v37 = Mcb->PairCount - 1;
if( (_DWORD)Index == v37 )
{
v20[2 * (unsigned int)Index] -= v36;
}
else if( (unsigned int)Index >= v37 || (v38 = (unsigned int)(Index + 1), v39 = v38, v20[2 * v38 + 1] == -1) )
{
v20[2 * (unsigned int)Index] -= v36;
}
else
{
FsRtlAddEntry(Mcb, (unsigned int)v38, 1ui64);
if( !v40 )
return;
*((_DWORD *)Mcb->Mapping + 2 * v39 + 1) = -1;
*((_DWORD *)Mcb->Mapping + 2 * v39) = *((_DWORD *)Mcb->Mapping + 2 * v35);
*((_DWORD *)Mcb->Mapping + 2 * v35) -= v36;
}
}
v4 += v36;
v3 -= v36;
}
LABEL_17:
if( v3 <= 0 )
return;
}
if( (_DWORD)Index )
v11 = Mapping[2 * (unsigned int)(Index - 1)];
else
v11 = 0;
v12 = (unsigned int)(v10 - v11);
v4 += v12;
v3 -= v12;
if( Mapping[2 * (unsigned int)Index + 1] == -1 )
goto LABEL_17;
v13 = Mcb->PairCount - 1;
if( (_DWORD)Index == v13 )
{
if( !(_DWORD)Index )
goto LABEL_45;
v14 = (unsigned int)(Index - 1);
v15 = Mapping[2 * v14 + 1];
if( v15 != -1 )
{
v27 = (_DWORD)Index == 1 ? 0 : Mapping[2 * (unsigned int)(Index - 2)];
if( Mapping[2 * v14] + v15 - v27 )
goto LABEL_45;
}
v16 = (unsigned int)v14;
}
else
{
if( !(_DWORD)Index )
goto LABEL_66;
v25 = (unsigned int)(Index - 1);
v26 = Mapping[2 * v25 + 1];
if( v26 != -1 )
{
if( (_DWORD)Index != 1 )
LODWORD(v25) = Mapping[2 * (unsigned int)(Index - 2)];
if( Mapping[2 * (unsigned int)(Index - 1)] + v26 - (_DWORD)v25 )
{
LABEL_66:
if( (unsigned int)Index < v13 && Mapping[2 * (unsigned int)(Index + 1) + 1] != -1 )
{
Mapping[2 * (unsigned int)Index + 1] = -1;
goto LABEL_17;
}
if( !(_DWORD)Index )
goto LABEL_74;
}
}
v28 = (unsigned int)(Index - 1);
v29 = Mapping[2 * v28 + 1];
if( v29 != -1 )
{
if( (_DWORD)Index != 1 )
LODWORD(v28) = Mapping[2 * (unsigned int)(Index - 2)];
if( Mapping[2 * (unsigned int)(Index - 1)] + v29 - (_DWORD)v28 )
{
LABEL_74:
if( (unsigned int)Index >= v13 || Mapping[2 * (unsigned int)(Index + 1) + 1] == -1 )
{
LABEL_45:
v17 = 1i64;
v16 = (unsigned int)Index;
goto LABEL_16;
}
if( !(_DWORD)Index )
goto LABEL_50;
}
}
v30 = (unsigned int)(Index - 1);
v31 = Mapping[2 * v30 + 1];
if( v31 == -1 )
goto LABEL_50;
if( (_DWORD)Index != 1 )
LODWORD(v30) = Mapping[2 * (unsigned int)(Index - 2)];
if( !(Mapping[2 * (unsigned int)(Index - 1)] + v31 - (_DWORD)v30) )
{
LABEL_50:
if( (unsigned int)Index < v13 && Mapping[2 * (unsigned int)(Index + 1) + 1] != -1 )
{
Mapping[2 * (unsigned int)Index + 1] = -1;
v17 = 1i64;
v16 = (unsigned int)(v7 - 1);
goto LABEL_16;
}
}
v16 = (unsigned int)(Index - 1);
}
v17 = 2i64;
LABEL_16:
FsRtlRemoveLargeEntry(Mcb, v16, v17);
goto LABEL_17;
}
}Referenced by:
FsRtlRemoveLargeMcbEntry