Delphi修改操作注册表权限的代码
需要uses jclwin32, AccCtrl; 此文件需要安装JCL <BR><div class="codetitle"><span><U>复制代码</U></span> 代码如下:</div><div class="codebody" id="code64249"> <BR>function AllowRegKeyForEveryone(Key: HKEY; Path: string): Boolean; <BR>var <BR>WidePath: PWideChar; <BR>Len: Integer; <BR>begin <BR>case Key of <BR>HKEY_LOCAL_MACHINE: <BR>Path := 'MACHINE\' + Path; <BR>HKEY_CURRENT_USER: <BR>Path := 'CURRENT_USER\' + Path; <BR>HKEY_CLASSES_ROOT: <BR>Path := 'CLASSES_ROOT\' + Path; <BR>HKEY_USERS: <BR>Path := 'USERS\' + Path; <BR>end; <BR>Len := (Length(Path)+1)*SizeOf(WideChar); <BR>GetMem(WidePath,Len); <BR>MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, PChar(Path), -1, WidePath, Len); <BR>Result := SetNamedSecurityInfoW(WidePath, SE_REGISTRY_KEY, <BR>DACL_SECURITY_INFORMATION, nil, nil, nil, nil) = ERROR_SUCCESS; <BR>FreeMem(WidePath); <BR>end; <BR></div><div class="art_xg">
<b>您可能感兴趣的文章:</b><ul><li>Delphi 常见文件处理及注册表文件的使用实例</li></ul>
</div>
</div>
<!--endmain-->
頁:
[1]