What's wrong with Registry.GetValue?

后端 未结 5 1281
轻奢々
轻奢々 2021-01-12 07:25

I trying to get a registry value:

var value = Registry.GetValue(@\"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography\", \"MachineGuid\", 0);
5条回答
  •  星月不相逢
    2021-01-12 07:55

    You say you're on 64-bit Windows: is your app 32-bit? If so it's probably being affected by registry redirection and is looking at HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Cryptography. You may have to P/Invoke to work around it: http://msdn.microsoft.com/en-us/library/aa384129.aspx.

提交回复
热议问题