X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=windows.c;h=2825a92082672a3c05aa5997390dc5d25f5b00b7;hb=refs%2Fheads%2Fmaster;hp=357feed1e80009f5e19e8cbd750ee135051178ae;hpb=6aaf844863e63b71b5cf6b557bf3cd9257b5cffd;p=libserialport.git
diff --git a/windows.c b/windows.c
index 357feed..2825a92 100644
--- a/windows.c
+++ b/windows.c
@@ -18,8 +18,6 @@
* along with this program. If not, see .
*/
-#include
-#include "libserialport.h"
#include "libserialport_internal.h"
/* USB path is a string of at most 8 decimal numbers < 128 separated by dots. */
@@ -145,7 +143,7 @@ static char *get_string_descriptor(HANDLE hub_device, ULONG connection_index,
desc_req->SetupPacket.wValue = (USB_STRING_DESCRIPTOR_TYPE << 8)
| descriptor_index;
desc_req->SetupPacket.wIndex = 0;
- desc_req->SetupPacket.wLength = size - sizeof(*desc_req);
+ desc_req->SetupPacket.wLength = (USHORT) (size - sizeof(*desc_req));
if (!DeviceIoControl(hub_device,
IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION,
@@ -267,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;
@@ -469,9 +467,9 @@ SP_PRIV enum sp_return get_port_details(struct sp_port *port)
if (!(escaped_port_name = malloc(strlen(port->name) + 5)))
RETURN_ERROR(SP_ERR_MEM, "Escaped port name malloc failed");
sprintf(escaped_port_name, "\\\\.\\%s", port->name);
- handle = CreateFile(escaped_port_name, GENERIC_READ, 0, 0,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED, 0);
+ handle = CreateFileA(escaped_port_name, GENERIC_READ, 0, 0,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED, 0);
free(escaped_port_name);
CloseHandle(handle);