Old 30th March 2011, 04:05   #1
Rajada
Junior Member
 
Join Date: Mar 2011
Posts: 14
Installer Corrupt, Bad Opcode

This installer is a mess. The code is huge, long and serves a bunch of intricate functions. I get the "installer corrupt, bad opcode" error when I try to run the installation part (up to that point it is fine). I barely understand the syntax of NSIS, so I'm guessing I made a stupid mistake somewhere along those lines. Sorry about the wall-o-text; I have no idea where the problem lies. I'm certain all the required files are there. Does this forum not have line-wrapping for code snippets? I'll remove the HUGE file lists (replaced with '...', because I doubt they are the problem.

Any help would be greatly appreciated.

[edit - Moderation]
Changed code block to an attachment
Attached Files
File Type: nsi attached.nsi (26.2 KB, 572 views)

Last edited by Rajada; 30th March 2011 at 05:24.
Rajada is offline   Reply With Quote
Old 30th March 2011, 06:38   #2
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 541
Send a message via ICQ to T.Slappy
Aaaaaaa!
Use PasteBin or Attach your .nsi file, do not paste so huge codes!!

Errors:
1. Add label Skip to section Essential Files
2. Your error is in function ReplaceLineStr
I do not have required files so I assume there is some parameter missing on the stack so the Exch fails.

PHP Code:
Exch $R0 string to replace that whole line with <<<< HERE is the error because
MessageBox MB_OK $R0        I cannot see this MessageBox 

Cool looking installers with custom design: www.graphical-installer.com
Design NSIS setup Pages easily: www.install-designer.com
Build NSIS installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.3 Rio: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 30th March 2011, 07:00   #3
Rajada
Junior Member
 
Join Date: Mar 2011
Posts: 14
Sorry, I'm really trying to understand this. Its a far cry from the OOP I'm used to...

So my first guess at what you mean is Essential files is missing the skip line at the end of the section. This is because Essential Files are required no matter what in the installer. But do I still need a skip?

As for the second part, I'm not sure what you're saying. Do I need to make that part look like you typed it? Literally throwing that message box line after the Exch line? I need more specifics, but thank you so much still for being helpful.

Last edited by Rajada; 30th March 2011 at 08:16.
Rajada is offline   Reply With Quote
Old 30th March 2011, 08:11   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Invalid Opcode usually means stack corruption. You're pushing or popping (or exch'ing) values incorrectly. This is what T.Slappy meant, the Exch commands in your ReplaceLineStr function aren't correct.
MSG is offline   Reply With Quote
Old 30th March 2011, 08:28   #5
Rajada
Junior Member
 
Join Date: Mar 2011
Posts: 14
Okay, well that tells me nothing unfortunately. I pretty much inherited this project so it isn't like I've been working with this stuff for long. I frankly have not the slightest clue what this function is supposed to do, which is probably why I don't even see the error to begin with. Its weird that this should pop up though. Perhaps I received a slightly outdated version of the source used because the previous released installer works fine. Regardless, I'm really new to this, I need slightly less technical explanations.

According to this, that function is fine.

This is the other major function with stacking. The version there has two differences from mine:

Example:

IfErrors error
...

StrCpy $0 ''




Mine:

IfErrors empty
...
empty:
StrCpy $0 ''


Does it matter? Also, should the functions be defined at the begging of my script to work properly? And also someone please tell me if the Skip label is needed for the non-optional essential files and why.
Rajada is offline   Reply With Quote
Old 30th March 2011, 10:46   #6
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Quote:
Originally Posted by Rajada View Post
Does it matter? Also, should the functions be defined at the begging of my script to work properly?
No and no.

If you had done a single search through your sourcecode, looking for 'ReplaceLineStr', you would have found that the code calls the function four times, but does it once without pushing the variables to the stack first. Obviously, you cannot 'Exch $R0' from the stack if the stack doesn't contain anything.
MSG is offline   Reply With Quote
Old 30th March 2011, 17:08   #7
Rajada
Junior Member
 
Join Date: Mar 2011
Posts: 14
Oh how did that get there? Gosh I feel stupid. Plus HMNSIS' search function doesn't work, so that's another thing I figured out. I get it though, its like having an accessed none, its just the odd order and syntax that throws me. See, I'm used to calling functions at the same time as defining the input variables, for example DoThis(var1, var2). Now, being unfamiliar with this code, I need to determine if that first call extraneous or not. I don't see a reason for it to be there, but I want to be sure I didn't maybe accidentally remove the variables or some other equally dumb mistake.

You know, the older version doesn't have that line, how it got there I have no idea, but I'm pretty sure I get this a lot better now. From what you've said about the error itself it really does sound like this is the problem. If this works it will be a relief, I thought I was going to have to spend weeks troubleshooting it. Funny how I can be so proficient with OOP based languages but this stuff just throws me through a loop. But thanks for being patient with me guys.
Rajada is offline   Reply With Quote
Old 30th March 2011, 19:06   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Feel free to try nsL (sticky topic).

Stu
Afrow UK is offline   Reply With Quote
Old 30th March 2011, 21:54   #9
Rajada
Junior Member
 
Join Date: Mar 2011
Posts: 14
Yeah I got it working 100% with your help, thanks guys. Now I have to go back to my complicated, ten-thousand line OOP project that by some miracle I understand enough to debug myself. Wish me luck. XP
Rajada is offline   Reply With Quote
Old 31st March 2011, 04:18   #10
Rajada
Junior Member
 
Join Date: Mar 2011
Posts: 14
Shoot, one last problem. I re-compiled this on a Windows 7 32 bit OS and if I try to take it over to my XP computer it fails the integrity check and has no icon, just shows up as the default exe icon. What's going on?
Rajada is offline   Reply With Quote
Old 31st March 2011, 04:51   #11
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
If the integrity check fails, the file probably isn't integral anymore. If you want to check manually, you could of course do a manual CRC or MD5 check on the file. But most probably you didn't copy the file correctly.
MSG is offline   Reply With Quote
Old 31st March 2011, 05:44   #12
Rajada
Junior Member
 
Join Date: Mar 2011
Posts: 14
Zipping it got it over uncorrupted, but still no icon on XP. DO I need to set that up separately than the main icon or something?
Rajada is offline   Reply With Quote
Old 31st March 2011, 05:56   #13
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Only Windows Vista and 7 support very very large icons, so if that's all you have then you should add a smaller one. Are you sure this isn't just some icon caching issue?
MSG is offline   Reply With Quote
Old 31st March 2011, 06:42   #14
Rajada
Junior Member
 
Join Date: Mar 2011
Posts: 14
I probably don't have a small one. Where would I find some help on how to define different icons for different OS's?
Rajada is offline   Reply With Quote
Old 31st March 2011, 08:01   #15
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
There are various free icon editors up on sourceforge. Google is your friend. What you want to do is make a multi-icon with different sizes. (And different color depths?)
MSG is offline   Reply With Quote
Old 31st March 2011, 17:42   #16
Rajada
Junior Member
 
Join Date: Mar 2011
Posts: 14
Ok, yeah, I've used an icon editor before for this same thing, but I'll look into multi icons. Thanks!
Rajada is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
bad, corrupt, error, installer, opcode

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