Page 36 of 40
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Mon Dec 21, 2009 1:27 pm
by gnozal
zxtunes.com wrote:gnozal tell PureZip supports unpacking zip (RAW) archive without heading from memory
(1 file without zip a heading format)?
No, this is not supported.
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Tue Feb 02, 2010 11:49 am
by KIKI
With PB 4.41
I don't arrive to store the relative path
ex:
C:\toto is the main directory
repfic = c:\toto\titi
PureZIP_AddFiles(MyZIP, repfic+"\banque.db", #PureZIP_StorePathRelative, #PureZIP_Recursive)
if i use
PureZIP_AddFiles(MyZIP, repfic+"\banque.db", #PureZIP_StorePathRelative, #PureZIP_RecursiveZeroDirs)
It's impossible to read archive after
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Tue Feb 02, 2010 1:23 pm
by gnozal
2KiKI : I am getting the expected results here ...
Code: Select all
repfic.s = "C:\toto\titi"
MyZIP.s = "C:\TEST1.ZIP"
Debug PureZIP_AddFiles(MyZIP, repfic+"\banque.db", #PureZIP_StorePathRelative, #PureZIP_Recursive)
Debug : 1
Resulting archive C:\TEST1.ZIP :
valid [tested with TotalCMD, 7-ZIP and WinRAR]
Archive listing : c:\TEST1.ZIP\banque.db
Code: Select all
repfic.s = "C:\toto\titi"
MyZIP.s = "C:\TEST2.ZIP"
Debug PureZIP_AddFiles(MyZIP, repfic+"\banque.db", #PureZIP_StorePathRelative, #PureZIP_RecursiveZeroDirs)
Debug : 1
Resulting archive C:\TEST2.ZIP :
valid [tested with TotalCMD, 7-ZIP and WinRAR]
Archive listing : c:\TEST2.ZIP\banque.db
Your base directory is "C:\toto\titi", so if you choose #PureZIP_StorePathRelative, the paths are stored relative to it, i.e. no path stored for 'banque.db' (it's in the base directory).
Try this :
Code: Select all
repfic.s = "C:\toto"
Debug PureZIP_AddFiles(MyZIP, repfic+"\*.db", #PureZIP_StorePathRelative, #PureZIP_Recursive)
NB : if you want more control, you may use the PureZIP_Archive_*() functions.
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Tue Feb 09, 2010 3:09 pm
by Kurzer
Hello Gnozal,
what does a Result of -666 means for function PureZIP_Archive_Compress() ?
(sorry no example code this time)
Kind Regards, Kurzer
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Tue Feb 09, 2010 3:21 pm
by gnozal
kurzer wrote:what does a Result of -666 means for function PureZIP_Archive_Compress() ?
(sorry no example code this time)
-666 is
#PureZIP_CallbackStop.
PureZIP_SetCompressionCallback(*ProcedureAddress)
The callback is called in realtime during compression or decompression.
Procedure MyCallback(FileName.s, Progression.f, UserParam.l)
; FileName : current processed file (if applicable)
; Progression : progression percentage)
ProcedureReturn #False
; ProcedureReturn #True to stop the compression
EndProcedure
Returned value [only for PureZIP_Archive_Compress() and PureZIP_Archive_Extract()]
#FALSE : compression / extraction continues
#TRUE : compression / extraction stops !
PureZIP_Archive_Compress() and PureZIP_Archive_Extract() returns #PureZIP_CallbackStop error
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Tue Feb 09, 2010 4:01 pm
by Kurzer
Uhh damn, thank you for this hint!

Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Wed Feb 17, 2010 8:16 pm
by IdeasVacuum
Hi Gnozal
PB 4.40 x86 WinXP SP3
Can you spare some time to help me?
Using three simple Pure_Zip functions I create an archive with just one file inside (that is all I need):
PureZIP_Archive_Create(sMyZipFilePathFull, #APPEND_STATUS_CREATE)
PureZIP_AddFile(sMyZipFilePathFull, sMyFilePathFull, #PureZIP_StorePathAbsolute)
PureZIP_Archive_Close()
A zip file is created (archived file size is correct, 1,219,434 bytes) and I can open it with WinZip, WinRar etc but I cannot extract the file.
WinZip reports:
Extracting file: C:\Temp\Leg2-Small.zip
Extracting to "C:\Temp\"
Use Path: yes Overlay Files: no
Error in file #1: bad Zip file offset (Error local header signature not found): disk #1 offset: 0
WinRar:
! C:\Temp\Leg2-Small.zip: The archive is corrupt
PureZIP_ExtractFiles(sMyZipFilePathFull, "*.*", "C:\Temp", #TRUE) does not work either.
This is the same with or without storing the file path, thread safe mode or not. What am I doing wrong?
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Thu Feb 18, 2010 9:48 am
by gnozal
IdeasVacuum wrote:Using three simple Pure_Zip functions I create an archive with just one file inside (that is all I need):
PureZIP_Archive_Create(sMyZipFilePathFull, #APPEND_STATUS_CREATE)
PureZIP_AddFile(sMyZipFilePathFull, sMyFilePathFull, #PureZIP_StorePathAbsolute)
PureZIP_Archive_Close()
A zip file is created (archived file size is correct, 1,219,434 bytes) and I can open it with WinZip, WinRar etc but I cannot extract the file.
You can't mix PureZIP_Archive_*() functions with 'standalone' functions like PureZIP_AddFile().
If you use PureZIP_
Archive_Create(), you have to use PureZIP_
Archive_Compress().
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Thu Feb 18, 2010 5:49 pm
by IdeasVacuum
Owch! So obvious with hindsight! Sorry to waste your time. It's a magnificent library, thank you.
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Fri Feb 19, 2010 9:52 am
by gnozal
IdeasVacuum wrote:Owch! So obvious with hindsight!
I have updated the help file

Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Fri Apr 02, 2010 11:44 am
by DoubleDutch
On PureBasic v4.50b2 there is a strange error:
Gives error: Can't write numerical value into a string variable.
But if I the structure as:
Code: Select all
Structure PureZIP_FileInfo2
Version.l ; version made by
VersionNeeded.l ; version needed to extract
flag.l ; general purpose bit flag [if bit 0 is set the file is encrypted]
CompressionMethod.l ; compression method [0 - 10]
dosDate.l ; last mod file date in Dos format [do not use !]
Crc32.l ; crc-32
CompressedSize.l ; compressed size
unCompressedSize.l ; uncompressed size
SizeFilename.l ; filename length
SizeFileExtra.l ; extra field length
SizeFileComment.l ; file comment length
DiskNumStart.l ; disk number start
internal_fa.l ; internal file attributes
external_fa.l ; external file attributes (packed file attributes)
tmu_date.tm_date ; file date (see tm_date structure) [use this to get filedate!]
FileName.s ; filename
EndStructure
myFileinfo.PureZIP_FileInfo2
It works.
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Tue Apr 06, 2010 10:41 pm
by jamba
I've noticed the same thing as Double Dutch with 4.5b2. uninstall/reinstall of the userlib does not fix. somehow the structure definition is truncated.
(I made a post in the userlib thread, which turned out to be the wrong place!)
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Wed Apr 07, 2010 12:38 pm
by gnozal
DoubleDutch wrote:On PureBasic v4.50b2 there is a strange error:
Gives error: Can't write numerical value into a string variable.[/code]
I can't download PB4.50 right now, but iirc the structure is defined in PureZIP.res, so I suspect the new PB version doesn't read old residents correctly anymore ?
I will probably have to recompile the resident(s).
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Wed Apr 21, 2010 5:34 am
by dmxpowa
id liek to ask for a file delete function, cuz if i do "AddFile" and the zip contains that file it just places it near the old item, produces 2 files with same name in the archive.
Re: PureZIP library : ZIP / UNZIP files [password supported]
Posted: Thu Apr 22, 2010 2:24 pm
by gnozal
dmxpowa wrote:id liek to ask for a file delete function, cuz if i do "AddFile" and the zip contains that file it just places it near the old item, produces 2 files with same name in the archive.
ZLIB does not provide any function to delete a file in an archive.
So this will not happen any time soon.