Lib Installer 1.0

Developed or developing a new product in PureBasic? Tell the world about it.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Lib Installer 1.0

Post 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)
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Wow, totally excellent Num3.
Just wondering, how is the exe file created?
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post 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 :)
Last edited by thefool on Sat Jul 24, 2004 11:47 pm, edited 1 time in total.
PolyVector
Enthusiast
Enthusiast
Posts: 499
Joined: Wed Sep 17, 2003 9:17 pm
Location: Southern California
Contact:

Post by PolyVector »

Brilliant work!... Nice smooth-looking interface 8O
I think I'll use this some time 8)
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Thanks thefool.
I'll have a closer look at that soon.
And offcourse thanks to num3 for the code :)
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
Wolf
Enthusiast
Enthusiast
Posts: 234
Joined: Sat Apr 03, 2004 12:00 pm
Location: S.T

Post by Wolf »

Thanks Num3 its great work :D

And thefool thank you for this informations :wink:



Best regards.
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Re: Lib Installer 1.0

Post 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
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post 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)
El_Choni
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Re: Lib Installer 1.0

Post 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.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Re: Lib Installer 1.0

Post 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
Last edited by Num3 on Sun Jul 25, 2004 10:26 am, edited 2 times in total.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post 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.
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post 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?
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post 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.
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post 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:
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post 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.
Post Reply