0

I am working with an application once written for Windows XP, making it work for Windows Vista and later. Formerly there was a lot of read and write accesses to HKEY_LOCAL_MACHINE in registry. I've rewritten this so that only the installer writes to HKEY_LOCAL_MAHINE (with elevated privileges) and the application accesses these settings with read-only access. The application is written in C# and C++ and compiled for 32 bit.

Everything is working fine on my development computer running Windows 7. I have also tested the installer and application an a clean (virtual) Windows 7, both as a local administrator and a normal user. It just works. But when I test the installer and application on another computer (also running Windows 7 as a local administrator) I get the following exception:

System.Security.SecurityException: Requested registry access is not allowed.

The exception is thrown by the RegistryKey.OpenSubKey(string) method which according to Microsoft retrieves a subkey as read-only which I thought should be ok.

I have tried following all the rules and recommendations when it comes to registry accesses on Windows Vista and later, but it seems that I still miss something. What am I missing here?

arghol
  • 745
  • 9
  • 21
  • possible duplicate of [Requested registry access is not allowed](http://stackoverflow.com/questions/562350/requested-registry-access-is-not-allowed) – Malice Dec 18 '14 at 09:57
  • I saw that question before posting, but I don't think it is a duplicate. That was about **writing** to parts of registry, this is about **reading** (which should be ok without administrator or elevated privileges). Sure, maybe a manifest might "solve" the problem, but I don't want to require administrator privileges. – arghol Dec 18 '14 at 10:08
  • What registry key are you trying to access? Can you read it with regedit? What permissions does it have? – Harry Johnston Dec 18 '14 at 22:06
  • Question was answered here: http://stackoverflow.com/questions/31741599/unable-to-read-registry-system-security-securityexception-requested-registry-a – Andrei Gavrila Jul 31 '15 at 16:08

0 Answers0