Page 20 of 40

Posted: Mon Aug 06, 2007 8:26 am
by gnozal
Update (both libs and DLL)

Changes :

- PureZIP now stores filenames with slash (like on Unix based systems) instead of backslash (like on Windows).

Posted: Tue Aug 07, 2007 10:40 am
by gnozal
Update (PB4.0x lib and DLL)

Changes :

- fixed broken unicode support (since V1.90)
- cleaned-up code
I hope it's all ok now ...

Password protect error

Posted: Thu Aug 09, 2007 5:23 pm
by Micko
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 :shock:

Re: Password protect error

Posted: Fri Aug 10, 2007 7:27 am
by gnozal
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 :shock:
I can't confirm. I just tested it this way :

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
Checked "c:\test.zip" in WinRAR and TotalCMD -> OK
Extracted files -> OK
Maye be some more details would help ?

Posted: Fri Aug 10, 2007 9:00 pm
by Micko
> Maye be some more details would help ?
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()
the fist file is always corrupt
"C:\Temp\" i have a lot of files and folders in this folder

Posted: Sat Aug 11, 2007 8:04 am
by gnozal
Micko wrote:> Maye be some more details would help ?
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()
the fist file is always corrupt
"C:\Temp" i have a lot of files and folders in this folder
Your code is false.
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
Tested the corrected code with a folder containing 3792 files (-> 79 Mb archive) ; no problem with WinRAR or TotalCMD (test archive or extract) ...

Posted: Sat Aug 11, 2007 1:55 pm
by Micko
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[/code]

Posted: Mon Aug 13, 2007 10:44 am
by gnozal
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
I don't understand ...
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 ?

Posted: Mon Aug 13, 2007 6:59 pm
by Micko
Sorry gnozal its ok now. thanks a lot for your support.
but how can i get the size of archive files not archive size.

Posted: Mon Aug 13, 2007 8:05 pm
by Bonne_den_kule
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_Archive_FileInfo(*FileInfo.PureZIP_FileInfo)
PureZIP_FileInfo\CompressedSize.l

Posted: Tue Aug 14, 2007 7:41 am
by gnozal
Bonne_den_kule wrote:
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_Archive_FileInfo(*FileInfo.PureZIP_FileInfo)
PureZIP_FileInfo\CompressedSize.l
Yes, that's it.

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
See PureZIP_Archive_FileInfo() help for more details.

Posted: Tue Aug 14, 2007 5:20 pm
by Micko
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 ?

Posted: Tue Aug 14, 2007 6:54 pm
by AL90
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")

Posted: Wed Aug 15, 2007 6:57 pm
by Micko
@ AL90
you are welcome
thanks a lot :D

Posted: Thu Aug 16, 2007 4:05 pm
by Micko
Hi gnozal
when i compress folder include application, setup and text files everything is ok but when extracting these files the exe seems corrupt. :(