IoTranslateBusAddress
INT8 __fastcall IoTranslateBusAddress(UINT64 a1, INT64 a2, INT64 a3, INT64 *a4, INT64 *TranslatedAddress){
int v5;
INT64 *v6;
unsigned int v7;
_INTERFACE_TYPE v8;
int v9;
__int16 v10;
_DEVICE_NODE *LegacyBusDeviceNode;
UINT8 v12;
UINT8 ResourceHandlerInfo;
int v14;
VOID *v15;
int v16;
VOID *Interface;
VOID *HandlerEntry;
INT64 *v20;
UINT8 ResourceType[16];
int v22;
__int128 v23;
int v24;
v5 = 0;
v20 = a4;
v24 = 0;
v6 = a4;
Interface = 0i64;
v7 = a2;
HandlerEntry = 0i64;
v8 = (int)a1;
v22 = 0;
v23 = 0i64;
if( KeGetCurrentIrql() || !*(&PnpReplaceEvent + 831) )
{
*TranslatedAddress = a3;
return 1;
}
v9 = *(_DWORD *)a4;
if( *(_DWORD *)a4 )
{
if( v9 != 1 )
return 0;
v10 = 1;
}
else
{
v10 = 0;
LOBYTE(v9) = 3;
}
*(_WORD *)&ResourceType[2] = v10;
ResourceType[0] = v9;
ResourceType[1] = 3;
*(_QWORD *)&ResourceType[4] = a3;
*(_DWORD *)&ResourceType[12] = 1;
PpDevNodeLockTree(PPL_SIMPLE_READ);
LegacyBusDeviceNode = IopFindLegacyBusDeviceNode(v8, v7);
if( LegacyBusDeviceNode == (_DEVICE_NODE *)*(&PnpReplaceEvent + 831) )
{
LABEL_21:
PpDevNodeUnlockTree(PPL_SIMPLE_READ);
if( ResourceType[0] != 3 && ResourceType[0] != 7 )
{
if( ResourceType[0] != 1 )
return 0;
v5 = 1;
}
*(_DWORD *)v6 = v5;
*TranslatedAddress = *(_QWORD *)&ResourceType[4];
return 1;
}
v12 = ResourceType[0];
while( 1 )
{
ResourceHandlerInfo = IopFindResourceHandlerInfo(ResourceTranslator, LegacyBusDeviceNode, v12, &HandlerEntry);
if( !ResourceHandlerInfo )
{
IopQueryResourceHandlerInterface(ResourceTranslator, LegacyBusDeviceNode->PhysicalDeviceObject, v12, &Interface);
if( v14 >= 0 )
{
v15 = Interface;
goto LABEL_14;
}
LABEL_18:
v12 = ResourceType[0];
goto LABEL_19;
}
if( HandlerEntry )
break;
LABEL_19:
LegacyBusDeviceNode = LegacyBusDeviceNode->Parent;
if( LegacyBusDeviceNode == (_DEVICE_NODE *)*(&PnpReplaceEvent + 831) )
{
LABEL_20:
v6 = v20;
goto LABEL_21;
}
}
v15 = (VOID *)*((_QWORD *)HandlerEntry + 3);
LABEL_14:
v16 = (*((__int64(__fastcall **)(_QWORD, UINT8 *, _QWORD, _QWORD, _QWORD, _QWORD, __int128 *))v15 + 4))(
*((_QWORD *)v15 + 1),
ResourceType,
0i64,
0i64,
0i64,
0i64,
&v23);
if( !ResourceHandlerInfo )
{
(*((void(__fastcall **)(_QWORD))v15 + 3))(*((_QWORD *)v15 + 1));
ExFreePoolWithTag(v15, 0);
}
if( v16 >= 0 )
{
v22 = v24;
*(_OWORD *)ResourceType = v23;
if( v16 == 288 )
goto LABEL_20;
goto LABEL_18;
}
PpDevNodeUnlockTree(PPL_SIMPLE_READ);
return 0;
}Referenced by:
No references.