PopCloneRange
VOID __stdcall PopCloneRange(_POP_HIBER_CONTEXT *HiberContext, UINT64 StartPage, UINT64 PageCount, UINT64 Tag){
int v5;
UINT64 v7;
_LIST_ENTRY *PoolWithTag;
_LIST_ENTRY *Flink;
UINT64 v10;
_LIST_ENTRY *v11;
UINT64 Blink;
_LIST_ENTRY *v13;
UINT64 v14;
_LIST_ENTRY *v15;
_LIST_ENTRY *v16;
v5 = Tag;
v7 = StartPage;
RtlSetBits(&HiberContext->DiscardMap, StartPage, PageCount);
PoolWithTag = 0i64;
Flink = HiberContext->ClonedRanges.Flink;
v10 = v7 + PageCount;
if( Flink == &HiberContext->ClonedRanges )
goto LABEL_13;
while( 1 )
{
v11 = Flink;
Flink = Flink->Flink;
Blink = (UINT64)v11[1].Blink;
if( (v7 < Blink || (_LIST_ENTRY *)v7 > v11[2].Flink) && (v10 < Blink || (_LIST_ENTRY *)v10 > v11[2].Flink) )
{
if( v7 > Blink )
goto LABEL_7;
if( Blink > v10 )
break;
}
if( v7 <= Blink )
Blink = v7;
v7 = Blink;
v14 = (UINT64)v11[2].Flink;
if( v10 >= v14 )
v14 = v10;
--HiberContext->ClonedRangeCount;
v15 = v11->Flink;
v10 = v14;
if( v11->Flink->Blink != v11 )
goto LABEL_25;
v16 = v11->Blink;
if( v16->Flink != v11 )
goto LABEL_25;
v16->Flink = v15;
v15->Blink = v16;
if( PoolWithTag )
ExFreePoolWithTag(v11, 0x70616D48u);
else
PoolWithTag = v11;
LABEL_7:
if( Flink == &HiberContext->ClonedRanges )
goto LABEL_12;
}
if( v7 >= Blink )
goto LABEL_7;
Flink = Flink->Blink;
LABEL_12:
if( PoolWithTag )
{
LABEL_14:
PoolWithTag->Flink = 0i64;
PoolWithTag->Blink = 0i64;
HIDWORD(PoolWithTag[1].Flink) = 0;
PoolWithTag[2].Blink = 0i64;
LODWORD(PoolWithTag[1].Flink) = v5;
PoolWithTag[1].Blink = (_LIST_ENTRY *)v7;
PoolWithTag[2].Flink = (_LIST_ENTRY *)v10;
v13 = Flink->Blink;
if( v13->Flink != Flink )
LABEL_25:
__fastfail(3u);
PoolWithTag->Flink = Flink;
PoolWithTag->Blink = v13;
v13->Flink = PoolWithTag;
Flink->Blink = PoolWithTag;
++HiberContext->ClonedRangeCount;
}
else
{
LABEL_13:
PoolWithTag = (_LIST_ENTRY *)ExAllocatePoolWithTag(NonPagedPoolNx, 0x30ui64, 0x70616D48ui64);
if( PoolWithTag )
goto LABEL_14;
if( HiberContext->Status >= 0 )
HiberContext->Status = -1073741670;
}
}Referenced by:
PopSetRange