diff --git a/serialport.c b/serialport.c index b2e4a79..0a46688 100644 --- a/serialport.c +++ b/serialport.c @@ -488,7 +488,7 @@ SP_API enum sp_return sp_open(struct sp_port *port, enum sp_mode flags) if (flags & SP_MODE_WRITE) desired_access |= GENERIC_WRITE; - port->hdl = CreateFile(escaped_port_name, desired_access, 0, 0, + port->hdl = CreateFileA(escaped_port_name, desired_access, 0, 0, OPEN_EXISTING, flags_and_attributes, 0); free(escaped_port_name); diff --git a/windows.c b/windows.c index 0521716..bc07e23 100644 --- a/windows.c +++ b/windows.c @@ -467,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);