libmspack
Data Structures | Macros | Functions
mspack.h File Reference
#include <sys/types.h>
#include <stdlib.h>
Include dependency graph for mspack.h:

Go to the source code of this file.

Data Structures

struct  mspack_system
 A structure which abstracts file I/O and memory management. More...
 
struct  mspack_file
 A structure which represents an open file handle. More...
 
struct  mscabd_cabinet
 A structure which represents a single cabinet file. More...
 
struct  mscabd_folder
 A structure which represents a single folder in a cabinet or cabinet set. More...
 
struct  mscabd_file
 A structure which represents a single file in a cabinet or cabinet set. More...
 
struct  mscab_compressor
 TODO. More...
 
struct  mscab_decompressor
 A decompressor for .CAB (Microsoft Cabinet) files. More...
 
struct  mschmc_file
 A structure which represents a file to be placed in a CHM helpfile. More...
 
struct  mschmd_section
 A structure which represents a section of a CHM helpfile. More...
 
struct  mschmd_sec_uncompressed
 A structure which represents the uncompressed section of a CHM helpfile. More...
 
struct  mschmd_sec_mscompressed
 A structure which represents the LZX compressed section of a CHM helpfile. More...
 
struct  mschmd_header
 A structure which represents a CHM helpfile. More...
 
struct  mschmd_file
 A structure which represents a file stored in a CHM helpfile. More...
 
struct  mschm_compressor
 A compressor for .CHM (Microsoft HTMLHelp) files. More...
 
struct  mschm_decompressor
 A decompressor for .CHM (Microsoft HTMLHelp) files. More...
 
struct  mslit_compressor
 TODO. More...
 
struct  mslit_decompressor
 TODO. More...
 
struct  mshlp_compressor
 TODO. More...
 
struct  mshlp_decompressor
 TODO. More...
 
struct  msszddd_header
 A structure which represents an SZDD compressed file. More...
 
struct  msszdd_compressor
 A compressor for the SZDD file format. More...
 
struct  msszdd_decompressor
 A decompressor for SZDD compressed files. More...
 
struct  mskwajd_header
 A structure which represents an KWAJ compressed file. More...
 
struct  mskwaj_compressor
 A compressor for the KWAJ file format. More...
 
struct  mskwaj_decompressor
 A decompressor for KWAJ compressed files. More...
 
struct  msoab_compressor
 A compressor for the Offline Address Book (OAB) format. More...
 
struct  msoab_decompressor
 A decompressor for .LZX (Offline Address Book) files. More...
 

Macros

#define MSPACK_SYS_SELFTEST(result)
 System self-test function, to ensure both library and calling program can use one another. More...
 
#define MSPACK_VER_LIBRARY   (0)
 Pass to mspack_version() to get the overall library version. More...
 
#define MSPACK_VER_SYSTEM   (1)
 Pass to mspack_version() to get the mspack_system version. More...
 
#define MSPACK_VER_MSCABD   (2)
 Pass to mspack_version() to get the mscab_decompressor version. More...
 
#define MSPACK_VER_MSCABC   (3)
 Pass to mspack_version() to get the mscab_compressor version. More...
 
#define MSPACK_VER_MSCHMD   (4)
 Pass to mspack_version() to get the mschm_decompressor version. More...
 
#define MSPACK_VER_MSCHMC   (5)
 Pass to mspack_version() to get the mschm_compressor version. More...
 
#define MSPACK_VER_MSLITD   (6)
 Pass to mspack_version() to get the mslit_decompressor version. More...
 
#define MSPACK_VER_MSLITC   (7)
 Pass to mspack_version() to get the mslit_compressor version. More...
 
#define MSPACK_VER_MSHLPD   (8)
 Pass to mspack_version() to get the mshlp_decompressor version. More...
 
#define MSPACK_VER_MSHLPC   (9)
 Pass to mspack_version() to get the mshlp_compressor version. More...
 
#define MSPACK_VER_MSSZDDD   (10)
 Pass to mspack_version() to get the msszdd_decompressor version. More...
 
#define MSPACK_VER_MSSZDDC   (11)
 Pass to mspack_version() to get the msszdd_compressor version. More...
 
#define MSPACK_VER_MSKWAJD   (12)
 Pass to mspack_version() to get the mskwaj_decompressor version. More...
 
#define MSPACK_VER_MSKWAJC   (13)
 Pass to mspack_version() to get the mskwaj_compressor version. More...
 
#define MSPACK_VER_MSOABD   (14)
 Pass to mspack_version() to get the msoab_decompressor version. More...
 
#define MSPACK_VER_MSOABC   (15)
 Pass to mspack_version() to get the msoab_compressor version. More...
 
#define MSPACK_SYS_OPEN_READ   (0)
 mspack_system::open() mode: open existing file for reading. More...
 
