mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-18 05:00:07 +02:00
* To be Delphi compatible TRegistry.DeleteKey() must delete the specified key and all its child keys.
git-svn-id: trunk@48207 -
(cherry picked from commit ffff24593d
)
This commit is contained in:
parent
bade890df5
commit
324061745a
@ -70,7 +70,28 @@ function TRegistry.DeleteKey(const Key: UnicodeString): Boolean;
|
||||
|
||||
Var
|
||||
u: UnicodeString;
|
||||
subkeys: TUnicodeStringArray;
|
||||
k, old: HKEY;
|
||||
i: integer;
|
||||
begin
|
||||
old:=fCurrentKey;
|
||||
k:=GetKey(Key);
|
||||
if k <> 0 then
|
||||
begin
|
||||
fCurrentKey:=k;
|
||||
try
|
||||
subkeys:=GetKeyNames;
|
||||
for i:=0 to High(subkeys) do
|
||||
begin
|
||||
Result:=DeleteKey(subkeys[i]);
|
||||
if not Result then
|
||||
exit;
|
||||
end;
|
||||
finally
|
||||
fCurrentKey:=old;
|
||||
CloseKey(k);
|
||||
end;
|
||||
end;
|
||||
u:=PRepKey(Key);
|
||||
FLastError:=RegDeleteKeyW(GetBaseKey(RelativeKey(Key)),PWideChar(u));
|
||||
Result:=FLastError=ERROR_SUCCESS;
|
||||
|
Loading…
Reference in New Issue
Block a user