Hi,
It looks like mountmgr.sys does not remove drives when devices are
unmounted. We should look at the is_mounted property and take the
appropriate action when it changes.
>From 81569076d1c1a77c32190338d46abf67b1392380 Mon Sep 17 00:00:00 2001
From: Lei Zhang <the...@google.com>
Date: Thu, 30 Oct 2008 16:33:57 -0700
Subject: [PATCH] mountmgr: Add and remove drives when they are (un)mounted.
---
dlls/mountmgr.sys/hal.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/mountmgr.sys/hal.c b/dlls/mountmgr.sys/hal.c
index e1d3da1..53aa10c 100644
--- a/dlls/mountmgr.sys/hal.c
+++ b/dlls/mountmgr.sys/hal.c
@@ -129,6 +129,15 @@ static void new_device( LibHalContext *ctx, const char *udi )
if (!p_libhal_device_get_property_bool( ctx, parent, "storage.removable", &error ))
goto done;
+ /* add property watch for mount point */
+ p_libhal_device_add_property_watch( ctx, udi, &error );
+
+ if (!p_libhal_device_get_property_bool( ctx, udi, "volume.is_mounted", &error ))
+ {
+ TRACE( "%s not mounted\n", udi );
+ goto done;
+ }
+
if (!(type = p_libhal_device_get_property_string( ctx, parent, "storage.drive_type", &error )))
p_dbus_error_free( &error ); /* ignore error */
@@ -137,9 +146,6 @@ static void new_device( LibHalContext *ctx, const char *udi )
add_dos_device( -1, udi, device, mount_point, drive_type );
- /* add property watch for mount point */
- p_libhal_device_add_property_watch( ctx, udi, &error );
-
done:
if (type) p_libhal_free_string( type );
if (parent) p_libhal_free_string( parent );
@@ -170,7 +176,13 @@ static void property_modified (LibHalContext *ctx, const char *udi,
TRACE( "udi %s key %s %s\n", wine_dbgstr_a(udi), wine_dbgstr_a(key),
is_added ? "added" : is_removed ? "removed" : "modified" );
- if (!strcmp( key, "volume.mount_point" )) new_device( ctx, udi );
+ if (!strcmp( key, "volume.is_mounted" ))
+ {
+ if (p_libhal_device_get_property_bool( ctx, udi, "volume.is_mounted", NULL ))
+ new_device( ctx, udi );
+ else
+ removed_device( ctx, udi );
+ }
}
--
1.5.4.5