非管理员模式下的注册表访问 [英] Registry access in non-admin mode
问题描述
现在我的用户告诉我认为,在非管理员(标准用户)模式下,应用程序不起作用。看,我看到当应用程序处于管理模式时,我无法读取放入HKEY_LOCAL_MACHINE的设置。
我有什么选择?我对标准模式知之甚少,这对于访问注册表的方式有何影响。任何信息赞赏。
您可以从HKLM读取为非管理员用户;你不能写信。
在构建它时使用TRegistry.Create(KEY_READ),并将RootKey设置为HKLM。
var
注册表:TRegistry;
begin
注意:= TRegistry.Create(KEY_READ)
try
Reg.RootKey:= HKLM;
//读取值在这里
finally
Reg.Free;
结束
结束
打开特定注册表项时也可以使用TRegistry.OpenKeyReadOnly()这有助于非管理员访问注册表的区域。
I've several long-standing apps written in Delphi that persist their settings in the registry. I've used HKEY_LOCAL_MACHINE for 'hard' settings such as configuration preferences and HKEY_CURRENT_USER for 'soft' info such as window positions, MRU lists etc.
Now my users are telling me that in non-admin (standard user) mode the apps dont work. Looking, I see that I'm not able to read a setting put into HKEY_LOCAL_MACHINE when the app was in admin mode.
What are my options for this? I know little about standard mode and how this affects access to the registry at all. Any info appreciated.
You can read from HKLM as a non-admin user; you just can't write to it.
Use TRegistry.Create(KEY_READ) when constructing it, and set the RootKey to HKLM.
var
Reg: TRegistry;
begin
Reg := TRegistry.Create(KEY_READ)
try
Reg.RootKey := HKLM;
// Read value here
finally
Reg.Free;
end;
end;
You can also use TRegistry.OpenKeyReadOnly() when opening a specific registry key; this helps with non-admin access to areas of the registry as well.
这篇关于非管理员模式下的注册表访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!