{"id":16156426,"url":"https://github.com/kanglin/com0com","last_synced_at":"2025-04-30T20:05:45.817Z","repository":{"id":84126357,"uuid":"81054890","full_name":"KangLin/com0com","owner":"KangLin","description":null,"archived":false,"fork":false,"pushed_at":"2017-02-06T07:20:43.000Z","size":194,"stargazers_count":2,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T20:05:39.001Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KangLin.png","metadata":{"files":{"readme":"ReadMe.txt","changelog":"Changes.txt","contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-06T06:23:30.000Z","updated_at":"2024-12-30T02:04:02.000Z","dependencies_parsed_at":"2023-04-12T03:16:37.651Z","dependency_job_id":null,"html_url":"https://github.com/KangLin/com0com","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KangLin%2Fcom0com","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KangLin%2Fcom0com/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KangLin%2Fcom0com/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KangLin%2Fcom0com/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KangLin","download_url":"https://codeload.github.com/KangLin/com0com/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251774894,"owners_count":21641731,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T01:44:53.265Z","updated_at":"2025-04-30T20:05:45.809Z","avatar_url":"https://github.com/KangLin.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"                 =============================\r\n                 Null-modem emulator (com0com)\r\n                 =============================\r\n\r\nINTRODUCTION\r\n============\r\n\r\nThe Null-modem emulator is an open source kernel-mode virtual serial\r\nport driver for Windows, available freely under GPL license.\r\nYou can create an unlimited number of virtual COM port\r\npairs and use any pair to connect one application to another.\r\nEach COM port pair provides two COM ports with default names starting\r\nat CNCA0 and CNCB0. The output to one port is the input from other\r\nport and vice versa.\r\n\r\nUsually one port of the pair is used by Windows application that\r\nrequires a COM port to communicate with a device and other port is\r\nused by device emulation program.\r\n\r\nFor example, to send/receive faxes over IP you can connect Windows Fax\r\napplication to CNCA0 port and t38modem (http://t38modem.sourceforge.net/)\r\nto CNCB0 port. In this case the t38modem is a fax modem emulation program.\r\n\r\nIn conjunction with the hub4com the com0com allows you to\r\n  - handle data and signals from a single real serial device by a number of\r\n    different applications. For example, several applications can share data\r\n    from one GPS device;\r\n  - use real serial ports of remote computer like if they exist on the local\r\n    computer (supports RFC 2217).\r\n\r\nThe homepage for com0com project is http://com0com.sourceforge.net/.\r\n\r\n\r\nINSTALLING\r\n==========\r\n\r\nNOTE (x64-based Windows Vista/Windows Server 2008/Windows 7/8):\r\n  The com0com.sys is a test-signed kernel-mode driver that will not load by\r\n  default. To enable test signing, enter command:\r\n\r\n    bcdedit.exe -set TESTSIGNING ON\r\n\r\n  and reboot the computer.\r\n\r\nNOTE:\r\n  Enabling test signing will impair computer security.\r\n\r\nSimply run the installer (setup.exe). An installation wizard will guide\r\nyou through the required steps.\r\nIf the Found New Hardware Wizard will pop up then\r\n  - select \"No, not this time\" and click Next;\r\n  - select \"Install the software automatically (Recommended)\" and click Next.\r\nThe one COM port pair with names CNCA0 and CNCB0 will be available on your\r\nsystem after the installation.\r\n\r\nYou can add more pairs with the Setup Command Prompt:\r\n\r\n  1. Launch the Setup Command Prompt shortcut.\r\n  2. Enter the install command, for example:\r\n\r\n       command\u003e install - -\r\n\r\nThe system will create 3 new virtual devices. One of the devices has\r\nname \"com0com - bus for serial port pair emulator\" and other two of\r\nthem have name \"com0com - serial port emulator\" and located on CNCAn\r\nand CNCBn ports.\r\n\r\nTo get more info enter the help command, for example:\r\n\r\n       command\u003e help\r\n\r\nAlternatively to setup ports you can invoke GUI-based setup utility by\r\nlaunching Setup shortcut (Microsoft .NET Framework 2.0 is required).\r\n\r\nTESTING\r\n=======\r\n\r\n  1. Start the HyperTerminal on CNCA0 port.\r\n  2. Start the HyperTerminal on CNCB0 port.\r\n  3. The output to CNCA0 port should be the input from CNCB0 port and\r\n     vice versa.\r\n\r\n\r\nUNINSTALLING\r\n============\r\n\r\nSimply launch the com0com's Uninstall shortcut in the Start Menu or remove\r\nthe \"Null-modem emulator (com0com)\" entry from the \"Add/Remove Programs\"\r\nsection in the Control Panel. An uninstallation wizard will guide\r\nyou through the required steps.\r\n\r\nHINT: To uninstall the old version of com0com (distributed w/o installer)\r\ninstall the new one and then uninstall it.\r\n\r\n\r\nFAQs \u0026 HOWTOs\r\n=============\r\n\r\nQ. Is it possible to run com0com on Windows 9x platform?\r\nA. No, it is not possible. You need Windows 2000 platform or newer.\r\n\r\nQ. Is it possible to install or uninstall com0com silently (with no user\r\n   intervention and no user interface)?\r\nA. Yes, it's possible with /S option, for example:\r\n\r\n     setup.exe /S\r\n     \"%ProgramFiles%\\com0com\\uninstall.exe\" /S\r\n\r\n   You can specify the installation directory with /D option, for example:\r\n\r\n     setup.exe /S /D=C:\\Program Files\\com0com\r\n\r\n   NOTE: Silent installation of com0com will not install any port pairs by\r\n         default {it can be overriden by setting CNC_INSTALL_CNCA0_CNCB0_PORTS\r\n         and/or CNC_INSTALL_COMX_COMX_PORTS environment variables).\r\n\r\nQ. What are the other setup.exe command line options?\r\nA. The command line options of setup.exe and uninstall.exe listed in\r\n   NSIS Users Manual, section 3.2 Installer Usage:\r\n\r\n     http://nsis.sourceforge.net/Docs/Chapter3.html#3.2\r\n\r\n   Additionally the following environment variables can be used.\r\n\r\n   To change behaviour of setup.exe:\r\n\r\n     CNC_INSTALL_START_MENU_SHORTCUTS={YES|NO}   - select/unselect \"Start Menu Shortcuts\"\r\n     CNC_INSTALL_CNCA0_CNCB0_PORTS={YES|NO}      - select/unselect \"CNCA0 \u003c-\u003e CNCB0\"\r\n     CNC_INSTALL_COMX_COMX_PORTS={YES|NO}        - select/unselect \"COM# \u003c-\u003e COM#\"\r\n     CNC_INSTALL_SKIP_SETUP_PREINSTALL={YES|NO}  - skip preinstalling/updating driver\r\n\r\n   To change behaviour of uninstall.exe:\r\n\r\n     CNC_UNINSTALL_SKIP_SETUP_UNINSTALL={YES|NO} - skip uninstalling devices and driver\r\n\r\nQ. Is it possible to change the names CNCA0 and CNCB0 to COM8 and COM9?\r\nA. Yes, it's possible. To change the names:\r\n\r\n   1. Launch the Setup Command Prompt shortcut.\r\n   2. Enter the change commands, for example:\r\n\r\n      command\u003e change CNCA0 PortName=COM8\r\n      command\u003e change CNCB0 PortName=COM9\r\n\r\n   Alternatively you can set names to 'COM#', for example:\r\n\r\n      command\u003e change CNCA0 PortName=COM#\r\n      command\u003e change CNCB0 PortName=COM#\r\n\r\n   If parameter 'PortName=COM#' is used then the Ports class installer will be\r\n   invoked to set the real port name. The Ports class installer selects the COM\r\n   port number and sets the real port name to COM\u003cn\u003e, where \u003cn\u003e is the selected\r\n   port number. After installing the Ports class port you can use the list\r\n   command to get the real port name and the parameter RealPortName=COM\u003cn\u003e to\r\n   change the real port name, for example:\r\n\r\n      command\u003e list\r\n             CNCA0 PortName=COM#,RealPortName=COM3\r\n             CNCB0 PortName=COM#,RealPortName=COM4\r\n      command\u003e change CNCA0 RealPortName=COM8\r\n      command\u003e change CNCB0 RealPortName=COM9\r\n      command\u003e list\r\n             CNCA0 PortName=COM#,RealPortName=COM8\r\n             CNCB0 PortName=COM#,RealPortName=COM9\r\n\r\nQ. The baud rate setting does not seem to make a difference: data is always\r\n   transferred at the same speed. How to enable the baud rate emulation?\r\nA. To enable baud rate emulation for transferring data from CNCA0 to CNCB0:\r\n\r\n   1. Launch the Setup Command Prompt shortcut.\r\n   2. Enter the change command, for example:\r\n\r\n      command\u003e change CNCA0 EmuBR=yes\r\n\r\nQ. The HyperTerminal test succeeds, but I get a failure when trying to open the\r\n   port with CreateFile(\"CNCA0\", ...). GetLastError() returns ERROR_FILE_NOT_FOUND.\r\nA. You must prefix the port name with the special characters \"\\\\.\\\". Try to open\r\n   the port with CreateFile(\"\\\\\\\\.\\\\CNCA0\", ...).\r\n\r\nQ. My application hangs during its startup when it sends anything to one paired\r\n   COM port. The only way to unhang it is to start HyperTerminal, which is connected\r\n   to the other paired COM port. I didn't have this problem with physical serial\r\n   ports.\r\nA. Your application can hang because receive buffer overrun is disabled by\r\n   default. You can fix the problem by enabling receive buffer overrun for the\r\n   receiving port. Also, to prevent some flow control issues you need to enable\r\n   baud rate emulation for the sending port. So, if your application use port CNCA0\r\n   and other paired port is CNCB0, then:\r\n\r\n   1. Launch the Setup Command Prompt shortcut.\r\n   2. Enter the change commands, for example:\r\n\r\n      command\u003e change CNCB0 EmuOverrun=yes\r\n      command\u003e change CNCA0 EmuBR=yes\r\n\r\nQ. When the corresponding port of a pair is not open, some characters will remain\r\n   in the ouput buffer of the sending port and be output upon the next connection.\r\n   Any clue on a possible workaround?\r\nA. It's a correct behavior if receive buffer overrun is disabled (by default). If\r\n   you need behavior where those characters should be lost (like real null modem do)\r\n   then enable receive buffer overrun for the receiving port. Also, to prevent some\r\n   flow control issues enable baud rate emulation for the sending port. So, if\r\n   sending port is CNCA0 and receiving port is CNCB0, then:\r\n\r\n   1. Launch the Setup Command Prompt shortcut.\r\n   2. Enter the change commands, for example:\r\n\r\n      command\u003e change CNCB0 EmuOverrun=yes\r\n      command\u003e change CNCA0 EmuBR=yes\r\n\r\nQ. I have to write an application connected to one side of the com0com port pair,\r\n   and I don't want users to 'see' all the virtual ports created by com0com, but\r\n   only the really available ones.\r\nA. if your application use port CNCB0 and other (used by users) paired port is CNCA0,\r\n   then CNCB0 can be 'hidden' and CNCA0 can be 'shown' on opening CNCB0 by your\r\n   application. To enable it:\r\n\r\n   1. Launch the Setup Command Prompt shortcut.\r\n   2. Enter the change commands:\r\n\r\n      command\u003e change CNCB0 ExclusiveMode=yes\r\n      command\u003e change CNCA0 PlugInMode=yes\r\n\r\nQ. When I add a port pair, why does Windows XP always pops up a Found New Hardware\r\n   Wizard? The drivers are already there and it can install them silently in the\r\n   background and report when the device is ready.\r\nA. It's because there is not signed com0com.cat catalog file. It can be created on\r\n   your test computer by this way:\r\n\r\n   1. Create a catalog file, for example:\r\n\r\n      cd \"C:\\Program Files\\com0com\"\r\n      inf2cat /driver:. /os:XP_X86\r\n\r\n   2. Create a test certificate, for example:\r\n\r\n      makecert -r -n \"CN=com0com (test)\" -sv com0com.pvk com0com.cer\r\n      pvk2pfx -pvk com0com.pvk -spc com0com.cer -pfx com0com.pfx\r\n\r\n   3. Sign the catalog file by test certificate, for example:\r\n\r\n      signtool sign /v /f com0com.pfx com0com.cat\r\n\r\n   4. Install a test certificate to the Trusted Root Certification Authorities\r\n      certificate store and the Trusted Publishers certificate store, for example:\r\n\r\n      certmgr -add com0com.cer -s -r localMachine root\r\n      certmgr -add com0com.cer -s -r localMachine trustedpublisher\r\n\r\n   The inf2cat, makecert, pvk2pfx, signtool and certmgr tools are included in the\r\n   Windows Driver Kit (WDK).\r\n\r\n   Alternatively you can cancel Found New Hardware Wizard and install driver by\r\n   update command, for example:\r\n\r\n      setupc install - -\r\n      setupc update\r\n\r\n   Additionally you can temporary suppress Plug and Play-related UI messages, for\r\n   example:\r\n\r\n      reg add HKLM\\Software\\Policies\\Microsoft\\Windows\\DeviceInstall\\Settings /v SuppressNewHWUI /t REG_DWORD /d 1 /f\r\n      setupc install - -\r\n      setupc update\r\n      reg add HKLM\\Software\\Policies\\Microsoft\\Windows\\DeviceInstall\\Settings /v SuppressNewHWUI /t REG_DWORD /d 0 /f\r\n\r\n   See http://support.microsoft.com/kb/938596 for more info.\r\n\r\nQ. How to monitor and get the paired port settings (baud rate, byte size, parity\r\n   and stop bits)?\r\nA. It can be done with extended IOCTL_SERIAL_LSRMST_INSERT. See example in\r\n\r\n   http://com0com.sourceforge.net/examples/LSRMST_INSERT/tstser.cpp\r\n\r\nQ. To transfer state to CTS and DSR they wired to RTS and DTR. How to transfer\r\n   state to DCD and RING?\r\nA. The OUT1 can be wired to DCD and OUT2 to RING. Use extended\r\n   IOCTL_SERIAL_SET_MODEM_CONTROL and IOCTL_SERIAL_GET_MODEM_CONTROL to change\r\n   state of OUT1 and OUT2.  See example in\r\n\r\n   http://com0com.sourceforge.net/examples/MODEM_CONTROL/tstser.cpp\r\n\r\nQ. What version am I running?\r\nA. In the device manager, the driver properties page shows the version and date\r\n   of the INF files, while the driver details page shows a version of\r\n   com0com.sys file. The version of com0com.sys file is the version that you\r\n   are running.\r\n\r\nQ. I'm able to use some application to talk to some hardware using com2tcp when\r\n   both the com2tcp 'server' and 'client' are running on the same computer.\r\n   When I try to move the client to a remote computer the application gives me\r\n   a timeout message and has no settings to increase the timeout. How to fix\r\n   the problem?\r\nA. Try to ajust AddRTTO and AddRITO params for application's COM port:\r\n\r\n   1. Launch the Setup Command Prompt shortcut.\r\n   2. Enter the change command, for example:\r\n\r\n      command\u003e change CNCA0 AddRTTO=100,AddRITO=100\r\n\r\nQ. I would like to be able to add, remove and rename virtual comm ports from my\r\n   own custom application. Is there an API that I can use or some command line\r\n   utility that will do the job?\r\nA. The setupc.exe is a command line utility that will do the job. To get more\r\n   info enter:\r\n\r\n      setupc help\r\n\r\n   BTW: The setupg.exe is a GUI wrapper for setupc.exe.\r\n\r\nQ. I need to use com0com ports with an application that doesn't recognize\r\n   com0com ports as \"real\" com ports. It does not see a com0com port even\r\n   though I have changed it's name to COMx. Is there a com0com settings that\r\n   will make the port appear to be a \"real\" com port?\r\nA. Yes, it is. You should put the port to the Ports class, for example:\r\n\r\n   1. Launch the Setup Command Prompt shortcut.\r\n   2. Install the pair of ports, were one of them has name COM#, for example:\r\n\r\n      command\u003e install PortName=COM# -\r\n\r\nQ. I have to somehow add a \"fake\" PNP device in device manager and have it\r\n   connected under COM3. I use PNPComSimulator (http://www.bds.dogma.net/pnp_part2.htm),\r\n   which can fake a PNP Serial device's response when polled by DevManager.\r\n   Is it possible to have the device manager look for PNP equipement via com0com?\r\nA. Yes, it is. The simplest way is to put the port to the Ports class, for example:\r\n\r\n   1. Launch the Setup Command Prompt shortcut.\r\n   2. Install the pair of ports, were one of them has name COM#, for example:\r\n\r\n      command\u003e install 0 PortName=COM# -\r\n\r\n   After installing the Ports class port you can use the list command to get\r\n   the real port name, for example:\r\n\r\n      command\u003e list\r\n             CNCA0 PortName=COM#,RealPortName=COM3\r\n             CNCB0 PortName=-\r\n\r\nQ. Is it possible to configure the com0com to randomly corrupt the data? It\r\n   would be nice to have this feature so that we can test our application\r\n   robustness.\r\nA. Yes, it's possible by setting EmuNoise parameter:\r\n\r\n   1. Launch the Setup Command Prompt shortcut.\r\n   2. Enter the change command, for example:\r\n\r\n      command\u003e change CNCA0 EmuNoise=0.00001,EmuBR=yes,EmuOverrun=yes\r\n      command\u003e change CNCB0 EmuNoise=0.00001,EmuBR=yes,EmuOverrun=yes\r\n\r\n   Now each character frame (including idle frames) will be corrupted with\r\n   probability 0.00001.\r\n\r\nQ. What is the maximum number of port pairs that can be defined?\r\nA. It depends from your system. The com0com itself has internal limit\r\n   1000000 port pairs.\r\n\r\nQ. In my application, users could be installing up to 250 com port pairs.\r\n   Initially, the installation is fairly quick, but each additional com port\r\n   generally takes longer to install than the previous one. It quickly\r\n   becomes unacceptable for a user to be expected to wait for the installation.\r\nA. It's because the installing of each next port pair requires to update driver\r\n   for all installed pairs. You can speed up installing of multiple com port\r\n   pairs by using install commands with --no-update option and then use\r\n   install command w/o --no-update option, for example:\r\n\r\n      command\u003e --no-update install - -\r\n      command\u003e --no-update install - -\r\n      ...\r\n      command\u003e --no-update install - -\r\n      command\u003e install\r\n\r\n   The example of the batch program:\r\n\r\n      cd /D \"%ProgramFiles%\\com0com\"\r\n      FOR /L %%i IN (0,1,249) DO setupc --no-update install - -\r\n      setupc install\r\n\r\nQ. I am using the 64-bit version of com0com and I am having trouble. I'd like\r\n   to debug this, but I can not find any free serial port monitor software,\r\n   like portmon that works with a 64-bit OS. Does anyone know of any?\r\nA. You can try to use internal com0com's tracing for debuging:\r\n\r\n      - get trace.reg file from com0com's source;\r\n      - import trace.reg to the Registry;\r\n      - reload driver (or reboot system);\r\n      - do your tests and watch results in C:\\com0com.log file.\r\n\r\n   To disable tracing reinstall com0com or import trace_disable.reg to the\r\n   Registry and reload driver.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanglin%2Fcom0com","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkanglin%2Fcom0com","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanglin%2Fcom0com/lists"}