#define MSPACK_SYS_OPEN_WRITE   (1)
 mspack_system::open() mode: open new file for writing More...
 
#define MSPACK_SYS_OPEN_UPDATE   (2)
 mspack_system::open() mode: open existing file for writing More...
 
#define MSPACK_SYS_OPEN_APPEND   (3)
 mspack_system::open() mode: open existing file for writing More...
 
#define MSPACK_SYS_SEEK_START   (0)
 mspack_system::seek() mode: seek relative to start of file More...
 
#define MSPACK_SYS_SEEK_CUR   (1)
 mspack_system::seek() mode: seek relative to current offset More...
 
#define MSPACK_SYS_SEEK_END   (2)
 mspack_system::seek() mode: seek relative to end of file More...
 
#define MSPACK_ERR_OK   (0)
 Error code: no error. More...
 
#define MSPACK_ERR_ARGS   (1)
 Error code: bad arguments to method. More...
 
#define MSPACK_ERR_OPEN   (2)
 Error code: error opening file. More...
 
#define MSPACK_ERR_READ   (3)
 Error code: error reading file. More...
 
#define MSPACK_ERR_WRITE   (4)
 Error code: error writing file. More...
 
#define MSPACK_ERR_SEEK   (5)
 Error code: seek error. More...
 
#define MSPACK_ERR_NOMEMORY   (6)
 Error code: out of memory. More...
 
#define MSPACK_ERR_SIGNATURE   (7)
 Error code: bad "magic id" in file. More...
 
#define MSPACK_ERR_DATAFORMAT   (8)
 Error code: bad or corrupt file format. More...
 
#define MSPACK_ERR_CHECKSUM   (9)
 Error code: bad checksum or CRC. More...
 
#define MSPACK_ERR_CRUNCH   (10)
 Error code: error during compression. More...
 
#define MSPACK_ERR_DECRUNCH   (11)
 Error code: error during decompression. More...
 
#define MSCAB_HDR_RESV_OFFSET   (0x28)
 Offset from start of cabinet to the reserved header data (if present). More...
 
#define MSCAB_HDR_PREVCAB   (0x01)
 Cabinet header flag: cabinet has a predecessor. More...
 
#define MSCAB_HDR_NEXTCAB   (0x02)
 Cabinet header flag: cabinet has a successor. More...
 
#define MSCAB_HDR_RESV   (0x04)
 Cabinet header flag: cabinet has reserved header space. More...
 
#define MSCABD_COMP_METHOD(comp_type)   ((comp_type) & 0x0F)
 Returns the compression method used by a folder. More...
 
#define MSCABD_COMP_LEVEL(comp_type)   (((comp_type) >> 8) & 0x1F)
 Returns the compression level used by a folder. More...
 
#define MSCAB_COMP_NONE   (0)
 Compression mode: no compression. More...
 
#define MSCAB_COMP_MSZIP   (1)
 Compression mode: MSZIP (deflate) compression. More...
 
#define MSCAB_COMP_QUANTUM   (2)
 Compression mode: Quantum compression. More...
 
#define MSCAB_COMP_LZX   (3)
 Compression mode: LZX compression. More...
 
#define MSCAB_ATTRIB_RDONLY   (0x01)
 mscabd_file::attribs attribute: file is read-only. More...
 
#define MSCAB_ATTRIB_HIDDEN   (0x02)
 mscabd_file::attribs attribute: file is hidden. More...
 
#define MSCAB_ATTRIB_SYSTEM   (0x04)
 mscabd_file::attribs attribute: file is an operating system file. More...
 
#define MSCAB_ATTRIB_ARCH   (0x20)
 mscabd_file::attribs attribute: file is "archived". More...
 
#define MSCAB_ATTRIB_EXEC   (0x40)
 mscabd_file::attribs attribute: file is an executable program. More...
 
#define MSCAB_ATTRIB_UTF_NAME   (0x80)
 mscabd_file::attribs attribute: filename is UTF8, not ISO-8859-1. More...
 
#define MSCABD_PARAM_SEARCHBUF   (0)
 mscab_decompressor::set_param() parameter: search buffer size. More...
 
#define MSCABD_PARAM_FIXMSZIP   (1)
 mscab_decompressor::set_param() parameter: repair MS-ZIP streams? More...
 
#define MSCABD_PARAM_DECOMPBUF   (2)
 mscab_decompressor::set_param() parameter: size of decompression buffer More...
 
#define MSCABD_PARAM_SALVAGE   (3)
 mscab_decompressor::set_param() parameter: salvage data from bad cabinets? If enabled, open() will skip file with bad folder indices or filenames rather than reject the whole cabinet, and extract() will limit rather than reject files with invalid offsets and lengths, and bad data block checksums will be ignored. More...
 
#define MSCHMC_ENDLIST   (0)
 mschmc_file::section value: end of CHM file list More...
 
