quick question

I want to use RegOpenKeyEx() and other various Reg…() functions from
within my intermediate NDIS driver. Is this possible? For the life of
me, I can’t figure out the header file to include to get these functions
available. Since this is an NDIS driver, I tried finding equivalent
registry functions in the list of NDIS functions, but I couldn’t find
anything that didn’t pertain to a certain miniport instance. The
registry settings I want to access are under
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/MyDriver. But the
NDIS functions I found only let me get into the individual adapters’
registry settings.

Help anyone?

Thanks,
John


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

The NDIS wrapper provides functions to manipulate the registry. Look up the
following in the documentation:

NdisOpenCOnfiguration()
NdisReadConfiguration()
NdisCloseConfiguration()
NdisOpenConfigurationKeyByIndex()
NdisOpenConfigurationKeyByName()
NdisReadNetworkAddress()
NdisWriteConfiguration()

Dan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of John Hirschi
Sent: Monday, April 16, 2001 1:36 PM
To: NT Developers Interest List
Subject: [ntdev] quick question

I want to use RegOpenKeyEx() and other various Reg…() functions from
within my intermediate NDIS driver. Is this possible? For the life of
me, I can’t figure out the header file to include to get these functions
available. Since this is an NDIS driver, I tried finding equivalent
registry functions in the list of NDIS functions, but I couldn’t find
anything that didn’t pertain to a certain miniport instance. The
registry settings I want to access are under
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/MyDriver. But the
NDIS functions I found only let me get into the individual adapters’
registry settings.

Help anyone?

Thanks,
John


You are currently subscribed to ntdev as: xxxxx@emulex.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

Right. I know about these functions, but take the basic one,
NdisOpenConfiguration(). Thee DDK says, “NdisOpenConfiguration returns
a handle for a registry key in which an NDIS NIC driver’s configuration
parameters are stored.” I don’t want the NIC driver’s configuration
parameters, I want to look at an arbitrary entry in the registry, namely
“HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/MyDriver”… Can
these NDIS functions be used to get there? The NdisOpenConfiguration
requires the argument of WrapperConfigurationContext that it gets from
the arguments passed to the MiniportInitialize function. So I’m
guessing if you send it that context, you won’t be able to get anywhere
other than in that section of the registry and its sub sections…

John

-----Original Message-----
From: Dan Sullivan [mailto:xxxxx@emulex.com]
Sent: Monday, April 16, 2001 11:49 AM
To: NT Developers Interest List
Subject: [ntdev] RE: quick question

The NDIS wrapper provides functions to manipulate the registry. Look up
the
following in the documentation:

NdisOpenCOnfiguration()
NdisReadConfiguration()
NdisCloseConfiguration()
NdisOpenConfigurationKeyByIndex()
NdisOpenConfigurationKeyByName()
NdisReadNetworkAddress()
NdisWriteConfiguration()

Dan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of John Hirschi
Sent: Monday, April 16, 2001 1:36 PM
To: NT Developers Interest List
Subject: [ntdev] quick question

I want to use RegOpenKeyEx() and other various Reg…() functions from
within my intermediate NDIS driver. Is this possible? For the life of
me, I can’t figure out the header file to include to get these functions
available. Since this is an NDIS driver, I tried finding equivalent
registry functions in the list of NDIS functions, but I couldn’t find
anything that didn’t pertain to a certain miniport instance. The
registry settings I want to access are under
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/MyDriver. But the
NDIS functions I found only let me get into the individual adapters’
registry settings.

Help anyone?

Thanks,
John


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


You are currently subscribed to ntdev as: xxxxx@sonicwall.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

The short answer is that you can’t do that. Microsoft doesn’t want you
messing with another drivers settings so they don’t provide a way to do it.
The long answer is that there are no absolutes in life. You can work around
these problems, but at what cost - not passing WHQL for one thing.

Dan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of John Hirschi
Sent: Monday, April 16, 2001 2:34 PM
To: NT Developers Interest List
Subject: [ntdev] RE: quick question

Right. I know about these functions, but take the basic one,
NdisOpenConfiguration(). Thee DDK says, “NdisOpenConfiguration returns
a handle for a registry key in which an NDIS NIC driver’s configuration
parameters are stored.” I don’t want the NIC driver’s configuration
parameters, I want to look at an arbitrary entry in the registry, namely
“HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/MyDriver”… Can
these NDIS functions be used to get there? The NdisOpenConfiguration
requires the argument of WrapperConfigurationContext that it gets from
the arguments passed to the MiniportInitialize function. So I’m
guessing if you send it that context, you won’t be able to get anywhere
other than in that section of the registry and its sub sections…

John

-----Original Message-----
From: Dan Sullivan [mailto:xxxxx@emulex.com]
Sent: Monday, April 16, 2001 11:49 AM
To: NT Developers Interest List
Subject: [ntdev] RE: quick question

