无法写入 HKEY_LOCAL_MACHINE\Software 下的注册表 [英] Cannot Write to the Registry under HKEY_LOCAL_MACHINE\Software

查看:428
本文介绍了无法写入 HKEY_LOCAL_MACHINE\Software 下的注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应用程序,它需要创建一个对登录屏幕和控制面板用户小程序隐藏的特殊用户帐户.通过将带有用户名的 DWORD 值 0 写入下面的注册表项,我可以实现此目标:

I'm writing an application that needs to create a special user account hidden from login screens and the Control Panel users applet. By writing a DWORD value of 0 with the user name to the registry key below, I'm able to accomplish this goal:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\SpecialAccounts\UserList

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList

问题在于,在开启 UAC 的 Windows 7 下,无论我尝试什么,我都无法以编程方式将值写入上面的键.

The problem is that under Windows 7 with UAC on, no matter what I try, I cannot programmatically write a value to the key above.

据我所知,在启用 UAC 的 Windows 7 上不允许写入某些键,除非您使用管理权限运行.我添加了一个应用程序清单 requestedExecutionLevel level="requireAdministrator" uiAccess="false",我在程序运行时接受了 UAC 提示,我的帐户是管理员的成员,但我仍然无法写入上述注册表项.

It is my understanding that writing to certain keys this is not allowed on Windows 7 with UAC on, unless you are running with Administrative privileges. I've added an application manifest requestedExecutionLevel level="requireAdministrator" uiAccess="false", I accept the UAC prompt when my program is run, my account is a member of Administrators, yet I am still unable to write to the above registry key.

我还需要做什么?在任何应用程序配置中,如何在 HKEY_LOCAL_MACHINE\SOFTWARE 下写入键和值?

What more do I need to do? How is it possible, in any application configuration, to write keys and values under HKEY_LOCAL_MACHINE\SOFTWARE?

更多信息...当我的程序运行时,没有抛出错误并且它似乎写入值.我的猜测是 Windows 正在虚拟化我正在写入的位置.如果要隐藏此特殊用户帐户,我需要写入实际位置,而不是虚拟位置.

Further information ... When my program runs, no errors are thrown and it seems to write values. My guess is that Windows is virtualizing the location to which I am writing. I need to write to the actual location, not a virtual one, if I am to hide this special user account.

推荐答案

可能是程序在 64 位操作系统上作为 32 位程序运行?在这种情况下,我建议您搜索您在 HKEY_LOCAL_MACHINE\SOFTWAREWow6432Node 子项下创建的值.

Probably the program runs as 32-bit program on the 64-bit operation system? In the case I recommend you to search the values which you created under Wow6432Node subkey of the HKEY_LOCAL_MACHINE\SOFTWARE.

您可以在此处阅读有关此类虚拟化的更多信息.您可以在某些 API 中使用 KEY_WOW64_32KEY 标志 以便能够使用没有虚拟化的完整注册表.

You can read more about such kind of virtualization here. You can use KEY_WOW64_32KEY flag in some API to be able to work with full registry without virtualization.

这篇关于无法写入 HKEY_LOCAL_MACHINE\Software 下的注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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