View Single Post
  #9  
Old 22-11-2011, 09:19 PM
RickS's Avatar
RickS (Rick)
PI cult recruiter

RickS is offline
 
Join Date: Apr 2010
Location: Brisbane
Posts: 10,584
My pleasure, Brendan

C# source code is attached for anybody that can make use of it. Improvements are welcome. I have done a lot of programming in other environments, but my knowledge of Windows internals is fairly rudimentary.

Comments from the program are included below with usage instructions.

Cheers,
Rick.

Quote:
//
// Repair mangled COM port names generated by MS Bluetooth stack.
// These are not null terminated, so some applications see spurious characters
// at the end of the COM port name, e.g. "COM11w".
//
// NB. This program modifies the Registry. Use at your own risk.
// I make no claims about the correctness or fitness for purpose of this code.
//
// Usage:
// - with no arguments the program will rewrite COM port names deleting
// any characters from the first non-numeric character onwards,
// e.g. COM123x67 would be rewritten as COM123.
// - with an argument of "-n" where 'n' is a decimal digit, the program
// will also assume that there are no more than 'n' digits in the COM port
// names and that any additional ones should be removed. This provides
// an option for dealing with COM port names where the spurious character
// just happens to be a decimal digit (which has been reported to happen,
// although probably infrequently). As an example, an argument of "-2"
// would rewrite "COM123" as "COM12".
//
// Rick Stevenson, 21-Nov-2011
//
// Based on some code by jbgagnon at:
// http://connect.microsoft.com/VisualS...with-bluetooth
//
Attached Files
File Type: zip DeMangleComPortNames-src.zip (1.5 KB, 37 views)
Reply With Quote