When stopping the service, automatically disconnect shared folder on windows. Not dismounting could lead to multiple shared folders. --- Changes since v1: - New patch --- spice/spice-webdavd.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c index 55b7bbb..74d4efc 100644 --- a/spice/spice-webdavd.c +++ b/spice/spice-webdavd.c @@ -805,6 +805,28 @@ map_drive(GTask *task, return; } + +static void +unmap_drive(void) +{ + gchar local_name[3]; + guint32 retval; + + local_name[0] = drive_letter; + local_name[1] = ':'; + local_name[2] = 0; + + retval = WNetCancelConnection2(local_name, CONNECT_UPDATE_PROFILE, TRUE); + + if (retval == NO_ERROR) + g_debug ("unmap_drive ok"); + else if (retval == ERROR_NOT_CONNECTED) + g_debug ("drive not connected"); + else + g_error ("map_drive error %d", retval); + + return; +} #endif static void @@ -894,6 +916,7 @@ service_ctrl_handler (DWORD ctrl, DWORD type, LPVOID data, LPVOID ctx) { case SERVICE_CONTROL_STOP: case SERVICE_CONTROL_SHUTDOWN: + unmap_drive (); quit (SIGTERM); service_status.dwCurrentState = SERVICE_STOP_PENDING; SetServiceStatus (service_status_handle, &service_status); -- 2.5.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel