Windows: honor notification suppression when dismounting

Guard both direct SHChangeNotify flushes with DeviceChangeBroadcastDisabled.
These calls bypass BroadcastDeviceChange and its suppression check.
This commit is contained in:
Mounir IDRASSI
2026-10-13 19:40:10 +09:00
parent b31bd203d4
commit c44fce5000
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -9827,7 +9827,7 @@ retry:
removal before the process exits, leaving a ghost drive letter.
Re-send the notification with SHCNF_FLUSH to force synchronous
processing by Explorer before we return. */
if (Silent)
if (Silent && !DeviceChangeBroadcastDisabled)
{
wchar_t root[] = { (wchar_t) (nDosDriveNo + L'A'), L':', L'\\', 0 };
SHChangeNotify (SHCNE_DRIVEREMOVED, SHCNF_PATH | SHCNF_FLUSH, root, NULL);
+1 -1
View File
@@ -6350,7 +6350,7 @@ retry:
/* GH #337, GH #1426: Flush shell notifications synchronously in
silent/CLI mode to prevent ghost drive letters when the process
exits immediately after dismount. */
if (Silent)
if (Silent && !DeviceChangeBroadcastDisabled)
{
DWORD removedDrives = prevMountList.ulMountedDrives & ~mountList.ulMountedDrives;
for (i = 0; i < 26; i++)