PnpDeleteLockedDeviceNodes
__int64 __fastcall PnpDeleteLockedDeviceNodes(
_DEVICE_OBJECT *a1,
_RELATION_LIST *a2,
int a3,
char a4,
unsigned int a5,
NTSTATUS a6,
__int64 a7,
__int64 a8){
NTSTATUS v8;
char v9;
_DEVICE_OBJECT *v12;
unsigned int v13;
_DEVICE_OBJECT *v14;
_DEVICE_NODE *v15;
unsigned int v16;
int v17;
__int64 v19;
char v20;
_DEVICE_OBJECT_LIST *DeviceObjectList;
NTSTATUS v22;
void *DeviceNode;
_RELATION_LIST_MARKER Marker;
_DEVICE_OBJECT *DeviceObject;
_DEVICE_RELATION_LEVEL RelationLevel;
char v28;
v28 = a4;
v8 = 0;
v9 = a4;
v12 = a1;
v13 = 0;
DeviceObject = 0i64;
RelationLevel = RELATION_LEVEL_REMOVE_EJECT;
if( a2->Sorted )
{
Marker = (_RELATION_LIST_MARKER)1i64;
while( 1 )
{
do
{
if( !IopEnumerateRelations(a2, &Marker, &DeviceObject, &RelationLevel, 0i64) )
return v13;
}
while( RelationLevel == RELATION_LEVEL_REMOVE_EJECT && !v9 );
v14 = DeviceObject;
v15 = DeviceObject ? (_DEVICE_NODE *)DeviceObject->DeviceObjectExtension->DeviceNode : 0i64;
if( a5 == 54 )
break;
if( DeviceObject == v12 )
{
v16 = a5;
LABEL_10:
v8 = a6;
goto LABEL_11;
}
if( RelationLevel != RELATION_LEVEL_DEPENDENT || (v16 = 51, a3 == 1) )
v16 = 0;
LABEL_11:
if( (unsigned int)(a3 - 2) <= 1 )
{
PiUpdateGuestAssignedState(v15, 0);
if( a3 == 2 && (v15->StateFlags & 2) != 0 )
{
v8 = 0;
LABEL_27:
v12 = a1;
goto LABEL_16;
}
}
v17 = PnpDeleteLockedDeviceNode(v15, a3, v16, v8, a7, a8);
v8 = 0;
v13 = v17;
if( !a3 && a5 == 54 && v17 == -1073740537 )
{
PipIsDeviceInDeviceObjectList();
if( v20 )
*(_DWORD *)(v19 + 704) |= 2u;
v13 = 0;
goto LABEL_27;
}
v12 = a1;
if( v17 < 0 )
{
if( (v15->StateFlags & 4) == 0 )
KeBugCheckEx(0xCAu, (PVOID)0xD, v15, (PVOID)4, 0i64);
PoFxIdleDevice(v15->PhysicalDeviceObject);
v15->StateFlags &= ~4u;
if( Marker.Mode == ENUMERATE_FORWARD && Marker.Counter )
{
DeviceObjectList = a2->DeviceObjectList;
Marker.Mode = ENUMERATE_BACKWARD;
Marker.Counter = DeviceObjectList->Count - Marker.Counter;
}
else
{
Marker = (_RELATION_LIST_MARKER)3i64;
}
while( IopEnumerateRelations(a2, &Marker, &DeviceObject, 0i64, 0i64) )
{
if( v14 != DeviceObject )
{
if( DeviceObject )
DeviceNode = DeviceObject->DeviceObjectExtension->DeviceNode;
else
DeviceNode = 0i64;
PnpDeleteLockedDeviceNode(DeviceNode, 1, 0, v22, a7, a8);
}
}
return(unsigned int)-2147483608;
}
LABEL_16:
v9 = v28;
}
v16 = 54;
goto LABEL_10;
}
return(unsigned int)-1073741823;
}Referenced by:
PipRemoveDevicesInRelationList
PipSendQueryRemoveIrpAndCheckOpenHandles
PnpProcessQueryRemoveAndEject