1

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

MIB
  • 337
  • 2
  • 15
  • It's probably zlib, which is very widespread. If you could compress a sample and upload it for analysis, we could analyze further. – Multimedia Mike Feb 08 '14 at 02:28
  • I've added a link in my post above to a zip containing a sample of the Compress()-Result. – MIB Feb 10 '14 at 08:36
  • Okay, that sample doesn't seem to be zlib or bzip2. In fact, both of those compress the sample better than this compression library. I'm guessing that you don't have any control over what the server is generating, which is what's motivating this inquiry? – Multimedia Mike Feb 10 '14 at 18:03
  • We've mobile device applications based on windev. We want to compress data to shrink transfervolumes. Using zlib seems to be a bit difficult by implementing dll-files. If there's someone with knowledge about this Compress() function, it _might_ be the easier/ faster way. – MIB Feb 12 '14 at 08:28

2 Answers2

1

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 :)

  • Hey, thanks for the response. In the meantime my colleagues have already found a solution based on gzip, which solved our problem. We don't experiment with the compress-Function anymore. But maybe helps your answer someone else. – MIB Apr 24 '15 at 13:13
0

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.

John N
  • 61
  • 5