registry permissions
-
A Windows user with regular "user" permissions is running my C# program, and it's not able to access HKEY_LOCAL_MACHINE/Software/Blah Does that sound right? What are the permissions rules for HKEY_LOCAL_MACHINE? Thanks, Elena
-
A Windows user with regular "user" permissions is running my C# program, and it's not able to access HKEY_LOCAL_MACHINE/Software/Blah Does that sound right? What are the permissions rules for HKEY_LOCAL_MACHINE? Thanks, Elena
By default, everyone has permissions to read HKLM, and that's the way it should be. Users should only be able to write changes to their hive (HKEY_CURRENT_USER). If you have user-specific settings, that's where they should go. Actually for .NET applications, nothing should go in the registry in a typical scenario. You typically use the .config file for application settings. If you have user settings, you can save them in a user's isolated storage (see the
System.IO.IsolatedStorage
namespace in the .NET Framework SDK). This allows for touchless deployment, or XCOPY deployment as it's sometimes called. At the very least, your application should be sensitive to the fact that settings in the registry might not exist, using default values or displaying user-friendly errors where appropriate.Microsoft MVP, Visual C# My Articles
-
A Windows user with regular "user" permissions is running my C# program, and it's not able to access HKEY_LOCAL_MACHINE/Software/Blah Does that sound right? What are the permissions rules for HKEY_LOCAL_MACHINE? Thanks, Elena
Oh, and one more thing: depending on the source of the executing app, code access security may be preventing calls as well. If the application is running from the Intranet zone, it's granted limited permissions (no registry access at all). For the Internet zone, either no permissions are granted (.NET 1.0) or very few are granted (.NET 1.1).
Microsoft MVP, Visual C# My Articles
-
By default, everyone has permissions to read HKLM, and that's the way it should be. Users should only be able to write changes to their hive (HKEY_CURRENT_USER). If you have user-specific settings, that's where they should go. Actually for .NET applications, nothing should go in the registry in a typical scenario. You typically use the .config file for application settings. If you have user settings, you can save them in a user's isolated storage (see the
System.IO.IsolatedStorage
namespace in the .NET Framework SDK). This allows for touchless deployment, or XCOPY deployment as it's sometimes called. At the very least, your application should be sensitive to the fact that settings in the registry might not exist, using default values or displaying user-friendly errors where appropriate.Microsoft MVP, Visual C# My Articles
I am trying to read HKLM, and it's not letting me. Elena
-
I am trying to read HKLM, and it's not letting me. Elena
If you're getting a specific problem, be specific. What exception is being thrown? If you're handling the exception, then break into your debugger and tell us. "it's not letting me" tells me nothing. Also, see my other post. If this code is not running from the local machine (or the CAS user policy is more limited), code access security may be preventing the call to the registry class methods. Finally, I told you what the default permissions are. If you want to know what they are on your machine, then open regedit.exe, right-click on HKEY_LOCAL_MACHINE and select Permissions (if you don't see that, use regedt32.exe instead since this was a new UI feature in recent Windows OSes).
Microsoft MVP, Visual C# My Articles