HvpExpandMap
NTSTATUS __stdcall HvpExpandMap(_HHIVE *Hive, UINT64 Type, UINT64 OldLength, UINT64 NewLength){
NTSTATUS v4;
__int64 v5;
unsigned int v6;
unsigned int v7;
__int64 v9;
unsigned int v10;
unsigned int v11;
unsigned int v12;
_HMAP_TABLE *v14;
_HMAP_TABLE *v15;
_HMAP_DIRECTORY *p_SmallDir;
__int64 v17;
_HMAP_DIRECTORY *v18;
_HMAP_DIRECTORY *v19;
v4 = 0;
v5 = (unsigned int)Type;
v6 = NewLength;
v7 = OldLength;
if( !(_DWORD)OldLength )
{
v14 = (_HMAP_TABLE *)Hive->Allocate(12288i64, 0i64, 925977923i64);
v15 = v14;
if( !v14 )
return -1073741801;
memset(v14, 0i64, sizeof(_HMAP_TABLE));
p_SmallDir = (_HMAP_DIRECTORY *)&Hive->Storage[v5].SmallDir;
Hive->Storage[v5].Map = p_SmallDir;
p_SmallDir->Directory[0] = v15;
}
v9 = v5;
if( v7 )
v10 = (v7 >> 12) - 1;
else
v10 = 0;
v11 = v10 >> 9;
v12 = ((v6 >> 12) - 1) >> 9;
if( v12 > v11 )
{
if( v11 || (v17 = v5, (_HMAP_TABLE **)Hive->Storage[v9].Map != &Hive->Storage[v9].SmallDir) )
{
LABEL_13:
if( !HvpAllocateMap(Hive, Hive->Storage[v9].Map, v11 + 1, v12) )
{
v4 = -1073741801;
HvpFreeMap(Hive, Hive->Storage[v9].Map, v11 + 1, v12);
}
return v4;
}
v18 = (_HMAP_DIRECTORY *)Hive->Allocate(0x2000i64, 0i64, 942755139i64);
v19 = v18;
if( v18 )
{
memset(v18, 0i64, sizeof(_HMAP_DIRECTORY));
v19->Directory[0] = Hive->Storage[v17].SmallDir;
Hive->Storage[v17].Map = v19;
goto LABEL_13;
}
return -1073741801;
}
return v4;
}Referenced by:
HvpAddBin
HvpPerformLogFileRecovery