Browse Source

* fixed TRegistry.ChangeKey

git-svn-id: trunk@1818 -
florian 20 years ago
parent
commit
ee18b4f6ce
2 changed files with 4 additions and 2 deletions
  1. 1 1
      fcl/inc/registry.pp
  2. 3 1
      fcl/win32/winreg.inc

+ 1 - 1
fcl/inc/registry.pp

@@ -207,7 +207,7 @@ end;
 
 
 function TRegistry.GetBaseKey(Relative: Boolean): HKey;
 function TRegistry.GetBaseKey(Relative: Boolean): HKey;
 begin
 begin
-  If Relative Then
+  If Relative and (CurrentKey<>0) Then
     Result := CurrentKey
     Result := CurrentKey
   else
   else
     Result := RootKey;
     Result := RootKey;

+ 3 - 1
fcl/win32/winreg.inc

@@ -226,7 +226,9 @@ end;
 
 
 procedure TRegistry.ChangeKey(Value: HKey; const Path: String);
 procedure TRegistry.ChangeKey(Value: HKey; const Path: String);
 begin
 begin
-
+  CloseKey;
+  FCurrentKey:=Value;
+  FCurrentPath:=Path;
 end;
 end;
 
 
 procedure TRegistry.GetKeyNames(Strings: TStrings);
 procedure TRegistry.GetKeyNames(Strings: TStrings);