如果没有管理员权限,您可以获得哪些注册表访问权限? [英] What registry access can you get without Administrator privileges?

查看:98
本文介绍了如果没有管理员权限,您可以获得哪些注册表访问权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我们不应该再使用注册表来存储应用程序数据,但是在更新旧应用程序(并希望进行最少的更改)时,非管理员可以使用哪些注册表配置单元?

I know that we shouldn't being using the registry to store Application Data anymore, but in updating a Legacy application (and wanting to do the fewest changes), what Registry Hives are non-administrators allowed to use?

我可以在没有管理员权限的情况下访问所有 HKEY_CURRENT_USER(应用程序当前访问 HKEY_LOCAL_MACHINE)吗?

Can I access all of HKEY_CURRENT_USER (the application currently access HKEY_LOCAL_MACHINE) without Administrator privileges?

推荐答案

一般来说,非管理员用户可以访问注册表:

In general, a non-administrator user has this access to the registry:

读/写:

  • HKEY_CURRENT_USER

只读:

  • HKEY_LOCAL_MACHINE
  • HKEY_CLASSES_ROOT(这只是一个链接HKEY_LOCAL_MACHINE\Software\Classes)
  • HKEY_LOCAL_MACHINE
  • HKEY_CLASSES_ROOT (which is just a link to HKEY_LOCAL_MACHINE\Software\Classes)

可以逐个键更改其中一些权限,但这种情况极为罕见.您不必担心.

It is possible to change some of these permissions on a key-by-key basis, but it's extremely rare. You should not have to worry about that.

出于您的目的,您的应用程序应该将设置和配置写入 HKEY_CURRENT_USER.规范位置位于 HKEY_CURRENT_USER\Software\YourCompany\YourProduct\

For your purposes, your application should be writing settings and configuration to HKEY_CURRENT_USER. The canonical place is anywhere within HKEY_CURRENT_USER\Software\YourCompany\YourProduct\

您可能会在 HKEY_LOCAL_MACHINE 中保存全局设置(适用于所有用户).很少需要这样做,你应该避免它.问题是任何用户都可以读取"这些内容,但只有管理员(或扩展名,您的安装/安装程序)可以设置"它们.

You could potentially hold settings that are global (for all users) in HKEY_LOCAL_MACHINE. It is very rare to need to do this, and you should avoid it. The problem is that any user can "read" those, but only an administrator (or by extension, your setup/install program) can "set" them.

其他常见的问题来源:您的应用程序不应写入Program filesWindows 目录中的任何内容.如果您需要写入文件,有几种选择;描述所有这些将是一个更长的讨论.所有选项最终都会写入相关用户的 %USERPROFILE% 下的子文件夹或其他文件夹.

Other common source of trouble: your application should not write to anything in the Program files or the Windows directories. If you need to write to files, there are several options at hand; describing all of them would be a longer discussion. All of the options end up writing to a subfolder or another under %USERPROFILE% for the user in question.

最后,您的应用程序应该远离HKEY_CURRENT_CONFIG.这个 hive 包含硬件配置、服务配置和其他 99.9999% 的应用程序不需要查看的项目(例如,它包含当前的即插即用设备列表).如果您需要从那里获取任何信息,大部分信息都可以通过其他地方受支持的 API 获得.

Finally, your application should stay out of HKEY_CURRENT_CONFIG. This hive holds hardware configuration, services configurations and other items that 99.9999% of applications should not need to look at (for example, it holds the current plug-and-play device list). If you need anything from there, most of the information is available through supported APIs elsewhere.

这篇关于如果没有管理员权限,您可以获得哪些注册表访问权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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