#define MSCHMC_UNCOMP   (1)
 mschmc_file::section value: this file is in the Uncompressed section More...
 
#define MSCHMC_MSCOMP   (2)
 mschmc_file::section value: this file is in the MSCompressed section More...
 
#define MSCHMC_PARAM_TIMESTAMP   (0)
 mschm_compressor::set_param() parameter: "timestamp" header More...
 
#define MSCHMC_PARAM_LANGUAGE   (1)
 mschm_compressor::set_param() parameter: "language" header More...
 
#define MSCHMC_PARAM_LZXWINDOW   (2)
 mschm_compressor::set_param() parameter: LZX window size More...
 
#define MSCHMC_PARAM_DENSITY   (3)
 mschm_compressor::set_param() parameter: intra-chunk quickref density More...
 
#define MSCHMC_PARAM_INDEX   (4)
 mschm_compressor::set_param() parameter: whether to create indices More...
 
#define MSSZDDC_PARAM_MISSINGCHAR   (0)
 msszdd_compressor::set_param() parameter: the missing character More...
 
#define MSSZDD_FMT_NORMAL   (0)
 msszddd_header::format value - a regular SZDD file More...
 
#define MSSZDD_FMT_QBASIC   (1)
 msszddd_header::format value - a special QBasic SZDD file More...
 
#define MSKWAJC_PARAM_COMP_TYPE   (0)
 mskwaj_compressor::set_param() parameter: compression type More...
 
#define MSKWAJC_PARAM_INCLUDE_LENGTH   (1)
 mskwaj_compressor::set_param() parameter: include the length of the uncompressed file in the header? More...
 
#define MSKWAJ_COMP_NONE   (0)
 KWAJ compression type: no compression. More...
 
#define MSKWAJ_COMP_XOR   (1)
 KWAJ compression type: no compression, 0xFF XOR "encryption". More...
 
#define MSKWAJ_COMP_SZDD   (2)
 KWAJ compression type: LZSS (same method as SZDD) More...
 
#define MSKWAJ_COMP_LZH   (3)
 KWAJ compression type: LZ+Huffman compression. More...
 
#define MSKWAJ_COMP_MSZIP   (4)
 KWAJ compression type: MSZIP. More...
 
#define MSKWAJ_HDR_HASLENGTH   (0x01)
 KWAJ optional header flag: decompressed file length is included. More...
 
#define MSKWAJ_HDR_HASUNKNOWN1   (0x02)
 KWAJ optional header flag: unknown 2-byte structure is included. More...
 
#define MSKWAJ_HDR_HASUNKNOWN2   (0x04)
 KWAJ optional header flag: unknown multi-sized structure is included. More...
 
#define MSKWAJ_HDR_HASFILENAME   (0x08)
 KWAJ optional header flag: file name (no extension) is included. More...
 
#define MSKWAJ_HDR_HASFILEEXT   (0x10)
 KWAJ optional header flag: file extension is included. More...
 
#define MSKWAJ_HDR_HASEXTRATEXT   (0x20)
 KWAJ optional header flag: extra text is included. More...
 
#define MSOABD_PARAM_DECOMPBUF   (0)
 msoab_decompressor::set_param() parameter: size of decompression buffer More...
 

Functions

int mspack_sys_selftest_internal (int)
 Part of the MSPACK_SYS_SELFTEST() macro, must not be used directly. More...
 
int mspack_version (int entity)
 Enquire about the binary compatibility version of a specific interface in the library. More...
 
struct mscab_compressormspack_create_cab_compressor (struct mspack_system *sys)
 Creates a new CAB compressor. More...
 
struct mscab_decompressormspack_create_cab_decompressor (struct mspack_system *sys)
 Creates a new CAB decompressor. More...
 
void mspack_destroy_cab_compressor (struct mscab_compressor *self)
 Destroys an existing CAB compressor. More...
 
void mspack_destroy_cab_decompressor (struct mscab_decompressor *self)
 Destroys an existing CAB decompressor. More...
 
struct mschm_compressormspack_create_chm_compressor (struct mspack_system *sys)
 Creates a new CHM compressor. More...
 
struct mschm_decompressormspack_create_chm_decompressor (struct mspack_system *sys)
 Creates a new CHM decompressor. More...
 
void mspack_destroy_chm_compressor (struct mschm_compressor *self)
 Destroys an existing CHM compressor. More...
 
void mspack_destroy_chm_decompressor (struct mschm_decompressor *self)
 Destroys an existing CHM decompressor. More...
 
struct mslit_compressormspack_create_lit_compressor (struct mspack_system *sys)
 Creates a new LIT compressor. More...
 
struct mslit_decompressormspack_create_lit_decompressor (struct mspack_system *sys)
 Creates a new LIT decompressor. More...
 
void mspack_destroy_lit_compressor (struct mslit_compressor *self)
 Destroys an existing LIT compressor. More...
 
void mspack_destroy_lit_decompressor (struct mslit_decompressor *self)
 Destroys an existing LIT decompressor. More...
 
struct mshlp_compressormspack_create_hlp_compressor (struct mspack_system *sys)
 Creates a new HLP compressor. More...
 
struct mshlp_decompressormspack_create_hlp_decompressor (struct mspack_system *sys)
 Creates a new HLP decompressor. More...
 
void mspack_destroy_hlp_compressor (struct mshlp_compressor *self)
 Destroys an existing hlp compressor. More...
 
void mspack_destroy_hlp_decompressor (struct mshlp_decompressor *self)
 Destroys an existing hlp decompressor. More...
 
struct msszdd_compressormspack_create_szdd_compressor (struct mspack_system *sys)
 Creates a new SZDD compressor. More...
 
struct msszdd_decompressormspack_create_szdd_decompressor (struct mspack_system *sys)
 Creates a new SZDD decompressor. More...
 
void mspack_destroy_szdd_compressor (struct msszdd_compressor *self)
 Destroys an existing SZDD compressor. More...
 
void mspack_destroy_szdd_decompressor (struct msszdd_decompressor *self)
 Destroys an existing SZDD decompressor. More...
 
struct mskwaj_compressormspack_create_kwaj_compressor (struct mspack_system *sys)
 Creates a new KWAJ compressor. More...
 
struct mskwaj_decompressormspack_create_kwaj_decompressor (struct mspack_system *sys)
 Creates a new KWAJ decompressor. More...
 
void mspack_destroy_kwaj_compressor (struct mskwaj_compressor *self)
 Destroys an existing KWAJ compressor. More...
 
void mspack_destroy_kwaj_decompressor (struct mskwaj_decompressor *self)
 Destroys an existing KWAJ decompressor. More...
 
struct msoab_compressormspack_create_oab_compressor (struct mspack_system *sys)
 Creates a new OAB compressor. More...
 
struct msoab_decompressormspack_create_oab_decompressor (struct mspack_system *sys)
 Creates a new OAB decompressor. More...
 
void mspack_destroy_oab_compressor (struct msoab_compressor *self)
 Destroys an existing OAB compressor. More...
 
void mspack_destroy_oab_decompressor (struct msoab_decompressor *self)
 Destroys an existing OAB decompressor. More...
 

Macro Definition Documentation

◆ MSCAB_ATTRIB_ARCH

#define MSCAB_ATTRIB_ARCH   (0x20)

mscabd_file::attribs attribute: file is "archived".

◆ MSCAB_ATTRIB_EXEC

#define MSCAB_ATTRIB_EXEC   (0x40)

mscabd_file::attribs attribute: file is an executable program.

◆ MSCAB_ATTRIB_HIDDEN

#define MSCAB_ATTRIB_HIDDEN   (0x02)

mscabd_file::attribs attribute: file is hidden.

◆ MSCAB_ATTRIB_RDONLY

#define MSCAB_ATTRIB_RDONLY   (0x01)

mscabd_file::attribs attribute: file is read-only.

◆ MSCAB_ATTRIB_SYSTEM

#define MSCAB_ATTRIB_SYSTEM   (0x04)

mscabd_file::attribs attribute: file is an operating system file.

◆ MSCAB_ATTRIB_UTF_NAME

#define MSCAB_ATTRIB_UTF_NAME   (0x80)

mscabd_file::attribs attribute: filename is UTF8, not ISO-8859-1.

◆ MSCAB_COMP_LZX

#define MSCAB_COMP_LZX   (3)

Compression mode: LZX compression.

◆ MSCAB_COMP_MSZIP

#define MSCAB_COMP_MSZIP   (1)

Compression mode: MSZIP (deflate) compression.

◆ MSCAB_COMP_NONE

#define MSCAB_COMP_NONE   (0)

Compression mode: no compression.

◆ MSCAB_COMP_QUANTUM

#define MSCAB_COMP_QUANTUM   (2)

Compression mode: Quantum compression.

◆ MSCAB_HDR_NEXTCAB

#define MSCAB_HDR_NEXTCAB   (0x02)

Cabinet header flag: cabinet has a successor.

◆ MSCAB_HDR_PREVCAB

#define MSCAB_HDR_PREVCAB   (0x01)

Cabinet header flag: cabinet has a predecessor.

◆ MSCAB_HDR_RESV

#define MSCAB_HDR_RESV   (0x04)

Cabinet header flag: cabinet has reserved header space.

◆ MSCAB_HDR_RESV_OFFSET

#define MSCAB_HDR_RESV_OFFSET   (0x28)

Offset from start of cabinet to the reserved header data (if present).

◆ MSCABD_COMP_LEVEL

#define MSCABD_COMP_LEVEL (   comp_type)    (((comp_type) >> 8) & 0x1F)

