Fixed drive hotplug path comparison.
authorArmin Novak <armin.novak@thincast.com>
Wed, 27 Jan 2021 08:25:26 +0000 (09:25 +0100)
committerakallabeth <akallabeth@users.noreply.github.com>
Thu, 25 Feb 2021 08:51:41 +0000 (09:51 +0100)
(cherry picked from commit c7bf33aad04822eb6400459114d405031edb376a)

channels/rdpdr/client/rdpdr_main.c

index a1db3b9..e59bf0f 100644 (file)
@@ -741,12 +741,18 @@ static BOOL device_already_plugged(rdpdrPlugin* rdpdr, const hotplug_dev* device
        BOOL rc = FALSE;
        int count, x;
        ULONG_PTR* keys = NULL;
+       WCHAR* path = NULL;
+       int status;
 
        if (!rdpdr || !device)
                return TRUE;
        if (!device->to_add)
                return TRUE;
 
+       status = ConvertToUnicode(CP_UTF8, 0, device->path, -1, &path, 0);
+       if (status <= 0)
+               return TRUE;
+
        ListDictionary_Lock(rdpdr->devman->devices);
        count = ListDictionary_GetKeys(rdpdr->devman->devices, &keys);
        for (x = 0; x < count; x++)
@@ -756,13 +762,14 @@ static BOOL device_already_plugged(rdpdrPlugin* rdpdr, const hotplug_dev* device
 
                if (!device_ext || (device_ext->device.type != RDPDR_DTYP_FILESYSTEM) || !device_ext->path)
                        continue;
-               if (strcmp(device_ext->path, device->path) == 0)
+               if (_wcscmp(device_ext->path, path) == 0)
                {
                        rc = TRUE;
                        break;
                }
        }
        free(keys);
+       free(path);
        ListDictionary_Unlock(rdpdr->devman->devices);
        return rc;
 }