Explorar o código

* fixed TRegistry.ChangeKey

git-svn-id: trunk@1818 -
florian %!s(int64=20) %!d(string=hai) anos
pai
achega
ee18b4f6ce
Modificáronse 2 ficheiros con 4 adicións e 2 borrados
  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);