+ Disposition needs correct address when creating key

This commit is contained in:
michael 2003-02-19 10:46:00 +00:00
parent ee44541d17
commit dac0abce62

View File

@ -31,7 +31,7 @@ end;
function TRegistry.sysCreateKey(const Key: String): Boolean; function TRegistry.sysCreateKey(const Key: String): Boolean;
Var Var
P: PChar; P: PChar;
Disposition: LPDWord; Disposition: Integer;
Handle: HKEY; Handle: HKEY;
SecurityAttributes: Pointer; //LPSECURITY_ATTRIBUTES; SecurityAttributes: Pointer; //LPSECURITY_ATTRIBUTES;
@ -46,7 +46,7 @@ begin
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
SecurityAttributes, SecurityAttributes,
Handle, Handle,
Disposition) = ERROR_SUCCESS; @Disposition) = ERROR_SUCCESS;
RegCloseKey(Handle); RegCloseKey(Handle);
end; end;
@ -133,17 +133,22 @@ function TRegistry.OpenKey(const Key: string; CanCreate: Boolean): Boolean;
Var Var
P: PChar; P: PChar;
Handle: HKEY; Handle: HKEY;
Disposition: LPDWord; Disposition: Integer;
SecurityAttributes: Pointer; //LPSECURITY_ATTRIBUTES; SecurityAttributes: Pointer; //LPSECURITY_ATTRIBUTES;
begin begin
SecurityAttributes := Nil; SecurityAttributes := Nil;
P:=PrepKey(Key); P:=PrepKey(Key);
If CanCreate then If CanCreate then
begin
Handle:=0;
Result:=RegCreateKeyEx(GetBaseKey(RelativeKey(Key)),P,0,'', Result:=RegCreateKeyEx(GetBaseKey(RelativeKey(Key)),P,0,'',
REG_OPTION_NON_VOLATILE, REG_OPTION_NON_VOLATILE,
fAccess,SecurityAttributes,Handle, fAccess,SecurityAttributes,Handle,
Disposition)=ERROR_SUCCESS @Disposition)=ERROR_SUCCESS
end
else else
Result:=RegOpenKeyEx(GetBaseKey(RelativeKey(Key)), Result:=RegOpenKeyEx(GetBaseKey(RelativeKey(Key)),
P,0,fAccess,Handle)=ERROR_SUCCESS; P,0,fAccess,Handle)=ERROR_SUCCESS;