IopCreateCmResourceList
UINT8 *__fastcall IopCreateCmResourceList(INT64 a1, INT64 a2, INT64 a3, _QWORD *a4){
UINT8 *v4;
int v6;
int v7;
__int64 v8;
__int64 v9;
char *v10;
_DWORD *v11;
__int64 v12;
unsigned int v13;
_DWORD *v14;
__int64 v15;
__int64 v16;
__int64 v17;
UINT64 v19;
UINT8 *PoolWithTag;
UINT8 *v21;
_DWORD *v22;
_DWORD *v23;
UINT8 *v24;
unsigned int v25;
UINT8 *i;
unsigned int v27;
char *v28;
UINT64 v29;
__int64 v30;
__int64 v31;
int v32;
int v33;
v33 = a3;
v32 = a2;
v4 = (UINT8 *)IopInitHalResources;
v6 = a2;
v7 = a3;
v8 = 4i64;
v9 = 0i64;
v10 = (char *)IopInitHalResources + 4;
v11 = (char *)IopInitHalResources + 4;
if( !*(_DWORD *)IopInitHalResources )
goto LABEL_12;
v12 = *(unsigned int *)IopInitHalResources;
do
{
v13 = v11[3];
v14 = v11 + 4;
v15 = 16i64;
if( v13 )
{
v16 = v13;
do
{
v17 = 20i64;
if( *(_BYTE *)v14 == 5 )
v17 = (unsigned int)v14[1] + 20i64;
v15 += v17;
v14 = (_DWORD *)((char *)v14 + v17);
--v16;
}
while( v16 );
v7 = v33;
}
if( *v11 == v6 && v11[1] == v7 )
v9 += v15;
v8 += v15;
v11 = (_DWORD *)((char *)v11 + v15);
--v12;
}
while( v12 );
if( !v9 )
{
LABEL_12:
*a4 = IopInitHalResources;
return 0i64;
}
v19 = v9 + 4;
if( v19 == v8 )
{
*a4 = 0i64;
return v4;
}
else
{
PoolWithTag = (UINT8 *)ExAllocatePoolWithTag(PagedPool, v19, 0x20207050ui64);
v21 = PoolWithTag;
if( !PoolWithTag )
{
*a4 = 0i64;
return 0i64;
}
memset((INT64)PoolWithTag, 0i64);
v22 = ExAllocatePoolWithTag(PagedPool, v8 - v19 + 4, 0x20207050ui64);
*a4 = v22;
v23 = v22;
if( !v22 )
{
ExFreePoolWithTag(v21, 0);
return 0i64;
}
memset((INT64)v22, 0i64);
*(_DWORD *)v21 = 0;
v24 = v21 + 4;
*v23 = 0;
v25 = 0;
for( i = (UINT8 *)(v23 + 1); v25 < *(_DWORD *)v4; ++v25 )
{
v27 = *((_DWORD *)v10 + 3);
v28 = v10 + 16;
v29 = 16i64;
if( v27 )
{
v30 = v27;
do
{
v31 = 20i64;
if( *v28 == 5 )
v31 = *((unsigned int *)v28 + 1) + 20i64;
v29 += v31;
v28 += v31;
--v30;
}
while( v30 );
}
if( *(_DWORD *)v10 == v32 && *((_DWORD *)v10 + 1) == v33 )
{
++*(_DWORD *)v21;
memmove(v24, (UINT8 *)v10, v29);
v24 += v29;
}
else
{
++*v23;
memmove(i, (UINT8 *)v10, v29);
i += v29;
}
v10 += v29;
}
return v21;
}
}Referenced by:
IopAllocateLegacyBootResources