PnpBuildRemovalRelationList

__int64 __fastcall PnpBuildRemovalRelationList(__int64 a1, int a2, __int64 a3, _RELATION_LIST **a4){
  __int64 v4; 
  __int64 v8; 
  _RELATION_LIST *BugCheckParameter3; 
  _RELATION_LIST *v10; 
  int v11; 

  v4 = *(_QWORD *)(a1 + 312);
  *a4 = 0i64;
  v8 = *(_QWORD *)(v4 + 40);
  BugCheckParameter3 = IopAllocateRelationList((PNP_DEVICE_DELETE_TYPE)a2);
  v10 = BugCheckParameter3;
  if( !BugCheckParameter3 )
    return 3221225626i64;
  v11 = PnpProcessRelation(v8, a2, (_UNICODE_STRING *)2, a3, BugCheckParameter3);
  if( v11 < 0 )
  {
    IopFreeRelationList(v10);
  }
  else
  {
    *a4 = v10;
    IopSortRelationListForRemove(v10);
  }
  return(unsigned int)v11;
}

Referenced by:

PnpProcessQueryRemoveAndEject