PiSwCloseDescendants

VOID __stdcall PiSwCloseDescendants(_UNICODE_STRING *ParentDeviceInstancePath){
  char v1; 
  char v2; 
  _QWORD *BusRelations; 
  _QWORD *v4; 
  _QWORD *v5; 
  INT64 v6; 

  v2 = v1;
  BusRelations = PiSwFindBusRelations((__int64)ParentDeviceInstancePath);
  if( BusRelations )
  {
    v4 = BusRelations + 2;
    v5 = (_QWORD *)BusRelations[2];
    while( v5 != v4 )
    {
      v6 = (INT64)(v5 - 12);
      v5 = (_QWORD *)*v5;
      if( (*(_DWORD *)(v6 + 4) & 1) == 0 && (!v2 || PiSwIsPdoAssociationsEmpty(v6)) )
      {
        PiSwCloseDescendants((_UNICODE_STRING *)(v6 + 72));
        PiSwCloseDevice((_PI_SWD_OBJECT *)v6);
      }
    }
  }
}

Referenced by:

PiSwCloseDescendants
PiSwIrpCleanup
PiSwProcessParentRemoveIrp