views:

401

answers:

3

Hi All,

I have a dll made in cpp which tries to read/write some Registry Keys. This code runs perfectly fine in Windows XP (32 bit environment) but it fails in Windows 7(64 bit environment).

The registry keys which this application accesses is the shared registry keys. These keys are not part of 32 bit registry cache(wow32 bit) or 64 bit registry cache.

Please provide your valuable inputs on this.

Thanks in advance.

Jits

+1  A: 

when you say "shared" you mean for example under HKLM? Only elevated applications are allowed to write to those on Windows 7 and Vista. If this is news to you I suggest searching on User Account Control or UAC.

Kate Gregory
Yeah sure, as if *RegQueryValueEx* was **writting** to registry.
AOI Karasu
Yeah, sure, when the question says "tries to read/write some Registry Keys" I am stupid to think the code might be writing them.
Kate Gregory
A: 

Maybe you should initialize the value of "lpcbData", the last parameter of RegQueryValueEx.

lydia
+2  A: 

Check out this: RegQueryValueEx Function

And this: Registry Key Security and Access Rights

IMO you have to check your permission settings that you use to open the key. Either remove the settings that require elevated privileges or run your app in elevated mode.

AOI Karasu