Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SetupDiGetDeviceRegistryProperty

423 views
Skip to first unread message

Raghavan

unread,
Jun 18, 2009, 7:31:10 AM6/18/09
to
Hi,

Can someone tell me how to use SetupDiGetDeviceRegistryProperty to get
the port number for the parallel port device(0x378)?? I tried by first
calling SetupDiGetClassDevs to get a handle to a device information
set and then calling SetupDiEnumDeviceInfo with this handle. But I am
not sure which property to pass the third parameter to
SetupDiGetDeviceRegistryProperty. I tried with SPDRP_BUSNUMBER and
SPDRP_ADDRESS but it returned error 13 ("Data is invalid"). Any
thoughts?

My code:

HDEVINFO handle= SetupDiGetClassDevs(&GUID_DEVCLASS_PORTS,
NULL,
NULL,
DIGCF_PRESENT);
DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
SetupDiEnumDeviceInfo(handle, MemberIndex,&DevInfoData);

SetupDiGetDeviceRegistryProperty(handle,
&DevInfoData,
SPDRP_ADDRESS ,
&dwRegType,
(BYTE*) buffer,
sizeof(buffer),
NULL);


Raghavan

Raghavan

unread,
Jun 18, 2009, 8:52:05 AM6/18/09
to

I noticed that the port base address is not present as a registry key.
If then I cant use SetupDiGetDeviceRegistryProperty to get the port
address, is there any other method that I can use?

Thanks

Raghavan

Kerem Gümrükcü

unread,
Jun 18, 2009, 8:24:15 AM6/18/09
to
Hi :-)

what you mean i guess is the I/O Port. What you now
have to do is to take a look at the devcon sample included
in the DDK/WDK. There you will see how you can get this
Information,...

[DevCon]
http://msdn.microsoft.com/en-us/library/ms792824.aspx

regards

Kerem

--
--
-----------------------
Beste Gr�sse / Best regards / Votre bien devoue
Kerem G�mr�kc�
Latest Project: http://www.pro-it-education.de/software/deviceremover
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."

"Raghavan" <ragha...@gmail.com> schrieb im Newsbeitrag
news:8407208d-b156-49e4...@i28g2000prd.googlegroups.com...

Doron Holan [MSFT]

unread,
Jun 18, 2009, 12:50:52 PM6/18/09
to
why do you want to get this information? the driver installed on the devnode
owns the io port, you can't use it in your own driver unless you are the
driver installed

d

--

This posting is provided "AS IS" with no warranties, and confers no rights.


"Raghavan" <ragha...@gmail.com> wrote in message
news:f455cf4d-0166-4206...@r31g2000prh.googlegroups.com...

Raghavan

unread,
Jun 19, 2009, 1:22:01 AM6/19/09
to
On Jun 18, 5:24 pm, Kerem Gümrükcü <kareem...@hotmail.com> wrote:
> Hi :-)
>
> what you mean i guess is the I/O Port. What you now
> have to do is to take a look at the devcon sample included
> in the DDK/WDK. There you will see how you can get this
> Information,...


Thanks a lot! I tried it with the devcon methods and it works fine.

Raghavan

Raghavan

unread,
Jun 19, 2009, 1:28:23 AM6/19/09
to
On Jun 18, 9:50 pm, "Doron Holan [MSFT]"

<doron.ho...@online.microsoft.com> wrote:
> why do you want to get this information? the driver installed on the devnode
> owns the io port, you can't use it in your own driver unless you are the
> driver installed
>
> d

I needed to display it in the app that I was changing (earlier a
deprecated API was used to get this info). I got it through
CM_Get_First_Log_Conf as done in the devcon sample. Now is it possible
for me to use it to read/write to the port?

Thanks,

Raghavan


0 new messages