How to debug inno-setup exceptions

2k Views Asked by At

I compiled inno-setup with XE6 myself. (I know, the document suggested older delphi versions, but I only have new IDE)

I want to use pascal script to customize setup. But even I added a simplest [Code] section, the created installation crash.

[Code]
function InitializeSetup(): Boolean;
begin
end; 

The created setup.exe failed while being installed:

[22:10:29.945]   *** Setup started
[22:10:36.182]   Setup version: Inno Setup version 5.5.4 (u)
[22:10:36.186]   Original Setup EXE: D:\Classics\Save\Installer\Win_Platform\Inno Setup\test\Output\setup.exe
[22:10:36.190]   Setup command line: /SL5="$911152,176640,176640,D:\Classics\Save\Installer\Win_Platform\Inno Setup\test\Output\setup.exe" /SPAWNWND=$7B05B8 /NOTIFYWND=$1150B10 /DEBUGWND=$74002E 
[22:10:36.200]   Windows version: 6.2.9200  (NT platform: Yes)
[22:10:36.203]   64-bit Windows: Yes
[22:10:36.209]   Processor architecture: x64
[22:10:36.212]   User privileges: Administrative
[22:10:37.660]   64-bit install mode: No
[22:10:37.674]   Created temporary directory: C:\Users\CAOSHU~1\AppData\Local\Temp\is-5AOTJ.tmp
[22:10:37.717]   InitializeSetup raised an exception (fatal).
[22:10:37.725]   Exception message:
[22:10:37.734]   Message box (OK):
    Access violation at address 006043C0 in module 'setup.tmp'. Read of address 00000014.
[22:11:03.501]   User chose OK.
[22:11:03.515]   Deinitializing Setup.
[22:11:04.424]   *** Setup exit code: 1

Perhaps the way I compiled inno setup has some problems. I need not use XE6? But how to debug and figure out where the problem is?

It is not some code which crashes when it runs. It is a setup.exe which created by inno setup.

1

There are 1 best solutions below

9
On

The value returned by InitializeSetup() is undefined.

function InitializeSetup(): Boolean;
begin
   result := true;
end;

You get an undefined behaviour because of this. If most of the time the result will be false (last 8 bits of RAX == 0), this is not always the case and you'll get a seriously "hard to understand" issue, particularly when, for no reason, it'll work.