문제

How can I edit a remote registry from 32-bit app to 64-bit server.

It very important: remote registry brunch must be 64bit, not 32bit.

I write code like this:

RegistryKey key = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, remoteServerName)
 .OpenSubKey(SUBKEY,true);

if (key != null)
{
    key.SetValue(KEY_1, Value_1);
    key.Close();
    key.Dispose();
}

It runs on 64-bit platform and edit 64bit server registry key.

How to edit the same key(64bit branch) via app runs on 32bit platform?

도움이 되었습니까?

해결책

You need to pass an additional argument (RegistryView.Registry32) to OpenRemoteBaseKey like the example below.

RegistryKey key = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, remoteServerName, RegistryView.Registry32)

These links would be helpful for you. http://msdn.microsoft.com/en-us/library/dd411615(v=vs.110).aspx http://msdn.microsoft.com/en-us/library/microsoft.win32.registryview(v=vs.110).aspx

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top