The NDIS wrapper provides functions to manipulate the registry. Look up
the
following in the documentation:

NdisOpenCOnfiguration()
NdisReadConfiguration()
NdisCloseConfiguration()
NdisOpenConfigurationKeyByIndex()
NdisOpenConfigurationKeyByName()
NdisReadNetworkAddress()
NdisWriteConfiguration()

Dan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of John Hirschi
Sent: Monday, April 16, 2001 1:36 PM
To: NT Developers Interest List
Subject: [ntdev] quick question

I want to use RegOpenKeyEx() and other various Reg…() functions from
within my intermediate NDIS driver. Is this possible? For the life of
me, I can’t figure out the header file to include to get these functions
available. Since this is an NDIS driver, I tried finding equivalent
registry functions in the list of NDIS functions, but I couldn’t find
anything that didn’t pertain to a certain miniport instance. The
registry settings I want to access are under
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/MyDriver. But the
NDIS functions I found only let me get into the individual adapters’
registry settings.

Help anyone?

Thanks,
John


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


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


You are currently subscribed to ntdev as: xxxxx@emulex.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

What’s wrong with using ZwCreateKey and the like to access arbitrary parts
of the registry? With that sort of stuff a driver of mine built the same
registry information that SCM builds for a legacy (pre-WDM) driver and
then, using an undocumented API (not the present concern), loaded the
driver.

James Antognini
IBM Research

Internet address – antognini@us.ibm.com
Notes address – James Antognini/Watson/xxxxx@IBMUS

Phone – external: 914-784-7258; tieline: 863-7258


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

Use ZwXxx equivalents, some are documented in the DDK. To use them in NDIS
driver, you have to #define BINARY_COMPATIBLE 0 before including ndis.h.
ntddk.h will be included in ndis.h and you can use any NT specific function.
As a result you’ll lose binary compatibility with w9x and WHQL (who cares?).

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


From: John Hirschi[SMTP:xxxxx@SonicWALL.com]
Reply To: NT Developers Interest List
Sent: Monday, April 16, 2001 7:36 PM
To: NT Developers Interest List
Subject: [ntdev] quick question

I want to use RegOpenKeyEx() and other various Reg…() functions from
within my intermediate NDIS driver. Is this possible? For the life of
me, I can’t figure out the header file to include to get these functions
available. Since this is an NDIS driver, I tried finding equivalent
registry functions in the list of NDIS functions, but I couldn’t find
anything that didn’t pertain to a certain miniport instance. The
registry settings I want to access are under
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/MyDriver. But the
NDIS functions I found only let me get into the individual adapters’
registry settings.

Help anyone?

Thanks,
John


You are currently subscribed to ntdev as: xxxxx@rkk.cz
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

Thank you very much for responding to my question… I appreciate
everyone’s input.

I converted my code from the Reg…() function to the Zw…() functions,
but I ran into the same problems I started with. When I try to use the
ZwOpenKey() function, I get an error code of 0xc0000034
(STATUS_OBJECT_NAME_NOT_FOUND). I went through some sample code in the
DDK to see what I was doing wrong. I noticed that all the examples were
calling IoOpenDeviceRegistryKey() before anything else, but that opens a
device-specific area of the registry…

Here is my code, boiled down:

const WCHAR c_szMyDrvReg =
L"\Registry\HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\M
yDriver";
NTSTATUS Status;
HANDLE hMyDrvLink;
UNICODE_STRING TempUnicodeString;
OBJECT_ATTRIBUTES Object;

RtlInitUnicodeString(&TempUnicodeString, c_szMyDrvReg);
InitializeObjectAttributes(&Object, &TempUnicodeString,
OBJ_CASE_INSENSITIVE, NULL, (PSECURITY_DESCRIPTOR) NULL);

Status = ZwOpenKey(&hMyDrvLink, KEY_ALL_ACCESS, &Object);

Status ends up being 0xc0000034, even if I cut out the \MyDriver part
of the c_szMyDrvReg string…

Any idea how to approach this?

Thanks,
John

-----Original Message-----
From: Vodicka, Michal [mailto:xxxxx@rkk.cz]
Sent: Tuesday, April 17, 2001 2:17 PM
To: NT Developers Interest List
Subject: [ntdev] RE: quick question

Use ZwXxx equivalents, some are documented in the DDK. To use them in
NDIS
driver, you have to #define BINARY_COMPATIBLE 0 before including ndis.h.
ntddk.h will be included in ndis.h and you can use any NT specific
function.
As a result you’ll lose binary compatibility with w9x and WHQL (who
cares?).

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


