PiSwProcessParentRemoveIrp

VOID __stdcall PiSwProcessParentRemoveIrp(_DEVICE_OBJECT *ParentDeviceObject){
  INT64 v1; 
  _DEVICE_OBJECT *v2; 
  _UNICODE_STRING *v3; 
  _ETHREAD *CurrentThread; 
  __int64 *v5; 
  __int64 *v6; 
  WCHAR *Buffer; 
  _PI_SWD_OBJECT *SwDevice; 
  _DEVICE_OBJECT *v9; 

  v2 = ParentDeviceObject;
  if( ParentDeviceObject )
    ParentDeviceObject = (_DEVICE_OBJECT *)ParentDeviceObject->DeviceObjectExtension->DeviceNode;
  v3 = (_UNICODE_STRING *)((unsigned __int64)&ParentDeviceObject->Timer & -(__int64)(ParentDeviceObject != 0i64));
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --CurrentThread->Tcb.KernelApcDisable;
  ExAcquireResourceExclusiveLite((UINT64)&PiSwLockObj, 1, v1);
  v5 = (__int64 *)PiSwGlobalPdoAssociationList;
  while( v5 != &PiSwGlobalPdoAssociationList )
  {
    v6 = v5;
    v5 = (__int64 *)*v5;
    if( (_DEVICE_OBJECT *)v6[2] == v2 )
    {
      v9 = (_DEVICE_OBJECT *)v6[3];
      if( (*((_DWORD *)v9->DeviceExtension + 2) & 0x20) == 0 )
        PiSwProcessRemove(v9, 0);
      PiSwDestroyDeviceObject(v9);
    }
  }
  if( v3 )
  {
    Buffer = v3->Buffer;
    if( Buffer )
    {
      SwDevice = PiSwFindSwDevice(Buffer);
      if( !SwDevice || (SwDevice[1] & 1) == 0 && !SwDevice[45] )
        PiSwCloseDescendants(v3);
    }
  }
  ExReleaseResourceLite(&PiSwLockObj);
  KeLeaveCriticalRegionThread(KeGetCurrentThread());
}

Referenced by:

IopRemoveDevice