PureZIP library : ZIP / UNZIP files

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

DataMiner
User
User
Posts: 25
Joined: Mon Mar 28, 2005 1:29 pm
Location: Germany

Post by DataMiner »

@gnozal
Do you think there is a way to add multivolume-support?
Or, if not, do you have any idea to handle it by code?
I am German - that's hard enough ;)
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

DataMiner wrote:@gnozal
Do you think there is a way to add multivolume-support?
Or, if not, do you have any idea to handle it by code?
I simply use the ZLIB available functions, and AFAIK there is no function to handle multivolume archives.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
DataMiner
User
User
Posts: 25
Joined: Mon Mar 28, 2005 1:29 pm
Location: Germany

Post by DataMiner »

:cry: It's a pity. Thanks for your reply!
I am German - that's hard enough ;)
User avatar
AL90
Enthusiast
Enthusiast
Posts: 217
Joined: Fri Sep 16, 2005 7:47 pm
Location: Germany
Contact:

Post by AL90 »

Hi gnozal,

how I can check if an archive requires a password?

I make a small code like this.:

Code: Select all

x=PureZIP_FindFile(ZipFileName$(CurrentWindow),b$,#True)
PureZIP_GetFileInfo(ZipFileName$(CurrentWindow), x, @FileInfo.PureZIP_FileInfo)
; Passwort abfrage.
If FileInfo\flag = 9
  pw$=InputRequester(Lang$(235), Lang$(236), "")
  If pw$<>""
    PureZIP_SetArchivePassword(pw$)
  EndIf
EndIf
Is that the correct way to do ?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AL90 wrote:Hi gnozal,
how I can check if an archive requires a password?
I make a small code like this.:
Is that the correct way to do ?
No, the help says :
Bit 0: If set, indicates that the file is encrypted.
So it should be something like that :

Code: Select all

If FileInfo\flag & %1 
 IsCrypted = #True 
Else 
 IsCrypted = #False 
EndIf
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
AL90
Enthusiast
Enthusiast
Posts: 217
Joined: Fri Sep 16, 2005 7:47 pm
Location: Germany
Contact:

Post by AL90 »

Ok, Thanks for your help. :wink:
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Hello gnozal!

I want to re-direct a bug to you that was found by "String" from the german PB forum.

He says that if he creates an archive with PureZIP and its filename contains sspeacial characters like äöüÄÖÜß, then this archiv is not caompatible with other pack-programs (WinRAR, 7-Zip) anymore.

Please, contact him for furthher informations, link to the german thread:

http://www.purebasic.fr/german/viewtopi ... highlight=
PB 4.30

Code: Select all

onErrorGoto(?Fred)
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AND51 wrote:I want to re-direct a bug to you that was found by "String" from the german PB forum.
Please, contact him for furthher informations, link to the german thread:
Ok
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
String
New User
New User
Posts: 7
Joined: Sat May 26, 2007 9:48 pm

Post by String »

Hallo gnozal
PureZIP kann lange Pfade packen.
Beim entpacken entstehen aber Fehler.

Hello gnozal
PureZIP can pack long paths.
However, faults arise unpack.

Code: Select all



; ####################
; There really are paths of this length
 ;File0.s = "C:\Dokumente und Einstellungen\Ich\Eigene Dateien\Eigene Musik\Future Trance Vol. 39\CD1\02 Everytime We Touch 2006.mp3"
; ####################
  File1.s = "c:\Temp\111111111111111\222222222222222\33333333333333333\444444444444444\555555555555\666666666\OK_7777.txt"
  File2.s = "c:\Temp\111111111111111\222222222222222\33333333333333333\444444444444444\555555555555\666666666\Error_7777.txt"
  dir3.s =  "c:\Temp\111111111111111\222222222222222\33333333333333333\444444444444444\555555555555\666666666\I am a path and no file\Super ERROR.txt"
  If MakeSureDirectoryPathExists_(@File1)
    If OpenFile(1,File1)
      WriteString(1,"File1 OK")
      CloseFile(1)
    EndIf
    If OpenFile(2,File2)
      WriteString(2,"File2 Error")
      CloseFile(2)
    EndIf
    If MakeSureDirectoryPathExists_(@dir3)
      If OpenFile(2,dir3)
        WriteString(2,"Dir Error")
        CloseFile(2)
      EndIf
    EndIf    
    MyZIP.s = "C:\Temp\test.zip"
    MyFilesToZIP.s = "c:\Temp\*.*"
    MyZIPOutPut.s = "c:\Temp\ZIP_Extract\"    
    testZIP.l = PureZIP_AddFiles(MyZIP, MyFilesToZIP, #PureZIP_StorePathRelative, #PureZIP_Recursive)
    If testZIP
      PureZIP_ExtractFiles(MyZIP, "*.*", MyZIPOutPut, #True)
      Debug "OK look in ´C:\Temp\ZIP_Extract\´"
    Else
      Debug "error"
    EndIf
  EndIf
  
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

String wrote:Hello gnozal
PureZIP can pack long paths.
However, faults arise unpack.
No time to debug right now.
However, could you test http://freenet-homepage.de/gnozal/PureZIP_BETA.zip ? I changed one constant value ...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
String
New User
New User
Posts: 7
Joined: Sat May 26, 2007 9:48 pm

Post by String »

Das Problem existiert auch bei der BETA.zip
PureZIP kann einen Pfad mit 254 Zeichen packen.
Aber nur eine Pfad Länge von 108 entpacken.

The problem exists also at the BETA.zip
PureZIP can pack a path with 254 signs.
But only one unpacking path length of 108.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

String wrote:The problem exists also at the BETA.zip
PureZIP can pack a path with 254 signs.
But only one unpacking path length of 108.
Test code

Code: Select all

; Add files
MyZIP.s = "C:\temp\TestFile.zip" 
Path.s = "c:\TEMP\111111111111111\222222222222222\33333333333333333\444444444444444\555555555555\666666666\777777777777777777\Error_7777.jpg"
Debug PureZIP_AddFile(MyZIP.s, Path.s, #PureZIP_StorePathAbsolute) 
Path.s = "c:\TEMP\111111111111111\222222222222222\33333333333333333\444444444444444\555555555555\666666666\777777777777777777\Ok_7777.jpg"
Debug PureZIP_AddFile(MyZIP.s, Path.s, #PureZIP_StorePathAbsolute) 
; Extract files
Path.s = "c:\TEMP\111111111111111\222222222222222\33333333333333333\444444444444444\555555555555\666666666\777777777777777777"
Debug PureZIP_ExtractFiles(MyZIP.s, "*.*", Path.s, #True) 
Result : extracted files without error

Code: Select all

c:\TEMP\111111111111111\222222222222222\33333333333333333\444444444444444\555555555555\666666666\777777777777777777\TEMP\111111111111111\222222222222222\33333333333333333\444444444444444\555555555555\666666666\777777777777777777\Error_7777.jpg
c:\TEMP\111111111111111\222222222222222\33333333333333333\444444444444444\555555555555\666666666\777777777777777777\TEMP\111111111111111\222222222222222\33333333333333333\444444444444444\555555555555\666666666\777777777777777777\Ok_7777.jpg
Total path length is 243 for unpacked file Error_7777.jpg

So it seems to work here ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post by Tranquil »

I want to take a closer look on this lib. But I can not find any information if this lib is thread save and unicode able. Anything on this!?
Tranquil
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Tranquil wrote:I want to take a closer look on this lib. But I can not find any information if this lib is thread save and unicode able. Anything on this!?
The PB3.94 library is not threadsafe nor unicode compatible.

The PB4.0x library exists in 4 versions :
- the standard version, located in %Purebasic%\PureLibraries\UserLibraries\ ;
- the thread-safe version, located in %Purebasic%\SubSystems\UserLibThreadSafe\PureLibraries\ .
- the unicode version, located in %Purebasic%\SubSystems\UserLibUnicode\PureLibraries\ .
- the unicode + thread-safe version, located in %Purebasic%\SubSystems\UserLibunicodeThreadSafe\PureLibraries\ .

In order to use this library in thread-safe mode (compiler option /THREAD), you have to enable the subsystem 'UserLibThreadSafe'
in the PB IDE, or add '/SUBSYSTEM UserLibThreadSafe' to the PBCompiler arguments. In jaPBe, do nothing : it will automatically
enable the 'UserLibThreadSafe' subsystem to use the threadsafe versions of the installed userlibraries.
It's the same logic for unicode and unicode + thread-safe modes.

I personally only use the standard version ; I did'nt get any feedback for the other versions, so I assume they work.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post by Tranquil »

Oh, thanks for very fast answering. I will try and give any report on success/ failure. :)

Hopefully I assume right: One open Archive can be handled by one thread or? couse Closing an Archive does not require an archive-handle nor ID.
Tranquil
Post Reply