I am trying to add values to Internet Explorer's Registry key from an addon. My understanding is if OpenKey()
doesn't find the Registry key, then it creates the key because of the true
parameter I am using. But it's not being created, and the function returns false. Any idea what I'm doing wrong?
procedure DoInitialization;
var
...
reg1: TRegistry;
begin
reg1 := tRegistry.Create(KEY_ALL_ACCESS);
try
if reg1.OpenKey('HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Low Rights\ElevationPolicy\{B93642D4-0A6D-11DF-AD36-FF4756D89593}', true) then begin
reg1.WriteString('AppPath', ClientDir);
reg1.WriteInteger('Policy', $00000003);
reg1.WriteString('AppName', 'xxxxxxxx.exe');
end else
ShowMessage('False');
finally
reg1.CloseKey;
end;
...
end;