From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Library:StormLib" |
|---|
| claim | "StormLib compresses MPQ sectors with method 0x02 as zlib streams (deflateInit2, positive windowBits, so a 2-byte RFC 1950 header and Adler-32 trailer follow the method byte) and picks windowBits from the input size: 8 for <= 0x100 bytes, 9 <= 0x200, ... 14 <= 0x4000, else 15. With zlib's 8-to-9 rule the stream after the method byte starts with 18, 28, 38, 48, 58, 68 or 78, not always 78." |
|---|
| scope | | level | "library" |
|---|
| applies_to | "Library:StormLib" |
|---|
| observed_in | |
|---|
|
|---|
| data | | function | "Compress_ZLIB (src/SCompression.cpp)" |
|---|
| condition | "MPQ_COMPRESSION_ZLIB (0x02)" |
|---|
| effect | "window size follows the sector size; first zlib byte 0x18-0x78" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "windowBits 8..15 chosen by cbInBuffer ('Determine the proper window bits (WoW.exe build 12694)'); deflateInit2(&z, level, Z_DEFLATED, windowBits, 8, Z_DEFAULT_STRATEGY); Decompress_ZLIB uses inflateInit (zlib header required)" |
|---|
| repo | "https://github.com/ladislav-zezula/StormLib" |
|---|
| commit | "116135c27e8c0dcf8ea0a0c549a6d737ce10fc73" |
|---|
| path | "src/SCompression.cpp" |
|---|
| lines | "123-150" |
|---|
|
| type | "source" |
|---|
| detail | "bundled zlib 1.2.5 also maps windowBits 8 to 9" |
|---|
| repo | "https://github.com/ladislav-zezula/StormLib" |
|---|
| commit | "116135c27e8c0dcf8ea0a0c549a6d737ce10fc73" |
|---|
| path | "src/zlib/deflate.c" |
|---|
| lines | "260-264" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "Python zlib 1.3.2 compressobj with wbits 8..15 gives first bytes 18 18 28 38 48 58 68 78." |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "zlib sector window size" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T05:49:45.537Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T04:02:55.177Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read StormLib src/SCompression.cpp at 116135c Compress_ZLIB and Decompress_ZLIB: windowBits 8 for <=0x100 up to 14 for <=0x4000, else 15, passed to deflateInit2; decompression uses inflateInit (zlib header). Window bits depend on input size of each call (the sector or smaller)." |
|---|
|
|
|---|