[Mono-dev] SerialPort - GetPortNames patch

Robert Jordan robertj at gmx.net
Sun Dec 2 09:58:26 EST 2007


Hi Martin,

> Attached is a patch to implement GetPortNames for windows by looking in the 
> registry. Can someone test it out and commit it for me if it is acceptable.
> I have tested it on XP and Vista, but if anyone can check the registry 
> location is also valid for 2000 that would be useful.

it would even work on NT 3.1: http://support.microsoft.com/kb/102988

Please add a null check for "subkey" after

RegistryKey subkey = 
Registry.LocalMachine.OpenSubKey("HARDWARE\\DEVICEMAP\\SERIALCOMM");

and consider the "using" pattern.

Shouldn't be the default port name the first entry of this
list? Your patch presets "COM1".

Robert




More information about the Mono-devel-list mailing list