The Forum is up for sale: XeNTaX Forum looking for new owner

zlib unpacker [Request]

Read or post about compression. And decompression. Or ask questions how to decompress your files.
fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 94 times

Re: zlib unpacker [Request]

Post by fatduck »

Thanks, by the way, could this offset value support hex input as well(eg: 0x10C). Because most of the time when we looking at the hex data, we use hex offset!

Thanks once again!
No more Fatduck, no more FatImporter, Byebye everyone!
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Re: zlib unpacker [Request]

Post by Rheini »

The idea isn't bad, but I won't implement that (maybe later) since every good hex editor provides both hex and decimal offsets, furthermore this version of the tool is meant to be also used in automatic processing.

Might take some time til it's finished since I'm completely rewriting the tool in another programming language (D)

I still have some file scanner code lying around here, another possible feature would be an automatic extraction of all zlibbed files contained in an archive. But this is just a thought atm :wink:
User avatar
asmxtx
veteran
Posts: 127
Joined: Sun Jun 08, 2008 10:32 pm
Location: Developers Country
Has thanked: 1 time
Been thanked: 30 times

Re: zlib unpacker [Request]

Post by asmxtx »

Here is a command line unpacker for ZLIB compressed data files.

Syntax:

Code: Select all

INFLATE <compr_file> [decompr_file | [0x]offset [decompr_file]]
compr_file: Container file which consists of jointed ZLIB data streams. Must be given on the command line.
decompr_file: Name of the decompressed file. Optional.
offset: Offset within compr_file where the ZLIB stream starts. Optional.

Example:

Code: Select all

INFLATE data.dat
Extracts the first ZLIB stream at offset 0 from DATA.DAT and names it DATA.DXX.

Code: Select all

INFLATE data.dat 17
Extracts the ZLIB stream from offset 0x11 (11hex, 17dez) from DATA.DAT and names it DATA.DXX.

Code: Select all

INFLATE data.dat extr.zlb
Extracts the first ZLIB stream at offset 0 from DATA.DAT and names it EXTR.ZLB.

Code: Select all

INFLATE data.dat 0x111 extr.zlb
Extracts the ZLIB stream from offset 0x111 (273dec) from DATA.DAT and names it EXTR.ZLB

Error codes: 0 - OK
1 - wrong parameters
2 - error opening input file
3 - error opening output file
4 - error ZLIB-initialization
5 - error during decompression
6 - error writing destination file
7 - given offset not in file range

(updated Sep 29, 2008)
You do not have the required permissions to view the files attached to this post.
Last edited by asmxtx on Mon Sep 29, 2008 4:55 am, edited 1 time in total.
fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 94 times

Re: zlib unpacker [Request]

Post by fatduck »

Hi asmxtx, I found a little problem with your tool here!
If I set the offset to 0x08, your tool won't deflate the file. But when I cut out the first 8 bytes and deflate with your tool, it works, it works!(even thought it said data error)

And I yes, I can use other tools (like zlibc, offzip) to deflate it without error!
You do not have the required permissions to view the files attached to this post.
No more Fatduck, no more FatImporter, Byebye everyone!
User avatar
asmxtx
veteran
Posts: 127
Joined: Sun Jun 08, 2008 10:32 pm
Location: Developers Country
Has thanked: 1 time
Been thanked: 30 times

Re: zlib unpacker [Request]

Post by asmxtx »

The problem should be solved now.
I didn't subtract the offset from the input size. This let ZLIB read random data beyond the input buffer if the compressed source was a not terminated stream like in your file. (Download link updated.)
deve
n00b
Posts: 15
Joined: Wed Apr 22, 2009 9:56 am

Re: zlib unpacker [Request]

Post by deve »

:bye:
Last edited by deve on Tue Jun 09, 2009 1:12 pm, edited 1 time in total.
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Re: zlib unpacker [Request]

Post by Rheini »

zlibc is not meant to be an archiver.
It is designed to de-/compress raw zlib streams.
i404401
ultra-n00b
Posts: 1
Joined: Thu May 03, 2012 1:14 am

Re: zlib unpacker [Request]

Post by i404401 »

@ Rheini : Thank you for your tool, it saved up my time.
Thanks to others who share their ideas here too.
Post Reply