Unable to detect resource leak in X64 VCL app

delphi package - automated exception handling

Re: Unable to detect resource leak in X64 VCL app

Postby q675318 » Sat Dec 08, 2018 5:19 am

my fix code
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;
q675318
 
Posts: 16
Joined: Sun Dec 02, 2018 9:29 pm

Re: Unable to detect resource leak in X64 VCL app

Postby madshi » Sat Dec 08, 2018 11:10 am

Thanks for finding the cause of the problem q675318!

The reason it still worked on my PC is that madExcept.pas has a special case for my development PC, where madExcept32/64.dll are compiled to "c:\sources\madshi".

Anyway, should be fixed in this build:

http://madshi.net/madCollectionBeta.exe (installer 2.8.8.2)
madshi
Site Admin
 
Posts: 10010
Joined: Sun Mar 21, 2004 5:25 pm

Re: Unable to detect resource leak in X64 VCL app

Postby spanfkyous » Sat Dec 08, 2018 11:25 am

q675318 wrote:my fix code
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;



Good Job
spanfkyous
 
Posts: 11
Joined: Fri Nov 10, 2017 1:29 am

Previous

Return to madExcept

Who is online

Users browsing this forum: No registered users and 4 guests

cron