Question

does anybody know, which Compression-Method the WinDev-Function Compress() uses and maybe, how to decompress the result in php?

The API of WinDev only says "binary" compression, but no further details about it. http://doc.windev.com/en-US/?3024012&product=WD&productversion=XXA150

In php I can use unpack(), but have to say which format. Without knowlegde it's a search of a needle in a haystack.

Maybe there's anyone, who has already done this, and could help me out.

Sample: zip-File containing a sample-Result of the Compress()-Function and the plain content for comparison

Was it helpful?

Solution

PCSOFT use their WDZ format for most of anything and it's not standard so you wont be able to open it with the usual tools. I heard they used some of the usual libs like zlib but put their little twist to it so you probably could only work with their tool WDZIP.EXE to work with that.

You should look at other functions like zipCreate() for creating archives and using some standard formats: http://doc.windev.com/en-US/?3082007

Hope this helps :)

OTHER TIPS

This question is 7 years old, but in case anyone needs to read data which have been compressed with that function, I've had to reverse it too:

  • It starts with 01 01 00 00 00 XX where XX is:
    • 00 for "no compression"
    • 04 for "LZW"
  • Then there's the length of compressed data in a little endian int32.
    • If there's compression, it's followed by the length of the uncompressed buffer (data length + 4).
  • Then there's the buffer (encoded or not) which contains:
    • The length of uncompressed data in a little endian int32.
    • The actual data.

The LZW compression uses 16 bits codes instead of the usual 12 bits, and its clear code is zero, which means every literal code is incremented.

I took Go's compress/lzw package and adapted it a little: 16 bits codes, zero clear code, decrementing every literal code. And it properly decodes everything so far.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top