PnpInvalidateRelationsInList
__int64 __fastcall PnpInvalidateRelationsInList(
_RELATION_LIST *List,
PNP_DEVICE_DELETE_TYPE OperationCode,
char a3,
char a4){
_FILE_OBJECT *RelationList;
_DEVICE_OBJECT_LIST *DeviceObjectList;
unsigned int i;
__int64 v11;
_DEVICE_TAGGED_FOR_REMOVAL v12;
_DEVICE_OBJECT *j;
__int64 v14;
_DEVOBJ_EXTENSION *DeviceObjectExtension;
_DWORD *DeviceNode;
__int64 v18;
int v19;
int v20;
_DEVICE_RELATION_LEVEL RelationLevel;
_DEVICE_TAGGED_FOR_REMOVAL Tagged;
_RELATION_LIST_MARKER Marker;
_DEVICE_OBJECT *DeviceObject[2];
DeviceObject[0] = 0i64;
Tagged = DEVICE_UNTAGGED;
RelationLevel = RELATION_LEVEL_REMOVE_EJECT;
RelationList = (_FILE_OBJECT *)IopAllocateRelationList(OperationCode);
if( !RelationList )
return 3221225626i64;
DeviceObjectList = List->DeviceObjectList;
for( i = 0; i < List->DeviceObjectList->Count; DeviceObjectList = List->DeviceObjectList )
{
v11 = i++;
DeviceObjectList->Devices[v11].Flags &= ~1u;
}
DeviceObjectList->TagCount = 0;
Marker = 0i64;
LABEL_5:
while( IopEnumerateRelations(List, &Marker, DeviceObject, &RelationLevel, &Tagged) )
{
if( (!a3 || RelationLevel == RELATION_LEVEL_REMOVE_EJECT) && Tagged == DEVICE_UNTAGGED )
{
for( j = DeviceObject[0]; ; j = *(_DEVICE_OBJECT **)(v18 + 32) )
{
if( IopSetRelationsTag(List, j, v12) )
{
LABEL_11:
if( j )
IopAddRelationToList(RelationList, (_SHARE_ACCESS *)j);
goto LABEL_5;
}
DeviceObjectExtension = j->DeviceObjectExtension;
DeviceNode = DeviceObjectExtension->DeviceNode;
if( a4 )
{
PipClearDevNodeFlags((_DEVICE_NODE *)DeviceObjectExtension->DeviceNode, 0x80000ui64);
v19 = DeviceNode[99];
if( (v19 & 0x10) != 0 )
{
if( (v19 & 0x2000) != 0 && DeviceNode[101] == 47 )
{
v20 = 3;
}
else
{
if( OperationCode != EjectDevice )
goto LABEL_17;
v20 = 12;
}
PnpRequestDeviceAction(j, v20, 1, 0i64, 0i64, 0i64, 0i64);
}
}
LABEL_17:
v18 = *((_QWORD *)DeviceNode + 2);
if( !v18 )
{
j = 0i64;
goto LABEL_11;
}
}
}
}
Marker = 0i64;
while( IopEnumerateRelations((_RELATION_LIST *)RelationList, &Marker, DeviceObject, 0i64, 0i64) )
PnpRequestDeviceAction(DeviceObject[0], 9, 0, v14, 0i64, 0i64, 0i64);
IopFreeRelationList((_RELATION_LIST *)RelationList);
return 0i64;
}Referenced by:
PnpProcessCompletedEject
PnpProcessQueryRemoveAndEject