我希望能够修改HKEY_CLASSES_ROOT的所有子键。
我有以下清单代码:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
我有以下汇编代码:
[assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CLASSES_ROOT")]
这有效:
Registry.ClassesRoot.CreateSubKey("._test");
但是这失败了(除非以编程方式创建密钥):
RegistryKey key = Registry.ClassesRoot.OpenSubKey("any_key");
key.CreateSubKey("._test");
用户决定选择哪个键,因此我无法记下:
[assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CLASSES_ROOT/desired_subkey")]
因为在程序执行期间动态选择了desired_subkey。
所有想法?