IopPnPDispatch
__int64 __fastcall IopPnPDispatch(
_DEVICE_OBJECT *DeviceObject,
_IRP *Irp,
__int64 a3,
__int64 a4,
__int64 a5,
__int64 a6,
__int64 a7,
unsigned int a8){
__int64 v8;
__int64 v9;
DEVICE_RELATIONS *v12;
unsigned int v13;
unsigned int v14;
__int64 v15;
__int64 v16;
__m128i si128;
int RootDevices;
unsigned int v20;
unsigned int v21;
unsigned int v22;
unsigned int v23;
PVOID v24;
GUID *v25;
GUID *v26;
__int64 v27;
int v28;
__int64 v29;
DEVICE_RELATIONS *Src;
DEVICE_RELATIONS *v31;
int v32;
DEVICE_RELATIONS *v33;
__int16 Count;
DEVICE_RELATIONS *PoolWithTag;
DEVICE_RELATIONS *v36;
__int64 v37;
INT64 *v38;
__int64 v39;
wchar_t *v40;
DEVICE_RELATIONS *v41;
int v42;
_WORD *v43;
__int16 v44;
char *v45;
__int16 v46;
signed __int64 v47;
__int64 v48;
__int64 v49;
unsigned int v50;
unsigned int v51;
DEVICE_RELATIONS *DeviceRelations[2];
SIZE_T NumberOfBytes;
int v54;
int v55;
v8 = *((_QWORD *)Irp + 23);
v9 = 0i64;
LODWORD(NumberOfBytes) = 0;
v54 = 0;
v55 = 0;
v12 = 0i64;
v13 = *(unsigned __int8 *)(v8 + 1);
DeviceRelations[0] = 0i64;
if( v13 <= 8 )
{
if( v13 != 8 )
{
switch( v13 )
{
case 0u:
case 1u:
goto LABEL_9;
case 2u:
if( DeviceObject )
v39 = *(_QWORD *)(*((_QWORD *)DeviceObject + 39) + 40i64);
else
v39 = 0i64;
if( !v39 || (*(_DWORD *)(v39 + 396) & 0x10000) != 0 )
IoDeleteDevice(DeviceObject);
IoInvalidateDeviceRelations(*((DEVICE_OBJECT **)IopRootDeviceNode + 4), SingleBusRelations);
goto LABEL_9;
case 3u:
goto LABEL_9;
}
if( v13 <= 5 )
goto LABEL_78;
if( v13 == 6 )
{
LABEL_9:
RootDevices = 0;
goto LABEL_20;
}
if( DeviceObject == *((_DEVICE_OBJECT **)IopRootDeviceNode + 4) && !*(_DWORD *)(v8 + 8) )
{
RootDevices = IopGetRootDevices(DeviceRelations);
goto LABEL_63;
}
if( *(_DWORD *)(v8 + 8) != 4 )
goto LABEL_19;
PoolWithTag = (DEVICE_RELATIONS *)ExAllocatePoolWithTag(PagedPool, 0x10ui64, 0x64647050ui64);
v36 = PoolWithTag;
if( !PoolWithTag )
goto LABEL_77;
PoolWithTag->Count = 1;
PoolWithTag->Objects[0] = DeviceObject;
ObfReferenceObject(DeviceObject);
v12 = v36;
LABEL_60:
RootDevices = 0;
goto LABEL_20;
}
RootDevices = *((_DWORD *)Irp + 12);
if( DeviceObject )
v24 = *(PVOID *)(*((_QWORD *)DeviceObject + 39) + 40i64);
else
v24 = 0i64;
if( v24 != IopRootDeviceNode )
goto LABEL_20;
v25 = *(GUID **)(v8 + 8);
if( v25 != &GUID_ARBITER_INTERFACE_STANDARD
&& RtlCompareMemory(v25, &GUID_ARBITER_INTERFACE_STANDARD, 0x10ui64) != 16 )
{
v26 = *(GUID **)(v8 + 8);
if( v26 != &GUID_TRANSLATOR_INTERFACE_STANDARD
&& RtlCompareMemory(v26, &GUID_TRANSLATOR_INTERFACE_STANDARD, 0x10ui64) != 16 )
{
goto LABEL_20;
}
v27 = *(_QWORD *)(v8 + 24);
*(_QWORD *)(v27 + 32) = IopTranslatorHandlerCm;
*(_QWORD *)(v27 + 40) = IopTranslatorHandlerIo;
goto LABEL_60;
}
v37 = *(_QWORD *)(v8 + 24);
RootDevices = 0;
*(_QWORD *)(v37 + 32) = ArbArbiterHandler;
if( *(_BYTE *)(v8 + 32) == 1 )
{
v38 = &IopRootPortArbiter;
goto LABEL_69;
}
if( *(_BYTE *)(v8 + 32) == 2 )
{
v38 = &IopRootIrqArbiter;
goto LABEL_69;
}
if( *(_BYTE *)(v8 + 32) != 3 )
{
if( *(_BYTE *)(v8 + 32) == 4 )
{
v38 = &IopRootDmaArbiter;
LABEL_69:
*(_QWORD *)(v37 + 8) = v38;
goto LABEL_20;
}
if( *(_BYTE *)(v8 + 32) == 6 )
{
v38 = &IopRootBusNumberArbiter;
goto LABEL_69;
}
if( *(_BYTE *)(v8 + 32) != 7 )
{
RootDevices = -1073741811;
goto LABEL_20;
}
}
v38 = &IopRootMemArbiter;
goto LABEL_69;
}
v14 = v13 - 9;
if( !v14 )
{
if( DeviceObject )
v15 = *(_QWORD *)(*((_QWORD *)DeviceObject + 39) + 40i64);
else
v15 = 0i64;
v16 = *(_QWORD *)(v8 + 8);
*(_DWORD *)v16 = 65600;
if( DeviceObject == *((_DEVICE_OBJECT **)IopRootDeviceNode + 4) )
{
*(_DWORD *)(v16 + 4) |= 0x1C0u;
*(_DWORD *)(v16 + 12) = 0;
}
si128 = _mm_load_si128((const __m128i *)&_xmm);
*(_DWORD *)(v16 + 16) = 0;
*(_DWORD *)(v16 + 20) = 1;
*(__m128i *)(v16 + 24) = si128;
*(_DWORD *)(v16 + 40) = _mm_cvtsi128_si32(si128);
if( *(_DWORD *)(v16 + 12) == -1 )
{
LODWORD(NumberOfBytes) = 4;
if( (int)CmGetDeviceRegProp(
PiPnpRtlCtx,
*(const wchar_t **)(v15 + 48),
0i64,
17,
(__int64)&v54,
(__int64)&v55,
(__int64)&NumberOfBytes,
0) >= 0
&& v54 == 4
&& (_DWORD)NumberOfBytes == 4 )
{
*(_DWORD *)(v16 + 12) = v55;
}
}
goto LABEL_9;
}
v20 = v14 - 1;
if( !v20 )
{
v50 = 0;
v51 = 4;
LABEL_127:
RootDevices = PnpGetDeviceResourcesFromRegistry(
DeviceObject,
v50,
v51,
(void **)DeviceRelations,
(unsigned int *)&NumberOfBytes);
if( RootDevices == -1073741772 )
goto LABEL_9;
LABEL_63:
v12 = DeviceRelations[0];
goto LABEL_20;
}
v21 = v20 - 1;
if( !v21 )
{
v50 = 1;
v51 = 2;
goto LABEL_127;
}
v22 = v21 - 1;
if( !v22 )
{
if( *(_DWORD *)(v8 + 8) != 1 || *((_QWORD *)Irp + 7) )
goto LABEL_19;
if( DeviceObject )
v48 = *(_QWORD *)(*((_QWORD *)DeviceObject + 39) + 40i64);
else
v48 = 0i64;
PiGetDeviceRegProperty(*(const wchar_t **)(v48 + 48), (__int64)Irp, 1, 14, 0i64, (__int64)&NumberOfBytes);
if( (_DWORD)NumberOfBytes )
{
v12 = (DEVICE_RELATIONS *)ExAllocatePoolWithTag(PagedPool, (unsigned int)NumberOfBytes, 0x64647050ui64);
if( v12 )
{
RootDevices = PiGetDeviceRegProperty(*(const wchar_t **)(v48 + 48), v49, 1, 14, v12, (__int64)&NumberOfBytes);
if( RootDevices < 0 )
{
if( RootDevices == -1073741275 )
RootDevices = -1073741772;
ExFreePoolWithTag(v12, 0);
v12 = 0i64;
}
goto LABEL_20;
}
goto LABEL_77;
}
LABEL_78:
RootDevices = -1073741823;
goto LABEL_20;
}
v23 = v22 - 7;
if( v23 )
{
if( v23 == 3 )
goto LABEL_9;
LABEL_19:
v12 = (DEVICE_RELATIONS *)*((_QWORD *)Irp + 7);
RootDevices = *((_DWORD *)Irp + 12);
goto LABEL_20;
}
if( DeviceObject == *((_DEVICE_OBJECT **)IopRootDeviceNode + 4) )
goto LABEL_19;
RootDevices = *((_DWORD *)Irp + 12);
if( RootDevices >= 0 )
{
if( *((_QWORD *)Irp + 7) )
goto LABEL_19;
}
if( DeviceObject )
v9 = *(_QWORD *)(*((_QWORD *)DeviceObject + 39) + 40i64);
v28 = *(_DWORD *)(v8 + 8);
DeviceRelations[0] = (DEVICE_RELATIONS *)v9;
if( v28 )
{
if( v28 <= 0 )
goto LABEL_96;
if( v28 <= 2 )
{
if( RootDevices == -1073741637 )
{
RootDevices = PiGetDeviceRegProperty(
*(const wchar_t **)(v9 + 48),
(__int64)Irp,
7,
(unsigned int)(v28 != 1) + 2,
0i64,
(__int64)&NumberOfBytes);
if( RootDevices == -1073741789 )
{
Src = (DEVICE_RELATIONS *)ExAllocatePoolWithTag(PagedPool, (unsigned int)NumberOfBytes, 0x64647050ui64);
if( Src )
{
RootDevices = PiGetDeviceRegProperty(
*(const wchar_t **)(v9 + 48),
v29,
7,
(unsigned int)(*(_DWORD *)(v8 + 8) != 1) + 2,
Src,
(__int64)&NumberOfBytes);
v31 = Src;
if( RootDevices < 0 )
{
ExFreePoolWithTag(Src, 0);
}
else
{
v32 = NumberOfBytes;
v33 = 0i64;
if( Src < (DEVICE_RELATIONS *)((char *)Src + ((unsigned int)NumberOfBytes & 0xFFFFFFFE)) )
{
do
{
Count = v31->Count;
if( LOWORD(v31->Count) )
{
if( (unsigned __int16)(Count - 32) > 0x5Fu || Count == 44 )
{
LOWORD(v31->Count) = 63;
v32 = NumberOfBytes;
}
}
else
{
if( v33 && v31 == (DEVICE_RELATIONS *)((char *)&v33->Count + 2) )
break;
v33 = v31;
}
v31 = (DEVICE_RELATIONS *)((char *)v31 + 2);
}
while( v31 < (DEVICE_RELATIONS *)((char *)Src + (v32 & 0xFFFFFFFE)) );
}
v12 = Src;
}
}
else
{
RootDevices = -1073741670;
}
}
if( RootDevices == -1073741275 )
{
v12 = (DEVICE_RELATIONS *)*((_QWORD *)Irp + 7);
RootDevices = *((_DWORD *)Irp + 12);
}
}
goto LABEL_20;
}
if( v28 != 3 )
{
if( v28 == 5 )
{
v40 = (wchar_t *)ExAllocatePoolWithTag(PagedPool, 0x4Eui64, 0x64647050ui64);
if( v40 )
{
v12 = (DEVICE_RELATIONS *)v40;
wcscpy(v40, L"{00000000-0000-0000-FFFF-FFFFFFFFFFFF}");
RootDevices = 0;
goto LABEL_20;
}
goto LABEL_77;
}
LABEL_96:
v12 = (DEVICE_RELATIONS *)*((_QWORD *)Irp + 7);
goto LABEL_20;
}
}
v41 = (DEVICE_RELATIONS *)ExAllocatePoolWithTag(PagedPool, *(unsigned __int16 *)(v9 + 40), 0x64647050ui64);
if( !v41 )
{
LABEL_77:
RootDevices = -1073741670;
goto LABEL_20;
}
v42 = 0;
memset((INT64)v41, 0i64);
v12 = v41;
RootDevices = 0;
v43 = *(_WORD **)&DeviceRelations[0][3].Count;
v44 = *v43;
if( *(_DWORD *)(v8 + 8) )
{
while( v44 )
{
if( v44 == 92 && ++v42 == 2 )
{
v45 = (char *)(v43 + 1);
v46 = *(_WORD *)v45;
if( *(_WORD *)v45 )
{
v47 = v45 - (char *)v41;
do
{
LOWORD(v41->Count) = v46;
v41 = (DEVICE_RELATIONS *)((char *)v41 + 2);
v46 = *(_WORD *)((char *)&v41->Count + v47);
}
while( v46 );
}
break;
}
v44 = *++v43;
}
}
else
{
while( v44 )
{
if( v44 == 92 && ++v42 == 2 )
break;
LOWORD(v41->Count) = v44;
v41 = (DEVICE_RELATIONS *)((char *)v41 + 2);
v44 = *++v43;
}
}
LABEL_20:
IopPnPCompleteRequest(Irp, (unsigned int)RootDevices, (UINT64)v12);
return(unsigned int)RootDevices;
}Referenced by:
No references.