Pinczakko
Joined: 29 Jul 2004 Posts: 140 Helped: 13 Location: Taka Bonerate National Park, Indonesia
|
23 Dec 2004 3:00 How to interrogate win2K PnP Manager |
|
|
|
I'm currently building a user mode application that need to know the "resource map" (i.e. the I/O map and memory map) of windows 2K/XP. I need to know how to obtain the I/O space or memory space that is consumed by PCI devices. This is needed since we can not invoke the BAR (base address register) sizing algorithm from within windows, if we attempt to do so, the system will eventually or directly hang. I presume that this information is available from the PnP manager of win2K/XP, but how to do it
Thx in advance
Pinczakko
|
|
Pinczakko
Joined: 29 Jul 2004 Posts: 140 Helped: 13 Location: Taka Bonerate National Park, Indonesia
|
23 Dec 2004 13:42 Re: How to interrogate win2K PnP Manager |
|
|
|
I found a nice article at codeproject.com that solve the problem. Perhaps, this info will be of some use for somebody. And to the moderators, I really sorry if this is considered as spamming. But in my opinion, it's not, since this info perhaps is of some use to low level/system programmer like me
| Quote: |
So how to get information about resources.
* Get class Guid using device class name (SetupDiClassGuidsFromNameA function)
* Get device info set for device class (SetupDiGetClassDevsA function)
* Get device info data for every device (SetupDiGetClassDevsA function, second parameter for this function is sequential device index in the device class, so call this function in circle with device index = 0, 1, etc.).
* Get information about current configuration (CM_Get_First_Log_Conf function)
* Get resource descriptor from current configuration (CM_Get_Next_Res_Des function, do this and follow steps for every resource till they exist)
* Get information about size of resource data (CM_Get_Res_Des_Data_Size function)
* Get resource data (CM_Get_Res_Des_Data function)
* Marshal resource data in suitable structures (class Marshal, methods PtrToStructure; structure IntPtr, method ToInt32 and vice versa to IntPtr)
|
the complete article by Vladimir Afanasyev http://www.codeproject.com/csharp/DivingSysProg3.asp
|
|