SetupDiOpenDevRegKey failure in DIF_INSTALLDEVICE

I have a device coinstaller that handles DIF_INSTALLDEVICE. While
processing DIF_INSTALLDEVICE, the coinstaller calls SetupDiOpenDevRegKey to
open the hardware key so it can write some registry entries prior to the
device starting.

I am getting an error from SetupDiOpenDevRegKey: 0xe0000204
(ERROR_KEY_DOES_NOT_EXIST). I am passing SetupDiOpenDevRegKey the HDEVINFO
and PSP_DEVINFO_DATA parameters being passed to the coinstaller function:

hDeviceKey = SetupDiOpenDevRegKey(hdiDeviceInfoSet, psdidDeviceInfoData,
DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_ALL_ACCESS);

I did see a thread about a similar-sounding problem on one of the
newsgroups, but there did not appear to be a resolution.

Is there a restriction as to when I can use SetupDiOpenDevRegKey to open the
hardware key (i.e., am I trying to access it too soon)? Is there a better
point in the install process to do this? As long as I can write the
registry entries so they exist when the device is started, that’s all that
matters. I’d do it in the INF, but I need to have unique data for each card
in the system.

The funny thing is, this has worked in the past on multiple machines. Of
course, that doesn’t mean anything in the world of debugging… it just
makes me wonder if it is, in fact, a timing issue.

Thank you!

-Dan

Just call SetupDiCreateDevRegKey instead and all should be good.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Daniel E.
Germann
Sent: Wednesday, July 05, 2006 3:17 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] SetupDiOpenDevRegKey failure in DIF_INSTALLDEVICE

I have a device coinstaller that handles DIF_INSTALLDEVICE. While
processing DIF_INSTALLDEVICE, the coinstaller calls SetupDiOpenDevRegKey
to open the hardware key so it can write some registry entries prior to
the device starting.

I am getting an error from SetupDiOpenDevRegKey: 0xe0000204
(ERROR_KEY_DOES_NOT_EXIST). I am passing SetupDiOpenDevRegKey the
HDEVINFO and PSP_DEVINFO_DATA parameters being passed to the coinstaller
function:

hDeviceKey = SetupDiOpenDevRegKey(hdiDeviceInfoSet,
psdidDeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_ALL_ACCESS);

I did see a thread about a similar-sounding problem on one of the
newsgroups, but there did not appear to be a resolution.

Is there a restriction as to when I can use SetupDiOpenDevRegKey to open
the hardware key (i.e., am I trying to access it too soon)? Is there a
better point in the install process to do this? As long as I can write
the registry entries so they exist when the device is started, that’s
all that matters. I’d do it in the INF, but I need to have unique data
for each card in the system.

The funny thing is, this has worked in the past on multiple machines.
Of course, that doesn’t mean anything in the world of debugging… it
just makes me wonder if it is, in fact, a timing issue.

Thank you!

-Dan


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Doron,

Worked like a charm. Thank you!

Do I need to do this only when SetupDiOpenDevRegKey fails, or does this work
like RegCreateKeyEx in that if the key is already there, it just opens the
existing key? I didn’t see this explained in the docs for
SetupDiCreateDevRegKey.

Thanks!

-Dan

----- Original Message -----

Subject: RE: SetupDiOpenDevRegKey failure in DIF_INSTALLDEVICE
From: “Doron Holan”
> Date: Wed, 5 Jul 2006 15:48:42 -0700
> X-Message-Number: 28
>
> Just call SetupDiCreateDevRegKey instead and all should be good.
>
> d
>
> – I can spell, I just can’t type.
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Daniel E.
> Germann
> Sent: Wednesday, July 05, 2006 3:17 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] SetupDiOpenDevRegKey failure in DIF_INSTALLDEVICE
>
> I have a device coinstaller that handles DIF_INSTALLDEVICE. While
> processing DIF_INSTALLDEVICE, the coinstaller calls SetupDiOpenDevRegKey
> to open the hardware key so it can write some registry entries prior to
> the device starting.
>
> I am getting an error from SetupDiOpenDevRegKey: 0xe0000204
> (ERROR_KEY_DOES_NOT_EXIST). I am passing SetupDiOpenDevRegKey the
> HDEVINFO and PSP_DEVINFO_DATA parameters being passed to the coinstaller
> function:
>
> hDeviceKey = SetupDiOpenDevRegKey(hdiDeviceInfoSet,
> psdidDeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_ALL_ACCESS);
>
> I did see a thread about a similar-sounding problem on one of the
> newsgroups, but there did not appear to be a resolution.
>
> Is there a restriction as to when I can use SetupDiOpenDevRegKey to open
> the hardware key (i.e., am I trying to access it too soon)? Is there a
> better point in the install process to do this? As long as I can write
> the registry entries so they exist when the device is started, that’s
> all that matters. I’d do it in the INF, but I need to have unique data
> for each card in the system.
>
> The funny thing is, this has worked in the past on multiple machines.
> Of course, that doesn’t mean anything in the world of debugging… it
> just makes me wonder if it is, in fact, a timing issue.
>
> Thank you!
>
> -Dan

It works like RegCreateKeyEx. If the key is there, it just opens the
existing key.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Daniel E.
Germann
Sent: Monday, July 10, 2006 5:20 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] SetupDiOpenDevRegKey failure in DIF_INSTALLDEVICE

Doron,

Worked like a charm. Thank you!

Do I need to do this only when SetupDiOpenDevRegKey fails, or does this
work like RegCreateKeyEx in that if the key is already there, it just
opens the existing key? I didn’t see this explained in the docs for
SetupDiCreateDevRegKey.

Thanks!

-Dan

----- Original Message -----

Subject: RE: SetupDiOpenDevRegKey failure in DIF_INSTALLDEVICE
From: “Doron Holan”
> Date: Wed, 5 Jul 2006 15:48:42 -0700
> X-Message-Number: 28
>
> Just call SetupDiCreateDevRegKey instead and all should be good.
>
> d
>
> – I can spell, I just can’t type.
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Daniel E.
> Germann
> Sent: Wednesday, July 05, 2006 3:17 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] SetupDiOpenDevRegKey failure in DIF_INSTALLDEVICE
>
> I have a device coinstaller that handles DIF_INSTALLDEVICE. While
> processing DIF_INSTALLDEVICE, the coinstaller calls
> SetupDiOpenDevRegKey to open the hardware key so it can write some
> registry entries prior to the device starting.
>
> I am getting an error from SetupDiOpenDevRegKey: 0xe0000204
> (ERROR_KEY_DOES_NOT_EXIST). I am passing SetupDiOpenDevRegKey the
> HDEVINFO and PSP_DEVINFO_DATA parameters being passed to the
> coinstaller
> function:
>
> hDeviceKey = SetupDiOpenDevRegKey(hdiDeviceInfoSet,
> psdidDeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_ALL_ACCESS);
>
> I did see a thread about a similar-sounding problem on one of the
> newsgroups, but there did not appear to be a resolution.
>
> Is there a restriction as to when I can use SetupDiOpenDevRegKey to
> open the hardware key (i.e., am I trying to access it too soon)? Is
> there a better point in the install process to do this? As long as I
> can write the registry entries so they exist when the device is
> started, that’s all that matters. I’d do it in the INF, but I need to

> have unique data for each card in the system.
>
> The funny thing is, this has worked in the past on multiple machines.
> Of course, that doesn’t mean anything in the world of debugging… it

> just makes me wonder if it is, in fact, a timing issue.
>
> Thank you!
>
> -Dan


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer