It is currently Tue May 21, 2013 6:04 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Working on an installer...
PostPosted: Tue Nov 09, 2004 10:21 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Apr 21, 2004 7:12 pm
Posts: 742
I've taken a look at num3's posts about his library installer (thanks to him for pointing me to it) and I found a bit of code that basically sums up how to create an installer/self-extracting pack file.

I've tried to replicate this myself, but without much of a guide other than the code posted by the fool on the post in question. I can't seem to get the source for the original library installer.

Anyway, I tried this:

Code:

createfile(0,"bob.exe")
    writedata(?bob,?bob-?bob_end)
    *str=allocatememory(11)
    pokes(*str,"bob = cool")
    writedata(*str,11)
    writelong(11)
closefile(0)

end

bob:
readfile(0,"bob.exe")
fileseek(lof()-4)
a=readlong()
fileseek(lof()-4-a)
a$=readstring()
debug a$
bob_end:



It creates an .exe that isn't a valid Win 32 application, apperently, I am using the demo version, is the debugger that is stapled to the .exe's I create effecting the program?

_________________
~I see one problem with your reasoning: the fact is thats not a chicken~


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 09, 2004 10:56 pm 
Offline
Always Here
Always Here
User avatar

Joined: Sat Aug 30, 2003 5:58 pm
Posts: 5892
Location: Denmark
well if you are working on an installer that code certantly wont work, as it needs purebasic compiler to add the file to itself.

But look at the code: (thank to boop64). (btw, this code needs some changes, as i used it to bind 2 files)

Code:
;Filename  "pack_test.pb"

;SFX_Test
;By Boop64
;http://boop64.2y.net

;Creat a pack archive and add a file
If CreatePack("tmp.pak")
AddPackFile("exe1.exe")
AddPackFile("exe2.exe")
ClosePack()
EndIf

;Read pack archive and copy to memory
If ReadFile(0,"tmp.pak")
len = Lof()
AllocateMemory(0, len,0)
*mem = MemoryID()
ReadData(*mem, len)
CloseFile(0)
EndIf

;Create the UnPack program with attatched pack archive.
If CreateFile(0, "UnPack_Test.exe")
WriteData(?filestart, ?fileend-?filestart) ;Write extraction program to file.
WriteData(*mem, len) ;Write pack archive
WriteLong(len) ;Write 4 byte pack archive file length to the end of the file.
CloseFile(0)
EndIf
DeleteFile("tmp.pak");Delete pack archive from harddrive
End

;Include the extraction program
filestart:
IncludeBinary"Extract.exe"
fileend:


Code:
;Filename "extract.pb"

;SFX_Test
;By: Boop64
;http://boop64.2y.net

;Opens the exe to read the pack archive file that is attatched.
If ReadFile(0, "UnPack_Test.exe")

;Get the file length of the packed archive.
FileSeek(Lof()-4) ;Set the file read position 4 bytes from the end. This is where the size of the packed archive file is stored
filelen.l = ReadLong();Read the file length of the pack file.

;Copy the file to memory temporarily.
AllocateMemory(0, filelen,0) ;Allocate memory for the pack archive's size.
*mem = MemoryID() ;Set a pointer to the memory address.
FileSeek(Lof()-4-filelen);Set the file read position before our pack archive
ReadData(*mem, filelen) ;Copy the data to memory.

;Write the pack archive to disk
CreateFile(1, "tmp.pak")
WriteData(*mem, filelen) ;Write the data from memory to a file.
CloseFile(1)
CloseFile(0)
EndIf

;Open the pack archive
If OpenPack("tmp.pak")
*file = NextPackFile();Extract the packed file to memory.
size.l = PackFileSize();Size of unpacked file
;Write unpacked file.
CreateFile(0, "exe1.exe")
WriteData(*file , size)
CloseFile(0)
*file = NextPackFile();Extract the packed file to memory.
size.l = PackFileSize();Size of unpacked file
;Write unpacked file.
CreateFile(1, "exe2.exe")
WriteData(*file , size)
CloseFile(1)
ClosePack()


;Delete our temporary pack archive and run exe's
DeleteFile("tmp.pak")
RunProgram("exe1.exe")
RunProgram("exe2.exe")

EndIf
End


You cant make this in 1 code, if you want to make an SFX that works without the purebasic compiler. You need to have a stub, that will extract the file from itself.
but stydy the code and try it

btw my name is in 1 word :D


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 09, 2004 11:15 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Fri Apr 25, 2003 4:34 pm
Posts: 758
Location: Canada
Keep at it and you will eventually get it !!

It can be done... http://www.reelmedia.org/pureinstall

_________________
Image Image


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 12, 2004 10:51 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 8:45 pm
Posts: 113
PureInstall packs better than Install Creator which I'm using up till now. Only problem is, PureInstall does not create an icon on the desktop.
♫


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 20, 2007 8:59 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Apr 18, 2007 9:27 pm
Posts: 195
Can someone please convert this for PB4, thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 21, 2007 12:42 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 525
Location: Germany
Thomas wrote:
PureInstall packs better than Install Creator which I'm using up till now. Only problem is, PureInstall does not create an icon on the desktop.
♫


You can use 'EasySetup', if you like. It's also written with PB and creates small (Overhead <90KB) setup programs.

_________________
PS: Sorry for my bad English. My native language is German.

My PureBasic-Project: EasySetup - SetupMaker for your programs
[Windows 7 x64] [PB V5.0x]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye