I see that WMI is very powerful and seems to be able to return most properties of a PC hardware. I'd like to display the available parallel ports on any PC and find their I/O addresses - I know that normally this is done using a Kernel driver but this is a legacy need - dont ask! Presently we look in Device Manager and then have to type in the address displayed there. I'd like to use WMI to find out this information. There are an excellent set of WMI classes at 1 but I cannot see how to iterate.
Thanks.
One must experiment to extract a complex information from WMI. I have tried to find the parallel port addresses on my PC and that is the report:
First of all I have queried Win32_ParallelPort class to find all parallel ports. (using the same code as PRUZ in his post before): 'Select * From Win32_ParallelPort'. The result is (I have only one parallel port in my system):
Second, I have queried Win32_PNPAllocatedResource ('Select * From Win32_PnPAllocatedResource'). I have got a lot of information here, but I have selected only the 3 entries by PNPDeviceID = "ACPI\PNP0401\4&25C6B52A&0".
The third entry is of no interest. The first two entries gives us two (decimal) starting addresses (888 and 1912)
Finally I have queried Win32_PortResource ('Select * From Win32_PortResource') to find the ending addresses corresponding to the starting addresses 888 and 1912:
Updated
I have used the same code as RRUZ, in GUI application (see below). The only thing you need to compile it is the WbemScripting_TLB.pas unit. The unit is generated by type library import wizard, you can read about the process in Delphi 2009 in my blog
@Brian , you just use the Win32_parallelPort class to get the info .
check this code.
May be this will help you :
I do not understand what are the values you need.
If you need to know this:
alt text http://img682.imageshack.us/img682/2382/imagen333.png
I think you can find it in Win32_PortResource classes and Win32_portConnector
Can you confirm that this is so?
Make a test; Open a CMD windows and type:
> WMIC PORT List FULL
alt text http://img215.imageshack.us/img215/1696/imagen332.png
If this is the value that you are searching, you can develop a new component in GLibWMI (or say to me for help you) that retrieve this values.
Regards.
PD: Excuseme for the mistakes with english.