diff options
author | Ladislav Zezula <ladislav.zezula@avast.com> | 2022-12-21 14:52:36 +0100 |
---|---|---|
committer | Ladislav Zezula <ladislav.zezula@avast.com> | 2022-12-21 14:52:36 +0100 |
commit | 0ad525680038c8450fbd9c438fad49ee133029f5 (patch) | |
tree | db856ffae24f43688f0f823d739b9dfff8553f8d /src | |
parent | 4145cbdbfb37d30c8f99072e7a7815033f41e729 (diff) |
Reverted all enums
Diffstat (limited to 'src')
-rw-r--r-- | src/pklib/explode.c | 16 | ||||
-rw-r--r-- | src/pklib/pklib.h | 84 |
2 files changed, 38 insertions, 62 deletions
diff --git a/src/pklib/explode.c b/src/pklib/explode.c index 21246b3..35210fb 100644 --- a/src/pklib/explode.c +++ b/src/pklib/explode.c @@ -31,7 +31,7 @@ char CopyrightPkware[] = "PKWARE Data Compression Library for Win32\r\n" //----------------------------------------------------------------------------- // Tables -const unsigned char DistBits[DIST_SIZES] = +const unsigned char DistBits[0x40] = { 0x02, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, @@ -39,7 +39,7 @@ const unsigned char DistBits[DIST_SIZES] = 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }; -const unsigned char DistCode[DIST_SIZES] = +const unsigned char DistCode[0x40] = { 0x03, 0x0D, 0x05, 0x19, 0x09, 0x11, 0x01, 0x3E, 0x1E, 0x2E, 0x0E, 0x36, 0x16, 0x26, 0x06, 0x3A, 0x1A, 0x2A, 0x0A, 0x32, 0x12, 0x22, 0x42, 0x02, 0x7C, 0x3C, 0x5C, 0x1C, 0x6C, 0x2C, 0x4C, 0x0C, @@ -47,28 +47,28 @@ const unsigned char DistCode[DIST_SIZES] = 0xF0, 0x70, 0xB0, 0x30, 0xD0, 0x50, 0x90, 0x10, 0xE0, 0x60, 0xA0, 0x20, 0xC0, 0x40, 0x80, 0x00 }; -const unsigned char ExLenBits[LENS_SIZES] = +const unsigned char ExLenBits[0x10] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; -const unsigned short LenBase[LENS_SIZES] = +const unsigned short LenBase[0x10] = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x000A, 0x000E, 0x0016, 0x0026, 0x0046, 0x0086, 0x0106 }; -const unsigned char LenBits[LENS_SIZES] = +const unsigned char LenBits[0x10] = { 0x03, 0x02, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x07, 0x07 }; -const unsigned char LenCode[LENS_SIZES] = +const unsigned char LenCode[0x10] = { 0x05, 0x03, 0x01, 0x06, 0x0A, 0x02, 0x0C, 0x14, 0x04, 0x18, 0x08, 0x30, 0x10, 0x20, 0x40, 0x00 }; -const unsigned char ChBitsAsc[CH_BITS_ASC_SIZE] = +const unsigned char ChBitsAsc[0x100] = { 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x07, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, @@ -88,7 +88,7 @@ const unsigned char ChBitsAsc[CH_BITS_ASC_SIZE] = 0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D }; -const unsigned short ChCodeAsc[CH_BITS_ASC_SIZE] = +const unsigned short ChCodeAsc[0x100] = { 0x0490, 0x0FE0, 0x07E0, 0x0BE0, 0x03E0, 0x0DE0, 0x05E0, 0x09E0, 0x01E0, 0x00B8, 0x0062, 0x0EE0, 0x06E0, 0x0022, 0x0AE0, 0x02E0, diff --git a/src/pklib/pklib.h b/src/pklib/pklib.h index e8b939b..95c7b3b 100644 --- a/src/pklib/pklib.h +++ b/src/pklib/pklib.h @@ -29,30 +29,6 @@ #define CMP_IMPLODE_DICT_SIZE2 2048 // Dictionary size of 2048 #define CMP_IMPLODE_DICT_SIZE3 4096 // Dictionary size of 4096 -enum CommonSizes { - OUT_BUFF_SIZE = 0x802 -}; - -enum LUTSizes { - DIST_SIZES = 0x40, - CH_BITS_ASC_SIZE = 0x100, - LENS_SIZES = 0x10, -}; - -enum ImplodeSizes { - OFFSS_SIZE2 = 0x204, - LITERALS_COUNT = 0x306, - HASHTABLE_SIZE = 0x900, - BUFF_SIZE = 0x2204, -}; - -enum ExplodeSizes{ - IN_BUFF_SIZE = 0x800, - CODES_SIZE = 0x100, - OFFSS_SIZE = 0x100, - OFFSS_SIZE1 = 0x80, -}; - //----------------------------------------------------------------------------- // Define calling convention @@ -77,25 +53,25 @@ typedef struct unsigned int dsize_mask; // 0010: Bit mask for dictionary. 0x0F = 0x400, 0x1F = 0x800, 0x3F = 0x1000 unsigned int ctype; // 0014: Compression type (CMP_ASCII or CMP_BINARY) unsigned int dsize_bytes; // 0018: Dictionary size in bytes - unsigned char dist_bits[DIST_SIZES]; // 001C: Distance bits - unsigned char dist_codes[DIST_SIZES]; // 005C: Distance codes - unsigned char nChBits[LITERALS_COUNT]; // 009C: Table of literal bit lengths to be put to the output stream - unsigned short nChCodes[LITERALS_COUNT];// 03A2: Table of literal codes to be put to the output stream + unsigned char dist_bits[0x40]; // 001C: Distance bits + unsigned char dist_codes[0x40]; // 005C: Distance codes + unsigned char nChBits[0x306]; // 009C: Table of literal bit lengths to be put to the output stream + unsigned short nChCodes[0x306]; // 03A2: Table of literal codes to be put to the output stream unsigned short offs09AE; // 09AE: void * param; // 09B0: User parameter unsigned int (*read_buf)(char *buf, unsigned int *size, void *param); // 9B4 void (*write_buf)(char *buf, unsigned int *size, void *param); // 9B8 - unsigned short offs09BC[OFFSS_SIZE2]; // 09BC: + unsigned short offs09BC[0x204]; // 09BC: unsigned long offs0DC4; // 0DC4: - unsigned short phash_to_index[HASHTABLE_SIZE]; // 0DC8: Array of indexes (one for each PAIR_HASH) to the "pair_hash_offsets" table + unsigned short phash_to_index[0x900]; // 0DC8: Array of indexes (one for each PAIR_HASH) to the "pair_hash_offsets" table unsigned short phash_to_index_end; // 1FC8: End marker for "phash_to_index" table - char out_buff[OUT_BUFF_SIZE]; // 1FCA: Compressed data - unsigned char work_buff[BUFF_SIZE]; // 27CC: Work buffer + char out_buff[0x802]; // 1FCA: Compressed data + unsigned char work_buff[0x2204]; // 27CC: Work buffer // + DICT_OFFSET => Dictionary // + UNCMP_OFFSET => Uncompressed data - unsigned short phash_offs[BUFF_SIZE]; // 49D0: Table of offsets for each PAIR_HASH + unsigned short phash_offs[0x2204]; // 49D0: Table of offsets for each PAIR_HASH } TCmpStruct; #define CMP_BUFFER_SIZE sizeof(TCmpStruct) // Size of compression structure. @@ -118,22 +94,22 @@ typedef struct unsigned int (*read_buf)(char *buf, unsigned int *size, void *param); // Pointer to function that reads data from the input stream void (*write_buf)(char *buf, unsigned int *size, void *param);// Pointer to function that writes data to the output stream - unsigned char out_buff[BUFF_SIZE]; // 0030: Output circle buffer. + unsigned char out_buff[0x2204]; // 0030: Output circle buffer. // 0x0000 - 0x0FFF: Previous uncompressed data, kept for repetitions // 0x1000 - 0x1FFF: Currently decompressed data // 0x2000 - 0x2203: Reserve space for the longest possible repetition - unsigned char in_buff[IN_BUFF_SIZE]; // 2234: Buffer for data to be decompressed - unsigned char DistPosCodes[CODES_SIZE]; // 2A34: Table of distance position codes - unsigned char LengthCodes[CODES_SIZE]; // 2B34: Table of length codes - unsigned char offs2C34[OFFSS_SIZE]; // 2C34: Buffer for - unsigned char offs2D34[OFFSS_SIZE]; // 2D34: Buffer for - unsigned char offs2E34[OFFSS_SIZE1]; // 2E34: Buffer for - unsigned char offs2EB4[OFFSS_SIZE]; // 2EB4: Buffer for - unsigned char ChBitsAsc[CH_BITS_ASC_SIZE]; // 2FB4: Buffer for - unsigned char DistBits[DIST_SIZES]; // 30B4: Numbers of bytes to skip copied block length - unsigned char LenBits[LENS_SIZES]; // 30F4: Numbers of bits for skip copied block length - unsigned char ExLenBits[LENS_SIZES]; // 3104: Number of valid bits for copied block - unsigned short LenBase[LENS_SIZES]; // 3114: Buffer for + unsigned char in_buff[0x800]; // 2234: Buffer for data to be decompressed + unsigned char DistPosCodes[0x100]; // 2A34: Table of distance position codes + unsigned char LengthCodes[0x100]; // 2B34: Table of length codes + unsigned char offs2C34[0x100]; // 2C34: Buffer for + unsigned char offs2D34[0x100]; // 2D34: Buffer for + unsigned char offs2E34[0x80]; // 2E34: Buffer for + unsigned char offs2EB4[0x100]; // 2EB4: Buffer for + unsigned char ChBitsAsc[0x100]; // 2FB4: Buffer for + unsigned char DistBits[0x40]; // 30B4: Numbers of bytes to skip copied block length + unsigned char LenBits[0x10]; // 30F4: Numbers of bits for skip copied block length + unsigned char ExLenBits[0x10]; // 3104: Number of valid bits for copied block + unsigned short LenBase[0x10]; // 3114: Buffer for } TDcmpStruct; #define EXP_BUFFER_SIZE sizeof(TDcmpStruct) // Size of decompression structure @@ -142,14 +118,14 @@ typedef struct //----------------------------------------------------------------------------- // Tables (in explode.c) -extern const unsigned char DistBits[DIST_SIZES]; -extern const unsigned char DistCode[DIST_SIZES]; -extern const unsigned char ExLenBits[LENS_SIZES]; -extern const unsigned short LenBase[LENS_SIZES]; -extern const unsigned char LenBits[LENS_SIZES]; -extern const unsigned char LenCode[LENS_SIZES]; -extern const unsigned char ChBitsAsc[CH_BITS_ASC_SIZE]; -extern const unsigned short ChCodeAsc[CH_BITS_ASC_SIZE]; +extern const unsigned char DistBits[0x40]; +extern const unsigned char DistCode[0x40]; +extern const unsigned char ExLenBits[0x10]; +extern const unsigned short LenBase[0x10]; +extern const unsigned char LenBits[0x10]; +extern const unsigned char LenCode[0x10]; +extern const unsigned char ChBitsAsc[0x100]; +extern const unsigned short ChCodeAsc[0x100]; //----------------------------------------------------------------------------- // Public functions |