Andreas Eibach Guest
|
Posted: Sun Nov 09, 2008 7:21 am Post subject: Building zpipe.c on windows: strange ZIP format that cannot |
|
|
Hi there,
I'm unable to unpack ZIP files on Windows with common archiver software
which are packed
with the zpipe.c sample tool . How comes?
I've built it under MingW/MSYS and it worked well, however the -lzdll
needs to be the last of the gcc line and must not come before the -o.
This took me _hours_ to figure out what the problem for the "undefined
references" is, since I assumed my installation to be OK.
When using
zpipe < mytest.fil > blah.zip
I can read the data of mytest.fil again by
zpipe -d < blah.zip
BUT I cannot unpack blah.zip using WinRAR or other tools. Why that?
How do I have to modify zpipe.c so that I can unpack the ZIP files with
common software?
(My first aim is to compile zlib support into my own application, which I'm
possibly planning to set under GPL#2. However, I cannot use 'alien' ZIP-like
formats because my decompression routines [using zlib1.dll] must also be
able to unpack archives which were created by third-party tools.
So what can I do?
Best Regards,
Andreas |
|
Klaus Stengel Guest
|
Posted: Sun Nov 09, 2008 3:40 pm Post subject: Re: Building zpipe.c on windows: strange ZIP format that can |
|
|
Hi,
Andreas Eibach wrote:
| Quote: | When using
zpipe < mytest.fil > blah.zip
I can read the data of mytest.fil again by
zpipe -d < blah.zip
BUT I cannot unpack blah.zip using WinRAR or other tools. Why that?
How do I have to modify zpipe.c so that I can unpack the ZIP files
with common software?
|
I think you misunderstood the purpose of the zpipe program. It just
applies the deflate compression algorithm to the given data stream and
nothing else. However, the ZIP file format (which you probably want) is
specified as a container for multiple files and codings and also
maintains information about the stored files, e.g. their names,
attributes, size. Data inside the archive is often compressed with
deflate, but it's also possible to use bzip2 and some other algorithms
in recent versions. Most common tools don't know how to handle 'raw'
streams as created by zpipe and only expect them inside some archive
format like ZIP.
Examples for reading/writing ZIP files are included in the zlib
distribution inside the contrib/minizip directory.
| Quote: | (My first aim is to compile zlib support into my own application,
which I'm possibly planning to set under GPL#2. However, I cannot use
'alien' ZIP-like formats because my decompression routines [using
zlib1.dll] must also be able to unpack archives which were created by
third-party tools. So what can I do?
|
Depending on the purpose of your application, you may want to use
a more complete and robust implementation than minizip. For
example, http://www.info-zip.org/ is mentioned on the zlib website and
you can find some more libraries/programs on
http://www.compression-links.info/Zip too.
Regards,
Klaus |
|