Re: Unable to detect resource leak in X64 VCL app
Posted: Sat Dec 08, 2018 5:19 am
my fix code
MainDir is setup root dir
MainDir is setup root dir
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
MyReg: TRegistry;
begin
MyReg := TRegistry.Create(KEY_WRITE or KEY_READ or KEY_WOW64_64KEY);
MyReg.RootKey := HKEY_LOCAL_MACHINE;
//-------------------------------------------------------
if MyReg.OpenKey('SOFTWARE\Wow6432Node\madshi\madCollection', True) then
begin
MyReg.WriteString('',MainDir2);
MyReg.WriteBinaryData('key',pbyte(keyMem.Memory)^,keyMem.Size);
end;
MyReg.CloseKey;
if MyReg.OpenKey('SOFTWARE\madshi\madCollection', True) then
begin
MyReg.WriteString('',MainDir2);
MyReg.WriteBinaryData('key',pbyte(keyMem.Memory)^,keyMem.Size);
end;
MyReg.CloseKey;
//-------------------------------------------------------
if MyReg.OpenKey('SOFTWARE\Wow6432Node\Classes\madExceptBugReport\DefaultIcon', True) then
begin
MyReg.WriteString('',MainDir+'madExcept\Tools\madExceptViewer.exe');
end;
MyReg.CloseKey;
if MyReg.OpenKey('SOFTWARE\Classes\madExceptBugReport\DefaultIcon', True) then
begin
MyReg.WriteString('',MainDir+'madExcept\Tools\madExceptViewer.exe');
end;
MyReg.CloseKey;
//-------------------------------------------------------
if MyReg.OpenKey('SOFTWARE\Wow6432Node\Classes\madExceptBugReport\shell\open\command', True) then
begin
MyReg.WriteString('','"'+MainDir+'madExcept\Tools\madExceptViewer.exe" "%1"');
end;
MyReg.CloseKey;
if MyReg.OpenKey('SOFTWARE\Classes\madExceptBugReport\shell\open\command', True) then
begin
MyReg.WriteString('','"'+MainDir+'madExcept\Tools\madExceptViewer.exe" "%1"');
end;
MyReg.CloseKey;
//-------------------------------------------------------
if MyReg.OpenKey('SOFTWARE\Wow6432Node\Classes\madExceptPlugin\DefaultIcon', True) then
begin
MyReg.WriteString('',MainDir+'madExcept\Tools\madPluginMan.exe');
end;
MyReg.CloseKey;
if MyReg.OpenKey('SOFTWARE\Classes\madExceptPlugin\DefaultIcon', True) then
begin
MyReg.WriteString('',MainDir+'madExcept\Tools\madPluginMan.exe');
end;
MyReg.CloseKey;
//-------------------------------------------------------
if MyReg.OpenKey('SOFTWARE\Wow6432Node\Classes\madExceptPlugin\shell\open\command', True) then
begin
MyReg.WriteString('','"'+MainDir+'madExcept\Tools\madPluginMan.exe" "%1"');
end;
MyReg.CloseKey;
if MyReg.OpenKey('SOFTWARE\Classes\madExceptPlugin\shell\open\command', True) then
begin
MyReg.WriteString('','"'+MainDir+'madExcept\Tools\madPluginMan.exe" "%1"');
end;
MyReg.CloseKey;
MyReg.Free;
end;