Registry rights
Author
Discussion

atom290

Original Poster:

1,015 posts

287 months

Thursday 27th January 2005
quotequote all
Im having a real doh moment currently, and cant for the life of me work out a way round it, so if it is easy im willing to sit in the corner for a while!

All users log on as user.

I am trying to run a program I have written in VB that accesses the registry, unfortunately the values are coming back blank unless im logged in as an administrator.

Can anyone suggest another method other than logging everyone on as administrator????

JonRB

80,062 posts

302 months

Thursday 27th January 2005
quotequote all
If you only want to read registry values, you need to open the registry in read-only mode.

Don't know how you do this in VB. If it's any help then in C++ you'd call RegOpenKeyEx with the samDesired parameter set to KEY_READ or KEY_QUERY_VALUE instead of the default KEY_ALL_ACCESS

Edit: With a Restricted User account you don't have write access to HKEY_LOCAL_MACHINE (HKLM) but you do to HKEY_CURRENT_USER (HKCU), so if you need write access then consider redesigning your app to use HKCU.

Edit2: You may want to read this Ask Dr. GUI article and also MSDN Knowledge Base Article Q145679


>> Edited by JonRB on Thursday 27th January 13:25

rlk500

917 posts

282 months

Thursday 27th January 2005
quotequote all
Alternatively you could grant the users full rights to the specific hive/key that your app references, using Regedit.

JonRB

80,062 posts

302 months

Thursday 27th January 2005
quotequote all
rlk500 said:
Alternatively you could grant the users full rights to the specific hive/key that your app references, using Regedit.
Surely that's an ugly workaround rather than an actual solution?

Plotloss

67,280 posts

300 months

Thursday 27th January 2005
quotequote all
Jon is on the money.

There is a way to pass the Run As command the administrator password also, but I would class that as an ugly solution...

_dobbo_

14,619 posts

278 months

Thursday 27th January 2005
quotequote all
Is it possible that the values only exist in the "administrator" user section of the registry - hence aren't available when logged on as a different user?

atom290

Original Poster:

1,015 posts

287 months

Thursday 27th January 2005
quotequote all
Thanks guys for all of the suggestions, but the Man was on the ball!

From onw Jon to another Jon