Returns the compression level used by a folder.

Parameters
comp_typea mscabd_folder::comp_type value
Returns
the compression level. This is only defined by LZX and Quantum compression

◆ MSCABD_COMP_METHOD

#define MSCABD_COMP_METHOD (   comp_type)    ((comp_type) & 0x0F)

Returns the compression method used by a folder.

Parameters
comp_typea mscabd_folder::comp_type value
Returns
one of MSCAB_COMP_NONE, MSCAB_COMP_MSZIP, MSCAB_COMP_QUANTUM or MSCAB_COMP_LZX

◆ MSCABD_PARAM_DECOMPBUF

#define MSCABD_PARAM_DECOMPBUF   (2)

mscab_decompressor::set_param() parameter: size of decompression buffer

◆ MSCABD_PARAM_FIXMSZIP

#define MSCABD_PARAM_FIXMSZIP   (1)

mscab_decompressor::set_param() parameter: repair MS-ZIP streams?

◆ MSCABD_PARAM_SALVAGE

#define MSCABD_PARAM_SALVAGE   (3)

mscab_decompressor::set_param() parameter: salvage data from bad cabinets? If enabled, open() will skip file with bad folder indices or filenames rather than reject the whole cabinet, and extract() will limit rather than reject files with invalid offsets and lengths, and bad data block checksums will be ignored.

Available only in CAB decoder version 2 and above.

◆ MSCABD_PARAM_SEARCHBUF

#define MSCABD_PARAM_SEARCHBUF   (0)

mscab_decompressor::set_param() parameter: search buffer size.

◆ MSCHMC_ENDLIST

#define MSCHMC_ENDLIST   (0)

mschmc_file::section value: end of CHM file list

◆ MSCHMC_MSCOMP

#define MSCHMC_MSCOMP   (2)

mschmc_file::section value: this file is in the MSCompressed section

◆ MSCHMC_PARAM_DENSITY

#define MSCHMC_PARAM_DENSITY   (3)

mschm_compressor::set_param() parameter: intra-chunk quickref density

◆ MSCHMC_PARAM_INDEX

#define MSCHMC_PARAM_INDEX   (4)

mschm_compressor::set_param() parameter: whether to create indices

◆ MSCHMC_PARAM_LANGUAGE

#define MSCHMC_PARAM_LANGUAGE   (1)

mschm_compressor::set_param() parameter: "language" header

◆ MSCHMC_PARAM_LZXWINDOW

#define MSCHMC_PARAM_LZXWINDOW   (2)

mschm_compressor::set_param() parameter: LZX window size

◆ MSCHMC_PARAM_TIMESTAMP

#define MSCHMC_PARAM_TIMESTAMP   (0)

mschm_compressor::set_param() parameter: "timestamp" header

◆ MSCHMC_UNCOMP

#define MSCHMC_UNCOMP   (1)

mschmc_file::section value: this file is in the Uncompressed section

◆ MSKWAJ_COMP_LZH

#define MSKWAJ_COMP_LZH   (3)

KWAJ compression type: LZ+Huffman compression.

◆ MSKWAJ_COMP_MSZIP

#define MSKWAJ_COMP_MSZIP   (4)

KWAJ compression type: MSZIP.

◆ MSKWAJ_COMP_NONE

#define MSKWAJ_COMP_NONE   (0)

KWAJ compression type: no compression.

◆ MSKWAJ_COMP_SZDD

#define MSKWAJ_COMP_SZDD   (2)

KWAJ compression type: LZSS (same method as SZDD)

◆ MSKWAJ_COMP_XOR

#define MSKWAJ_COMP_XOR   (1)

KWAJ compression type: no compression, 0xFF XOR "encryption".

◆ MSKWAJ_HDR_HASEXTRATEXT

#define MSKWAJ_HDR_HASEXTRATEXT   (0x20)

KWAJ optional header flag: extra text is included.

◆ MSKWAJ_HDR_HASFILEEXT

#define MSKWAJ_HDR_HASFILEEXT   (0x10)

KWAJ optional header flag: file extension is included.

◆ MSKWAJ_HDR_HASFILENAME

#define MSKWAJ_HDR_HASFILENAME   (0x08)

KWAJ optional header flag: file name (no extension) is included.

◆ MSKWAJ_HDR_HASLENGTH

#define MSKWAJ_HDR_HASLENGTH   (0x01)

KWAJ optional header flag: decompressed file length is included.

◆ MSKWAJ_HDR_HASUNKNOWN1

#define MSKWAJ_HDR_HASUNKNOWN1   (0x02)

KWAJ optional header flag: unknown 2-byte structure is included.

◆ MSKWAJ_HDR_HASUNKNOWN2

#define MSKWAJ_HDR_HASUNKNOWN2   (0x04)

