微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

简单的问题关于registryCreateSubKey

为什么这不工作? 我试图在[HKEY_LOCAL_MACHINE SOFTWARE MyService]下创build一个registry项,但是没有任何东西被创build。

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using Microsoft.Win32; namespace RegistryKey { class Program { static void Main(string[] args) { const string SUB_KEY_NAME = @"SOFTWAREMyService"; // Create a subkey named MyService under HKEY_LOCAL_MACHINE. Registry.LocalMachine.CreateSubKey(SUB_KEY_NAME); } } }

更新:没关系。 我是个白痴。 我使用远程registry编辑器检查registry,相信它会显示相同的registry编辑器。 它没有! 我可以看到使用registry的path。

在Windows上有没有相当于.Net的Valgrind?

任务pipe理器不同意Process Explorer?

processstartinfo.UseShellExecute有什么大不了的?

如何使用.NET枚举属于特定进程的所有窗口?

Windbg可以显示线程名称吗?

您无权写入HKLM。 如果你想在这里写,那么你需要:

以高级用户身份运行进程,或者。

只在安装时试图写入HKLM。

试试这个代码

RegistryKey regkey = Registry.CurrentUser; regkey = regkey.CreateSubKey(SUB_KEY_NAME); //this is the path then you create yours keys regkey.SetValue("Install","ok"); //name of key exp:(install) and then the value exp:(ok)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