Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Macros | |
#define | ENSURE_BYTES |
#define | WRITE_BYTE |
Functions | |
int | lzss_decompress (struct mspack_system *system, struct mspack_file *input, struct mspack_file *output, int input_buffer_size, int mode) |
#define ENSURE_BYTES |
#define WRITE_BYTE |
int lzss_decompress | ( | struct mspack_system * | system, |
struct mspack_file * | input, | ||
struct mspack_file * | output, | ||
int | input_buffer_size, | ||
int | mode | ||
) |
Decompresses an LZSS stream.
Input bytes will be read in as necessary using the system->read() function with the input file handle given. This will continue until system->read() returns 0 bytes, or an error. Errors will be passed out of the function as MSPACK_ERR_READ errors. Input streams should convey an "end of input stream" by refusing to supply all the bytes that LZSS asks for when they reach the end of the stream, rather than return an error code.
Output bytes will be passed to the system->write() function, using the output file handle given. More than one call may be made to system->write().
As EXPAND.EXE (SZDD/KWAJ), Microsoft Help and QBasic have slightly different encodings for the control byte and matches, a "mode" parameter is allowed, to choose the encoding.
system | an mspack_system structure used to read from the input stream and write to the output stream, also to allocate and free memory. |
input | an input stream with the LZSS data. |
output | an output stream to write the decoded data to. |
input_buffer_size | the number of bytes to use as an input bitstream buffer. |
mode | one of LZSS_MODE_EXPAND, LZSS_MODE_MSHELP or LZSS_MODE_QBASIC |
Definition at line 37 of file lzssd.c.
References mspack_system::alloc, c, ENSURE_BYTES, mspack_system::free, i, inbuf, invert(), len, LZSS_MODE_EXPAND, LZSS_MODE_MSHELP, LZSS_MODE_QBASIC, LZSS_WINDOW_FILL, LZSS_WINDOW_SIZE, memset(), MSPACK_ERR_ARGS, MSPACK_ERR_NOMEMORY, MSPACK_ERR_OK, pos, read(), and WRITE_BYTE.
Referenced by kwajd_extract(), and szddd_extract().