|
@@ -177,7 +177,7 @@ Var
|
|
Handle: HKEY;
|
|
Handle: HKEY;
|
|
Disposition: Integer;
|
|
Disposition: Integer;
|
|
SecurityAttributes: Pointer; //LPSECURITY_ATTRIBUTES;
|
|
SecurityAttributes: Pointer; //LPSECURITY_ATTRIBUTES;
|
|
-
|
|
|
|
|
|
+ S: string;
|
|
begin
|
|
begin
|
|
SecurityAttributes := Nil;
|
|
SecurityAttributes := Nil;
|
|
P:=PrepKey(Key);
|
|
P:=PrepKey(Key);
|
|
@@ -194,21 +194,27 @@ begin
|
|
else
|
|
else
|
|
Result:=RegOpenKeyExA(GetBaseKey(RelativeKey(Key)),
|
|
Result:=RegOpenKeyExA(GetBaseKey(RelativeKey(Key)),
|
|
P,0,fAccess,Handle)=ERROR_SUCCESS;
|
|
P,0,fAccess,Handle)=ERROR_SUCCESS;
|
|
- If Result then
|
|
|
|
- fCurrentKey:=Handle;
|
|
|
|
|
|
+ If Result then begin
|
|
|
|
+ if RelativeKey(Key) then
|
|
|
|
+ S:=CurrentPath + Key
|
|
|
|
+ else
|
|
|
|
+ S:=P;
|
|
|
|
+ ChangeKey(Handle, S);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRegistry.OpenKeyReadOnly(const Key: string): Boolean;
|
|
function TRegistry.OpenKeyReadOnly(const Key: string): Boolean;
|
|
|
|
|
|
Var
|
|
Var
|
|
- P: PChar;
|
|
|
|
- Handle: HKEY;
|
|
|
|
-
|
|
|
|
|
|
+ OldAccess: LongWord;
|
|
begin
|
|
begin
|
|
- P:=PrepKey(Key);
|
|
|
|
- Result := RegOpenKeyExA(GetBaseKey(RelativeKey(Key)),P,0,KEY_READ,Handle) = 0;
|
|
|
|
- If Result Then
|
|
|
|
- fCurrentKey := Handle;
|
|
|
|
|
|
+ OldAccess:=fAccess;
|
|
|
|
+ fAccess:=KEY_READ;
|
|
|
|
+ try
|
|
|
|
+ Result:=OpenKey(Key, False);
|
|
|
|
+ finally
|
|
|
|
+ fAccess:=OldAccess;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRegistry.RegistryConnect(const UNCName: string): Boolean;
|
|
function TRegistry.RegistryConnect(const UNCName: string): Boolean;
|