Simple, using your own win32 calls, you can get
I just provide a piece of code to help you,
var guidComPorts = Guid.Empty; UInt32 dwSize; IntPtr hDeviceInfo; var buffer = new byte[512]; var providerName = new[] { }; var spddDeviceInfo = new SpDevinfoData(); var bStatus = SetupDiClassGuidsFromName("Ports", ref guidComPorts, 1, out dwSize); if (bStatus) { hDeviceInfo = SetupDiGetClassDevs( ref guidComPorts, (IntPtr)null, (IntPtr)null, DigcfPresent | DigcfProfile); if (hDeviceInfo.ToInt32() != 0) { while (true) { spddDeviceInfo.CbSize = Marshal.SizeOf(spddDeviceInfo);
Use this code ...
find friendly names, split the string get the exact port you are looking for. I completed it, it works fine due to some reason of confidentiality, cannot provide the full code here.
Read more Find this link
http://www.codeproject.com/KB/cs/HardwareHelper.aspx
source share