Anyone have ZIP/UNZIP DLL with hooks?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fangbeast.

Anyone have a ZIP/UNZIP DLL with information on the 'hooks' it uses? I'm working on another program to catalogue, sort and rename Incredimail graphics libraries with are really ZIP files. I need to get this big collection under control :):)

Regards Fangles

Fangles
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

have you searched for InfoZip ?
Or take a close look at vbaccelarator.com or planetsoucrecode.com or at least
Powerbasic.com
there are a lot of examples to use several zip-librarys in a Basic-dialect.
I have also some source on my machine.If you need these (VB-examples) i 'l send you.


Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fangbeast.
have you searched for InfoZip ?
Or take a close look at vbaccelarator.com or planetsoucrecode.com or at least
Powerbasic.com

Siggi
Thanks for the kind words Siggi but there are a few issues here... I tried InfoZip but, I don't like the idea of having to "shell" out to the O/S to do things, it's counterproductive and especially in PureBASIC's case, asynchronous so a danger to other processes which you have to control by inserting artifical delays.

I did try it (InfoZIp) and the response was "cannot find central ZIP record and cannot find file, period". Both WinRAR and WinZIP can find and undo these files so I guess InfoZip is missing something, some sort of compatibility.

I need to find an up-to-date zip/unzip library and some clever person to help me (big hint there) as I've never studied VB.

But, I'll give anything a go :):) If you can translate the source into PureBASIC so my feeble brain can follow it, then I'd be very happy.

Regards, Fangles :)

Fangles
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

Hi Fangles,
i'm confuse because can you explain exactly what you need ?
Do you want only extract files from a Zip-Compatible-Archive ,
or compress them ? If you strucle with the FREE InfoZip's DLL
then you have to buy a Pro-solution.If you able to code in C, search for the
Sourcecode from Mark Nelson(ZLIB).
Do you need a pack/depack-routine in a sourcecode (Non Zip-Compatible) ?
I'm testing with selfextracting Exe's (In PureBasic) to include Bitmaps, needed DLL's etc.in only one File.
I Prefer a non Zip-Standard (but also inflate) because of easier implementation.
I have done this with VB and PowerBasic .Now it's time do do it PureBasic.


Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

If you need a way to compress/decompress data files in PureBasic, try to look at the following Win32 API commands: LZOpen_() LZCopy_(). I will try to write a quick example to do that, and why not, do a new lib :)



Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fangbeast.
Hi Fangles,
i'm confuse because can you explain exactly what you need ?

Siggi
Hi Siggi, sorry to confuse you, but I confuse myself sometimes!! Besides, I made a partial mistake.

I need a way to uncompress the following types ZIP, RAR, ZOO, ARC, PAK, ACE, LZH, CAB and others eventually. For now, I want to be able to uncompress CAB, ZIP and RAR files to get the information out of it that I need.

I haven't seen the InfoZIP DLL but I have used InfoZip extractor by shelling out to it and it fails on many small ZIP files, complaining that it cannot find the "central directory zip record". I have used other unZIPping programs to do the same thing and they have no problem.

Right now though, I need to be able to process CAB files. I have been shelling out to Microsoft's EXTRACT.EXE to do this and my program took a beating. Keep in mind, I am a beginner at PureBASIC (grin).

Thanks for the help :)

Fangles
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fangbeast.
If you need a way to compress/decompress data files in PureBasic, try to look at the following Win32 API commands: LZOpen_() LZCopy_(). I will try to write a quick example to do that, and why not, do a new lib :)

Fred - AlphaSND
Yes please!!!! (grovel grovel). I am a million years away from understanding how to use the Win32API's without help so any examples will be glady drooled at. I need to be able to handle CAB files right now for the cataloguer I wrote for IncrediMail's graphic content. Issued the first slow version today to testers!!! WooHoo!!

Fangles
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

Fred wrote:
>If you need a way to compress/decompress data files in PureBasic, try to look >at the following Win32 API commands: LZOpen_() LZCopy_(). I will try to write >a quick example to do that, and why not, do a new lib :)

Nhmmm, I know these Functions but First there are slow,second they can't compress (Only decompress) and the compress ratio is slow.But a example will be help each in the community.Yesterday I played with JCalg.dll (This came with ASM (MASM or TASM)-Sourcecode), a super fast compressor (Decompress a 2,3 MB in 60 ms in Memory).I take a closer look on it.If anyone interrested I'l post the code.Thanx Fred.

