Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cannot create a key uder HKEY_USERS !

315 views
Skip to first unread message

Drago

unread,
Dec 15, 2003, 4:22:20 AM12/15/03
to
Hi,
I want to make a new key under HKEY_USERS.
I use RegCreateKeyEx(HKEY_USERS, "Test\\SOFTWARE", 0, NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL, &hKey, &dw);

However the function always returns - "The parameter is incorrect." . If I
change HKEY_USERS to HKEY_CURRENT_USER the key gets created. I can not add a
new key under HKEY_USERS even when I use Regedit.exe . I am testing on a
Windows XP professional PC . Can anyone tell me what is wrong?

Thanks!


Frank Hickman

unread,
Dec 15, 2003, 4:42:03 AM12/15/03
to
HKEY_USERS is restricted to Admins and the OS. I'm betting you do not have
sufficient privileges to create a key there.

HTH
--
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.


"Drago" <drag...@abv.bg> wrote in message
news:uAexszuw...@TK2MSFTNGP11.phx.gbl...

Drago

unread,
Dec 15, 2003, 4:58:07 AM12/15/03
to
Thanks for your reply but I am a computer administrator on the PC.


"Frank Hickman" <fhickman_nosp@m_noblesoft.com> wrote in message
news:d9ydnS3DIKQ...@comcast.com...

Frank Hickman

unread,
Dec 15, 2003, 6:08:55 AM12/15/03
to
Yes I see what you mean. I also could not successfully create a key under
it with admin rights. Perhaps it is locked from the kernel that says no to
anyone but NT_AUTHORITY or SYSTEM. Probably so that someone couldn't bypass
the security in order to create users.

--
Frank

"Drago" <drag...@abv.bg> wrote in message

news:uXeBlKvw...@TK2MSFTNGP10.phx.gbl...

Alexander Grigoriev

unread,
Dec 15, 2003, 11:39:04 AM12/15/03
to
HKEY_USERS is not a key in which you can create subkeys.
It's a global root "key" under which you can mount registry hives (registry
files), by calling RegLoadKey, and only if you have SE_BACKUP_NAME
privilege.

The same is for HKEY_LOCAL_MACHINE.

HKU and HKLM can only hold hives as subkeys.

"Drago" <drag...@abv.bg> wrote in message
news:uAexszuw...@TK2MSFTNGP11.phx.gbl...

Alexander Grigoriev

unread,
Dec 15, 2003, 11:40:30 AM12/15/03
to
From RegCreateKeyEx documentation:

"An application cannot create a key that is a direct child of HKEY_USERS or
HKEY_LOCAL_MACHINE."

"Drago" <drag...@abv.bg> wrote in message
news:uAexszuw...@TK2MSFTNGP11.phx.gbl...

Jase

unread,
Dec 15, 2003, 11:39:01 PM12/15/03
to
I think the "direct child" is the key phrase there. Just create your key
under HKEY_USERS/Software.

Jase

"Alexander Grigoriev" <al...@earthlink.net> wrote in message
news:exdLqoyw...@TK2MSFTNGP10.phx.gbl...

Igor Tandetnik

unread,
Dec 16, 2003, 9:31:32 AM12/16/03
to
"Jase" <jshe...@spamblock.enersol.com.au> wrote in message
news:3fde8c65$0$18749$afc3...@news.optusnet.com.au...

> I think the "direct child" is the key phrase there. Just create your
key
> under HKEY_USERS/Software.

There is no subkey named "Software" under HKEY_USERS. Are you maybe
confusing it with HKEY_CURRENT_USER?
--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Jase

unread,
Dec 18, 2003, 6:59:38 PM12/18/03
to
There is on my system ;-) There are two keys under HKEY_USERS.
1. .DEFAULT
2. Software

Why do you want to put the key there anyway? Is there a special reason why
you can't use a subkey of HKEY_LOCAL_MACHINE?

Jase

"Igor Tandetnik" <itand...@mvps.org> wrote in message
news:uESDsH%23wDH...@TK2MSFTNGP12.phx.gbl...

r norman

unread,
Dec 18, 2003, 9:07:42 PM12/18/03
to
On Fri, 19 Dec 2003 10:59:38 +1100, "Jase"
<jshe...@spamblock.enersol.com.au> wrote:
>
>"Igor Tandetnik" <itand...@mvps.org> wrote in message
>news:uESDsH%23wDH...@TK2MSFTNGP12.phx.gbl...
>> "Jase" <jshe...@spamblock.enersol.com.au> wrote in message
>> news:3fde8c65$0$18749$afc3...@news.optusnet.com.au...
>> > I think the "direct child" is the key phrase there. Just create your
>> key
>> > under HKEY_USERS/Software.
>>
>> There is no subkey named "Software" under HKEY_USERS. Are you maybe
>> confusing it with HKEY_CURRENT_USER?
>> --

>There is on my system ;-) There are two keys under HKEY_USERS.


>1. .DEFAULT
>2. Software
>
>Why do you want to put the key there anyway? Is there a special reason why
>you can't use a subkey of HKEY_LOCAL_MACHINE?
>

Yes, if you want each user to have his/her own private settings. The
proper place is HKEY_CURRENT_USER. The other location, HKEY_USERS
has all the separate user information in it.

Jase

unread,
Dec 21, 2003, 11:19:03 PM12/21/03
to
"r norman" <rsn_@_comcast.net> wrote in message
news:k7n4uvgrlg4eammua...@4ax.com...

Still confused. Why can't you use HKEY_LOCAL_MACHINE for common settings,
and HKEY_CURRENT_USER for user specific stuff?

Jase


r norman

unread,
Dec 22, 2003, 1:16:43 AM12/22/03
to

That is exactly what I was trying to say.

The reason you can't use a subkey of HKEY_LOCAL_MACHINE is
specifically to give users their own separate information. If you
want all users to share the information, then HKEY_LOCAL__MACHINE is
the place.

Ron Natalie

unread,
Dec 22, 2003, 9:14:10 AM12/22/03
to

"Jase" <jshe...@spamblock.enersol.com.au> wrote in message news:3fe670b8$0$18689$afc3...@news.optusnet.com.au...

> >
> > Yes, if you want each user to have his/her own private settings. The
> > proper place is HKEY_CURRENT_USER. The other location, HKEY_USERS
> > has all the separate user information in it.
> >
>
> Still confused. Why can't you use HKEY_LOCAL_MACHINE for common settings,
> and HKEY_CURRENT_USER for user specific stuff?
>

And HKEY_USERS is essentially just a list of the known users (one of which is going to
be mapped to HKEY_CURRENT_USER at any given time).

Alexander Grigoriev

unread,
Dec 22, 2003, 10:34:28 AM12/22/03
to

"Ron Natalie" <r...@sensor.com> wrote in message
news:3fe6b4f7$0$421$9a6e...@news.newshosting.com...

>
>
> And HKEY_USERS is essentially just a list of the known users (one of which
is going to
> be mapped to HKEY_CURRENT_USER at any given time).
>

Only those currently logged on (at least on NT/2K/XP).


0 new messages