From: drowe67 Date: Sun, 13 May 2018 05:22:32 +0000 (+0000) Subject: attempt at handling com port names with correct MS synthax X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=d4b96d53a28374e116cbc943a7c9866a090d4de3;p=freetel-svn-tracking.git 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 --- 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");