码迷,mamicode.com
首页 > 其他好文 > 详细

RegistryView

时间:2018-11-26 15:08:22      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:.com   tor   store   port   handle   can   prope   window   machine   

https://docs.microsoft.com/en-us/dotnet/api/microsoft.win32.registryview?view=netframework-4.7

On the 64-bit version of Windows, portions of the registry are stored separately for 32-bit and 64-bit applications. There is a 32-bit view for 32-bit applications and a 64-bit view for 64-bit applications.

You can specify a registry view when you use the OpenBaseKey and OpenRemoteBaseKey(RegistryHive, String, RegistryView) methods, and the FromHandle property on a RegistryKey object.

If you request a 64-bit view on a 32-bit operating system, the returned keys will be in the 32-bit view.

 

 

https://stackoverflow.com/questions/13728491/opensubkey-returns-null-for-a-registry-key-that-i-can-see-in-regedit-exe

A 32-bit application on a 64-bit OS will be looking at the HKLM\Software\Wow6432Node node by default. To read the 64-bit version of the key, you‘ll need to specify the RegistryView:

using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
using (var key = hklm.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"))
{
// key now points to the 64-bit key
}

 

 

 

RegistryView

标签:.com   tor   store   port   handle   can   prope   window   machine   

原文地址:https://www.cnblogs.com/chucklu/p/10020030.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!