源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2022-03-09 20:39 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Delphi修改操作注册表权限的代码
需要uses jclwin32, AccCtrl; 此文件需要安装JCL
[u]复制代码[/u] 代码如下:
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;
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部