KWAJ optional header flag: unknown multi-sized structure is included.

◆ MSKWAJC_PARAM_COMP_TYPE

#define MSKWAJC_PARAM_COMP_TYPE   (0)

mskwaj_compressor::set_param() parameter: compression type

◆ MSKWAJC_PARAM_INCLUDE_LENGTH

#define MSKWAJC_PARAM_INCLUDE_LENGTH   (1)

mskwaj_compressor::set_param() parameter: include the length of the uncompressed file in the header?

◆ MSOABD_PARAM_DECOMPBUF

#define MSOABD_PARAM_DECOMPBUF   (0)

msoab_decompressor::set_param() parameter: size of decompression buffer

◆ MSPACK_ERR_ARGS

#define MSPACK_ERR_ARGS   (1)

Error code: bad arguments to method.

◆ MSPACK_ERR_CHECKSUM

#define MSPACK_ERR_CHECKSUM   (9)

Error code: bad checksum or CRC.

◆ MSPACK_ERR_CRUNCH

#define MSPACK_ERR_CRUNCH   (10)

Error code: error during compression.

◆ MSPACK_ERR_DATAFORMAT

#define MSPACK_ERR_DATAFORMAT   (8)

Error code: bad or corrupt file format.

◆ MSPACK_ERR_DECRUNCH

#define MSPACK_ERR_DECRUNCH   (11)

Error code: error during decompression.

◆ MSPACK_ERR_NOMEMORY

#define MSPACK_ERR_NOMEMORY   (6)

Error code: out of memory.

◆ MSPACK_ERR_OK

#define MSPACK_ERR_OK   (0)

Error code: no error.

◆ MSPACK_ERR_OPEN

#define MSPACK_ERR_OPEN   (2)

Error code: error opening file.

◆ MSPACK_ERR_READ

#define MSPACK_ERR_READ   (3)

Error code: error reading file.

◆ MSPACK_ERR_SEEK

#define MSPACK_ERR_SEEK   (5)

Error code: seek error.

◆ MSPACK_ERR_SIGNATURE

#define MSPACK_ERR_SIGNATURE   (7)

Error code: bad "magic id" in file.

◆ MSPACK_ERR_WRITE

#define MSPACK_ERR_WRITE   (4)

Error code: error writing file.

◆ MSPACK_SYS_OPEN_APPEND

#define MSPACK_SYS_OPEN_APPEND   (3)

mspack_system::open() mode: open existing file for writing

◆ MSPACK_SYS_OPEN_READ

#define MSPACK_SYS_OPEN_READ   (0)

mspack_system::open() mode: open existing file for reading.

◆ MSPACK_SYS_OPEN_UPDATE

#define MSPACK_SYS_OPEN_UPDATE   (2)

mspack_system::open() mode: open existing file for writing

◆ MSPACK_SYS_OPEN_WRITE

#define MSPACK_SYS_OPEN_WRITE   (1)

mspack_system::open() mode: open new file for writing

◆ MSPACK_SYS_SEEK_CUR

#define MSPACK_SYS_SEEK_CUR   (1)

mspack_system::seek() mode: seek relative to current offset

◆ MSPACK_SYS_SEEK_END

#define MSPACK_SYS_SEEK_END   (2)

mspack_system::seek() mode: seek relative to end of file

◆ MSPACK_SYS_SEEK_START

#define MSPACK_SYS_SEEK_START   (0)

mspack_system::seek() mode: seek relative to start of file

◆ MSPACK_SYS_SELFTEST

#define MSPACK_SYS_SELFTEST (   result)
Value:
do { \
(result) = mspack_sys_selftest_internal(sizeof(off_t)); \
} while (0)
int mspack_sys_selftest_internal(int)
Part of the MSPACK_SYS_SELFTEST() macro, must not be used directly.

System self-test function, to ensure both library and calling program can use one another.

A result of MSPACK_ERR_OK means the library and caller are compatible. Any other result indicates that the library and caller are not compatible and should not be used. In particular, a value of MSPACK_ERR_SEEK means the library and caller use different off_t datatypes.

It should be used like so:

int selftest_result;
MSPACK_SYS_SELFTEST(selftest_result);
if (selftest_result != MSPACK_ERR_OK) {
fprintf(stderr, "incompatible with this build of libmspack\n");
exit(0);
}
#define MSPACK_ERR_OK
Error code: no error.
Definition: mspack.h:485
#define MSPACK_SYS_SELFTEST(result)
System self-test function, to ensure both library and calling program can use one another.
Definition: mspack.h:191
Parameters
resultan int variable to store the result of the self-test

◆ MSPACK_VER_LIBRARY

#define MSPACK_VER_LIBRARY   (0)

Pass to mspack_version() to get the overall library version.

◆ MSPACK_VER_MSCABC

#define MSPACK_VER_MSCABC   (3)

