Hello,
Could please somebody say if there, in Windows API,
is a function to get the registry key name by
its open handle (HKey)?

I want to get it after successful
hK = SetupDiOpenDevRegKey(DeviceInfoSet, DeviceInfoData, ...)

(probably I overlooked something, or there is a better way?
Google didn't help me.)
Thanks.

Re: Find reg key name by handle. by Tim

Tim
Sat Dec 08 22:52:28 PST 2007

"Sergei V" <sv@a.c.ad.e.m.org> wrote:

>Hello,
>Could please somebody say if there, in Windows API,
>is a function to get the registry key name by
>its open handle (HKey)?
>
>I want to get it after successful
>hK = SetupDiOpenDevRegKey(DeviceInfoSet, DeviceInfoData, ...)
>
>(probably I overlooked something, or there is a better way?
>Google didn't help me.)

Why do you need this? If you want the PnP ID, you can get that from
SetupDiGetDeviceInstanceId.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: Find reg key name by handle. by Sergei

Sergei
Sun Dec 09 01:39:14 PST 2007

Thank you, Tim for the reply.
Why do I need? Probably, I don't.
I open the reg key in one code fragment and want to create a report in
another, where
there is no DeviceInfoSet, DeviceInfoData. Probably I shalt carry them...
(I have also an option to enumerate the registry and use full text search...
:-)

I believe
hK = SetupDiOpenDevRegKey(DeviceInfoSet, DeviceInfoData, ...)
opens different parts of the registry dependent on the KeyType and therefore
SetupDiGetDeviceInstanceId
helps with the device key, not with driver's (please correct me if I'm not
right)

Then, you say, there is no WinAPI method to get the registry key name
by its open handle? Right? Correct?

This was what I gussed and wanted be confirmed.
Thank you once more.

"Tim Roberts" <timr@probo.com> wrote in message
news:5g3nl3l12bl9i563vnh8d4pbgd46haqedd@4ax.com...
> "Sergei V" <sv@a.c.ad.e.m.org> wrote:
>
>>Hello,
>>Could please somebody say if there, in Windows API,
>>is a function to get the registry key name by
>>its open handle (HKey)?
>>
>>I want to get it after successful
>>hK = SetupDiOpenDevRegKey(DeviceInfoSet, DeviceInfoData, ...)
>>
>>(probably I overlooked something, or there is a better way?
>>Google didn't help me.)
>
> Why do you need this? If you want the PnP ID, you can get that from
> SetupDiGetDeviceInstanceId.
> --
> Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.



Re: Find reg key name by handle. by Tim

Tim
Mon Dec 10 20:00:12 PST 2007

"Sergei V" <sv@a.c.ad.e.m.org> wrote:
>
>I believe
>hK = SetupDiOpenDevRegKey(DeviceInfoSet, DeviceInfoData, ...)
>opens different parts of the registry dependent on the KeyType and therefore
>SetupDiGetDeviceInstanceId
>helps with the device key, not with driver's (please correct me if I'm not
>right)

Yes. The driver key is usually the easier one to find...

>Then, you say, there is no WinAPI method to get the registry key name
>by its open handle? Right? Correct?

Nope. As far as I know, from my old days trolling through the registry
with a binary editor, the index is one way. Given a name, the index points
to the key records, but there's no way to go the other way.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.