PnpCompileDeviceInstancePaths
__int64 __fastcall PnpCompileDeviceInstancePaths(int a1, _RELATION_LIST *a2, char a3, char a4, _QWORD *a5){
unsigned int v5;
_QWORD *v10;
int v11;
_DWORD *DeviceNode;
VOID **CriticalMemory;
VOID **v14;
_DWORD *v15;
_QWORD *v16;
const VOID *v17;
_WORD *v18;
_RELATION_LIST_MARKER Marker;
_DEVICE_OBJECT *DeviceObject;
_DEVICE_RELATION_LEVEL RelationLevel;
v5 = 0;
DeviceObject = 0i64;
RelationLevel = RELATION_LEVEL_REMOVE_EJECT;
if( !a2 )
__fastfail(5u);
v10 = a5;
v11 = 0;
Marker = 0i64;
*a5 = 0i64;
while( IopEnumerateRelations(a2, &Marker, &DeviceObject, &RelationLevel, 0i64) )
{
if( DeviceObject )
DeviceNode = DeviceObject->DeviceObjectExtension->DeviceNode;
else
DeviceNode = 0i64;
if( DeviceNode && (!a4 || (DeviceNode[176] & 2) == 0) && *((_QWORD *)DeviceNode + 6) && (!a3 || RelationLevel) )
v11 += *((unsigned __int16 *)DeviceNode + 20) + 2;
}
CriticalMemory = PnpAllocateCriticalMemory(a1, PagedPool, (unsigned int)(v11 + 2), 0x4B706E50u);
*v10 = CriticalMemory;
v14 = CriticalMemory;
if( CriticalMemory )
{
Marker = (_RELATION_LIST_MARKER)2i64;
while( IopEnumerateRelations(a2, &Marker, &DeviceObject, &RelationLevel, 0i64) )
{
if( DeviceObject )
v15 = DeviceObject->DeviceObjectExtension->DeviceNode;
else
v15 = 0i64;
if( v15 && (!a4 || (v15[176] & 2) == 0) && *((_QWORD *)v15 + 6) && (!a3 || RelationLevel) )
{
v16 = DeviceObject->DeviceObjectExtension->DeviceNode;
if( v16 )
{
v17 = (const VOID *)v16[6];
if( v17 )
{
memmove(v14, v17, *((unsigned __int16 *)v16 + 20));
v18 = (_WORD *)v14 + ((unsigned __int64)*((unsigned __int16 *)v16 + 20) >> 1);
*v18 = 0;
v14 = (VOID **)(v18 + 1);
}
}
}
}
*(_WORD *)v14 = 0;
}
else
{
return(unsigned int)-1073741670;
}
return v5;
}Referenced by:
PnpCancelRemoveOnHungDevices
PnpProcessQueryRemoveAndEject