From d6412d280180ed87cb07578d5d15d09d775b9f7d Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Fri, 24 Jan 2020 05:14:47 +0000 Subject: [PATCH] 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. --- windows.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows.c b/windows.c index f9c2c41..2825a92 100644 --- a/windows.c +++ b/windows.c @@ -265,8 +265,8 @@ 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, - NULL, OPEN_EXISTING, 0, NULL); + hub_device = CreateFileA(device_name, GENERIC_WRITE, FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, 0, NULL); free(device_name); if (hub_device == INVALID_HANDLE_VALUE) return;