To share serial ports you must create corresponding keys in Windows registry. There are two ways to accomplish this task: creating registry file and importing it to Windows registry or manually creating the necessary entries using regedit or WinAPI directly from your application.
Let's take a closer look at the registry options:
To share serial ports in a system you must create the following key: HKEY_LOCAL_MACHINE\SOFTWARE\ELTIMA Software\SharedSerialPorts\.
where HKLM\Software\ELTIMA Software\SharedSerialPorts is the main container key that stores all configuration info,
"Shared Port Name" is the
key that has to be the same as the name of the port you are about to share (for
instance, "COM1"),
"Permissions" is the key that stores all necessary entries
to describe the programs, that have custom permissions, different from the
default (R, W),
"List custom permissions for programs" is the list of the
applications that have settings other than default. This list has to stick to
the following syntax:
| Variable name | Full path and permissions |
| Contents (DWORD) | By default the value is Read|Write (0x03) Read - 0x01 Write - 0x02 Control - 0x0 |
and PortSettings is a string of 4 or 5 items, separated by comma. For instance:
nBaudrate,cParity,nDatabits,nStopBits,cFlowControl
Defines serial port baudrate. Possible values are: 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 56000, 57600, 115200, 128000 and 256000. By default, 110 value is taken.
Defines data lengths in a packet. Possible values are: 5, 6, 7 and 8. Default value is 7 bits.
Defines parity is one of the following values: (E)ven, (O)dd, (M)ark, (S)pace, or (N)one. By default (N)one is taken.
Defines a number of stop bits. Possible values are: "1", "1,5" and "2". Default value is "1".
Defines flow control value. Possible values are: Hardware (P), Xon/Xoff (X) and None. Default value is None.
PortSettings parameter could be empty, which means that dynamic connection parameters will be used instead.
Examples:
[HKEY_LOCAL_MACHINE\SOFTWARE\ELTIMA Software\SharedSerialPorts\COM2] |