Pass to mspack_version() to get the mscab_compressor version.

◆ MSPACK_VER_MSCABD

#define MSPACK_VER_MSCABD   (2)

Pass to mspack_version() to get the mscab_decompressor version.

◆ MSPACK_VER_MSCHMC

#define MSPACK_VER_MSCHMC   (5)

Pass to mspack_version() to get the mschm_compressor version.

◆ MSPACK_VER_MSCHMD

#define MSPACK_VER_MSCHMD   (4)

Pass to mspack_version() to get the mschm_decompressor version.

◆ MSPACK_VER_MSHLPC

#define MSPACK_VER_MSHLPC   (9)

Pass to mspack_version() to get the mshlp_compressor version.

◆ MSPACK_VER_MSHLPD

#define MSPACK_VER_MSHLPD   (8)

Pass to mspack_version() to get the mshlp_decompressor version.

◆ MSPACK_VER_MSKWAJC

#define MSPACK_VER_MSKWAJC   (13)

Pass to mspack_version() to get the mskwaj_compressor version.

◆ MSPACK_VER_MSKWAJD

#define MSPACK_VER_MSKWAJD   (12)

Pass to mspack_version() to get the mskwaj_decompressor version.

◆ MSPACK_VER_MSLITC

#define MSPACK_VER_MSLITC   (7)

Pass to mspack_version() to get the mslit_compressor version.

◆ MSPACK_VER_MSLITD

#define MSPACK_VER_MSLITD   (6)

Pass to mspack_version() to get the mslit_decompressor version.

◆ MSPACK_VER_MSOABC

#define MSPACK_VER_MSOABC   (15)

Pass to mspack_version() to get the msoab_compressor version.

◆ MSPACK_VER_MSOABD

#define MSPACK_VER_MSOABD   (14)

Pass to mspack_version() to get the msoab_decompressor version.

◆ MSPACK_VER_MSSZDDC

#define MSPACK_VER_MSSZDDC   (11)

Pass to mspack_version() to get the msszdd_compressor version.

◆ MSPACK_VER_MSSZDDD

#define MSPACK_VER_MSSZDDD   (10)

Pass to mspack_version() to get the msszdd_decompressor version.

◆ MSPACK_VER_SYSTEM

#define MSPACK_VER_SYSTEM   (1)

Pass to mspack_version() to get the mspack_system version.

◆ MSSZDD_FMT_NORMAL

#define MSSZDD_FMT_NORMAL   (0)

msszddd_header::format value - a regular SZDD file

◆ MSSZDD_FMT_QBASIC

#define MSSZDD_FMT_QBASIC   (1)

msszddd_header::format value - a special QBasic SZDD file

◆ MSSZDDC_PARAM_MISSINGCHAR

#define MSSZDDC_PARAM_MISSINGCHAR   (0)

msszdd_compressor::set_param() parameter: the missing character

Function Documentation

◆ mspack_create_cab_compressor()

struct mscab_compressor* mspack_create_cab_compressor ( struct mspack_system sys)

Creates a new CAB compressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a mscab_compressor or NULL

◆ mspack_create_cab_decompressor()

struct mscab_decompressor* mspack_create_cab_decompressor ( struct mspack_system sys)

Creates a new CAB decompressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a mscab_decompressor or NULL

◆ mspack_create_chm_compressor()

struct mschm_compressor* mspack_create_chm_compressor ( struct mspack_system sys)

Creates a new CHM compressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a mschm_compressor or NULL

◆ mspack_create_chm_decompressor()

struct mschm_decompressor* mspack_create_chm_decompressor ( struct mspack_system sys)

Creates a new CHM decompressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a mschm_decompressor or NULL

◆ mspack_create_hlp_compressor()

struct mshlp_compressor* mspack_create_hlp_compressor ( struct mspack_system sys)

Creates a new HLP compressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a mshlp_compressor or NULL

◆ mspack_create_hlp_decompressor()

struct mshlp_decompressor* mspack_create_hlp_decompressor ( struct mspack_system sys)

Creates a new HLP decompressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a mshlp_decompressor or NULL

◆ mspack_create_kwaj_compressor()

struct mskwaj_compressor* mspack_create_kwaj_compressor ( struct mspack_system sys)

Creates a new KWAJ compressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a mskwaj_compressor or NULL

◆ mspack_create_kwaj_decompressor()

struct mskwaj_decompressor* mspack_create_kwaj_decompressor ( struct mspack_system sys)

Creates a new KWAJ decompressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a mskwaj_decompressor or NULL

◆ mspack_create_lit_compressor()

struct mslit_compressor* mspack_create_lit_compressor ( struct mspack_system sys)

Creates a new LIT compressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a mslit_compressor or NULL

◆ mspack_create_lit_decompressor()

struct mslit_decompressor* mspack_create_lit_decompressor ( struct mspack_system sys)

