IopSortRelationListForRemove
NTSTATUS __stdcall IopSortRelationListForRemove(_RELATION_LIST *RelationList){
_DEVICE_OBJECT_LIST *DeviceObjectList;
int v3;
__int64 v4;
_DEVICE_OBJECT *DeviceObject;
_QWORD *DeviceNode;
char v7;
char v8;
char v9;
_DEVICE_OBJECT *v10;
__int64 v11;
_LIST_ENTRY *ProviderList;
_LIST_ENTRY *Flink;
int v14;
char v16;
UINT64 DependencyTypes;
_DEVICE_OBJECT *Provider;
Provider = 0i64;
if( RelationList->Sorted )
return 0;
PnpAcquireDependencyRelationsLock(0);
DeviceObjectList = RelationList->DeviceObjectList;
v3 = 0;
v4 = 0i64;
if( !RelationList->DeviceObjectList->Count )
goto LABEL_19;
do
{
DeviceObject = DeviceObjectList->Devices[v4].DeviceObject;
if( DeviceObject )
DeviceNode = DeviceObject->DeviceObjectExtension->DeviceNode;
else
DeviceNode = 0i64;
if( DeviceNode[2] || (DeviceNode[81] & 0xFFFFFFFFFFFFFFFEui64) != 0 )
{
PipIsDeviceInDeviceObjectList();
v8 = v7;
}
else
{
v8 = 0;
}
v9 = 0;
ProviderList = PiGetProviderList(DeviceObject);
Flink = ProviderList->Flink;
if( ProviderList->Flink != ProviderList )
{
while( 1 )
{
PiEnumerateProviderListEntry(Flink, &Provider, &DependencyTypes);
v10 = Provider;
if( Provider )
{
PipIsDeviceInDeviceObjectList();
if( v16 )
break;
}
Flink = Flink->Flink;
if( Flink == ProviderList )
goto LABEL_8;
}
v9 = 1;
}
LABEL_8:
if( v8 || v9 )
{
*(_DWORD *)(v11 + 24 * v4 + 32) &= ~4u;
}
else
{
*(_DWORD *)(v11 + 24 * v4 + 32) |= 4u;
++v3;
}
DeviceObjectList = RelationList->DeviceObjectList;
v4 = (unsigned int)(v4 + 1);
}
while( (unsigned int)v4 < RelationList->DeviceObjectList->Count );
if( v3 )
{
v14 = PipSortDeviceObjectList(&RelationList->DeviceObjectList, (UINT64)v10);
if( v14 >= 0 )
RelationList->Sorted = 1;
}
else
{
LABEL_19:
v14 = -1073741823;
}
ExReleaseResourceLite((PERESOURCE)((char *)&stru_140C452E0 + 384));
PpDevNodeUnlockTree(PPL_SIMPLE_READ);
return v14;
}Referenced by:
PipRemoveDevicesInRelationList
PnpBuildRemovalRelationList