PnpInvalidateRelationsInList
INT64 __stdcall PnpInvalidateRelationsInList(
_RELATION_LIST *RelationsList,
_PNP_DEVICE_DELETE_TYPE OperationCode,
UINT8 OnlyDeviceRelations,
UINT8 RestartDevNode){
unsigned int **RelationList;
_DEVICE_OBJECT_LIST *DeviceObjectList;
unsigned int i;
__int64 v11;
_DEVICE_OBJECT *j;
unsigned __int64 v13;
__int64 v15;
__int64 v16;
__int64 v17;
int v18;
_PNP_DEVICE_ACTION_REQUEST v19;
int a4;
int a5;
int a2[2];
PVOID Object[2];
Object[0] = 0i64;
a5 = 0;
a4 = 0;
RelationList = (unsigned int **)IopAllocateRelationList((unsigned int)OperationCode);
if( !RelationList )
return 3221225626i64;
DeviceObjectList = RelationsList->DeviceObjectList;
for( i = 0; i < RelationsList->DeviceObjectList->Count; DeviceObjectList = RelationsList->DeviceObjectList )
{
v11 = i++;
DeviceObjectList->Devices[v11].Flags &= ~1u;
}
DeviceObjectList->TagCount = 0;
*(_QWORD *)a2 = 0i64;
LABEL_5:
while( IopEnumerateRelations((unsigned int **)RelationsList, a2, Object, &a4, &a5) )
{
if( (!OnlyDeviceRelations || !a4) && !a5 )
{
for( j = (_DEVICE_OBJECT *)Object[0]; ; j = *(_DEVICE_OBJECT **)(v17 + 32) )
{
if( (unsigned int)IopSetRelationsTag((int **)RelationsList, (__int64)j) )
{
LABEL_11:
if( j )
IopAddRelationToList((INT64)RelationList, (INT64)j, 2i64, 0i64);
goto LABEL_5;
}
v15 = *((_QWORD *)j + 39);
v16 = *(_QWORD *)(v15 + 40);
if( RestartDevNode )
{
PipClearDevNodeFlags(*(_DEVICE_NODE **)(v15 + 40), 0x80000ui64);
v18 = *(_DWORD *)(v16 + 396);
if( (v18 & 0x10) != 0 )
{
if( (v18 & 0x2000) != 0 && *(_DWORD *)(v16 + 404) == 47 )
{
v19 = ClearEjectProblem;
}
else
{
if( OperationCode != EjectDevice )
goto LABEL_17;
v19 = ResetDevice;
}
PnpRequestDeviceAction(j, v19, 1u, 0i64, 0i64, 0i64);
}
}
LABEL_17:
v17 = *(_QWORD *)(v16 + 16);
if( !v17 )
{
j = 0i64;
goto LABEL_11;
}
}
}
}
*(_QWORD *)a2 = 0i64;
while( IopEnumerateRelations(RelationList, a2, Object, 0i64, 0i64) )
PnpRequestDeviceAction((_DEVICE_OBJECT *)Object[0], ReenumerateDeviceTree, 0, v13, 0i64, 0i64);
IopFreeRelationList(RelationList);
return 0i64;
}Referenced by:
PnpProcessCompletedEject
PnpProcessQueryRemoveAndEject