I need to get the permissions of a given key (HKEY_CURRENT_USER\Software\Microsoft\Protected Storage System Provider) and then set all the subkeys (HKEY_CURRENT_USER\Software\Microsoft\Protected Storage System Provider\S-1-5-21-842925246-152049171-1060284298-1003) with these same permissions.
Also, how to replace this new permissions with the older ones.
Any ideas on how to accomplish this? I've looked into the docs but with no examples it's a little difficult to get it right.
Thanks,
Steven Martins
Get and set permissions on a registry key
Does the code I gave you via email not work? Here is it again:
This code is supposed to work in all OSs - well, in win9x it simply does nothing. But you can execute it everywhere without any problems. Also it doesn't matter whether the paths exist or not. If they don't exist, madSecurity again simply does nothing.
Code: Select all
procedure UnprotectHkcu(path: string);
begin
with RegistrySecurity('HKCU\' + path) do begin
ProtectedDAcl := false;
DAcl.SetFileAccess(CurrentUser, true);
end;
end;
var str : string;
begin
str := 'Software\Microsoft\Protected Storage System Provider\' +
CurrentUser.SidStr;
UnprotectHkcu(str);
UnprotectHkcu(str + '\Data');
UnprotectHkcu(str +
'\Data\e161255a-37c3-11d2-bcaa-00c04fd929db\e161255a-37c3-11d2-bcaa-00c04fd9
29db');