title: C# Registry Permission
body: <p>i want to be able to modify all subkeys of HKEY_CLASSES_ROOT.</p>
  
  <p>I have the following manifest code:</p>
  
  <pre><code>&lt;requestedExecutionLevel  level="requireAdministrator" uiAccess="false" /&gt;
  </code></pre>
  
  <p>I have the following assembly code:</p>
  
  <pre><code>[assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CLASSES_ROOT")]
  </code></pre>
  
  <p>This works:</p>
  
  <pre><code> Registry.ClassesRoot.CreateSubKey("._test");
  </code></pre>
  
  <p>But this fails (unless the key is programmatically created):</p>
  
  <pre><code> RegistryKey key = Registry.ClassesRoot.OpenSubKey("any_key");
   key.CreateSubKey("._test");
  </code></pre>
  
  <p>The user decides which key is selected, therefore i can't write down:</p>
  
  <pre><code>[assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CLASSES_ROOT/desired_subkey")]
  </code></pre>
  
  <p>since the desired_subkey is dynamically chosen during program execution.</p>
  
  <p>So any ideas?</p>