Tech Support > Microsoft Windows > Drivers > Reading Registry
Reading Registry
Posted by Mike on November 29th, 2004


Which function could I use to read the content of the following registry Key?

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\De viceClasses\
{28d78fad-5a12-11d1-ae5b-0000f803a8c2}
##?#USB#Vid_0f0f&Pid_2000#6&376e3da7&0&1#{28d78fad -5a12-11d1-ae5b-0000f803a8c2}\#\Device Parameters\Port Number

Mike

Posted by Don Burn on November 29th, 2004


Well you can do it with any of the value functions, but the bigger question
is why do such a thing. First you are using an explicit control set this is
a bad idea since you cannot be sure there will be a ControlSet001. You
should only be handling the current control set, since you cannot rely on
the names of the control sets. Second thing is you are mucking around in
the contol area, which is undocumented and likely to change. See if you can
get the data you want from IoGetDeviceProperty, this is the blessed way of
dealing with this type of data.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

"Mike" <Mike@discussions.microsoft.com> wrote in message
news:7AAEA36F-862A-43EC-BAE3-F1C74B39B2C5@microsoft.com...
c2}\#\Device Parameters\Port Number


Posted by Maxim S. Shatskih on November 29th, 2004


IoOpenDeviceRegistryKey(PLUGPLAY_REGKEY_DRIVER)

You will need a PDO pointer though.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Mike" <Mike@discussions.microsoft.com> wrote in message
news:7AAEA36F-862A-43EC-BAE3-F1C74B39B2C5@microsoft.com...
\#\Device Parameters\Port Number


Posted by Mike on November 30th, 2004


I noticed afterward that I wrote ControlSet001 instead of CurrentControlSet.
Sorry about that.

I want to read that location, because I need to relate between USB001,
USB002, etc and the physical port my device is plug to. That value gives me
the number in USB001, USB002, etc for each physical port plugged in the PC.

"Don Burn" wrote:

Posted by Mark Roddy on November 30th, 2004


Mike wrote:


--

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032


Similar Posts