PnpCmResourcesToIoResources
IO_RESOURCE_REQUIREMENTS_LIST *__stdcall PnpCmResourcesToIoResources(
CM_RESOURCE_LIST *CmResourceList,
UINT64 Priority,
UINT64 a3){
unsigned int v3;
int *v4;
unsigned int v5;
int v6;
int v8;
UINT64 v9;
__int64 v10;
unsigned int v11;
__int64 v12;
__int64 v13;
unsigned int v14;
char *PoolWithTag;
char *v16;
int v17;
char *v18;
int v19;
_DWORD *v20;
unsigned int v21;
int v22;
IO_RESOURCE_REQUIREMENTS_LIST *result;
UINT64 v24;
unsigned __int64 v25;
unsigned __int64 v26;
int v27;
int v28;
unsigned __int64 Start;
v3 = *(_DWORD *)Priority;
v4 = (int *)(Priority + 4);
v5 = 0;
v6 = a3;
v8 = 0;
v9 = Priority + 4;
if( !*(_DWORD *)Priority )
return 0i64;
v10 = v3;
do
{
v11 = *(_DWORD *)(v9 + 12);
v9 += 16i64;
v8 += v11;
if( v11 )
{
v12 = v11;
do
{
v13 = 0i64;
if( *(_BYTE *)v9 == 5 )
{
v13 = *(unsigned int *)(v9 + 4);
--v8;
}
v9 += v13 + 20;
--v12;
}
while( v12 );
}
--v10;
}
while( v10 );
if( !v8 )
return 0i64;
v14 = v3 + v8;
PoolWithTag = (char *)ExAllocatePoolWithTag(PagedPool, 32i64 * v14 + 72, 0x75737050ui64);
v16 = PoolWithTag;
if( !PoolWithTag )
return 0i64;
memset((INT64)PoolWithTag, 0i64);
*((_DWORD *)v16 + 1) = *v4;
v17 = *(_DWORD *)(Priority + 8);
*((_DWORD *)v16 + 9) = v14;
v18 = v16 + 72;
*((_DWORD *)v16 + 12) = v6;
v19 = 0;
*((_DWORD *)v16 + 2) = v17;
*(_QWORD *)(v16 + 12) = 0i64;
*(_QWORD *)(v16 + 20) = 0i64;
*((_DWORD *)v16 + 7) = 1;
*((_DWORD *)v16 + 8) = 65537;
*((_WORD *)v16 + 20) = -32767;
*(_DWORD *)(v16 + 42) = 3;
*((_WORD *)v16 + 23) = 0;
if( *(_DWORD *)Priority )
{
while( 1 )
{
if( v19 )
{
*(_DWORD *)(v18 + 2) = 0;
*(_WORD *)v18 = -4095;
*((_WORD *)v18 + 3) = 0;
v27 = *v4;
if( *v4 == -1 )
v27 = 1;
*((_DWORD *)v18 + 2) = v27;
*(_QWORD *)(v18 + 12) = (unsigned int)v4[1];
v18 += 32;
}
v20 = v4 + 4;
v21 = 0;
if( v4[3] )
break;
LABEL_21:
v4 = v20;
if( (unsigned int)++v19 >= *(_DWORD *)Priority )
goto LABEL_22;
}
while( 1 )
{
*v18 = 1;
v18[1] = *(_BYTE *)v20;
v18[2] = *((_BYTE *)v20 + 1);
*((_WORD *)v18 + 2) = *((_WORD *)v20 + 1);
v18[3] = 0;
*((_WORD *)v18 + 3) = 0;
switch( *(_BYTE *)v20 )
{
case 1:
goto LABEL_24;
case 2:
if( (*((_BYTE *)v20 + 2) & 2) != 0 )
{
*((_DWORD *)v18 + 3) = -2;
v28 = *((unsigned __int16 *)v20 + 3);
*((_DWORD *)v18 + 5) = 0;
*((_DWORD *)v18 + 2) = ~v28;
*((_WORD *)v18 + 8) = 4;
*((_WORD *)v18 + 9) = *((_WORD *)v20 + 2);
v26 = *(_QWORD *)(v20 + 3);
goto LABEL_25;
}
v22 = v20[2];
*((_DWORD *)v18 + 3) = v22;
break;
case 3:
goto LABEL_24;
case 4:
if( *((char *)v20 + 2) < 0 )
{
*((_DWORD *)v18 + 2) = v20[2];
*((_DWORD *)v18 + 3) = v20[2];
*((_DWORD *)v18 + 4) = v20[1];
*((_DWORD *)v18 + 5) = *((unsigned __int8 *)v20 + 12);
}
else
{
*((_DWORD *)v18 + 2) = v20[1];
*((_DWORD *)v18 + 3) = v20[1];
}
goto LABEL_19;
case 5:
v5 = v20[1];
goto LABEL_20;
case 6:
*((_DWORD *)v18 + 3) = v20[1];
*((_DWORD *)v18 + 4) = v20[1] - 1 + v20[2];
v22 = v20[2];
break;
case 7:
LABEL_24:
Start = 0i64;
v24 = RtlCmDecodeMemIoResource((_CM_PARTIAL_RESOURCE_DESCRIPTOR *)v20, &Start);
*((_DWORD *)v18 + 2) = v20[3];
v25 = Start;
*((_QWORD *)v18 + 2) = Start;
v26 = v25 + v24 - 1;
*((_DWORD *)v18 + 3) = 1;
LABEL_25:
*((_QWORD *)v18 + 3) = v26;
goto LABEL_19;
default:
*((_DWORD *)v18 + 2) = v20[1];
*((_DWORD *)v18 + 3) = v20[2];
*((_DWORD *)v18 + 4) = v20[3];
goto LABEL_19;
}
*((_DWORD *)v18 + 2) = v22;
LABEL_19:
v18 += 32;
LABEL_20:
v20 = (_DWORD *)((char *)v20 + v5 + 20);
++v21;
v5 = 0;
if( v21 >= v4[3] )
goto LABEL_21;
}
}
LABEL_22:
result = (IO_RESOURCE_REQUIREMENTS_LIST *)v16;
*(_DWORD *)v16 = (_DWORD)v18 - (_DWORD)v16;
return result;
}Referenced by:
IoReportResourceUsageInternal
IopAllocateBootResourcesInternal
IopQueryConflictListInternal
IopQueryDeviceResources
PnpFilterResourceRequirementsList
PnpReleaseBootResourcesForFilteredRequirements
PnpRestoreResourcesInternal