From d4b96d53a28374e116cbc943a7c9866a090d4de3 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Sun, 13 May 2018 05:22:32 +0000 Subject: [PATCH] attempt at handling com port names with correct MS synthax git-svn-id: https://svn.code.sf.net/p/freetel/code@3602 01035d8c-6547-0410-b346-abe4f91aad63 --- freedv-dev/src/serialport.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/freedv-dev/src/serialport.cpp b/freedv-dev/src/serialport.cpp index 85184b9e..38de5fef 100644 --- a/freedv-dev/src/serialport.cpp +++ b/freedv-dev/src/serialport.cpp @@ -60,12 +60,18 @@ bool Serialport::openport(const char name[], bool useRTS, bool RTSPos, bool useD goto error; } + // As per: + // https://support.microsoft.com/en-us/help/115831/howto-specify-serial-ports-larger-than-com9 + + TCHAR nameWithStrangePrefix[100]; + StringCchPrintf(nameWithStrangePrefix, 100, "\\\\\\\\.\\\\%s", name); + fprintf(stderr, "nameWithStrangePrefix: %s\n"); if((com_handle=CreateFileA(name - ,GENERIC_READ|GENERIC_WRITE /* Access */ + ,fdwAccess /* Access */ ,0 /* Share mode */ ,NULL /* Security attributes */ ,OPEN_EXISTING /* Create access */ - ,FILE_ATTRIBUTE_NORMAL /* File attributes */ + ,0 /* File attributes */ ,NULL /* Template */ ))==INVALID_HANDLE_VALUE) { StringCchPrintf(lpszFunction, 100, "%s", "CreateFileA"); -- 2.25.1