1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

windows: Fix another CreateFile usage.

When built with MSVC with unicode enabled, this gave:

warning C4133: 'function': incompatible types - from 'char *' to 'LPCWSTR'

due to CreateFile expanding to CreateFileW which accepts UTF-16 filenames.

The device name used here is in 8-bit format, having come from a call to
wc_to_utf8() in either get_root_hub_name() or get_external_hub_name(). So
we need to use CreateFileA.
This commit is contained in:
Martin Ling 2020-01-24 05:14:47 +00:00 committed by Uwe Hermann
parent 60fc49ceab
commit d6412d2801

View File

@ -265,7 +265,7 @@ static void enumerate_hub(struct sp_port *port, const char *hub_name,
return;
strcpy(device_name, "\\\\.\\");
strcat(device_name, hub_name);
hub_device = CreateFile(device_name, GENERIC_WRITE, FILE_SHARE_WRITE,
hub_device = CreateFileA(device_name, GENERIC_WRITE, FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
free(device_name);
if (hub_device == INVALID_HANDLE_VALUE)