Unzipping a pkzip with C++

I have a PKZIP file. It's not a standalone file, it's part of a bigger format, I cannot reference it via the file system, I have to interact with it in a form of a char array, or any type that it can be transformed into. It's a performance sensitive bit, I cannot afford the processor time to write the file to disk just to be read again.

This are it's contents, without the compressed part:

50 4B 03 04 14 00 00 00 08 00 51 B2 8B 4A B3 B6
6C B0 F6 18 00 00 40 07 01 00 07 00 00 00 2D 33
31 2F 31 32 38

<compressed data (6390 bytes)>

50 4B 01 02 14 00 14 00 00 00 08 00 51 B2 8B 4A
B3 B6 6C B0 F6 18 00 00 40 07 01 00 07 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 2D 33
31 2F 31 32 38 50 4B 05 06 00 00 00 00 01 00 01
00 35 00 00 00 1B 19 00 00 00 00

You can get the full file here: https://pastebin.com/QsyAa6kY

This is not a homework, this is not an assignment. This is the stupidest thing possible. I'm working on project of mine in order to learn c++ and openGL. And yet, here I am, for a week now, unable to unzip a fucking pkzip file, the most generic, most widely used compression format. And I cannot move on until I do.

So I'm begging someone here, who has experience with compression and zip files, to give me an small code excerpt that will unzip this file, and then zip it back up again. There must be a single library that will deal with zips as arrays of data instead of files. And there must be a simple way to unzip a stupid zip file. It shouldn't be more than ten lines of code.

I gave it my best. I failed. I can't. I give up. I just want to unzip the stupid file and not have to cry myself to sleep tonight.

Please.

I can pay you if you want.
I offer $50 for unzip and zip.
This is the specification for zip files.

https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

I've never used a public domain .zip file library (try googling zip file library), so I don't know if they are any good or as easy to use as you expect.

you can always write your own code, but that will certainly be more than 10 lines of code.

Good luck.
windows will unzip it natively with a right click as of the last couple of versions of the os. You don't need code.

zip is moderately complex, its not 10 lines of code at all...
Take a look at boost:

http://www.boost.org/doc/libs/1_64_0/libs/iostreams/doc/index.html

basic_zlib_decompressor
any chance this file is very old? It shouldnt matter but pk zip was a dos utility.... it more or less died by 1998 and I think it morphed into winzip (not 100% sure if that was the same folks or not).

IIRC .gz and .zip are not totally 100% compatible (??). Not sure on that either. All the modern tools can handle both, but I seem to recall a time where I needed 2 extraction tools...

Last edited on
Topic archived. No new replies allowed.