Old 14th January 2008, 18:35   #1
Junior Member
Join Date: Jan 2008
Location: Palo Alto, CA
Posts: 1
Installer corrupted: invalid opcode

I've just spent quite some time figuring out why my installer is aborting and giving me a dialog box with:

"Installer corrupted: invalid opcode".

I couldn't find any forum posts or documentation to help me debug this, so I tracked it down, line by line in my script until I figured out which line it was. And then I guessed what the answer was. Here are the two lines that are causing me to get this error:

IfErrors 0 +2
!insertmacro LogProgressMessage '"There was an error..."'

The intent of "IfErrors 0 +2" is that if there are no errors to skip over the logging message. Note that LogProgressMessage is my own macro which uses GetTime to log a message with a date and time to a log file.

However, since this is a macro, not a statement, the +2 is very ineffective. In fact, I believe that when my macro is expanded out, the first statement is a "Push". There is of course a corresponding Pop, but if there is no error, the Push is skipped while the Pop is not.

Therefore there are three lessons here:

* More Pops than Pushes will cause your installer to abort with "Installer corrupted: invalid opcode".
* When using the +2 mechanism to jump over statements, you must be sure that the next line is really a statement, not a macro.
* In general it's much safer to use labels than to use the +2 mechanism (or any +n)
jared.oberhaus is offline   Reply With Quote
Old 14th January 2008, 18:41   #2
Afrow UK
Afrow UK's Avatar
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
A macro contains more than one line of code. Use a label or use ${If} ${Errors} ... ${EndIf}

Afrow UK is offline   Reply With Quote
Old 25th May 2009, 22:51   #3
Junior Member
Join Date: May 2009
Posts: 43
Glad I found this!
Just been going nuts for 2 hours trying to solve this.
I had a pop with no offsetting push.
Thx for posting this.
BoscoBilly is offline   Reply With Quote
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump