HELP...how to access registry's HKEY_CURRENT_USER

hi kernel folks,

i’m having some problem accessing the HKEY_CURRENT_USER key in
registry under kernel mode. I tried using RtlQueryRegistryValues and it
returns STATUS_OBJECT_NAME_NOT_FOUND.

i’m sure the path and key are there in the registry. Is there some
thing to take note in order to access HKEY_CURRENT_USER? Here’s my code
snippet:

BOOLEAN
NmUsb_GetRegistryDword(
IN PWCHAR RegPath,
IN PWCHAR ValueName,
IN OUT PULONG Value
)

UNICODE_STRING path;
RTL_QUERY_REGISTRY_TABLE paramTable[2];
ULONG lDef = *Value;
NTSTATUS status;
BOOLEAN fres;
WCHAR wbuf[MAXIMUM_FILENAME_LENGTH];

path.Length = 0;
path.MaximumLength = MAXIMUM_FILENAME_LENGTH * sizeof( WCHAR );
path.Buffer = wbuf;

RtlZeroMemory(path.Buffer, path.MaximumLength);
RtlMoveMemory(path.Buffer, RegPath, wcslen( RegPath) * sizeof( WCHAR
));

RtlZeroMemory(paramTable, sizeof(paramTable));

paramTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
paramTable[0].Name = (PWSTR)ValueName;
paramTable[0].EntryContext = Value;
paramTable[0].DefaultType = REG_DWORD;
paramTable[0].DefaultData = &lDef;
paramTable[0].DefaultLength = sizeof(ULONG);

status = RtlQueryRegistryValues( RTL_REGISTRY_USER |
RTL_REGISTRY_OPTIONAL, path.Buffer, paramTable, NULL, NULL);
* snip *

hope somebody can give me some pointers
thanx in advance

> i’m having some problem accessing the HKEY_CURRENT_USER key in

registry under kernel mode. I tried using RtlQueryRegistryValues and it
returns STATUS_OBJECT_NAME_NOT_FOUND.

I don’t think it is possible. Imagine Terminal Server with 100 different
users :slight_smile:
Also - HKCU is mounted (by shell32.dll?) at interactive logon only. No such
key
even for services - not to mention kmode drivers.

Max

if it’s impossible, then why is it that in the DDKunder RtlQueryRegistryValues
the definition
“RTL_REGISTRY_USER:
Path is relative to \Registry\User\CurrentUser” is being mentioned ?

Maxim S. Shatskih wrote:

> i’m having some problem accessing the HKEY_CURRENT_USER key in
> registry under kernel mode. I tried using RtlQueryRegistryValues and it
> returns STATUS_OBJECT_NAME_NOT_FOUND.

I don’t think it is possible. Imagine Terminal Server with 100 different
users :slight_smile:
Also - HKCU is mounted (by shell32.dll?) at interactive logon only. No such
key
even for services - not to mention kmode drivers.

Max


You are currently subscribed to ntdev as: xxxxx@singnet.com.sg
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Try reading the HKEY_USERS sub-key, which name contains SID of the logged on
user. This key contains the same info as HKEY_CURRENT_USER. I’m not sure how
this works on Terminal Server, but on regular NT Workstation/Server this
works fine - I can read this key from a service, so probably this will work
for kernel mode driver as well…

serge

-----Original Message-----
From: kengleng [mailto:xxxxx@singnet.com.sg]
Sent: Thursday, August 03, 2000 5:16 PM
To: NT Developers Interest List
Subject: [ntdev] Re: HELP…how to access registry’s HKEY_CURRENT_USER

if it’s impossible, then why is it that in the DDKunder
RtlQueryRegistryValues
the definition
“RTL_REGISTRY_USER:
Path is relative to \Registry\User\CurrentUser” is being mentioned ?

Maxim S. Shatskih wrote:

> i’m having some problem accessing the HKEY_CURRENT_USER key in
> registry under kernel mode. I tried using RtlQueryRegistryValues and it
> returns STATUS_OBJECT_NAME_NOT_FOUND.

I don’t think it is possible. Imagine Terminal Server with 100 different
users :slight_smile:
Also - HKCU is mounted (by shell32.dll?) at interactive logon only. No
such
key
even for services - not to mention kmode drivers.

Max


You are currently subscribed to ntdev as: xxxxx@singnet.com.sg
To unsubscribe send a blank email to $subst(‘Email.Unsub’)


You are currently subscribed to ntdev as: xxxxx@stac.ee
To unsubscribe send a blank email to $subst(‘Email.Unsub’)