HvpAllocateLogBuffers
__int64 __fastcall HvpAllocateLogBuffers(PVOID **a1, _DWORD *a2, unsigned int a3){
VOID **v6;
__int64 v7;
__int64 v8;
char v9;
VOID **PoolWithTag;
VOID **v11;
unsigned int v12;
PVOID *v14;
__int64 v15;
unsigned int v16;
__int64 v17;
size_t v18;
VOID **v19;
unsigned int v20;
__int64 v21;
unsigned int v22;
unsigned int v23;
bool v24;
VOID **v25;
PVOID *v26;
unsigned int NumberOfBytes;
v6 = 0i64;
v7 = 0i64;
v8 = 0i64;
v9 = 0;
PoolWithTag = ExAllocatePoolWithTag(5ui64, a3, 1867074883i64);
if( PoolWithTag )
{
v8 = 1i64;
v11 = ExAllocatePoolWithTag(1ui64, 0x18ui64, 1867074883i64);
v6 = v11;
if( v11 )
{
*(_DWORD *)v11 = 0;
v11[1] = PoolWithTag;
*((_DWORD *)v11 + 4) = a3;
*a1 = v11;
*a2 = 1;
LABEL_4:
v6 = 0i64;
v12 = 0;
goto LABEL_5;
}
ExFreePoolWithTag(PoolWithTag, 0);
}
LABEL_8:
if( !v9 )
goto LABEL_39;
if( v6 )
{
if( (_DWORD)v8 )
{
v14 = v6 + 1;
v15 = (unsigned int)v8;
do
{
if( *v14 )
{
ExFreePoolWithTag(*v14, 0);
*v14 = 0i64;
}
v14 += 3;
--v15;
}
while( v15 );
}
ExFreePoolWithTag(v6, 0);
v6 = 0i64;
}
v7 = (unsigned int)(v7 + 1);
if( (_DWORD)v7 != 9 )
{
LABEL_39:
v16 = *((_DWORD *)LogEntryChunkSizes + v7) << 12;
NumberOfBytes = v16;
v17 = a3 / v16 + 1;
if( !(a3 % v16) )
v17 = a3 / v16;
v8 = (unsigned int)v17;
v18 = 24 * v17;
v19 = ExAllocatePoolWithTag(1ui64, 24 * v17, 1867074883i64);
v6 = v19;
if( v19 )
{
memset(v19, 0i64, v18);
v20 = a3;
v21 = 0i64;
while( (unsigned int)v21 < (unsigned int)v8 )
{
LODWORD(v6[3 * v21]) = 0;
v22 = v20 - v16;
v23 = 0;
v24 = v20 < NumberOfBytes;
if( v20 >= NumberOfBytes )
v20 = NumberOfBytes;
if( !v24 )
v23 = v22;
LODWORD(v6[3 * v21 + 2]) = v20;
v25 = ExAllocatePoolWithTag(5ui64, v20, 1867074883i64);
v6[3 * v21 + 1] = v25;
if( !v25 )
{
v9 = 1;
goto LABEL_8;
}
v20 = v23;
v21 = (unsigned int)(v21 + 1);
v16 = NumberOfBytes;
}
*a1 = v6;
*a2 = v8;
goto LABEL_4;
}
}
v12 = -1073741801;
LABEL_5:
if( v6 )
{
if( (_DWORD)v8 )
{
v26 = v6 + 1;
do
{
if( *v26 )
{
ExFreePoolWithTag(*v26, 0);
*v26 = 0i64;
}
v26 += 3;
--v8;
}
while( v8 );
}
ExFreePoolWithTag(v6, 0);
}
return v12;
}Referenced by:
HvpGenerateLogEntry