Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Newsgroups > Vista General

Vista - Registry rights under Vista

Reply
 
Old 01-06-2009   #1 (permalink)
DavidW


 
 

Registry rights under Vista

Hello,

I am a developer. What parts of the Windows registry are writable and readable
under an Standard User account? I assume that branches off
HKEY_CURRENT_USER\Software are okay, but I need to be able to make changes for
all users. If this can only be done under an Adminstrator account I still have a
problem. I can create a key under HKEY_USERS\.DEFAULT\Software in Regedit in an
Administrator account, but I get an access violation when I try to create it by
calling RegCreateKeyEx from within my application. Is this the right location in
the registry for all-user information, and, if so, how do I write to it from
within an application?



My System SpecsSystem Spec
Old 01-06-2009   #2 (permalink)
Pavel A.


 
 

Re: Registry rights under Vista

"DavidW" <no@xxxxxx> wrote in message
newscV8l.125866$sC4.70343@xxxxxx
Quote:

> Hello,
>
> I am a developer. What parts of the Windows registry are writable and
> readable under an Standard User account? I assume that branches off
> HKEY_CURRENT_USER\Software are okay, but I need to be able to make changes
> for all users. If this can only be done under an Adminstrator account I
> still have a problem.
You're right. Standard user account cannot modify global system branches or
HKEY_CURRENT_USER of other users.
Quote:

> I can create a key under HKEY_USERS\.DEFAULT\Software in Regedit in an
> Administrator account, but I get an access violation when I try to create
> it by calling RegCreateKeyEx from within my application. Is this the right
> location in the registry for all-user information, and, if so, how do I
> write to it from within an application?
This is one of locations.
Have look at the Windows Installer - it is designed to support
the installation type that you need.
http://msdn.microsoft.com/en-us/libr...88(VS.85).aspx

Unfortunately, this is not very simple or intuitive as we'd like it
Your team or project lead should be able to guide you further.

Good luck,
--PA



My System SpecsSystem Spec
Old 01-06-2009   #3 (permalink)
DavidW


 
 

Re: Registry rights under Vista

Tyro wrote:
Quote:

> You are a developer?? And have no knowledge of Vista? Microsoft
> provides that to you.
I'm sure it does, but where? Where is it explained why a registry key can be
created in RegEdit but the same key cannot be created from an application? It is
not under RegCreateKeyEx in the VC++ documentation. Microsoft probably provides
the answer to just about every question asked here...somewhere. The hardest part
about writing software used to be designing and writing your code. Now it is
finding the right information.
Quote:

> You sound like a hacker.
Nope.
Quote:

>
> Tyro
>
>
> "DavidW" <no@xxxxxx> wrote in message
> newscV8l.125866$sC4.70343@xxxxxx
Quote:

>> Hello,
>>
>> I am a developer. What parts of the Windows registry are writable and
>> readable under an Standard User account? I assume that branches off
>> HKEY_CURRENT_USER\Software are okay, but I need to be able to make
>> changes for all users. If this can only be done under an
>> Adminstrator account I still have a problem. I can create a key under
>> HKEY_USERS\.DEFAULT\Software in Regedit in an Administrator account,
>> but I get an access violation when I try to create it by calling
>> RegCreateKeyEx from within my application. Is this the right
>> location in the registry for all-user information, and, if so, how
>> do I write to it from within an application?

My System SpecsSystem Spec
Old 01-06-2009   #4 (permalink)
DavidW


 
 

Re: Registry rights under Vista

Pavel A. wrote:
Quote:

> "DavidW" <no@xxxxxx> wrote in message
> newscV8l.125866$sC4.70343@xxxxxx
Quote:

>> Hello,
>>
>> I am a developer. What parts of the Windows registry are writable and
>> readable under an Standard User account? I assume that branches off
>> HKEY_CURRENT_USER\Software are okay, but I need to be able to make
>> changes for all users. If this can only be done under an
>> Adminstrator account I still have a problem.
>
> You're right. Standard user account cannot modify global system
> branches or HKEY_CURRENT_USER of other users.
If it can only be done as an Administrator then so be it.
Quote:
Quote:

>> I can create a key under HKEY_USERS\.DEFAULT\Software in Regedit in
>> an Administrator account, but I get an access violation when I try
>> to create it by calling RegCreateKeyEx from within my application.
>> Is this the right location in the registry for all-user information,
>> and, if so, how do I write to it from within an application?
>
> This is one of locations.
> Have look at the Windows Installer - it is designed to support
> the installation type that you need.
> http://msdn.microsoft.com/en-us/libr...88(VS.85).aspx
That doesn't look like what I need, unless something special is required during
the app's installation to enable it to write to that location once it's
installed and someone runs it. I did notice that if the app was launched from
the installer (i.e., checkbox to launch when installation complete) the accesses
worked, but they did not work on subsequent launches.
Quote:

> Unfortunately, this is not very simple or intuitive as we'd like it
Can you give me an idea what I'm looking for? Some sort of installation
attribute? I'm using InnoSetup for the installer.
Quote:

> Your team or project lead should be able to guide you further.
I am the lead.
Quote:

> Good luck,
Thanks.


My System SpecsSystem Spec
Old 01-07-2009   #5 (permalink)
Pavel A.


 
 

Re: Registry rights under Vista

DavidW wrote:
Quote:

> Can you give me an idea what I'm looking for? Some sort of installation
> attribute? I'm using InnoSetup for the installer.
IMHO you should be looking for making a MSI package
that can be automatically "elevated", so it can do "administrative"
install for all users.
This is the only valid way to install a system-wide app by a
no-admin user (if enabled by policy).

Or, you can redesign the app so that it can be installed locally for
each user, and not require tampering with global system locations.

