Page 1 of 1

Terminate with Exit Code

Posted: Thu May 21, 2009 12:58 pm
by manoj_jain
Just changed my InstallAware setup code to use "Terminate with Exit Code". Now when I run the setup.exe under Vista, depending on where I break from the setup, I get the correct exit code - as displayed by "echo %ERRORLEVEL%" from Vista's DOS command window.

However, when the same setup.exe is run from Windows XPSP2, it does not update the ERRORLEVEL. The ERRORLEVEL value remains the same as before setup.exe was launched. So if the ERRORLEVEL was set to 99, after setup finished (or terminates) the ERRORLEVEL is still set to 99.

I then ran a test C++ exe and after this exe finished, ERRORLEVEL does show the actual error code returned by the test EXE. So ERRORLEVEL logic is working under XPSP2 - just not with SETUP.EXE.

Help ?

Posted: Fri May 22, 2009 4:46 am
by MichaelNesmith
This code is not platform specific, so it should work on all operating systems. Please re-test using both an uncompressed setup and a compressed setup.

Do not just rely on the batch file mechanism but use CreateProcess from your own application to validate the return code. Please report what you find.

Thanks - problem fixed

Posted: Fri May 22, 2009 12:46 pm
by manoj_jain
Thanks Michael.

The problem was not resolved by using uncompressed setup. But if I used another program (using CreateProcess) and check setup's exit code, then it does return the proper code.

So it seems that the way a process's exit code is handled in XP is different from Vista - at least the way InstallAware setups are concerned.

Anyway, this workaround will do for now.

Thanks again.

Posted: Fri May 22, 2009 4:57 pm
by MichaelNesmith
That's truly odd. If CreateProcess works, then I would imagine something is wrong with the batch files on XP, which is even more surprising because that would probably be the first thing Vista does better than XP :lol:

At any rate, as you have seen via CreateProcess, InstallAware is returning the correct codes.