Page 1 of 1
UnnPack a file and be able to see it! [Solved]
Posted: Sun May 23, 2010 8:48 pm
by Rook Zimbabwe
OK I am playing with the PACK feature in PB. I can get a file to pack... easy... I look in the directory and it is there...
How can I UNpack it so it will exist?
Code: Select all
dir$ = GetCurrentDirectory() ;
resource$ = dir$ +"TICKET.mdb"
PACK$ = "TICKET.RES"
; ***********************************
; REMmed out AFTER I made pack file and unpack was UNremmed!
;
;CreatePack(PACK$)
;AddPackFile(resource$ ,1) ; 0 no compression to 9 HIGHEST Compression
;ClosePack()
; ************************************
; UNremmed after file wsa made and pack routines were REMmed!
;
result = OpenPack(PACK$)
Debug "OPEN PACK FILE = "+Str(result)
For x = 0 To 2 ; I only have 1 file in the PACK but I thought I would count it!
result1 = NextPackFile()
Debug "PACK FILE "+Str(X)+" = "+Str(result1)
Next
ClosePack()
I run this on a program I packed and I see NOTHING!!!
Re: UnnPack a file and be able to see it!
Posted: Sun May 23, 2010 9:15 pm
by Mohawk70
Rook Zimbabwe wrote:OK I am playing with the PACK feature in PB. I can get a file to pack... easy... I look in the directory and it is there...
How can I UNpack it so it will exist?
Code: Select all
dir$ = GetCurrentDirectory() ;
resource$ = dir$ +"TICKET.mdb"
PACK$ = "TICKET.RES"
; ***********************************
; REMmed out AFTER I made pack file and unpack was UNremmed!
;
;CreatePack(PACK$)
;AddPackFile(resource$ ,1) ; 0 no compression to 9 HIGHEST Compression
;ClosePack()
; ************************************
; UNremmed after file wsa made and pack routines were REMmed!
;
If OpenPack(PACK$)
npf = NextPackFile()
pfs = PackFileSize()
If npf
If CreateFile(0,PACK$+".bak"); ;write to disk
WriteData(0,npf,pfs)
CloseFile(0)
EndIf
EndIf
ClosePack()
I run this on a program I packed and I see NOTHING!!!
Code Ammended above !
Re: UnnPack a file and be able to see it! [Solved]
Posted: Mon May 24, 2010 2:35 am
by Rook Zimbabwe
Thanks Mohawk... it worked after I done did the following:
Code: Select all
If npf
If CreateFile(0,PACK$+".bak"); ;write to disk
WriteData(0,npf,pfs) ; was cf,npf,pfs - I figure for MULTIUPLE files cf was correct!
; Pity you cannot get pack file name from pack! But since they are YOUR files you should know
; whats going to come out!
CloseFile(0)
EndIf
EndIf

Re: UnnPack a file and be able to see it! [Solved]
Posted: Mon May 24, 2010 4:01 am
by Mohawk70
cf was a typo - pulled just the relevant code from a program of mine and forgot to change to 0 !
Rook Zimbabwe wrote:
; Pity you cannot get pack file name from pack! But since they are YOUR files you should know
; whats going to come out!
[/code]

Simple ...
To get filenames, simply create a text file with the list of filenames and make sure it's the first file added to the pack.
When unpacking, first extract the list file, open it and read each line for the filename before extracting the corresponding
file. You could even use a preferences file - filelist.txt - and include each file's name, size, hash, etc; like below
[File]
1=file1.txt
2=file2.txt
3=file3.txt
[Size]
1=256
2=512
3=768
[Hash]
1=ac328954
2=f0eebead
3=1234abcd
archive.pack would contain - in order
filelist.txt
file1.txt
file2.txt
file3.txt
Re: UnnPack a file and be able to see it! [Solved]
Posted: Mon May 24, 2010 11:57 am
by jamba
a little bit off-topic, but with the packer is it true that x86 and x64 versions of created pack files are not compatible? (different compression algorithm?)