I haven't used Inno for a while - maybe their latest versions
support what you need. The version I knew, did not.

Regards,
--PA
My System SpecsSystem Spec
Old 01-07-2009   #6 (permalink)
Kyle Alons


 
 

Re: Registry rights under Vista

"DavidW" <no@xxxxxx> wrote in message
newscV8l.125866$sC4.70343@xxxxxx
Quote:

> Hello,
>
> I am a developer. What parts of the Windows registry are writable and
> readable under an Standard User account? I assume that branches off
> HKEY_CURRENT_USER\Software are okay, but I need to be able to make changes
> for all users. If this can only be done under an Adminstrator account I
> still have a problem. I can create a key under
> HKEY_USERS\.DEFAULT\Software in Regedit in an Administrator account, but I
> get an access violation when I try to create it by calling RegCreateKeyEx
> from within my application. Is this the right location in the registry for
> all-user information, and, if so, how do I write to it from within an
> application?
>
Your question applies to much more than Vista. Non-admin users haven't been
able to edit other user or machine registry data since Windows 2000.
http://msdn.microsoft.com/en-us/library/ms995853.aspx

The only difference in Vista is that by default, unelevated admin users
can't either.
http://www.kinook.com/blog/?p=40

You might want to rethink whether you really have to do it, but if you must
modify the registry for all users, during installation (require admin
rights), you could make a subkey of HKEY_LOCAL_MACHINE editable by all
users.

--
---------------------
Kyle Alons
http://www.kinook.com


My System SpecsSystem Spec
Old 01-07-2009   #7 (permalink)
DavidW


 
 

Re: Registry rights under Vista

Kyle Alons wrote:
Quote:

> "DavidW" <no@xxxxxx> wrote in message
> newscV8l.125866$sC4.70343@xxxxxx
Quote:

>> Hello,
>>
>> I am a developer. What parts of the Windows registry are writable and
>> readable under an Standard User account? I assume that branches off
>> HKEY_CURRENT_USER\Software are okay, but I need to be able to make
>> changes for all users. If this can only be done under an
>> Adminstrator account I still have a problem. I can create a key under
>> HKEY_USERS\.DEFAULT\Software in Regedit in an Administrator account,
>> but I get an access violation when I try to create it by calling
>> RegCreateKeyEx from within my application. Is this the right
>> location in the registry for all-user information, and, if so, how
>> do I write to it from within an application?
>>
>
> Your question applies to much more than Vista. Non-admin users
> haven't been able to edit other user or machine registry data since
> Windows 2000. http://msdn.microsoft.com/en-us/library/ms995853.aspx
I know, but the difference with Vista is that the RegCreateKeyEx call fails even
for an administrator. It works in XP.
Quote:

> The only difference in Vista is that by default, unelevated admin
> users can't either.
> http://www.kinook.com/blog/?p=40
And that appears to be what's killing me. I don't get an elevation prompt
either. The call just fails with "Access denied".
Quote:

> You might want to rethink whether you really have to do it,
I do, because the software controls an external device and some settings
associated with it apply to all users. Most of my registry values are in
HKEY_CURRENT_USER.
Quote:

> but if
> you must modify the registry for all users, during installation
> (require admin rights), you could make a subkey of HKEY_LOCAL_MACHINE
> editable by all users.
Thanks. That worked. (It didn't work for HKEY_USERS\.DEFAULT, though, but I
don't mind switching to HKEY_LOCAL_MACHINE).


My System SpecsSystem Spec
Old 01-08-2009   #8 (permalink)
Ben Voigt [C++ MVP]


 
 

Re: Registry rights under Vista

DavidW wrote:
Quote:

> Kyle Alons wrote:
Quote:

>> "DavidW" <no@xxxxxx> wrote in message
>> newscV8l.125866$sC4.70343@xxxxxx
Quote:

>>> Hello,
>>>
>>> I am a developer. What parts of the Windows registry are writable
>>> and readable under an Standard User account? I assume that branches
>>> off HKEY_CURRENT_USER\Software are okay, but I need to be able to
>>> make changes for all users. If this can only be done under an
>>> Adminstrator account I still have a problem. I can create a key
>>> under HKEY_USERS\.DEFAULT\Software in Regedit in an Administrator
>>> account, but I get an access violation when I try to create it by
>>> calling RegCreateKeyEx from within my application. Is this the right
>>> location in the registry for all-user information, and, if so, how
>>> do I write to it from within an application?
>>>
>>
>> Your question applies to much more than Vista. Non-admin users
>> haven't been able to edit other user or machine registry data since
>> Windows 2000. http://msdn.microsoft.com/en-us/library/ms995853.aspx
>
> I know, but the difference with Vista is that the RegCreateKeyEx call
> fails even for an administrator. It works in XP.
>
Quote:

>> The only difference in Vista is that by default, unelevated admin
>> users can't either.
>> http://www.kinook.com/blog/?p=40
>
> And that appears to be what's killing me. I don't get an elevation
> prompt either. The call just fails with "Access denied".
Ahh, here is your problem AND how we are going to fix it. The elevation
prompt isn't triggered by behavior that requires elevation. It is triggered
by the file name or the manifest embedded in the executable. Google for
runAsInvoker vs runAsAdmin. Once you mark your program runAsAdmin then the
elevation prompt will appear and RegCreateKeyEx will succeed.


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
How to access a registry entry wo no access rights Vista security
Registry Search Tool... Cleaning Up Vista Registry... Vista General
No rights on HKEY_Local_Machine registry map 'optionalcomponents' Vista General
Wise Registry Cleaner vs AusLogics Registry Defrag vs CCLeaner? Vista performance & maintenance
Registry Key Error - Insufficient Access Rights Vista performance & maintenance


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46