windows 在没有管理员权限的情况下更改注册表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4844441/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Changing registry without admin rights
提问by John White
I thought I needed admin rights for changing registry (I get errors if my app doesn't have such). Maybe only some part of the registry require admin rights.
我以为我需要管理员权限来更改注册表(如果我的应用程序没有这样的权限,我会收到错误消息)。也许只有注册表的某些部分需要管理员权限。
Could you give some information? I need to store my app data somewhere without admin rights.
你能提供一些信息吗?我需要将我的应用程序数据存储在没有管理员权限的地方。
回答by SLaks
You need administrative privileges to write to locations that are shared by multiple users.
In the filesystem, this means folders like \WINDOWS
or \Program Files
.
In the registry, this means all of the hives which aren't per-user.
您需要管理权限才能写入多个用户共享的位置。
在文件系统中,这意味着像\WINDOWS
或这样的文件夹\Program Files
。在注册表中,这意味着不是每个用户的所有配置单元。
Therefore, you can only write to HKEY_CURRENT_USER
.
Specifically, you should write to HKCU\Software\Your Company
.
因此,您只能写入HKEY_CURRENT_USER
.
具体来说,你应该写信给HKCU\Software\Your Company
.
回答by Bob Moore
Log in as a normal non-admin user. Open up regedit, right-click on the top level keys and examine the permissions for each, you'll see which ones you can write to as a user. Basically, it's just HKEY_CURRENT_USER as SLaks says.
以普通非管理员用户身份登录。打开regedit,右键单击顶级键并检查每个键的权限,您将看到您可以作为用户写入哪些权限。基本上,正如 SLaks 所说,它只是 HKEY_CURRENT_USER。
HKEY_LOCAL_MACHINE is off limits, for instance. You can write to HKEY_USERS/your users SID, because HKCU is basically an image of that.
例如,HKEY_LOCAL_MACHINE 是禁区。您可以写入 HKEY_USERS/您的用户 SID,因为 HKCU 基本上是它的映像。