PureZIP library : ZIP / UNZIP files
Moderator: gnozal
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Update (both libs and DLL)
Changes :
- PureZIP now stores filenames with slash (like on Unix based systems) instead of backslash (like on Windows).
Changes :
- PureZIP now stores filenames with slash (like on Unix based systems) instead of backslash (like on Windows).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Update (PB4.0x lib and DLL)
Changes :
- fixed broken unicode support (since V1.90)
- cleaned-up code
I hope it's all ok now ...
Changes :
- fixed broken unicode support (since V1.90)
- cleaned-up code
I hope it's all ok now ...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Password protect error
Hi gnozal
i use purezip to password protect some files but when i try open these files with win rar, i see only the first file corrupt.
if it's one file protect by password, this one always corrupt
i use purezip to password protect some files but when i try open these files with win rar, i see only the first file corrupt.
if it's one file protect by password, this one always corrupt

-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: Password protect error
I can't confirm. I just tested it this way :Micko wrote:Hi gnozal
i use purezip to password protect some files but when i try open these files with win rar, i see only the first file corrupt.
if it's one file protect by password, this one always corrupt
Code: Select all
; Create encrypted ZIP
If PureZIP_Archive_Create("c:\test.zip", #APPEND_STATUS_CREATE)
PureZIP_SetArchivePassword("password")
PureZIP_Archive_Compress("c:\PureBasic400\Examples\PureZIP\PureZIP_TEST_1.pb", #False)
PureZIP_Archive_Compress("c:\PureBasic400\Examples\PureZIP\PureZIP_TEST_2.pb", #False)
PureZIP_Archive_Compress("c:\PureBasic400\Examples\PureZIP\PureZIP_TEST_3.pb", #False)
PureZIP_Archive_Close()
EndIf
Extracted files -> OK
Maye be some more details would help ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
> Maye be some more details would help ?
yes i use this code. the fist file is always corrupt
"C:\Temp\" i have a lot of files and folders in this folder
yes i use this code.
Code: Select all
nom_archive.s= "Archive.zip"
PureZIP_Archive_Create("C:\"+ nom_archive, #APPEND_STATUS_CREATE);
PureZIP_SetArchivePassword("password")
PureZIP_AddFiles("C:\"+ nom_archive,"C:\Temp\*.*" , #PureZIP_StorePathRelative ,#PureZIP_Recursive)
PureZIP_Archive_Close()
"C:\Temp\" i have a lot of files and folders in this folder
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Your code is false.Micko wrote:> Maye be some more details would help ?
yes i use this code.the fist file is always corruptCode: Select all
nom_archive.s= "Archive.zip" PureZIP_Archive_Create("C:"+ nom_archive, #APPEND_STATUS_CREATE); PureZIP_SetArchivePassword("password") PureZIP_AddFiles("C:"+ nom_archive,"C:\Temp\*.*" , #PureZIP_StorePathRelative ,#PureZIP_Recursive) PureZIP_Archive_Close()
"C:\Temp" i have a lot of files and folders in this folder
It should be like this :
Code: Select all
nom_archive.s= "Archive.zip"
; PureZIP_Archive_Create("C:"+ nom_archive, #APPEND_STATUS_CREATE) ; use ONLY with PureZIP_Archive_* functions, like PureZIP_Archive_Compress() etc...
PureZIP_SetArchivePassword("password")
PureZIP_AddFiles("C:"+ nom_archive,"C:\Temp\*.*" , #PureZIP_StorePathRelative ,#PureZIP_Recursive)
; PureZIP_Archive_Close() ; use ONLY with PureZIP_Archive_* functions
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
I don't understand ...Micko wrote:thanks gnozal this work but i have an other problem.
in my "C:\Temp" folder i have compressor.exe file and other file. After zip these files when i try to execute the exe "compressor.exe n'est pas une application WIN32 valide" message appear.
i use your last code
Compressor.exe is in the archive, the archive check is ok, and yet if you extract it the exe is not valid ?
Again, without source, what can I do ?
Note : what version of PB are you using ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- Addict
- Posts: 841
- Joined: Mon Jun 07, 2004 7:10 pm
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Yes, that's it.Bonne_den_kule wrote:PureZIP_Archive_FileInfo(*FileInfo.PureZIP_FileInfo)Micko wrote:Sorry gnozal its ok now. thanks a lot for your support.
but how can i get the size of archive files not archive size.
PureZIP_FileInfo\CompressedSize.l
Code: Select all
PureZIP_Archive_FileInfo(*FileInfo.PureZIP_FileInfo)
Description
Get file information from current file in current archive.
Parameter
Structure PureZIP_FileInfo
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
Structure tm_date
tm_sec.l ; seconds after the minute - [0,59]
tm_min.l ; minutes after the hour - [0,59]
tm_hour.l ; hours since midnight - [0,23]
tm_mday.l ; day of the month - [1,31]
tm_mon.l ; months since January - [0,11]
tm_year.l ; years - [1980..2044]
EndStructure
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Micko wrote:gnozal i use this but it's return the size of each file. if i want the total of all archive files how can i proceed ?
Code: Select all
Procedure.l GetDirectorySizeZIP(ZipFile$,Dir$)
TotalSize.q=0
FileInfo.PureZIP_FileInfo
If PureZIP_Archive_Read(ZipFile$)
ReturnValue.l = PureZIP_Archive_FindFirst() = #UNZ_OK
While ReturnValue = #UNZ_OK
If PureZIP_Archive_FileInfo(@FileInfo) = #UNZ_OK
a$="ZIP:"+FileInfo\Filename
If LCase(Left(a$,Len(Dir$)))=LCase(Dir$) And Right(a$,1)<>""
TotalSize+FileInfo\unCompressedSize & $FFFFFFFF
EndIf
EndIf
ReturnValue = PureZIP_Archive_FindNext()
Wend
PureZIP_Archive_Close()
EndIf
ProcedureReturn TotalSize
EndProcedure
Debug GetDirectorySizeZIP("c:\test.zip","")
;Debug GetDirectorySizeZIP("c:\test.zip","ZIP:\SubFolder")