2
votes

I have a problem, my application is running under admin rights (I have also manifest)

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

I'm making program to changing default icons. When I'm changing default icon for *.php file everything is ok. But if I want change default icon for *.mp3 file i get this error Requested registry access is not allowed. I dont know how can I get better privileges for working with registry. I'm using only this -> RegistryKeyPermissionCheck.ReadWriteSubTree. And this gives me error:

FileExt = FileExt.OpenSubKey("UserChoice", RegistryKeyPermissionCheck.ReadWriteSubTree);

Thanks for response!

2
Have you used regedit to look at the key to see what permissions it has on it? - Mark Hall
The read is allowed for all extensions. But .php extension I can change but .mp3 not. Permissions are the same. And administrator (I'm running app as admin) has full control right for all extensions. - sczdavos

2 Answers

1
votes

Have u already tried to start your Assembly as an administrator? To check this quickly just start the compiled application as an administrator.

To achieve this programmatically change the user context during the execution of your code look at this MSDN article: http://msdn.microsoft.com/en-us/library/w070t6ka.aspx

0
votes

I added try catch -> try read/write catch read.