ZwOpenKey fail on Win2k in DriverEntry at boot

Hello,

I have a few lines of code to query a registry key under HLM during boot
time from driver, I use ZwOpenKey() to open and ZwQueryKey to read the
value. It works perfect under WinNT system, but on Win2k I found the
ZwOpenKEy failed, however if I try to do the same thing after the
machine is up and log in, the same code works.

Anybody got some insight on this one?

Thanks a lot

Qiang


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

It looks like you are trying to open a part of the hive that isn’t available
at boot time. Not all of HKLM is loaded by the boot loader.
System\CurrentControlSet\Services is, but most (all?) of HKLM\Software is
not.

What is the complete path?

Phil

-----Original Message-----
From: Qiang Zhang [mailto:xxxxx@ecutel.com]
Sent: Thursday, July 12, 2001 3:35 PM
To: NT Developers Interest List
Subject: [ntdev] ZwOpenKey fail on Win2k in DriverEntry at boot

Hello,

I have a few lines of code to query a registry key under HLM during boot
time from driver, I use ZwOpenKey() to open and ZwQueryKey to read the
value. It works perfect under WinNT system, but on Win2k I found the
ZwOpenKEy failed, however if I try to do the same thing after the
machine is up and log in, the same code works.

Anybody got some insight on this one?

Thanks a lot

Qiang


You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi, Phil, You got it correct, thanks! well, didn’t know Win2k has
different behavior from WinNT on this one.

It was under software, now I put a key under Service it works

Qiang

-----Original Message-----
From: Barila, Phil [mailto:xxxxx@intel.com]
Sent: Thursday, July 12, 2001 5:55 PM
To: NT Developers Interest List
Subject: [ntdev] RE: ZwOpenKey fail on Win2k in DriverEntry at boot

It looks like you are trying to open a part of the hive that isn’t
available
at boot time. Not all of HKLM is loaded by the boot loader.
System\CurrentControlSet\Services is, but most (all?) of HKLM\Software
is
not.

What is the complete path?

Phil

-----Original Message-----
From: Qiang Zhang [mailto:xxxxx@ecutel.com]
Sent: Thursday, July 12, 2001 3:35 PM
To: NT Developers Interest List
Subject: [ntdev] ZwOpenKey fail on Win2k in DriverEntry at boot

Hello,

I have a few lines of code to query a registry key under HLM during boot
time from driver, I use ZwOpenKey() to open and ZwQueryKey to read the
value. It works perfect under WinNT system, but on Win2k I found the
ZwOpenKEy failed, however if I try to do the same thing after the
machine is up and log in, the same code works.

Anybody got some insight on this one?

Thanks a lot

Qiang


You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@ecutel.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

I’m surprised that you were able to read that part of the registry in NT4,
as it has the same limitation. Evidently, your DriverEntry is called much
later in the boot process by NT4 than by Win2K.

You should be putting your key under your own Service key. Did you know
that your DriverEntry routine gets handed the name of your key in the second
parameter? If your driver is named MyDriver, your key is already there at
HKLM\System\CurrentControlSet\Services\MyDriver, and you will get handed a
PUNICODE_STRING containing
\Registry\Machine\System\CurrentControlSet\Services\MyDriver. You should
put anything you need in MyDriver\MyStuff, where MyStuff is a name that
actually means something.

Phil

-----Original Message-----
From: Qiang Zhang [mailto:xxxxx@ecutel.com]
Sent: Thursday, July 12, 2001 4:14 PM
To: NT Developers Interest List
Subject: [ntdev] RE: ZwOpenKey fail on Win2k in DriverEntry at boot

Hi, Phil, You got it correct, thanks! well, didn’t know Win2k has
different behavior from WinNT on this one.

It was under software, now I put a key under Service it works

Qiang

-----Original Message-----
From: Barila, Phil [mailto:xxxxx@intel.com]
Sent: Thursday, July 12, 2001 5:55 PM
To: NT Developers Interest List
Subject: [ntdev] RE: ZwOpenKey fail on Win2k in DriverEntry at boot

It looks like you are trying to open a part of the hive that isn’t
available
at boot time. Not all of HKLM is loaded by the boot loader.
System\CurrentControlSet\Services is, but most (all?) of HKLM\Software
is
not.

What is the complete path?

Phil

-----Original Message-----
From: Qiang Zhang [mailto:xxxxx@ecutel.com]
Sent: Thursday, July 12, 2001 3:35 PM
To: NT Developers Interest List
Subject: [ntdev] ZwOpenKey fail on Win2k in DriverEntry at boot

Hello,

I have a few lines of code to query a registry key under HLM during boot
time from driver, I use ZwOpenKey() to open and ZwQueryKey to read the
value. It works perfect under WinNT system, but on Win2k I found the
ZwOpenKEy failed, however if I try to do the same thing after the
machine is up and log in, the same code works.

Anybody got some insight on this one?

Thanks a lot

Qiang


You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@ecutel.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com