- NSIS Discussion
- Full color icon, XP style without recompiling and smaller header size
Archive: Full color icon, XP style without recompiling and smaller header size
kichik
8th July 2002 18:49 UTC
Full color icon, XP style without recompiling and smaller header size
I have worked on this for quite a while now, but it is finally ready :)
This is a modification of NSIS 1.98.
I have added:
* Ability to add XP manifest without recompiling (XPStyle on)
* Support for all types of icons. Uninstall icon shuold still be the same structure as the installer icon, if used. You can even add an icon with 3 different sizes in it (this mod's installer includes one with 9).
* Stripping of unused resources from the exe header. For example, if you didn't use the license page, the license dialog resource will be stripped down resulting in an even smaller exe header.
* ${NSISDIR} - A constant holding the path in which NSIS is installed, on the compiler machine of course...
I am suggesting this mod as NSIS 1.99.
Sunjammer kindly helped me by hosting the file on his NSIS archive.
You can download it from:
http://www.clantpa.co.uk/nsis/wiki/index.php/Nsis199
I hope you enjoy it :)
KiCHiK
rainwater
8th July 2002 19:41 UTC
Does XPStyle on work when you have CRC check on?
kichik
8th July 2002 20:06 UTC
Yes, all of the above work with CRC check on.
Yathosho
9th July 2002 00:20 UTC
but i cant use this with nsis 2.0 alpha?
Yathosho
9th July 2002 00:25 UTC
${NSISDIR} is nice, thank you!
about my previously posted question. i'm really hot for the fullcolor icons, but i just modified my code for some new features of 2.0 alpha. maybe there could be a new alpha with your features beside the 1.99 ?
rainwater
9th July 2002 02:14 UTC
If you let me know which files you changed for each new feature, I will try to incorporate them into 2.0a.
spanky
9th July 2002 03:38 UTC
kichik,
Using your mod I get an error using InstallColors. It worked with NSIS 1.98 but it doesn't work with yours.
I'm using:
InstallColors 0066C8 000000
From MakeNSISW:
"InstallColors: fg=0066C8 bg=000000
Usage: InstallColors (/windows | (foreground_color background_color))
Error in script "poop.nsi" on line 86 -- aborting creation process"
Any knowledge as to why this occurs?
Sunjammer
9th July 2002 08:54 UTC
Keep me posted about whether or not this *is* a bug, if it is I'll list it as a known bug on the info page about this mod.
Sunjammer
9th July 2002 09:07 UTC
Rainwater said:
If you let me know which files you changed for each new feature, I will try to incorporate them into 2.0a.
1.98 -> KiCHiK 1.99 diffs attached (placed here so anyone who cares can see). The zip contains a text file listing the changed files plus the diffs of the changed files, I haven't had time to strip out the unchanged code so the diff files are complete files if you see what I mean.
kichik
9th July 2002 09:43 UTC
Thanks spanky,
It was indeed a bug, and a very stupid one may I add...
I have fixed this bug and another one relating the default uninstall icon. I have also updated the makefiles (I hope I did it right...).
I hope the new file will be up soon on Sunjammer's NSIS Archive. I will let you know when it is there.
Sunjammer
9th July 2002 09:52 UTC
The archive has now been updated with the new version of KiCHiK's 1.99 NSIS mod.
kichik
9th July 2002 12:03 UTC
Sunjammer, you forgot the core of it all in the diffs zip you posted earlier. You forgot ResourceEditor.cpp and ResourceEditor.h.
Sunjammer
9th July 2002 12:24 UTC
Ahha of course that would be because I posted differences and forgot additions, twit. Well you've pointed it out now, can't believe I forgot to mention that!
CodeSquid
9th July 2002 16:44 UTC
Compile error with !packhdr
I'm using the packhdr command to further reduce the size of the installer. I'm using the latest version of UPX for exe compression.
But everytime I use !packhdr in my scripts, NSIS 1.99 always reports this error message:
"Locating install icon after compress: find_data_offset: error searching data -- failing!"
rainwater
9th July 2002 17:48 UTC
Re: Compile error with !packhdr
Originally posted by CodeSquid
I'm using the packhdr command to further reduce the size of the installer. I'm using the latest version of UPX for exe compression.
But everytime I use !packhdr in my scripts, NSIS 1.99 always reports this error message:
"Locating install icon after compress: find_data_offset: error searching data -- failing!"
It sounds like there could be a problem with the patch that is stripping the unused resources. Maybe people should use upx to take care of that?
kichik
9th July 2002 18:43 UTC
My patch doesn't ever remove the icon. I don't see any reason for it to fail. The icon is there. Did this work with NSIS 1.98? Maybe UPX compresses the icons as well. But then, how could Windows read them?
Please send me the script so I can look further into it.
EDIT:
I think I know what is wrong. Maybe UPX compress all of the icon resource together, and doesn't align each raw data section size to 8 like my resource editor does.
I will look into it, and if this is the case I will just rewrite the find_data_offset function to match this case.
Does it only happen when you add an icon file with more than one icon?
CodeSquid
9th July 2002 19:01 UTC
Yes, it worked before with 1.98
When I call upx with --compress-icons=0 1.99 still doesn't work
EDIT:
My icon files have more than one icon: 32x32 and 16x16, each in 16 and 256 colors
kichik
9th July 2002 19:11 UTC
OK, so that must be the problem... UPX eliminates the space between icons... I will fix this bug tomorrow.
spanky
9th July 2002 21:35 UTC
Normally, compressing the icons is not a good idea.
Use this instead:
!packhdr tmp.dat "upx --best --crp-ms=500000 --color --compress-icons=0 tmp.dat
kichik
10th July 2002 16:36 UTC
I have found out what the problem is, and it is a pretty funny one :)
It seems UPX doesn't eliminate the space between icons, it adds more! :eek: Some compression eh?
I won't make the fix today, maybe tomorrow. If anyone else wants to do it instead of me here is my idea (if you have a better one please post it):
The uninstaller icon data should be saved as an array of variable length entries. Each entry of the array would contain:
1) The size of the icon
2) The offset in which it should saved
3) The icon data itself
generate_uninstall_icon_data would build this array and leave the offsets entries empty. After the file is compressed using UPX or whatever (which is the last the time the exe header can change) the offsets will be written into this array. To find the offsets you will have to write a function like get_addr_of_res.
The function generating the uninstaller must change too (in the exe header).
If all this is done it would be useless for get_addr_of_res to search for the icon offset, and to be called after each use of CResrouceEditor.
If someone is ready to this please tell me. If I get no PMs/E-Mail until tomorrow I will do it my self.
pjw62
10th July 2002 20:40 UTC
I haven't seen your code yet, but it sounds a bit special sir.
You are a good programmer (or I am extraordinarily poor) and I must admit, I had a go at it and could not get it working very cleanly. Eventually I had to settle with not being able to add named entries, 'cause I just couldn't get them to work.
I am downloading yours now and will take a quick peep ;)
Thanks/
kichik
11th July 2002 11:05 UTC
Thanks pjw62 :D
If you need some resources of the resource section strcture PM me, I have stumbled ascross some while studying the subject ;)
kichik
11th July 2002 18:47 UTC
OK, it is ready!
InstallColors, UPX, multiple icons, zlib and bz2. It all works now. This time I wrote the icons handling functions a bit more general so it should be able to handle even the craziest compiler/packer unless it compresses the icons (I hope :D ).
I have also added an error message if the NSIS path could not be found in the registry. It does not stop compilation, but I at least now you will know why your include doesn't work.
I have asked Sunjammer to upload the new file. He'll let you know when it is there.
Sunjammer
11th July 2002 19:06 UTC
Uploaded
KiCHiK's new version has been uploaded. The direct link to the file is http://www.clantpa.co.uk/nsis/hosted/nsis199.exe.
rainwater
11th July 2002 19:10 UTC
Originally posted by kichik
I have also added an error message if the NSIS path could not be found in the registry. It does not stop compilation, but I at least now you will know why your include doesn't work.
That is not needed. You don't need to read from the registry to get the directory. Just change that code in build.cpp to this:
{
char szNSISDir[NSIS_MAX_STRLEN],*fn2;
GetModuleFileName(NULL,szNSISDir,sizeof(szNSISDir));
fn2=strrchr(szNSISDir,'\\');
if(fn2!=NULL) *fn2=0;
definedlist.add("NSISDIR", (char*)szNSISDir);
}
kichik
11th July 2002 19:23 UTC
Thanks Rainwater, it is indeed better. Done.
EDIT: Uploaded
mlbl
12th July 2002 16:03 UTC
I think that the stuff that you stripped down causes a problem with having a custom Enabled/Disabled bitmap for the checkboxes/option boxes.
It worked fine in 1.98 but this feature was broken in your copy, hope you can fix it ASAP. Other than that everything else works fine.
kichik
12th July 2002 16:22 UTC
Err... I can't beleive I did that stupid mistake again! I forgot to call get_addr_of_resource after altering rsources...
A new version will be uploaded ASAP.
T(+)rget
14th July 2002 20:25 UTC
I was wondering whether or not u could add that Brand Image thingy to your version of NSIS as well with full like bmp support like with da icons if poss.
T(+)rget
14th July 2002 23:25 UTC
lol soz
Anyway like I said it'll be nice to see that Brand Image thing included with this version of NSIS you know the image on the side of the installer.
mlbl
15th July 2002 01:48 UTC
Originally posted by T(+)rget
lol soz
Anyway like I said it'll be nice to see that Brand Image thing included with this version of NSIS you know the image on the side of the installer.
That would probably make the installer look a bit weird. In it's current form, the installer is pretty much simple and small in size. Adding a branding image will also make the installer size much larger and i think NSIS looks great at the moment. If you're looking for an installer that supports branding, try Inno Setup instead -
www.jrsoftware.org
T(+)rget
15th July 2002 21:05 UTC
Yeah but you could do a switch so that if you don't include it in your nsi file it won't use the coding for it or if you put in your nsi file BrandImage off.
I just think it'll be a nice addition to NSIS which most people would like to use say like if the installer is over 50mb or something you wouldn't notice much difference in size.
kichik
19th July 2002 12:21 UTC
Hi Target,
I will do it. I was thinking of doing it with the first version but I had a problem with bitmaps...
To mlbl, I will make it so the header size won't change. Don't worry, it is just a couple of lines of code...
KiCHiK
[edit]I have just noticed that Sunjammer has uploaded the new version with the Enabled/Disabled bitmap bug fixed.
Thanks Sunjammer[/edit]
Sunjammer
19th July 2002 18:09 UTC
I have just noticed that Sunjammer has uploaded the new version with the Enabled/Disabled bitmap bug fixed.
Eh? I haven't done anything recently, what are you on about KiCHiK? :D
[edit]
KiCHiK is correct - if you consider six days ago to be "recently" :D [/edit]
T(+)rget
20th July 2002 00:09 UTC
lol
Thanks for your reply about adding the Brand Image like that old version which that anyedit guy done NSIS v1.59BB (I did contact him about doing it for the latest version but he ain't got no time to do it)
kichik
20th July 2002 15:46 UTC
A new version is out:
- Full color bitmap for EnabledBitmap/DisabledBitmap are now supported. Bitmap size MUST be 20x20 now though... I hope that doesn't break anyone's script
- Code now compiles and works with Borland compiler (would somone mind checking it on mingw too?)
- Fixed a bug that caused makensis to crash if uninstall section was present and WriteUninstaller wasn't. Also made it so the uninstaller data won't be added unless WriteUninstaller was called.
For Borland copmiler users:
1) To compile my mod you need to change the current makefile and get it to compile ResourceEditor.cpp too.
2) If you want to make your Borland compiled NSIS even smaller you can remove any resources of the RCData type (using Resource Hacker or another resource editor), and remove the .reloc section (using crayzee's wipe.reloc v1.40 or another aligner/wiper). UPX does a good job as well.
I think that branding image support will take a little longer to make than I have thought in the first place. It is a little complicated... I will try to find some code on the Internet, but if I fail I will have to write it my-self and it will take some time.
T(+)rget
20th July 2002 16:46 UTC
Here's the download link to the old Brand Image using NSIS v1.59
NSIS Brand Image
kichik
20th July 2002 20:50 UTC
The problem with this mod is that it forces you to use branding image. I don't want to do that. I want to give it as an option.
To do this I need to learn how to edit dialog resources. And of course, like everything else with Microsoft, it isn't that simple...
I haven't found any class/code that already does this so I guess I will have to write my own class. I hope it won't take too long. If I write this class I will be able to implement font changing as well.
Sunjammer
21st July 2002 15:50 UTC
Uploaded
I was away so KiCHiK's new NSIS 1.99 version has literally only just been uploaded to my archive. Keep it up KiCHiK - that's the sixth version I've uploaded so far :D
T(+)rget
21st July 2002 21:45 UTC
Yeah do it your way mate so we can change fonts as well :D that'll be nice. Can't wait for this version to come out!