From: John Hirschi[SMTP:xxxxx@SonicWALL.com]
Reply To: NT Developers Interest List
Sent: Monday, April 16, 2001 7:36 PM
To: NT Developers Interest List
Subject: [ntdev] quick question

I want to use RegOpenKeyEx() and other various Reg…() functions from
within my intermediate NDIS driver. Is this possible? For the life
of
me, I can’t figure out the header file to include to get these
functions
available. Since this is an NDIS driver, I tried finding equivalent
registry functions in the list of NDIS functions, but I couldn’t find
anything that didn’t pertain to a certain miniport instance. The
registry settings I want to access are under
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/MyDriver. But
the
NDIS functions I found only let me get into the individual adapters’
registry settings.

Help anyone?

Thanks,
John


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


You are currently subscribed to ntdev as: xxxxx@sonicwall.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 think the error code is clear it this case :slight_smile:

Try to change HKEY_LOCAL_MACHINE to MACHINE or start with RegistryPath
string passed to DriverEntry(). ZwOpenKey() is enough,
IoOpenDeviceRegistryKeys() isn’t necessary.

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


From: John Hirschi[SMTP:xxxxx@SonicWALL.com]
Reply To: NT Developers Interest List
Sent: Friday, April 20, 2001 11:51 PM
To: NT Developers Interest List
Subject: [ntdev] RE: quick question

Thank you very much for responding to my question… I appreciate
everyone’s input.

I converted my code from the Reg…() function to the Zw…() functions,
but I ran into the same problems I started with. When I try to use the
ZwOpenKey() function, I get an error code of 0xc0000034
(STATUS_OBJECT_NAME_NOT_FOUND). I went through some sample code in the
DDK to see what I was doing wrong. I noticed that all the examples were
calling IoOpenDeviceRegistryKey() before anything else, but that opens a
device-specific area of the registry…

Here is my code, boiled down:

const WCHAR c_szMyDrvReg =
L"\Registry\HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\M
yDriver";
NTSTATUS Status;
HANDLE hMyDrvLink;
UNICODE_STRING TempUnicodeString;
OBJECT_ATTRIBUTES Object;

RtlInitUnicodeString(&TempUnicodeString, c_szMyDrvReg);
InitializeObjectAttributes(&Object, &TempUnicodeString,
OBJ_CASE_INSENSITIVE, NULL, (PSECURITY_DESCRIPTOR) NULL);

Status = ZwOpenKey(&hMyDrvLink, KEY_ALL_ACCESS, &Object);

Status ends up being 0xc0000034, even if I cut out the \MyDriver part
of the c_szMyDrvReg string…

Any idea how to approach this?

Thanks,
John


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

You’re awesome! Thanks! On to the next bug!

-----Original Message-----
From: Vodicka, Michal [mailto:xxxxx@rkk.cz]
Sent: Friday, April 20, 2001 4:00 PM
To: NT Developers Interest List
Subject: [ntdev] RE: quick question

I think the error code is clear it this case :slight_smile:

Try to change HKEY_LOCAL_MACHINE to MACHINE or start with RegistryPath
string passed to DriverEntry(). ZwOpenKey() is enough,
IoOpenDeviceRegistryKeys() isn’t necessary.

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


From: John Hirschi[SMTP:xxxxx@SonicWALL.com]
Reply To: NT Developers Interest List
Sent: Friday, April 20, 2001 11:51 PM
To: NT Developers Interest List
Subject: [ntdev] RE: quick question

Thank you very much for responding to my question… I appreciate
everyone’s input.

I converted my code from the Reg…() function to the Zw…() functions,
but I ran into the same problems I started with. When I try to use
the
ZwOpenKey() function, I get an error code of 0xc0000034
(STATUS_OBJECT_NAME_NOT_FOUND). I went through some sample code in
the
DDK to see what I was doing wrong. I noticed that all the examples
were
calling IoOpenDeviceRegistryKey() before anything else, but that opens
a
device-specific area of the registry…

Here is my code, boiled down:

const WCHAR c_szMyDrvReg =

L"\Registry\HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\M

yDriver";
NTSTATUS Status;
HANDLE hMyDrvLink;
UNICODE_STRING TempUnicodeString;
OBJECT_ATTRIBUTES Object;

RtlInitUnicodeString(&TempUnicodeString, c_szMyDrvReg);
InitializeObjectAttributes(&Object, &TempUnicodeString,
OBJ_CASE_INSENSITIVE, NULL, (PSECURITY_DESCRIPTOR) NULL);

Status = ZwOpenKey(&hMyDrvLink, KEY_ALL_ACCESS, &Object);

Status ends up being 0xc0000034, even if I cut out the \MyDriver part
of the c_szMyDrvReg string…

Any idea how to approach this?

Thanks,
John


You are currently subscribed to ntdev as: xxxxx@sonicwall.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