Index




COM Port Manager - ComPortMan V0.9.2

Getting Started

Installation

Configuration

Problems

History

Licence agreement




Homepage:
http://www.uwe-sieber.de/comportman_e.html


EMail:
mail@uwe-sieber.de







Getting started



ComPortMan is a Windows service that gives control over Window's COM-port assignment. Running as service makes it independent of the logged on user's privileges, so there is no need to give the users the privilege to change COM-ports in the Windows Device Management.

You can define new default COM-ports for USB-to-Serial devices or any other type of serial device.
It can keep clean the Windows COM name arbiter and show balloon-tips for newly attached ports.

ComPortMan works with Windows 2000, XP, Server 2003, Vista, Windows 7 and Server 2008. The x64 version works on x64 editions of Windows only.

It is primarily tested under
  • Windows XP SP3
  • Windows 7 Ultimate
  • Windows 7 Ultimate x64


    Installation

    ComPortMan does not come with a SETUP.EXE, it's all manual work. See Section Installation.



    Conditions

    The software is not limited or crippled in any way. It's fully functional without a time limit. There is no "full version".

    ComPortMan is Freeware for private and educational use only. Otherwise a licence is required per computer after a 30 day test period.
    "Educational" means institutions where the students outnumber the employees.
    Furthermore it's free for public, free of charge libraries.

    Price list is available here:
    http://www.uwe-sieber.de/comportman_e.html

    Licence agreement


    Why?

    When a new COM-port appears in the system then Windows does not assing the first free number, instead it assigns the first number which has never been used before.

    The reservation of former used port numbers is stored in the registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter
    I've made tool for deleting the reservation manually:
    http://www.uwe-sieber.de/misc_tools_e.html#com_ports


    With ComPortMan you can define which COM-port-number is assigned to a port by some criteria.







    Installation



    Unzip the distribution file (ComPortMan.ZIP), e.g. to your programs folder (a ComPortMan folder is included). On NTFS formatted drives this requires admin privileges.
    As result the files should be in a folder like C:\Program Files\ComPortMan

    Under Vista and Windows 7 I suggest to install ComPortMan in a different folder than C:\Program Files, because under this folder changes of the ComPortMan.INI made by a non elevated user are redirected into the "Vista Virtual Store" where ComPortMan will not read it.
    In a folder like C:\Tools\ComPortMan there is no problem. You should give the folder the same access rights as the C:\Program Files folder to prevent bad software replacing the ComPortMan.EXE or modifying the ComPortMan.INI for getting started with higher privileges!

    ComPortMan will not run from a network or subst drive, it must be located on a "real" local drive.

    Then enter your prefered configuration into the ComPortMan.INI (see below). There is a sample file
    included called ComPortMan_sample.INI. Either create a new ComPortMan.INI or rename the sample file.
    On an NTFS formatted drive editing the ComPortMan.INI requires admin privileges. Under Vista/Win7 you should start the Editor elevated, otherwise the ComPortMan.INI might be redirected into the Vista virtual store where it has no effect.

    If you are logged on with administrator privileges you can simply install the ComPortMan service.

    _install.cmd

    This does not copy any files, it only registers ComPortMan as service and starts the service.
    Without administrator privileges you will be asked for.

    Once installed ComPortMan is permanently running as Windows service. The service starts automatically on Windows startup.
    Remember: Once installed as service it does not matter from where the service is started. The ComPortMan.EXE is loaded from the folder where the _install.cmd had been started from!


    Uninstallation:
    You can uninstall the service using parameter -uninstall, this is what the _uninstall.cmd does:

    _uninstall.cmd

    This stops the service and unregisters it.

    Installation and uninstallation can be done without the message box by using

    ComPortMan -silentinstall
    ComPortMan -silentuninstall

    It returns Errorlevel 0 on success, 1 on failure.

    You can stop and start the installed service by means of the NET command:

    net stop ComPortMan
    net start ComPortMan

    or by means of the _stop and _start command script which are using the ComPortMan.EXE and request admin previleges if required.


    You can change the COM-port settings in the ComPortMan.INI without restarting the service because it's checked for changes each time a COM-device event occurs.

    Most settings take effect without restarting the service.

    See configuration.


    Hint:

    The command scripts contain simple command lines only like
    ComPortMan -install
    Therefore they must be started from the ComPortMan folder, otherwise the ComPortMan.EXE isn't found. To make the CMD file work when started from another folder modify them this way:
    "%~dp0ComPortMan" -install

    %~dp0 is the placeholder for the drive and path to the CMD file. How does it work? %0 is placeholder for the running CMD file like C:\Program Files\ComPortMan\_install.cmd.
    ~dp is a "modifier" which delivers drive and path like C:\Program Files\ComPortMan. Because of the possible space character in the path it must be quoted.

    Read more about batch parameters and modifiers here:
    http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx







    Configuration



    The desired COM-ports are defined in a text file called ComPortMan.INI located in the same place as the ComPortMan.EXE.
    Modern applications often store their settings in the Windows registry but I don't like that. INI files are the 'classic' approach. 

    Windows Vista, Windows 7, Server 2008:
    Since Vista the "Virtual Store" might redirect the INI file to
    C:\Users\(UserName)\AppData\Local\VirtualStore\Program Files\ComPortMan
    when you modifiy or copy it.
    But the ComPortMan service always reads from its own folder. So, since Vista always edit the INI file as "real" Administrator.
    Or install ComPortMan into a different folder, for instance to C:\Tools\ComPortMan because the Vista Virtual Store deals with the "C:\Program Files" folder only.



    How INI files work:
    INI files have sections leaded in by names in square brackets, e.g. [ComPorts] or [BalloonTips]. The settings relevant to that section appear below the section name.
    Each section name is allowed to exist once only! Same thing for the values within a section.
    Comment lines begin with a semicolon. Never try to deactivate a section this way:

    ;[ComPorts20]

    This extends the previous section to the begin of the next section which leads to unexpected results. This is the right way:

    [xxxx ComPorts20]

    It is still a new section but with no effect because of the unknown name.


    Settings in the Registry:
    ComPortMan can read its settings from the registry too. It reads from
    HKLM/Software/Uwe Sieber/ComPortMan

    If this registry key exists, then the ComPortMan.INI is ignored! Only the log file settings are read from the INI then.

    To make ComPortMan see changes in the registry, change the (Standard) value under HKLM/Software/Uwe Sieber/ComPortMan to any different value than before. ComPortMan reads the configuration again then.
    Here is a sample REG file (do not execute it unchanged): http://www.uwe-sieber.de/files/comportman_sample.reg

    Under x64 Windows the Win32 edition of ComPortMan is redirected to
    HKLM/Software/Wow6432Node/Uwe Sieber/ComPortMan
    so better use the x64 version here.


    Simple Samples

    Without a configuration ComPortMan does not touch the COM-port assignments.

    For each type of COM-port you need a different handling for you need one [ComPortsXX] section. Which section is used for a port is controlled by the criterias defined in each section. Each section needs at least one criteria.
    The ListComPorts tool shows some data about all currently present ports, these data can be used as criterias.

    Sample of ListComPorts output:

    PortName      : COM2
    KernelName    : \Device\Serial0
    DeviceID      : ACPI\PNP0501\1
    FriendlyName  : Communications Port (COM2)
    IRQ           : 7
    IoPort        : 3F8

    PortName      : COM7
    KernelName    : \Device\sscdmdm0
    DeviceID      : USB\VID_04E8&PID_6601&MI_00\9&34C622D7&0&4_00
    FriendlyName  : SAMSUNG Mobile Modem #2


    If you want the COM2 back on COM1, configure a section like this, green are the criteria, violet the target port:

    [ComPorts10]
    IRQ=7
    IoPort=3F8
    PortName=COM1

    For moving the current COM7 to COM3:

    [ComPorts20]
    KernelName=\Device\sscdmdm0
    PortName=COM3


    The numbers of the section have no relation to anything. ComPortMan just reads [ComPorts1] to [ComPorts99] and checks the criteria. The first section with fitting criteria is used.

    If you want a certain port not changed just configure a low numbered section with fitting criteria but without a PortName line.


    After saving the INI file start the ListComPorts tool again. If you have done things right it will show your sections:

    PortName      : COM2
    KernelName    : \Device\Serial0
    DeviceID      : ACPI\PNP0501\1
    FriendlyName  : Communications Port (COM2)
    IRQ           : 7
    IoPort        : 3F8
    Section       : [ComPorts10]

    PortName      : COM7
    KernelName    : \Device\sscdmdm0
    DeviceID      : USB\VID_04E8&PID_6601&MI_00\9&34C622D7&0&4_00
    FriendlyName  : SAMSUNG Mobile Modem #2
    Section       : [ComPorts20]


    ComPortMan checks the ports when it starts and when a new port appears in the system. So, for making it change a removable port, remove and attach it again. For an internal port stop and start the ComPortMan service.






    Settings



    Even the section [Settings] is mentioned here again and again, all settings have to be together within the one and only section [Settings]! There can be only one...

    Most settings take effect immediately.


    Check COM-ports on startup

    By default ComPortMan checks the COM port on startup. If it shall not do so:

    [Settings]
    CheckPortsOnStartup=0


    Check COM-ports on resmue from standby or hibernation

    Some Windows installations wake up with screwed up COM-ports after resume. If required, ComPortMan can check the ports on resume. This is deactivated by default because it's usually not required.

    [Settings]
    CheckPortsOnResume=1


    Delete DosDeviceName of COM-Ports after removal

    Some drivers forget do remove the symbolic link from the DosDeviceName (like COM1) to their kernel object (like \Device\Serial1). Usually no probem because no other device will use this port thank to the COM Name Arbiter registry settings. But when using ComPortMan this might be a problem.
    If  ComPortMan shall alway delete the DosDeviceName:

    [Settings]
    RemoveDosDeviceNameOnRemoval=1

    By default this is done when ComPortMan had assigned the port in the Quick-and-dirty mode.


    Quick-and-dirty Mode

    Up to V0.7 ComPortMan changed port numbers by modifying the port's registry settings and then restarting the device. But this sometimes take several seconds. When dealing with multi-port devices then their upper device, e.g. an USB-hub, is restarted instead.
    This is clean but slow.

    In the Quick-and-dirty mode the registry settings are modified too but then ComPortMan just deletes the old port name and creates the new one. Fast but dirty.
    On removal of the port ComPortMan has to delete the new name because the ports driver probably wants to delete the old name! If its old name is meanwhile used by another port, problably this meanwhile foreign port is deleted. If this really happens depents on the driver of the removed port.
    As long as you deal with one device at the same time there is no problem.

    This setting is available global:

    [Settings]
    QuickAndDirtyMode=1

    And individual for each ComPorts section. Sample:

    [ComPorts20]
    DeviceId=FTDIBUS*
    PortNames=COM3,COM4
    QuickAndDirtyMode=0



    Windows COM-Name-Arbiter

    For each COM-port when installed Windows sets a bit in the registry which markes this port as reserved to make it not being used by new devices. The result are the increasing COM-port numbers...
    A tool for manually reset the bits is my COM Name Arbiter Setter.

    ComPortMan can clean up too. It does so on startup of the service and after a COM-port has been removed.

    Sample: Clean the reservation for ports 3, 4 and 10-256:

    [Settings]
    ComNameArbiterClean=3,4,10-256

    The reservation of currently present ports is not removed, furthermore ComPortMan modifies reservations on arrival of COM-ports.



    After removal delete the device from the Windows device management

    If you deal with lots of always new devices which will never be attached again then it makes sense to delete it from the Windows device management after removal.

    For the COM-Port:

    [Settings]
    RemovePortDeviceOnRemoval=1

    For the USB device:

    [Settings]
    RemoveUsbDeviceOnRemoval=1



    Debug Information

    If there are problems I may figure out what is wrong by reading the debug logs which ComPortMan writes.
    It can write a log file or live output that can be grabbed by SysInternals DebugView

    To activate the log file set WriteLogFile=1, for the live output WriteDebugInfo=1.
    To control how detailed the output is, set the LogLevel=1 to 4, 3 is usually good enough.
    The file is _ComPortMan.LOG in the root folder of the Windows drive by default but can be changed:

    [Settings]
    WriteDebugInfo=1
    LogLevel=3
    WriteLogFile=1
    LogFile=C:\ComPortMan.LOG

    No restart is required to take effect. The log file settings are read from the INI only, even when the Registry is used for other settings.

    On startup of the service an existing ComPortMan.LOG is renamed into ComPortMan_BAK.LOG, an existing ComPortMan_BAK.LOG is deleted.






    Balloon Tips



    ComPortMan can show a balloon tip with information about the assigned COM-Port numbers.

    [BalloonTips]
    Enabled=1
    Timeout=6000

    Timeout is the duration the balloon tip is shown in milliseconds.
    5 seconds (5000 ms) is the default.

    The timeout starts again when the mouse is moved over the balloon tip.




    COM-Ports depending on Criteria




    You need several sections [ComPortsXX], in which the different criteria are defined together with the target COM-ports.
    The sections are tested from [ComPorts1] to [ComPorts99] and finally [ComPorts] (without a number).
    The first section whose criteria fits to the port is used. So, configure special cases at low numbers and more general ones at higher numbers and the most general with the highest number or without a number.
    I suggest to use the number in steps of 10, so you can later easily insert sections.

    The section and value numbers have no relation to anything. Section and values are just evaluated from low numbers upwards to high numbers, that's all.

    The ListComPorts tool shows for each port which section is used for it, so you can easily check if you have configured right.

    Each section needs at least one criteria.

    Untypical sample for showing how it works, criteria in green, target letters in violet:

    [ComPorts10]
    DeviceID1=USB\VID_067B&PID_2517
    DeviceID2=USB\VID_1234&PID_5678
    PortName1=COM5
    PortName2=COM6

    This section is used if a port with either DeviceID USB\VID_067B&PID_2517 or USB\VID_1234&PID_5678 is attached. The port then gets assigned COM5 if available, otherwise COM6. If both are in use then the port is not changed.

    There is no relation between the numbers!

    Typical sample for getting these two ports on its own port-numbers:

    [ComPorts10]
    DeviceID=USB\VID_067B&PID_2517
    PortName=COM5

    [ComPorts20]
    DeviceID=USB\VID_1234&PID_5678
    PortName=COM6

    When only one criteria of the same type or one PortName is used then the number can be ommitted as shown in the above samples.

    If you want two ports handled by one section then use numbered criteria:

    [ComPorts10]
    DeviceID1=USB\VID_067B&PID_2517
    DeviceID2=USB\VID_1212&PID_8976
    PortName=COM5

    Here one of the device IDs must fit the port. The numbers have no relation to anything, they are just used to make the values unique.


    One more sample:

    Don't touch one certain USB-COM-Port, all others on COM3, 4 or 5

    ;don't touch Samsung Modems
    [ComPorts10]
    KernelName=\Device\sscdmdm*
    PortName=

    ;all other USB serials at COM3, 4, 5
    [ComPorts20]
    DeviceID=USB\*
    PortName1=COM3
    PortName2=COM4
    PortName3=COM5

    Or short, using the list notation:

    [ComPorts20]
    DeviceID=USB\*
    PortNames=COM3,COM4,COM5










    COM-Port by Kernel Name



    The kernel name is what the "DOS device name" (COM1, COM2 etc) points to thru a symbolic link. 

    Internal ISA-style ports have a name like \Device\Serial0, \Device\Serial1 etc. The kernel name of other devices is defined by their driver, so it can be used to identify a certain type of port.

    The ListComPorts tool show the kernel name:

    PortName      : COM1
    KernelName    : \Device\Serial0
    DeviceID      : ACPI\PNP0501\1
    FriendlyName  : Communications Port (COM1)
    IRQ           : 7
    Port          : 3F8

    PortName      : COM7
    KernelName    : \Device\sscdmdm0
    DeviceID      : USB\VID_04E8&PID_6601&MI_00\9&34C622D7&0&4_00
    FriendlyName  : SAMSUNG Mobile Modem #2

    PortName      : COM4
    KernelName    : \Device\QCUSB_COM4_2
    DeviceID      : USB\VID_12D1&PID_1001&MI_01\7&36AC8E78&0&0001
    FriendlyName  : HUAWEI Mobile Connect - 3G Application Interface (COM4)



    Sample:

    ;don't touch the Samsung and the Huawei modems
    [ComPorts10]
    KernelName1=\Device\sscdmdm*
    KernelName2=\Device\QCUSB_COM*

    ;any other USB-serials
    [ComPorts20]
    ParentDeviceID=USB\*
    PortNames=COM3,COM4




    COM-Port by Device ID or Parent Device ID



    The ListComPorts tool show the device IDs:

    PortName       : COM1
    KernelName     : \Device\Serial0
    DeviceID       : ACPI\PNP0501\1
    ParentDeviceID : PCI\VEN_8086&DEV_2918&SUBSYS_00000000&REV_02\3&13C0B0C5&0&F8
    FriendlyName   : Communications Port (COM1)
    IRQ            : 7
    Port           : 3F8

    PortName       : COM4
    KernelName     : \Device\sscdmdm0
    DeviceID       : USB\VID_04E8&PID_6601&MI_00\9&34C622D7&0&4_00
    ParentDeviceID : USB\VID_04E8&PID_6601\7&310D02EB&1&3
    FriendlyName   : SAMSUNG Mobile Modem #2

    PortName       : COM6
    KernelName     : \Device\QCUSB_COM6_1
    DeviceID       : USB\VID_12D1&PID_1001&MI_01\7&36AC8E78&0&0001
    ParentDeviceID : USB\VID_12D1&PID_1001\6&33F5ECF6&0&4
    FriendlyName   : HUAWEI Mobile Connect - 3G Application Interface (COM4)

    PortName       : COM7
    KernelName     : \Device\VCP0
    DeviceID       : FTDIBUS\VID_0403+PID_6001+FTF6DPKEA\0000
    ParentDeviceID : USB\VID_0403&PID_6001\FTF6DPKE
    FriendlyName   : USB Serial Port (COM7)


    Sample:

    ;don't touch the Samsung and the Huawei modems
    [ComPorts10]
    DeviceID1=USB\VID_04E8&PID_6601*
    DeviceID2=USB\VID_12D1&PID_1001*

    ;any other USB-serials
    [ComPorts20]
    ParentDeviceID=USB\*
    PortNames=COM3,COM4

    Some USB to serial devices don't have a USB\xxx device ID, but their parent device always has. 

    Or just use the BusType criteria instead:

    ;any other USB-serials
    [ComPorts20]
    BusType=USB
    PortNames=COM3,COM4





    COM-ports by USB Port



    The ListComPorts tool show the friendly name:

    PortName      : COM1
    KernelName    : \Device\Serial0
    DeviceID      : ACPI\PNP0501\1
    FriendlyName  : Communications Port (COM1)
    IRQ           : 7
    Port          : 3F8

    PortName      : COM7
    KernelName    : \Device\sscdmdm0
    DeviceID      : USB\VID_04E8&PID_6601&MI_00\9&34C622D7&0&4_00
    FriendlyName  : SAMSUNG Mobile Modem #2

    PortName      : COM4
    KernelName    : \Device\QCUSB_COM4_2
    DeviceID      : USB\VID_12D1&PID_1001&MI_01\7&36AC8E78&0&0001
    FriendlyName  : HUAWEI Mobile Connect - 3G Application Interface (COM4)



    Sample:

    ;don't touch the Samsung and the Huawei modems
    [ComPorts10]
    FriendlyName1=SAMSUNG Mobile Modem *
    FriendlyName2=HUAWEI Mobile Connect *

    ;any other USB-serials
    [ComPorts20]
    ParentDeviceID=USB\*
    PortNames=COM3,COM4





    COM-ports by Bus-Type



    BusType means how the serial device is connected to the system. This can be
  • USB
  • PCMCIA
  • PCI
  • ISA
  • UNKNOWN

    The ListComPorts tool shows the BusType:

    PortName       : COM1
    KernelName     : \Device\Serial0
    DeviceID       : ACPI\PNP0501\1
    ParentDeviceID : PCI\VEN_8086&DEV_2918&SUBSYS_00000000&REV_02\3&13C0B0C5&0&F8
    FriendlyName   : Communications Port (COM1)
    BusType        : ISA
    IRQ            : 4
    IoPort         : 3F8

    PortName       : COM4
    KernelName     : \Device\sscdmdm0
    DeviceID       : USB\VID_04E8&PID_6601&MI_00\8&A4D665B&0&3_00
    ParentDeviceID : USB\VID_04E8&PID_6601\7&310D02EB&1&3
    FriendlyName   : SAMSUNG CDMA Modem #2
    BusType        : USB

    PortName       : COM7
    KernelName     : \Device\VCP0
    DeviceID       : FTDIBUS\VID_0403+PID_6001+FTF6DPKEA\0000
    ParentDeviceID : USB\VID_0403&PID_6001\FTF6DPKE
    FriendlyName   : USB Serial Port (COM7)
    BusType        : USB



    Sample:

    ;any USB-serial on COM3 and 4
    [ComPorts20]
    BusType=USB
    PortNames=COM3,COM4





    COM-ports by USB-Port




    Sample:

    [ComPorts10]
    UsbPort=1-2-3
    PortName=COM7


    ListComPorts shows the used USB-Port:

    PortName       : COM7
    KernelName     : \Device\VCP0
    DeviceID       : FTDIBUS\VID_0403+PID_6001+FTF6DPKEA\0000
    ParentDeviceID : USB\VID_0403&PID_6001\FTF6DPKE
    FriendlyName   : USB Serial Port (COM7)
    BusType        : USB
    UsbPort        : 1-1


    Using the USB port is handy for multiport adaptors. These devices are in fact multiple single USB-to-serial devices attached to an integrated USB-hub.
    Since the arrival order is not guarateed to be as the ports are numbered, it is better to configre one section per port and use the last part of the USB port name as criteria.

    Sample for a Prolific 4x adaptor (which is an 4x USB hub with 4 USB-serial devices) on COM11 to COM14 in the expected order:

    [ComPorts21]
    PortName=COM11
    FriendlyName=Prolific*
    UsbPort=*-1

    [ComPorts22]
    PortName=COM12
    FriendlyName=Prolific*
    UsbPort=*-2

    [ComPorts23]
    PortName=COM13
    FriendlyName=Prolific*
    UsbPort=*-3

    [ComPorts24]
    PortName=COM14
    FriendlyName=Prolific*
    UsbPort=*-4

    The numbers of the section have no meaning, they just have to be uniqe.

    Hit: With V0.8.3 the first digit has change. Now the port names are the same as in USBDLM and UsbTreeView.





    Wildcards



    Configuring criterions wildcards can be used:
    The asterisk '*' stands for null to n characters and the question mark '?' for exactly one.

    It's all case insensitive.


    Sample          | fits for                | does not fit
    ----------------+-------------------------+------------------
    \Device\Serial? | \Device\Serial0,        | \Device\Serial20
                    | \Device\Serial9         |
    ----------------+-------------------------+------------------
    USB\VID_*       | everything that starts  | PCI\VEN_...
                    | with USB\VID_           |
    ----------------+-------------------------+------------------
    *\VID_*         | everything that contains| PCI\VEN_...
                    | \VID_                   | 
    ----------------+-------------------------+------------------
    2-1-*           | 2-1-1, 2-1-7, 2-1-1-3   | 2-1, 1-1-1
    ----------------+-------------------------+------------------
    2-1-?           | 2-1-1, 2-1-7            | 2-1, 2-1-1-3
    ----------------+-------------------------+------------------
    *-1             | 2-1-1, 13-5-1           | 1-2, 13-5-2
    ----------------+-------------------------+------------------







    Technical Information



    Here some background information, just what came into my mind...


    Window Service

    ComPortMan is a Windows Service. As such it is registered in the registry and started and stopped by the "Service Control Manager".

    Services usually are running in the context "Local System" and have highest privileges here. ComPortMan is a Win32 service, not a kernel service. A kernel service could have the start type "System" which would ensure that it is loaded before the user logs on. For a Win32 service "Automatic" is earliest start type. With "Automatic" the user might be logged on before the services starts, see also "ComPortMan service starts to late" under Problems.


    Device fails to start if its COM-port is already in use

    At least under XP a device fails to start if the COM-Port it had assigned last time is currently not available.
    Therefore ComPortMan modifies the COM-Ports of non present devices to number 200+ if it assigns a COM-port to a device. This ensures that the other devices can start if they are attached at the same time.
    The parking number can be changed or the parking disabled (0):

    [Settings]
    ParkingPortNumber=200






    Creating an MSI



    Having ComPortMan as an MSI with included ComPortMan.INI file is useful for distributing ComPortMan in a network by means of a group policy, admins know better than I do...

    The Microsoft WIX toolset is used for creating the MSI. You need the Microsoft WIX toolset. Download the WIX35.MSI, right click -> Install.

    If there is no Visual Studio installed it comes first with a warnig message. Just click OK.
    WiX installs to the default programs folder, e.g. to "C:\Program Files\Windows Installer XML v3.5", the folder where the environment variable %ProgramFiles% points to.
    WiX requires the .NET 3.5 Framework.

    Here is the WIX script for ComPortMan: ComPortMan.WXS
    In this script there is a line for adding the "ComPortMan_sample.ini", change this into "ComPortMan.INI".

    Into the ComPortMan folder put the files from the ComPortMan.ZIP archive, the ComPortMan.WXS, your customized ComPortMan.INI and a make_msi.cmd like this:

    @echo off
    set WiX_Path=%ProgramFiles%\Windows Installer XML v3.5\bin

    if not exist "%WiX_Path%" echo !!!!!!!!!!! WiX not found !!!!!!!!!!!!! & pause & goto ExitPoint

    rem -- ensure the folder of the CMD file is the current folder --
    %~d0
    cd %~p0

    rem -- excute WiX candle and light, pause & exit if error --
    "%WiX_Path%\candle.exe" -dProcessorArchitecture=x86 -arch x86 -out ComPortMan.wixobj ComPortMan.wxs
    if errorlevel 1 pause & goto ExitPoint

    "%WiX_Path%\light.exe" -out ComPortMan.msi ComPortMan.wixobj 
    if errorlevel 1 pause & goto ExitPoint

    rem -- cleanup --
    del ComPortMan.wixobj
    del ComPortMan.wixpdb

    :ExitPoint


    For the x64 version change x86 to x64:
    "%WiX_Path%\candle.exe" -dProcessorArchitecture=x64 -arch x64 -out ComPortMan.wixobj ComPortMan.wxs


    The wixpdb file created where the MSI is created, so, if you change -out to another folder then put this path to the "del ComPortMan.wixpdb" line too.
















    Problems



    Wrong COM-port for a short moment

    When a serial device is attached then it usually comes with a COM-port which (if required) ComPortMan changes at the earliest possible point. If an application reads the COM-port at the same point then it gets confused when ComPortMan changes the port a millisecond later.


    ComPortMan service starts to late

    Since XP Windows does not delay the user logon until all services are started - the illusion of a fast system start has priority...
    So it can happen that the user gets logged on before the ComPortMan service is started. If the user starts then an application which opens a certain COM port, it might not be there because ComPortMan was not started yet. Very theoretically problem...


    Error 193

    If the start of the ComPortMan service fails with error 193 (which is ERROR_BAD_EXE_FORMAT), then the ComPortMan.EXE is in a folder which cannot be read by the "Local System" account. This is required for a service beeing started by the Service Control Manager.
    Fix it by giving "SYSTEM" at least read+execute access.

















    History



    V0.9.2.0 (10 May 2015)
  • New: FriendlyName is checked and fixed even ComPortMan does not change the port number
  • New: Port number is set as used in the "COM Name Arbiter" registry key, even ComPortMan does not change the port number; makes sense because Windows does this only when the device is installed but not on subsequent arrivals
  • New: Port number collisions are detected and fixed even when ComPortMan does not change the port number (on arrival only, not on service startup)

    V0.9.1.0 (01 Oct 2014)
  • New: COM ports of "Modem" class devices are handled

    V0.9.0.0 (12 May 2014)
  • Bugfix: For USB devices attached to USB3 controllers the USB port name was wrong

    V0.8.9.0 (18 Feb 2014)
  • Bugfix: For devices with device interface GUID_DEVINTERFACE_USB the removal was not processed
  • New: Setting RemoveDosDeviceNameOnRemoval

    V0.8.8.3 (17 Feb 2014)
  • New: Works with devices which have the device interface GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR and GUID_DEVINTERFACE_USB  (so far only GUID_DEVINTERFACE_COMPORT)
  • Bugfix: USB port not determined on Texas Instrumens USB3 controllers

    V0.8.7.0 (15 May 2013)
  • New: After removal of a COM-port the device can be deleted from the Windows device management, see Settings

    V0.8.6.0 (15 May 2013)
  • Bugfix: When assigning a COM-port for a new device the same port is changed for all non-present devices to ensure their driver can start if the are attached at the same time

    V0.8.5.0 (04 July 2012)
  • Bugfix: -silentstop (used by the MSI) was not implemented

    V0.8.4.0 (03 July 2012)
  • Bugfix: -install and -uninstall did not work in V0.8.3.0

    V0.8.3.0 (10 June 2012)
  • Bugfix: Wrong balloontip if multiple different COM devices attached to the same USB hub
  • Change: The first digit of the USB port name has been changed to be compatible with USBDLM and UsbTreeView

    V0.8.2.0 (1 March 2012)
  • Bugfix: COM-port removed if all configured ports are not available

    V0.8.1.0 (27 Feb 2012)
  • Bugfix: Detection of mulit-port-adaptors as such failed with some devices
  • New: "Quick-and-dirty mode" is default, see Settings

    V0.8.0.0 (27 Feb 2012)
  • New: Fast "Quick-and-dirty mode" available, see Settings
  • New: Windows COM-port reservation can be removed, see Settings

    V0.7.0.0 (22 Feb 2012)
  • New: COM-Ports sorted in the balloontip

    V0.6.1.0 (17 Feb 2012)
  • Bugfix: USB-Port-Name had the final part missing on some devices

    V0.6.0.0 (17 Feb 2012)
  • Bugfix: Failure on arrival of USB multi-port adaptors

    V0.5.0.0 (15 Feb 2012)
  • New: COM-Ports by USB-Port
  • New: Balloontips on COM-Port arrival

    V0.1.0.0 (22 Jan 2012)
  • very first public version





    Plans


  • testing 4x and 8x USB serial adapters
  • maybe AutoRuns on arrival of COM-Ports like USBDLM does
  • COM port swapping, so far the COM port assignment works only if the target port is not in use



    Software licence ComPortMan




    This licence agreement is based on and bound to German law. This is a translation of the most important facts for our customers and visitors. All programs and documents were created corresponding German law. If there were any infringements of changed or international law it is done unintentional. Please let me know in order to allow corrections.


    1. The subject of the contract

    The subject of the contract is the enclosed software, the software description and instructions, as well as other associated written material, in the following also called 'software'.
    The author makes attentive to the fact that it is not possible to provide software that works error free is in all applications and combinations.
    The subject of the contract is therefore only a software, which is usable in the sense of the program description.


    2. Granting of a licence

    The author grants public schools, universities and other non profit institution of education where the students outnumber all others a free licence.
    Furthermore public libraries whose usage is free of charge can use the software for free.
    Other users have 30 days to determine if this product meets their needs. After this time one licence per computer must be ordered or the software must be removed from the computers.

    The licence applies to all version numbers of the software now and in the future to the appropriate number of licences.

    The volume licences are valid for the particular number of computers within a company or organization.

    A Site Licence allows anyone in the organization making the purchase, within a 160 km (100 mile) radius of the purchasing location, to use the software. This includes people from that organization location who are travelling but it does not include people with locations outside of the 160 km radius.

    A World-Wide Licence allows anyone in the organization making the purchase, who is on the planet Earth, to use the software.

    The author does not supply updates since all updates are offered for download.

    The software can be copied and passed on freely, as long as the ZIP or MSI archive is unchanged. Re-packaging is allowed for internal use only.


    3. No further legal claims

    The author is both author and owner of the software, as well as of algorithms and procedures used in this software.


    4. No modifications or decompiling

    Changes in any files, disassembling, reverse engineering, patching of this software is expressly prohibited.


    5. Redistribution

    Redistribution of the unmodified software archive files on CD/DVD media of computer magazines is allowed.
    Making them available for download is unwanted. Whenever possible link to http://www.uwe-sieber.de/files/comportman.zip and http://www.uwe-sieber.de/files/comportman.msi
    Re-packaging is allowed for internal use only.


    6. No warranty

    I make no guarantee, implied or otherwise as to the accuracy of the documentation or the software's suitability for any purpose. It is a condition of the licence that the user accepts that I'm not responsible for any damages arising by the use or misuse of this software. This includes loss of profit, data, any material losses and their consequential damages: even if I'm informed about the possibility of those damages. I try to fix bugs as soon as possible.