Re: RegOpenKeyEx and QueryValueEx to get values from registry

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Tom Esh (tjeshGibberish_at_earthlink.net)
Date: 03/29/04


Date: Mon, 29 Mar 2004 12:23:43 -0500

On Mon, 29 Mar 2004 05:26:51 -0800, "Rui Oliveira"
<anonymous@discussions.microsoft.com> wrote:

>I am using RegOpenKeyEx and QueryValueEx to get values
>from registry.
>
>The problem is that, this only works for users the local
>administrator rights. When I tried with an user with
>just 'Users group' or 'Power Users group' rights, the
>QueryValueEx functions returns an empty value.

>...
>lRetVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, sKeyName, 0,
>KEY_ALL_ACCESS, hKey)

The problem is KEY_ALL_ACCESS. User's don't have it and you don't need
it in this case. Best approach is to use the minimum permission that
works. KEY_READ should be sufficient.

-Tom
MVP - Visual Basic
(please post replies to the newsgroup)



Relevant Pages

  • Re: registry edit
    ... newsgroup. ... >| monitor.reg - it will add keys that were not installed ... >| a message that I am unable to access the registry. ... >| I have administrator rights so do not know what is going ...
    (microsoft.public.win2000.registry)
  • Re: Work Laptop - Personal Folders Disbaled
    ... You can try making a backup of the registry, then deleting that key, but unless you have administrator rights to that machine, you may not be able to do so. ... > What value should it be to enable Personal Folders? ... >> our laptops have been reconfigured. ...
    (microsoft.public.outlook)
  • Re: How to create key in HKLMHARDWAREDEVICEMAPScsiScsi Port2Scsi Bus 0 ??
    ... I have Administrator rights! ... I check the premision on registry and I ... You may need to adjust the permissions of the "SCSI Bus 0" key ...
    (microsoft.public.windowsxp.general)
  • Re: usbccid driver : enable Escape command
    ... this is not a solution as this kind of registry modification ... is not possible with user rights, only administrator rights. ...
    (microsoft.public.development.device.drivers)
  • RE: SP2 "Access Denied"
    ... I did check my administrator rights in the Registry and confimred I had full ... Anti-Virus software in hopes this was part of the problem. ... provide much diagnostic help. ...
    (microsoft.public.windowsxp.help_and_support)