#include <sys/types.h>
#include <stdlib.h>
Go to the source code of this file.
◆ MSCAB_ATTRIB_ARCH
#define MSCAB_ATTRIB_ARCH (0x20) |
◆ MSCAB_ATTRIB_EXEC
#define MSCAB_ATTRIB_EXEC (0x40) |
◆ MSCAB_ATTRIB_HIDDEN
#define MSCAB_ATTRIB_HIDDEN (0x02) |
◆ MSCAB_ATTRIB_RDONLY
#define MSCAB_ATTRIB_RDONLY (0x01) |
◆ MSCAB_ATTRIB_SYSTEM
#define MSCAB_ATTRIB_SYSTEM (0x04) |
◆ MSCAB_ATTRIB_UTF_NAME
#define MSCAB_ATTRIB_UTF_NAME (0x80) |
◆ MSCAB_COMP_LZX
#define MSCAB_COMP_LZX (3) |
Compression mode: LZX compression
Definition at line 856 of file mspack.h.
◆ MSCAB_COMP_MSZIP
#define MSCAB_COMP_MSZIP (1) |
Compression mode: MSZIP (deflate) compression.
Definition at line 852 of file mspack.h.
◆ MSCAB_COMP_NONE
#define MSCAB_COMP_NONE (0) |
Compression mode: no compression.
Definition at line 850 of file mspack.h.
◆ MSCAB_COMP_QUANTUM
#define MSCAB_COMP_QUANTUM (2) |
Compression mode: Quantum compression
Definition at line 854 of file mspack.h.
◆ MSCAB_HDR_NEXTCAB
#define MSCAB_HDR_NEXTCAB (0x02) |
Cabinet header flag: cabinet has a successor
Definition at line 793 of file mspack.h.
◆ MSCAB_HDR_PREVCAB
#define MSCAB_HDR_PREVCAB (0x01) |
Cabinet header flag: cabinet has a predecessor
Definition at line 791 of file mspack.h.
◆ MSCAB_HDR_RESV
#define MSCAB_HDR_RESV (0x04) |
Cabinet header flag: cabinet has reserved header space
Definition at line 795 of file mspack.h.
◆ MSCAB_HDR_RESV_OFFSET
#define MSCAB_HDR_RESV_OFFSET (0x28) |
Offset from start of cabinet to the reserved header data (if present).
Definition at line 788 of file mspack.h.
◆ MSCABD_COMP_LEVEL
#define MSCABD_COMP_LEVEL |
( |
|
comp_type | ) |
(((comp_type) >> 8) & 0x1F) |
Returns the compression level used by a folder.
- Parameters
-
- Returns
- the compression level. This is only defined by LZX and Quantum compression
Definition at line 847 of file mspack.h.
◆ MSCABD_COMP_METHOD
#define MSCABD_COMP_METHOD |
( |
|
comp_type | ) |
((comp_type) & 0x0F) |
◆ MSCABD_PARAM_DECOMPBUF
#define MSCABD_PARAM_DECOMPBUF (2) |
◆ MSCABD_PARAM_FIXMSZIP
#define MSCABD_PARAM_FIXMSZIP (1) |
◆ 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.
Definition at line 943 of file mspack.h.
◆ MSCABD_PARAM_SEARCHBUF
#define MSCABD_PARAM_SEARCHBUF (0) |
◆ MSCHMC_ENDLIST
#define MSCHMC_ENDLIST (0) |
◆ MSCHMC_MSCOMP
#define MSCHMC_MSCOMP (2) |
◆ MSCHMC_PARAM_DENSITY
#define MSCHMC_PARAM_DENSITY (3) |
◆ MSCHMC_PARAM_INDEX
#define MSCHMC_PARAM_INDEX (4) |
◆ MSCHMC_PARAM_LANGUAGE
#define MSCHMC_PARAM_LANGUAGE (1) |
◆ MSCHMC_PARAM_LZXWINDOW
#define MSCHMC_PARAM_LZXWINDOW (2) |
◆ MSCHMC_PARAM_TIMESTAMP
#define MSCHMC_PARAM_TIMESTAMP (0) |
◆ MSCHMC_UNCOMP
#define MSCHMC_UNCOMP (1) |
◆ MSKWAJ_COMP_LZH
#define MSKWAJ_COMP_LZH (3) |
KWAJ compression type: LZ+Huffman compression
Definition at line 1984 of file mspack.h.
◆ MSKWAJ_COMP_MSZIP
#define MSKWAJ_COMP_MSZIP (4) |
KWAJ compression type: MSZIP
Definition at line 1986 of file mspack.h.
◆ MSKWAJ_COMP_NONE
#define MSKWAJ_COMP_NONE (0) |
KWAJ compression type: no compression.
Definition at line 1978 of file mspack.h.
◆ MSKWAJ_COMP_SZDD
#define MSKWAJ_COMP_SZDD (2) |
KWAJ compression type: LZSS (same method as SZDD)
Definition at line 1982 of file mspack.h.
◆ MSKWAJ_COMP_XOR
#define MSKWAJ_COMP_XOR (1) |
KWAJ compression type: no compression, 0xFF XOR "encryption".
Definition at line 1980 of file mspack.h.
◆ MSKWAJ_HDR_HASEXTRATEXT
#define MSKWAJ_HDR_HASEXTRATEXT (0x20) |
KWAJ optional header flag: extra text is included
Definition at line 2004 of file mspack.h.
◆ MSKWAJ_HDR_HASFILEEXT
#define MSKWAJ_HDR_HASFILEEXT (0x10) |
KWAJ optional header flag: file extension is included
Definition at line 2001 of file mspack.h.
◆ MSKWAJ_HDR_HASFILENAME
#define MSKWAJ_HDR_HASFILENAME (0x08) |
KWAJ optional header flag: file name (no extension) is included
Definition at line 1998 of file mspack.h.
◆ MSKWAJ_HDR_HASLENGTH
#define MSKWAJ_HDR_HASLENGTH (0x01) |
KWAJ optional header flag: decompressed file length is included
Definition at line 1989 of file mspack.h.
◆ MSKWAJ_HDR_HASUNKNOWN1
#define MSKWAJ_HDR_HASUNKNOWN1 (0x02) |
KWAJ optional header flag: unknown 2-byte structure is included
Definition at line 1992 of file mspack.h.
◆ MSKWAJ_HDR_HASUNKNOWN2
#define MSKWAJ_HDR_HASUNKNOWN2 (0x04) |
KWAJ optional header flag: unknown multi-sized structure is included
Definition at line 1995 of file mspack.h.
◆ MSKWAJC_PARAM_COMP_TYPE
#define MSKWAJC_PARAM_COMP_TYPE (0) |
◆ MSKWAJC_PARAM_INCLUDE_LENGTH
#define MSKWAJC_PARAM_INCLUDE_LENGTH (1) |
◆ MSOABD_PARAM_DECOMPBUF
#define MSOABD_PARAM_DECOMPBUF (0) |
◆ MSPACK_ERR_ARGS
#define MSPACK_ERR_ARGS (1) |
Error code: bad arguments to method
Definition at line 487 of file mspack.h.
◆ MSPACK_ERR_CHECKSUM
#define MSPACK_ERR_CHECKSUM (9) |
Error code: bad checksum or CRC
Definition at line 503 of file mspack.h.
◆ MSPACK_ERR_CRUNCH
#define MSPACK_ERR_CRUNCH (10) |
Error code: error during compression
Definition at line 505 of file mspack.h.
◆ MSPACK_ERR_DATAFORMAT
#define MSPACK_ERR_DATAFORMAT (8) |
Error code: bad or corrupt file format
Definition at line 501 of file mspack.h.
◆ MSPACK_ERR_DECRUNCH
#define MSPACK_ERR_DECRUNCH (11) |
Error code: error during decompression
Definition at line 507 of file mspack.h.
◆ MSPACK_ERR_NOMEMORY
#define MSPACK_ERR_NOMEMORY (6) |
Error code: out of memory
Definition at line 497 of file mspack.h.
◆ MSPACK_ERR_OK
#define MSPACK_ERR_OK (0) |
Error code: no error
Definition at line 485 of file mspack.h.
◆ MSPACK_ERR_OPEN
#define MSPACK_ERR_OPEN (2) |
Error code: error opening file
Definition at line 489 of file mspack.h.
◆ MSPACK_ERR_READ
#define MSPACK_ERR_READ (3) |
Error code: error reading file
Definition at line 491 of file mspack.h.
◆ MSPACK_ERR_SEEK
#define MSPACK_ERR_SEEK (5) |
Error code: seek error
Definition at line 495 of file mspack.h.
◆ MSPACK_ERR_SIGNATURE
#define MSPACK_ERR_SIGNATURE (7) |
Error code: bad "magic id" in file
Definition at line 499 of file mspack.h.
◆ MSPACK_ERR_WRITE
#define MSPACK_ERR_WRITE (4) |
Error code: error writing file
Definition at line 493 of file mspack.h.
◆ MSPACK_SYS_OPEN_APPEND
#define MSPACK_SYS_OPEN_APPEND (3) |
◆ MSPACK_SYS_OPEN_READ
#define MSPACK_SYS_OPEN_READ (0) |
◆ MSPACK_SYS_OPEN_UPDATE
#define MSPACK_SYS_OPEN_UPDATE (2) |
◆ MSPACK_SYS_OPEN_WRITE
#define MSPACK_SYS_OPEN_WRITE (1) |
◆ MSPACK_SYS_SEEK_CUR
#define MSPACK_SYS_SEEK_CUR (1) |
◆ MSPACK_SYS_SEEK_END
#define MSPACK_SYS_SEEK_END (2) |
◆ MSPACK_SYS_SEEK_START
#define MSPACK_SYS_SEEK_START (0) |
◆ MSPACK_SYS_SELFTEST
#define MSPACK_SYS_SELFTEST |
( |
|
result | ) |
|
Value: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;
fprintf(stderr, "incompatible with this build of libmspack\n");
}
- Parameters
-
result | an int variable to store the result of the self-test |
Definition at line 191 of file mspack.h.
◆ MSPACK_VER_LIBRARY
#define MSPACK_VER_LIBRARY (0) |
◆ MSPACK_VER_MSCABC
#define MSPACK_VER_MSCABC (3) |
◆ MSPACK_VER_MSCABD
#define MSPACK_VER_MSCABD (2) |
◆ MSPACK_VER_MSCHMC
#define MSPACK_VER_MSCHMC (5) |
◆ MSPACK_VER_MSCHMD
#define MSPACK_VER_MSCHMD (4) |
◆ MSPACK_VER_MSHLPC
#define MSPACK_VER_MSHLPC (9) |
◆ MSPACK_VER_MSHLPD
#define MSPACK_VER_MSHLPD (8) |
◆ MSPACK_VER_MSKWAJC
#define MSPACK_VER_MSKWAJC (13) |
◆ MSPACK_VER_MSKWAJD
#define MSPACK_VER_MSKWAJD (12) |
◆ MSPACK_VER_MSLITC
#define MSPACK_VER_MSLITC (7) |
◆ MSPACK_VER_MSLITD
#define MSPACK_VER_MSLITD (6) |
◆ MSPACK_VER_MSOABC
#define MSPACK_VER_MSOABC (15) |
◆ MSPACK_VER_MSOABD
#define MSPACK_VER_MSOABD (14) |
◆ MSPACK_VER_MSSZDDC
#define MSPACK_VER_MSSZDDC (11) |
◆ MSPACK_VER_MSSZDDD
#define MSPACK_VER_MSSZDDD (10) |
◆ MSPACK_VER_SYSTEM
#define MSPACK_VER_SYSTEM (1) |
◆ MSSZDD_FMT_NORMAL
#define MSSZDD_FMT_NORMAL (0) |
◆ MSSZDD_FMT_QBASIC
#define MSSZDD_FMT_QBASIC (1) |
◆ MSSZDDC_PARAM_MISSINGCHAR
#define MSSZDDC_PARAM_MISSINGCHAR (0) |
◆ mspack_create_cab_compressor()
◆ mspack_create_cab_decompressor()
Creates a new CAB decompressor.
- Parameters
-
- Returns
- a mscab_decompressor or NULL
Definition at line 140 of file cabd.c.
160 self->searchbuf_size = 32768;
162 self->buf_size = 4096;
void *(* alloc)(struct mspack_system *self, size_t bytes)
◆ mspack_create_chm_compressor()
◆ mspack_create_chm_decompressor()
Creates a new CHM decompressor.
- Parameters
-
- Returns
- a mschm_decompressor or NULL
Definition at line 78 of file chmd.c.
static int chmd_extract(struct mschm_decompressor *base, struct mschmd_file *file, const char *filename)
static int chmd_error(struct mschm_decompressor *base)
static void chmd_close(struct mschm_decompressor *base, struct mschmd_header *chm)
static int chmd_fast_find(struct mschm_decompressor *base, struct mschmd_header *chm, const char *filename, struct mschmd_file *f_ptr, int f_size)
static struct mschmd_header * chmd_fast_open(struct mschm_decompressor *base, const char *filename)
static struct mschmd_header * chmd_open(struct mschm_decompressor *base, const char *filename)
References mspack_system::alloc, chmd_close(), chmd_error(), chmd_extract(), chmd_fast_find(), chmd_fast_open(), chmd_open(), mspack_default_system, MSPACK_ERR_OK, mspack_valid_system(), and NULL.
Referenced by main().
◆ mspack_create_hlp_compressor()
◆ mspack_create_hlp_decompressor()
◆ mspack_create_kwaj_compressor()
◆ mspack_create_kwaj_decompressor()
Creates a new KWAJ decompressor.
- Parameters
-
- Returns
- a mskwaj_decompressor or NULL
Definition at line 55 of file kwajd.c.
static struct mskwajd_header * kwajd_open(struct mskwaj_decompressor *base, const char *filename)
static int kwajd_decompress(struct mskwaj_decompressor *base, const char *input, const char *output)
static int kwajd_extract(struct mskwaj_decompressor *base, struct mskwajd_header *hdr, const char *filename)
static void kwajd_close(struct mskwaj_decompressor *base, struct mskwajd_header *hdr)
static int kwajd_error(struct mskwaj_decompressor *base)
References mspack_system::alloc, kwajd_close(), kwajd_decompress(), kwajd_error(), kwajd_extract(), kwajd_open(), mspack_default_system, MSPACK_ERR_OK, mspack_valid_system(), and NULL.
Referenced by main().
◆ mspack_create_lit_compressor()
◆ mspack_create_lit_decompressor()
◆ mspack_create_oab_compressor()
◆ mspack_create_oab_decompressor()
Creates a new OAB decompressor.
- Parameters
-
- Returns
- a msoab_decompressor or NULL
Definition at line 43 of file oabd.c.
55 self->buf_size = 4096;
static int oabd_decompress_incremental(struct msoab_decompressor *self, const char *input, const char *base, const char *output)
static int oabd_decompress(struct msoab_decompressor *self, const char *input, const char *output)
static int oabd_param(struct msoab_decompressor *base, int param, int value)
References mspack_system::alloc, mspack_default_system, mspack_valid_system(), NULL, oabd_decompress(), oabd_decompress_incremental(), and oabd_param().
Referenced by main().
◆ mspack_create_szdd_compressor()
◆ mspack_create_szdd_decompressor()
Creates a new SZDD decompressor.
- Parameters
-
- Returns
- a msszdd_decompressor or NULL
Definition at line 41 of file szddd.c.
static void szddd_close(struct msszdd_decompressor *base, struct msszddd_header *hdr)
static struct msszddd_header * szddd_open(struct msszdd_decompressor *base, const char *filename)
static int szddd_error(struct msszdd_decompressor *base)
static int szddd_extract(struct msszdd_decompressor *base, struct msszddd_header *hdr, const char *filename)
static int szddd_decompress(struct msszdd_decompressor *base, const char *input, const char *output)
References mspack_system::alloc, mspack_default_system, MSPACK_ERR_OK, mspack_valid_system(), NULL, szddd_close(), szddd_decompress(), szddd_error(), szddd_extract(), and szddd_open().
Referenced by main().
◆ mspack_destroy_cab_compressor()
Destroys an existing CAB compressor.
- Parameters
-
Definition at line 22 of file cabc.c.
◆ mspack_destroy_cab_decompressor()
Destroys an existing CAB decompressor.
- Parameters
-
Definition at line 173 of file cabd.c.
178 if (self->d->infh) sys->
close(self->d->infh);
struct mscab_decompressor base
void(* close)(struct mspack_file *file)
◆ mspack_destroy_chm_compressor()
Destroys an existing CHM compressor.
- Parameters
-
Definition at line 22 of file chmc.c.
◆ mspack_destroy_chm_decompressor()
◆ mspack_destroy_hlp_compressor()
Destroys an existing hlp compressor.
- Parameters
-
Definition at line 22 of file hlpc.c.
◆ mspack_destroy_hlp_decompressor()
Destroys an existing hlp decompressor.
- Parameters
-
Definition at line 22 of file hlpd.c.
◆ mspack_destroy_kwaj_compressor()
Destroys an existing KWAJ compressor.
- Parameters
-
Definition at line 22 of file kwajc.c.
◆ mspack_destroy_kwaj_decompressor()
◆ mspack_destroy_lit_compressor()
Destroys an existing LIT compressor.
- Parameters
-
Definition at line 22 of file litc.c.
◆ mspack_destroy_lit_decompressor()
Destroys an existing LIT decompressor.
- Parameters
-
Definition at line 22 of file litd.c.
◆ mspack_destroy_oab_compressor()
Destroys an existing OAB compressor.
- Parameters
-
Definition at line 22 of file oabc.c.
◆ mspack_destroy_oab_decompressor()
◆ mspack_destroy_szdd_compressor()
Destroys an existing SZDD compressor.
- Parameters
-
Definition at line 22 of file szddc.c.
◆ mspack_destroy_szdd_decompressor()
◆ mspack_sys_selftest_internal()
int mspack_sys_selftest_internal |
( |
int |
offt_size | ) |
|
◆ 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
-
entity | the interface to request current version of |
- Returns
- the version of the requested interface
Definition at line 16 of file system.c.
References MSPACK_VER_LIBRARY, MSPACK_VER_MSCABC, MSPACK_VER_MSCABD, MSPACK_VER_MSCHMC, MSPACK_VER_MSCHMD, MSPACK_VER_MSHLPC, MSPACK_VER_MSHLPD, MSPACK_VER_MSKWAJC, MSPACK_VER_MSKWAJD, MSPACK_VER_MSLITC, MSPACK_VER_MSLITD, MSPACK_VER_MSOABC, MSPACK_VER_MSOABD, MSPACK_VER_MSSZDDC, MSPACK_VER_MSSZDDD, and MSPACK_VER_SYSTEM.