reactos/drivers/storage/partmgr
Hermès Bélusca-Maïto 9e07d0cc74
[PARTMGR] Trigger mount points removal when a partition/volume is deleted (#7034)
CORE-18139

When a partition is created, PartMgr notifies the volume manager
(FTDisk on Windows <= 2003, VolMgr on Vista+) of its presence.
(Note that currently in ReactOS, our partmgr does the job of both
PartMgr *AND* VolMgr.)
The VolMgr then sends a `GUID_DEVINTERFACE_VOLUME` PnP notification,
which is handled by the mount manager (MountMgr) as part of a
`GUID_DEVICE_INTERFACE_ARRIVAL` notification:
```
MountMgr!MountMgrMountedDeviceNotification -> MountMgrMountedDeviceArrival
followed by
MountMgr!MountMgrTargetDeviceNotification
```

When a partition is deleted, via e.g. Disk Management or DiskPart,
it can be observed, on Windows, that the PartMgr gets notified by
the PnP manager, as part of QueryDeviceRelations. Before actually
removing the partition, it notifies the VolMgr. The latter invalidates
any volume mounted on that partition (`*PartitionRemoved*` functions
for basic volumes), then requests (`*DeleteMountPoints` function)
the MountMgr to delete all the mount points associated to the volume:
```
VolMgr!*DeleteMountPoints
-> MountMgr!MountMgrDeviceControl -> MountMgrDeletePoints
```
**** THIS is the new functionality that is implemented for ReactOS ****
**** in the present commit.                                        ****

Following this, a subsequent PnP notification is sent, which calls
```
MountMgr!MountMgrTargetDeviceNotification
-> MountMgr!MountMgrMountedDeviceRemoval
```
(Note that this observation somewhat invalidates the modification
made in ReactOS commit 62a4f9d42b : our MountMgr placed in Windows
*WOULD* receive a `GUID_TARGET_DEVICE_REMOVE_COMPLETE` target-device
notification...)

Finally, a `GUID_DEVICE_INTERFACE_REMOVAL` PnP notification is sent
to the MountMgr:
```
MountMgr!MountMgrMountedDeviceNotification
-> MountMgr!MountMgrMountedDeviceRemoval
```
2024-07-11 13:46:52 +02:00
..
CMakeLists.txt [BOOTDATA] Fix boot (addendum to dd56e065bc) 2020-12-06 01:55:20 +03:00
debug.h [PARTMGR] Add the Partition Manager driver 2020-11-13 03:04:15 +03:00
guid.c [PARTMGR] Add the Partition Manager driver 2020-11-13 03:04:15 +03:00
partition.c [PARTMGR] Trigger mount points removal when a partition/volume is deleted (#7034) 2024-07-11 13:46:52 +02:00
partmgr.c [PARTMGR] Detect and flag partitionless ("super-floppy") disks (#6926) 2024-06-12 12:15:22 +02:00
partmgr.h [PARTMGR] Reimplement IOCTL_MOUNTDEV_QUERY_UNIQUE_ID for MBR and GPT partitions (#6926) 2024-06-12 12:15:31 +02:00
partmgr.rc [PARTMGR] Add the Partition Manager driver 2020-11-13 03:04:15 +03:00
partmgr_reg.inf [PARTMGR] Add the Partition Manager driver 2020-11-13 03:04:15 +03:00
utils.c [PARTMGR] Add the Partition Manager driver 2020-11-13 03:04:15 +03:00