승리 7 64에서 레지스트리에 액세스 할 때 ComregisterFunction에서 무단 ADACCESSEXCELCE
-
19-09-2019 - |
문제
BHO Internet Explorer Extension을 등록하는 데 사용하는 [ComregisterFunction]이 있습니다. 64 비트 Windows 7 머신에 등록하는 동안 SubKey.SetValue ( "NoExplorer", 1)에 대한 호출에 무단 ADACCESSException이 발생합니다.
레지스트리에는 bho가 @ hklm software wow6432node microsoft wind 모든 도움이 감사하겠습니다.
[ComRegisterFunction]
public static void RegisterBho(Type type) {
string BhoKeyName= "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Browser Helper Objects";
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(BhoKeyName, true) ??
Registry.LocalMachine.CreateSubKey(BhoKeyName);
if(registryKey == null) throw new ApplicationException("Unable to register Bho");
registryKey.Flush();
string guid = type.GUID.ToString("B");
RegistryKey subKey = registryKey.OpenSubKey(guid) ?? registryKey.CreateSubKey(guid);
if (subKey == null) throw new ApplicationException("Unable to register Bho");
subKey.SetValue("NoExplorer", 1);
registryKey.Close();
subKey.Close();
}
해결책 2
그것을 알아 냈습니다. 작동하기 위해 다음을 추가해야했습니다. 왜 다른 버전의 OS에서 작동했는지 잘 모르겠습니다.
RegistrySecurity rs = new RegistrySecurity();
rs.AddAccessRule(new RegistryAccessRule(user,
RegistryRights.FullControl,
InheritanceFlags.ObjectInherit,
PropagationFlags.InheritOnly,
AccessControlType.Allow));
RegistryKey subKey = registryKey.OpenSubKey(guid) ?? registryKey.CreateSubKey(guid, RegistryKeyPermissionCheck.Default, rs);
다른 팁
행정 특권으로 실행해야합니다.
제휴하지 않습니다 StackOverflow