Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   UpdateResource() (http://forums.winamp.com/showthread.php?t=244686)

prsTM 26th April 2006 18:41

UpdateResource()
 
I want to stamp an affiliate ID into our installer without rebuilding it. I tried writing a small utility that would add a resource to the setup.exe using BeginUpdateResource(), UpdateResource(), and EndUpdateResource(), closely following the example on MSDN.

Yes, I realize I'd need to set CRCCheck off.

However, after my utility exited, I see my installer has been truncated from ~480K to ~40K. The utility works properly on itself, so it must be due to the format of the installer itself.

Anyone know how make this work?

kichik 28th April 2006 11:09

Use !packhdr and then CRCCheck will work and the installer won't be truncated because there'll be nothing to truncate at that stage.

prsTM 28th April 2006 13:41

I'm not sure I understand.

I think I take away from your post that tweaking the resources blows up because the executable header is compressed, right?

So are you saying this problem is unique to the NSIS proprietary compression, and that say, UPX won't enable the corruption?

kichik 28th April 2006 13:50

No, I'm saying you should execute your executable editor using !packhdr instead of executing it after the installer is created. That's what !packhdr is for. It's for modifying the stub before anything is added to it and before the CRC is calculated.

prsTM 28th April 2006 14:08

Ah! Now I understand.

Unfortunately, that doesn't fit my requirements. Forgive me if I wasn't clear in my original post, but what I want to do is to distribute the completed installer along with my resource tweek utility so that affiliates can stamp their own ID into it.

The fallback solution is to ask them to install the NSIS compiler, and distribute nsi script and install files. Then they could build the installer with their affiliate ID as an argument. But then I wouldn't need my resource tweeker to get the ID into the installer.

kichik 28th April 2006 14:12

In this case you can use CResourceEditor from the NSIS source code, instead of UpdateResource(). It will not truncate the data tacked to the installer. Though the CRC check will still fail.

prsTM 28th April 2006 14:15

Cool, I didn't know that was there. Thanks very much!


All times are GMT. The time now is 04:35.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.