Creates a new LIT decompressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a mslit_decompressor or NULL

◆ mspack_create_oab_compressor()

struct msoab_compressor* mspack_create_oab_compressor ( struct mspack_system sys)

Creates a new OAB compressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a msoab_compressor or NULL

◆ mspack_create_oab_decompressor()

struct msoab_decompressor* mspack_create_oab_decompressor ( struct mspack_system sys)

Creates a new OAB decompressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a msoab_decompressor or NULL

◆ mspack_create_szdd_compressor()

struct msszdd_compressor* mspack_create_szdd_compressor ( struct mspack_system sys)

Creates a new SZDD compressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a msszdd_compressor or NULL

◆ mspack_create_szdd_decompressor()

struct msszdd_decompressor* mspack_create_szdd_decompressor ( struct mspack_system sys)

Creates a new SZDD decompressor.

Parameters
sysa custom mspack_system structure, or NULL to use the default
Returns
a msszdd_decompressor or NULL

◆ mspack_destroy_cab_compressor()

void mspack_destroy_cab_compressor ( struct mscab_compressor self)

Destroys an existing CAB compressor.

Parameters
selfthe mscab_compressor to destroy

◆ mspack_destroy_cab_decompressor()

void mspack_destroy_cab_decompressor ( struct mscab_decompressor self)

Destroys an existing CAB decompressor.

Parameters
selfthe mscab_decompressor to destroy

◆ mspack_destroy_chm_compressor()

void mspack_destroy_chm_compressor ( struct mschm_compressor self)

Destroys an existing CHM compressor.

Parameters
selfthe mschm_compressor to destroy

◆ mspack_destroy_chm_decompressor()

void mspack_destroy_chm_decompressor ( struct mschm_decompressor self)

Destroys an existing CHM decompressor.

Parameters
selfthe mschm_decompressor to destroy

◆ mspack_destroy_hlp_compressor()

void mspack_destroy_hlp_compressor ( struct mshlp_compressor self)

Destroys an existing hlp compressor.

Parameters
selfthe mshlp_compressor to destroy

◆ mspack_destroy_hlp_decompressor()

void mspack_destroy_hlp_decompressor ( struct mshlp_decompressor self)

Destroys an existing hlp decompressor.

Parameters
selfthe mshlp_decompressor to destroy

◆ mspack_destroy_kwaj_compressor()

void mspack_destroy_kwaj_compressor ( struct mskwaj_compressor self)

Destroys an existing KWAJ compressor.

Parameters
selfthe mskwaj_compressor to destroy

◆ mspack_destroy_kwaj_decompressor()

void mspack_destroy_kwaj_decompressor ( struct mskwaj_decompressor self)

Destroys an existing KWAJ decompressor.

Parameters
selfthe mskwaj_decompressor to destroy

◆ mspack_destroy_lit_compressor()

void mspack_destroy_lit_compressor ( struct mslit_compressor self)

Destroys an existing LIT compressor.

Parameters
selfthe mslit_compressor to destroy

◆ mspack_destroy_lit_decompressor()

void mspack_destroy_lit_decompressor ( struct mslit_decompressor self)

Destroys an existing LIT decompressor.

Parameters
selfthe mslit_decompressor to destroy

◆ mspack_destroy_oab_compressor()

void mspack_destroy_oab_compressor ( struct msoab_compressor self)

Destroys an existing OAB compressor.

Parameters
selfthe msoab_compressor to destroy

◆ mspack_destroy_oab_decompressor()

void mspack_destroy_oab_decompressor ( struct msoab_decompressor self)

Destroys an existing OAB decompressor.

Parameters
selfthe msoab_decompressor to destroy

◆ mspack_destroy_szdd_compressor()

void mspack_destroy_szdd_compressor ( struct msszdd_compressor self)

Destroys an existing SZDD compressor.

Parameters
selfthe msszdd_compressor to destroy

◆ mspack_destroy_szdd_decompressor()

void mspack_destroy_szdd_decompressor ( struct msszdd_decompressor self)

Destroys an existing SZDD decompressor.

Parameters
selfthe msszdd_decompressor to destroy

◆ mspack_sys_selftest_internal()

int mspack_sys_selftest_internal ( int  )

Part of the MSPACK_SYS_SELFTEST() macro, must not be used directly.

◆ mspack_version()

int mspack_version ( int  entity)

Enquire about the binary compatibility version of a specific interface in the library.

Currently, the following interfaces are defined:

The result of the function should be interpreted as follows:

  • -1: this interface is completely unknown to the library
  • 0: this interface is known, but non-functioning
  • 1: this interface has all basic functionality
  • 2, 3, ...: this interface has additional functionality, clearly marked in the documentation as "version 2", "version 3" and so on.
Parameters
entitythe interface to request current version of
Returns
the version of the requested interface