靠不住的行为VS2010得到HKLM值,即使与以管理员身份运行C#.NET 4 [英] wonky behaviour vs2010 get HKLM value even with Run As Administrator c# .NET 4

查看:216
本文介绍了靠不住的行为VS2010得到HKLM值,即使与以管理员身份运行C#.NET 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关,这将作为Windows服务
运行的应用程序 我存储在HKLM \ SOFTWARE ......注册表项的设置值。

For an application that will run as a windows service
I store settings values in a HKLM\Software... registry key.

我一直访问我的注册表值的库。

I've a library that accesses my registry values.

我有,我用它来验证code ++工程,一个简单的测试控制台应用程序。

I've a simple test console application that I use to verify that the code works.

要通过我的测试控制台应用程序调试,我必须运行VS2010以管理员身份。

To debug via my test console application, I must run vs2010 as administrator.

一切正常:

Console.WriteLine(WindowsRegistry.getTaleoOrgCode("test"));

调用

Microsoft.Win32.RegistryKey hklmLocalMachineRoot =
Microsoft.Win32.Registry.LocalMachine;
Microsoft.Win32.RegistryKey hklmLocalMachineHbsiTaleoClient =
hklmLocalMachineRoot.OpenSubKey(@"SOFTWARE\Taleo\" + clientName.Trim(), false);
 // read only
if (hklmLocalMachineHbsiTaleoClient != null)

通过调试,很明显,hklmLocalMachineHbsiTaleoClient不为空。

via debug, it's clear that hklmLocalMachineHbsiTaleoClient is not null.

我有一个使用上述库函数的应用程序。

I have an application that uses the above library subroutine.

我开始在VS2010该应用程序还以管理员身份。

I start that application in vs2010 also as administrator.

通过调试,很明显,hklmLocalMachineHbsiTaleoClient为空。

via debug, it's clear that hklmLocalMachineHbsiTaleoClient is null.

在调试,我保证故障的应用程序
有我的注册表程序库的最新版本。

Before debugging, I ensure that the failing application
has the latest version of my registry routines library.

Visual Studio 2010的专业版在Windows 7下运行。

The vs2010 Pro version is running under Windows 7.

帮助,请和谢谢。

推荐答案

汉斯是正确的,他的评论是,妖注册表虚拟化。

Hans is right in his comment that the demon is registry virtualization.

请看看我的跟进queestion:

Please see my follow up queestion:

<一个href="http://stackoverflow.com/questions/4980211/how-do-i-search-all-non-virtual-and-virtual-registries-in-vista-win7-et-cetera">how我搜索所有的非虚拟和虚拟注册表在Vista中,Win7的,等等C#.NET 4 HKLM

感谢你。

这篇关于靠不住的行为VS2010得到HKLM值,即使与以管理员身份运行C#.NET 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