attempt at handling com port names with correct MS synthax
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 13 May 2018 05:22:32 +0000 (05:22 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 13 May 2018 05:22:32 +0000 (05:22 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3602 01035d8c-6547-0410-b346-abe4f91aad63

freedv-dev/src/serialport.cpp

index 85184b9e091ef5fdccbac161089821ac1e44dbdf..38de5feff2553453516248b40a3290b52b5ad4cb 100644 (file)
@@ -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");