0

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.

dltigles
  • 45
  • 6

1 Answers1

0

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.

Abstract type
  • 1,901
  • 2
  • 15
  • 26
  • Well, the result is undefined in this case, but there are only two scenarios that may happen. Either the setup will start, or not. No exception is raised in this case. The setup [`triggers`](https://github.com/jrsoftware/issrc/blob/is-5_5_5/Projects/Main.pas#L3143) the `InitializeSetup` event by the `RunBooleanFunction` method which [`tests`](https://github.com/jrsoftware/issrc/blob/is-5_5_5/Projects/ScriptRunner.pas#L358) that undefined (but declared) result for value 1 and returns accordingly. – TLama Nov 23 '14 at 17:39
  • We agree then ;) I wait for the OP to reply: my assumption is that its installer crashes because the function always returns false, which might be wrong...The small text about UB is just explanatory. Actually since the code turns in a VM, the thing I've said about RAX could be wrong. – Abstract type Nov 23 '14 at 17:46
  • @BBaz Same error after adding "result := True". After setup.exe started, it first showed "Select Setup Language" page, then after I clicking "OK", the exception-warning windows showed:"Access violation at address 006043c0 in module 'setup.tmp'. Read of address 00000014." – dltigles Nov 23 '14 at 23:10
  • And BTW, I didn't compile the code with IDE. I just compiled it use build.bat. – dltigles Nov 23 '14 at 23:21
  • @dltigles, so why you said that you did to me ? Let me guess, you've just clicked on the batch script without seeing the result of build (because the console window was closed) hoping that everything worked fine. And now you're trying to figure out why does some *weird AV* is raised following a trial error way thinking you'll get soon to the finish. You won't. You should build all the projects! All of them! That build must succeed! [P.S. feel free to flag my comments again, you're just against yourself; I'm done, I remember you from several different accounts created on StackOverflow] – TLama Nov 24 '14 at 10:19
  • @TLama I said I didn't compile the code with IDE, just means a way to reproduce the error for BBaz, not for you. Because I did not try "return TRUE" at first, so I tried another time without compiling with IDE, but it failed again, so I want to tell BBaz the whole conditions to recreate the error. That is it. I saw the console output while I run build.bat, only some hints, no errors. If it had errors, then I could not get the exe for running. – dltigles Nov 24 '14 at 11:11
  • @TLama BTW, for accounts, I first use Chrome, and create one. But for some reason, it cannot ask question. And just some days later, I found IE can show the website more better, so I create another one. But a week ago, my IE cannot open(Can I ask someone to help me? _~_). So I just return to Chrome. Chrome told me I only can use the old account. And I find I can ask question now. I have no mistake, I think. – dltigles Nov 24 '14 at 11:21
  • And where is the comments above? I just want to reference them, but perhaps they were deleted? – dltigles Nov 24 '14 at 11:25
  • 1
    @TLama: BTW, thanks for your helping. My inno-setup environment is ok now. Thanks. – dltigles Nov 24 '14 at 13:52