Merge pull request #6762 from akallabeth/drive_hotplug_fix

Fixed drive hotplug path comparison.
This commit is contained in:
Martin Fleisz 2021-01-27 11:30:02 +01:00 committed by GitHub
commit 95b7f3b46d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -739,12 +739,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++)
@ -754,13 +760,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;
}