Archive: intermittent crashes and anomalies


intermittent crashes and anomalies
Hi

I have a rather simple NSIS installer based on installoptions with intermittent faults.

whenever i change the payload (the actual files, executable, help files etc) chances are that creating the installer (compiling the NSIS script) will fail with a crash especially when I use the LZMA/solid compressor. Take this example from today:

1. attempt to compile script with LZMA -> CRASH!
2. same script with default compressor -> OK!
3. straight after step #2, retry compile with LZMA -> OK!

what on earth could cause such a behaviour without me touching anything? To clarify what crashes is the NSIS compiler, and no installer EXE file is output

even when the installer is created it isn't always reliable. I have some checks for 64 bit windows using x64.nsh. My old installer was fine with it, now the same installer with the new payload can't recognize 64 bit windows unless it's run from an elevated process (!)

what is the cause of this randomness?
where can i get the latest version of UPX.EXE?

thanks
nikos


Which version of NSIS? What are the crash details?

UPX is on upx.sf.net.


I have downloaded the latest NSIS version and the latest UPX. So far I have not seen any crashes during compilation but this 64 bit detection code doesn't work still: (within Function .onInit):


!include "x64.nsh"
${If} ${RunningX64}
!ifdef WIN64
SetRegView 64
;${DisableX64FSRedirection} not required?
!else
MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 'There is a specific 64 bit xplorer² version$\r$\nFor details click zabkat.com/x2-64bit.htm $\r$\nProceed with 32 bit installation anyway?' IDYES noprob
Quit
noprob:
!endif
${Else}
!ifdef WIN64
MessageBox MB_OK|MB_ICONSTOP 'This is the 64 bit xplorer² installer$\r$\nPlease download the 32 bit version from zabkat.com/ $\r$\nClick Ok to quit Setup.'
Quit
!endif
${EndIf}


when I !define WIN64 the installer doesn't detect 64 bit windows so I just get a messagebox saying that "this is the 64 bit installer please get the 32 bit version..." which means that
${If} ${RunningX64}
didn't detect the OS properly!

any tips?
thanks

Try this instead, I have a headache following that. !ifdef is a compiler command, not a runtime command. I only tested on Vista and XP 32-bit and the 64-bit program installer is able to detect that I'm not running X64 without elevated privileges. As expected when I tried to install 64-bit xplorer² on 32-bit it blocked installation.


!include x64.nsh

Function .onInit
;This is for the 64-bit program installer, tell the user to download the 32-bit version if not running 64-bit because you can't run 64-bit binaries on a 32-bit OS
!ifdef WIN64
${IfNot} ${RunningX64}
MessageBox MB_OK|MB_ICONSTOP "This is the 64 bit xplorer² installer$\r$\nPlease download the 32 bit version from zabkat.com/ $\r$\nClick Ok to quit Setup."
Abort
${EndIf}

;If WIN64 is NOT defined, creates the 32-bit installer, warn that a 64-bit version is available if executed on 64-bit OS
!else
${If} ${RunningX64}
MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 "There is a specific 64 bit xplorer² version$\r$\nFor details click zabkat.com/x2-64bit.htm $\r$\nProceed with 32 bit installation anyway?" IDYES noprob
Abort
noprob:
${EndIf}
!endif

FunctionEnd
I hope that is what you're looking for. You may also want something like this:

!ifdef WIN64
OutFile "xplorer2-64bit.exe"
!else
OutFile "xplorer2-32bit.exe"
!endif

Also, from x64.nsh on redirection:
; DisableX64FSRedirection disables file system redirection.
; EnableX64FSRedirection enables file system redirection.
;
; SetOutPath $SYSDIR
; ${DisableX64FSRedirection}
; File some.dll # extracts to C:\Windows\System32
; ${EnableX64FSRedirection}
; File some.dll # extracts to C:\Windows\SysWOW64
;

I tried this "inside out" approach but it fails all the same

the weird thing is that if people run the installer from the desktop it fails, but if they open a 64 bit browser like xplorer2 and run the installer from in there there are no problems whatsoever


I'd ask to see the entire script, but that might not be possible.. and inquire if you are using some stripped/butchered version of Windows (such as with nLite or vLite) or might have any programs running, usually security programs, that might be causing the behavior.

And I don't see any upx.exe included with NSIS, have you tried it without using UPX at all?


ok it was a weird one but I've got it

in essense it was a faulty goto


FindWindow $0 "STATIC" "xplorer2_CommPort"
IsWindow $0 0 +4
MessageBox MB_OK|MB_ICONEXCLAMATION "xplorer² is already running$\r$\nPress <Alt+X> to quit xplorer²"
; try to quit xplorer2 window anyway
SendMessage $0 ${WM_COMMAND} 57602 0

${If} ${RunningX64}
...


it looks like the +4 jump didn't count comment lines (where's that documented?) so I removed the +4 and introduced a label instead and all is well (!)

it looks like the +4 jump didn't count comment lines (where's that documented?)
It is documented in the "Relative Jumps" section in the manual: http://nsis.sourceforge.net/Docs/Chapter4.html#4.4

Note that relative jumps specify the number of INSTRUCTIONS to jump not the number of lines in your script (see the manual for details). Note also the part where the manual mentions using "macro insertion" and relative jumps.

right, so it _is_ documented but very confusing regardless. Half the statements you use in the script are counted in jumps and half not? What a derranged concept!? :)

now i'm going to have to double check 1000 lines of installer code to double check what other jumps have gone wrong like that :(

thanks for clearing this up


You could always do a Regular Expression Search using Notepad++.

[+-][0-9]