IopSortRelationListForRemove
__int64 __fastcall IopSortRelationListForRemove(__int64 a1){
INT64 *v2;
int v3;
__int64 v4;
INT64 v5;
__int64 v6;
unsigned __int64 v7;
bool v8;
char v9;
__int64 v10;
LIST_ENTRY *ProviderList;
LIST_ENTRY *Flink;
int v13;
UINT64 DependencyTypes;
DEVICE_OBJECT *Provider;
Provider = 0i64;
if( *(_BYTE *)(a1 + 8) )
{
return 0;
}
else
{
PnpAcquireDependencyRelationsLock(0);
v2 = *(INT64 **)a1;
v3 = 0;
v4 = 0i64;
if( !**(_DWORD **)a1 )
goto LABEL_19;
do
{
v5 = v2[3 * v4 + 2];
if( v5 )
v6 = *(_QWORD *)(*(_QWORD *)(v5 + 312) + 40i64);
else
v6 = 0i64;
v7 = *(_QWORD *)(v6 + 16);
v8 = (v7 || (v7 = *(_QWORD *)(v6 + 648) & 0xFFFFFFFFFFFFFFFEui64) != 0)
&& PipIsDeviceInDeviceObjectList(v2, *(_QWORD *)(v7 + 32), 0i64);
v9 = 0;
ProviderList = PiGetProviderList((DEVICE_OBJECT *)v5);
Flink = ProviderList->Flink;
if( ProviderList->Flink != ProviderList )
{
while( 1 )
{
PiEnumerateProviderListEntry(Flink, &Provider, &DependencyTypes);
if( Provider )
{
if( PipIsDeviceInDeviceObjectList(*(INT64 **)a1, (INT64)Provider, 0i64) )
break;
}
Flink = Flink->Flink;
if( Flink == ProviderList )
goto LABEL_8;
}
v9 = 1;
}
LABEL_8:
if( v8 || v9 )
{
*(_DWORD *)(v10 + 24 * v4 + 32) &= ~4u;
}
else
{
*(_DWORD *)(v10 + 24 * v4 + 32) |= 4u;
++v3;
}
v2 = *(INT64 **)a1;
v4 = (unsigned int)(v4 + 1);
}
while( (unsigned int)v4 < **(_DWORD **)a1 );
if( v3 )
{
v13 = PipSortDeviceObjectList((unsigned int **)a1);
if( v13 >= 0 )
*(_BYTE *)(a1 + 8) = 1;
}
else
{
LABEL_19:
v13 = -1073741823;
}
ExReleaseResourceLite(&PiDependencyRelationsLock);
PpDevNodeUnlockTree(0);
}
return(unsigned int)v13;
}Referenced by:
PipRemoveDevicesInRelationList
PnpBuildRemovalRelationList