Page 1 of 3

Lib Installer 1.0

Posted: Sat Jul 24, 2004 10:01 pm
by Num3
Well i've just finished this rater quick project for the comunity.

This program creates self extractable executables that will install User Libraries in PureBasic, without the need of Copy/Paste stuff around.

The SelfExtractable will only add an extra 25.600 bytes to the end file, most of it because of the BMP picture in it :lol:

The source code is included for modification / personall use :P

Image

Image

GET ME !!! (75kb)

Posted: Sat Jul 24, 2004 11:27 pm
by GeoTrail
Wow, totally excellent Num3.
Just wondering, how is the exe file created?

Posted: Sat Jul 24, 2004 11:42 pm
by thefool
its rather simple to do it, when you have seen the source once.
uhm he packs the data and injects it into a stub, then adding the size of the packed file.
So the final exe is like this:

|-------------|
|EXE data---|
|Packfile----|
|Size(long)-|
|-------------|


Then the stub does this:

reads the 4 numbers from the end of itself to get the size of the packed file, then it copys all the packed data to disk and extracts it. You can examine the source of his great packer :)
else, there is some source on this forum somewhere, that does it.
then you can easly make your own self extractors and exe builders and that stuff.
Thats also a good way if you have made your own script language, and now want a kind of interpretter that the user can put down in 1 exe.

uhm num3 dont get angry because i post your code here :P
but geotrail, heres the extractor source in the stub:

Code: Select all

ReadFile(0, filename)
  FileSeek(Lof()-4)
  filelen.l  = ReadLong()
  If filelen>0
    mem=AllocateMemory(filelen)
    FileSeek(Lof()-4  - filelen)
    ReadData(mem,  filelen)
    CreateFile(1,  "~tmp")
    WriteData(mem,  filelen)
    CloseFile(1)
    CloseFile(0)
so you see it does what i've told

the code for injecting the file:

Code: Select all

    If OpenFile(0,"Install_Libary.exe")
      WriteData(?installer,?installer_end-?installer)
      WriteData(mem,  len)
      WriteLong(len)
      CloseFile(0)
    EndIf
Opens install_library.exe
injects the installer stub
writes the packed file
and then the lenght of the packed file.

Num3: Thanks for the source that i have posted here. If i shall remove it please say, but you have put the source to your installer, so i guess its ok.

But anyway num3, its a great app, even though i dont make userlibs. But if people would use this, it would be better than copying and pasting. Could be nice with a lib administration program, where it could list the installed libs and then you choose to remove them, and then all files the lib installes is also removed (help files etc). But thats just a dream :)

Posted: Sat Jul 24, 2004 11:45 pm
by PolyVector
Brilliant work!... Nice smooth-looking interface 8O
I think I'll use this some time 8)

Posted: Sat Jul 24, 2004 11:52 pm
by GeoTrail
Thanks thefool.
I'll have a closer look at that soon.
And offcourse thanks to num3 for the code :)

Posted: Sun Jul 25, 2004 12:27 am
by Wolf
Thanks Num3 its great work :D

And thefool thank you for this informations :wink:



Best regards.

Re: Lib Installer 1.0

Posted: Sun Jul 25, 2004 3:38 am
by NoahPhense
Very nice Num3, good contribution.

- np

@thefool
where it could list the installed libs and then you choose to remove them, and then all files the lib installes is also removed (help files etc). But thats just a dream
Already exists.. and can have VERY small footprint all depends on how
you build it.
I use this:
http://nsis.sourceforge.net/

with this:
http://www.spaceblue.com/venis/

ahh..

- np

Posted: Sun Jul 25, 2004 4:00 am
by El_Choni
A similar thingie to that you mention is supposed to be included with next TailBite Final Version ;) (lol, my releases are the most delayed ones I've seen: next release date is due to September because of my holydays, but I still don't know exactly what will be released)

Re: Lib Installer 1.0

Posted: Sun Jul 25, 2004 10:16 am
by freedimension
Num3 wrote:This program creates self extractable executables that will install User Libraries in PureBasic, without the need of Copy/Paste stuff around.
Just Brilliant.

But you forgot at least a place for "Example Files". That would make it perfect.

Re: Lib Installer 1.0

Posted: Sun Jul 25, 2004 10:19 am
by Num3
NoahPhense wrote: Already exists.. and can have VERY small footprint all depends on how
you build it.
I use this:
http://nsis.sourceforge.net/

with this:
http://www.spaceblue.com/venis/

ahh..

- np
LOL...
Nsis footprint is 34Kb :P
Winrar footprint 52 Kb
My code after UPX 25Kb

Offcourse i cannot compare my simple extractor with those :D

@ALL

The code is free to use and abuse, hope it helps anyone who want's to understand how SelfExtractables work!

2 Things are missing (it was late at night when i finished)

The remove button
And the Examples Tab

Anyway this example was based on other examples and on Winrar...

In the rar dir copy the Default.SFX to the desktop and change it to Default.EXE... Taaadaaaa it's an executable that get's the RAR attached to it's rear end :wink:


Btw Nsis uses a new packer (LZMA) that is far better then Purebasics one, in fact better than anyone i've ever seen...

A 25Mb file goes like this:

RAR -> 6.5Mb
Zip -> 7.8Mb
PB -> 6.6 Mb (has good has rar)
Nsis new algo -> 3.5Mb !!! 8O

Posted: Sun Jul 25, 2004 10:23 am
by thefool
@thefool
Quote:
where it could list the installed libs and then you choose to remove them, and then all files the lib installes is also removed (help files etc). But thats just a dream


Already exists.. and can have VERY small footprint all depends on how
you build it.
I use this:
http://nsis.sourceforge.net/

with this:
http://www.spaceblue.com/venis/
@noaphense:

The idea was to change num3's installer to put a file in a specific directory. The file should have a list of what the installer installs. Then have an app that can list those files and then process the file list and remove the files it lists. I have a lot of libs, and when somebody posts a lib i install it and then removes it. But also just for having things a little managed.

Posted: Sun Jul 25, 2004 12:31 pm
by GeoTrail
I tried this:
I installed the latest NSIS installer and the Venis IX editor.
I added one file to the installation, a exe file created in PB which was 16.5 kb in size and after compiling the installation it ended up with 77.1 kb.

After my calculations that gives NSIS a footprint of 60.6 kb.
Or am I doing something wrong?

Posted: Sun Jul 25, 2004 12:36 pm
by thefool
nsis does make small exe's. if you look at other installers they can add several hundred kb's. But num3's app is smart, and it only adds a very small amount to the executable.

but @geotrail:
you could make your own installer that fits your needs. then it will be small. There is an installer made in pb somewhere. think on pauls reelmedia website. as i remember, it was actually a nice installer.
But i was doing my own but dumped it, because i did it too complex with too many files that should have been in 1. maybe i should look at it again.

Posted: Sun Jul 25, 2004 12:51 pm
by GeoTrail
Yeah, when I learn alittle more about PB then I think I will make an installer :)
Always wanted to do that.
Maybe even a Inno-Setup style thing after time :lol:

Posted: Sun Jul 25, 2004 12:53 pm
by thefool
hehe

its not that difficult to make a simple installer.
actually i made mine install files even got the shortcuts to work.
Now i only need an uninstaller and a builder app.