Fangles,
Oh Guy, you want everything.I have Code for reading out the content of a zip,rar,arj and cabinet archive(Without decompressing).
Many of the Zip-examples do both compress and decompress.There is also a example
for using(compress and decompress) cabinetfiles.But all those examples are in VB
and take a while for converting to PureBasic.

Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fangbeast.
Fangles,
Oh Guy, you want everything.I have Code for reading out the content of a zip,rar,arj and cabinet archive(Without decompressing).
Siggi
Me want everything?? Never!! (Very evil grin) Actually, I could do with a simple CABinet decompress routine as I need to extract one text file from a CABinet format archive to process it. And anything is faster (and safer) than shelling out to EXTRACT.EXE, especially in Asynchronous mode!!

regards

Fangles
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Leigh.

Rings,

That JCalg.dll stuff sounds very interesting. I've use Zlib in the past and I really rate it. Please do post you findings here...

Leigh.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

To Download jcalg-compression:
http://www.collakesoftware.com/files/jcalg1_r528.zip

I think it's open source and realy fast.

Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

Oh I'v forgotten, there is a example in PowerBasic
(Yes we have to mess with this compiler and translate the code
(Or better the whole ASM) into PureBasic.
For those who are interresting in BasicCode for JCalg(Only in PowerBasic, but i have tried it today and it works) I email you the code.
The Example is too long to write here sorry.

Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

As I'm very interessted in compressing technologies, I quickly take a look to JCALG1 and... it rocks. The compressing speed are really slow (about 8 secs on my Duron 900 for a 300 Kb file) but the decompressing speed is instant, under 10 ms. This makes this compressor/decompressor really attractive, especially for games or pre-compressed data for applications. I've done a library for PureBasic (using the asm code shipped with the library), so it's small and fast . Like I like it. I will be integrated in the next version of PB. Because PB library has changed (but old libs still work, don't worry), the compiler must be upgraded before using this one, so everyone should wait until the official relase.

Anyway, here is my test source code in PB, so you could see how easy it's to use (final exec size is 17,5 kb, no need for any DLL):

Code: Select all

 
If ReadFile(0, OpenFileRequester("Choose a file to compress", "", "*.*", 0))
  FileLength = LOF()
  
  ; Allocate the 2 memory buffers needed for compression..
  ;
  If FileLength And AllocateMemory(0, FileLength , 0) And AllocateMemory(1, FileLength+8, 0)
    ReadMemory(UseMemory(0), FileLength) ; Read the whole file in the memory buffer
    
    ; Compress our file, which is in memory (and use a timer to see the time spend by compression..)
    ;
    StartTimer = GetTickCount_()
    CompressedLength = CompressMemory(UseMemory(0), UseMemory(1), FileLength)    
    If CompressedLength

      CompressionTime = GetTickCount_()-StartTimer

      StartTimer = GetTickCount_()
      DecompressedLength = DecompressMemory(UseMemory(1), UseMemory(0))
      If DecompressedLength = FileLength
        DecompressionTime = GetTickCount_()-StartTimer
      EndIf      
    EndIf 
  EndIf
EndIf

End   
Fred - AlphaSND


Edited by - fred on 18 October 2001 22:45:29
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

Fred, you're the man !
I think these Compression-functions are some of the most wanted functions for the next release.
The speed while doing a compression is not a problem.But the speed of uncompressing really is.So this routines are specially for PureBasic.
(Do do of course games or other application with embbeded Data's).
Remember that a couple of programming-languages can include data into one
file (A sort of resource's) and decompress while starting.
Now I think that should also possible to PureBasic.


Some Hints and Tips for Compression(If you make some new Functions):

1) A Function for Get the Uncompressed Size for the Compressed (File or Data)
(Store the Length of the uncompressed Data into the compressed one)

2) Not only Compress in Memory, allow to compress/uncompress
directy to File(s) (eliminate to write more code than needed )

3) Allow to include such compressed files into a exe and decompress them
(If needed) .For Example:
LoadSound(0, CMemorybank(1))
instead of LoadSound(0, SoundFileName$)
or
test=LoadImage(1, CMemorybank(10))
instead of test=LoadImage(1, "Explosion_3.bmp")

I don't know if these is too complex for you,but i have seen some
techniques before(In other languages).


(I'm also a Compression-Freak and have done a lot of Compressions in Basic)

4) Generate a Event(Percentage% or Lentgh-Pointer) while compressing
(To show that something is been done )

5) Make the routines available in all the Compilers(Also Linux)


Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

uups ,
these Reply should been done into the wishlist.

Siggi
Post Reply