欢迎来到入门教程网!

Delphi

当前位置:主页 > 软件编程 > Delphi >

Delphi修改操作注册表权限的代码

来源:本站原创|时间:2020-01-10|栏目:Delphi|点击:

需要uses jclwin32, AccCtrl; 此文件需要安装JCL

复制代码 代码如下:

function AllowRegKeyForEveryone(Key: HKEY; Path: string): Boolean;
var
WidePath: PWideChar;
Len: Integer;
begin
case Key of
HKEY_LOCAL_MACHINE:
Path := 'MACHINE\' + Path;
HKEY_CURRENT_USER:
Path := 'CURRENT_USER\' + Path;
HKEY_CLASSES_ROOT:
Path := 'CLASSES_ROOT\' + Path;
HKEY_USERS:
Path := 'USERS\' + Path;
end;
Len := (Length(Path)+1)*SizeOf(WideChar);
GetMem(WidePath,Len);
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, PChar(Path), -1, WidePath, Len);
Result := SetNamedSecurityInfoW(WidePath, SE_REGISTRY_KEY,
DACL_SECURITY_INFORMATION, nil, nil, nil, nil) = ERROR_SUCCESS;
FreeMem(WidePath);
end;

上一篇:Delphi 生成excel中饼图的实例代码

栏    目:Delphi

下一篇:delphi程序全屏显示无标题栏覆盖整个屏幕(适合屏保)

本文标题:Delphi修改操作注册表权限的代码

本文地址:https://www.xiuzhanwang.com/a1/Delphi/8656.html

网页制作CMS教程网络编程软件编程脚本语言数据库服务器

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:835971066 | 邮箱:835971066#qq.com(#换成@)

Copyright © 2002-2020 脚本教程网 版权所有