159#define LIB_MSPACK_H 1
165#include <sys/types.h>
191#define MSPACK_SYS_SELFTEST(result) do { \
192 (result) = mspack_sys_selftest_internal(sizeof(off_t)); \
232#define MSPACK_VER_LIBRARY (0)
234#define MSPACK_VER_SYSTEM (1)
236#define MSPACK_VER_MSCABD (2)
238#define MSPACK_VER_MSCABC (3)
240#define MSPACK_VER_MSCHMD (4)
242#define MSPACK_VER_MSCHMC (5)
244#define MSPACK_VER_MSLITD (6)
246#define MSPACK_VER_MSLITC (7)
248#define MSPACK_VER_MSHLPD (8)
250#define MSPACK_VER_MSHLPC (9)
252#define MSPACK_VER_MSSZDDD (10)
254#define MSPACK_VER_MSSZDDC (11)
256#define MSPACK_VER_MSKWAJD (12)
258#define MSPACK_VER_MSKWAJC (13)
260#define MSPACK_VER_MSOABD (14)
262#define MSPACK_VER_MSOABC (15)
311 const char *filename,
456#define MSPACK_SYS_OPEN_READ (0)
458#define MSPACK_SYS_OPEN_WRITE (1)
460#define MSPACK_SYS_OPEN_UPDATE (2)
462#define MSPACK_SYS_OPEN_APPEND (3)
465#define MSPACK_SYS_SEEK_START (0)
467#define MSPACK_SYS_SEEK_CUR (1)
469#define MSPACK_SYS_SEEK_END (2)
483#define MSPACK_ERR_OK (0)
485#define MSPACK_ERR_ARGS (1)
487#define MSPACK_ERR_OPEN (2)
489#define MSPACK_ERR_READ (3)
491#define MSPACK_ERR_WRITE (4)
493#define MSPACK_ERR_SEEK (5)
495#define MSPACK_ERR_NOMEMORY (6)
497#define MSPACK_ERR_SIGNATURE (7)
499#define MSPACK_ERR_DATAFORMAT (8)
501#define MSPACK_ERR_CHECKSUM (9)
503#define MSPACK_ERR_CRUNCH (10)
505#define MSPACK_ERR_DECRUNCH (11)
786#define MSCAB_HDR_RESV_OFFSET (0x28)
789#define MSCAB_HDR_PREVCAB (0x01)
791#define MSCAB_HDR_NEXTCAB (0x02)
793#define MSCAB_HDR_RESV (0x04)
837#define MSCABD_COMP_METHOD(comp_type) ((comp_type) & 0x0F)
845#define MSCABD_COMP_LEVEL(comp_type) (((comp_type) >> 8) & 0x1F)
848#define MSCAB_COMP_NONE (0)
850#define MSCAB_COMP_MSZIP (1)
852#define MSCAB_COMP_QUANTUM (2)
854#define MSCAB_COMP_LZX (3)
917#define MSCAB_ATTRIB_RDONLY (0x01)
919#define MSCAB_ATTRIB_HIDDEN (0x02)
921#define MSCAB_ATTRIB_SYSTEM (0x04)
923#define MSCAB_ATTRIB_ARCH (0x20)
925#define MSCAB_ATTRIB_EXEC (0x40)
927#define MSCAB_ATTRIB_UTF_NAME (0x80)
930#define MSCABD_PARAM_SEARCHBUF (0)
932#define MSCABD_PARAM_FIXMSZIP (1)
934#define MSCABD_PARAM_DECOMPBUF (2)
970 const char *filename);
1039 const char *filename);
1385#define MSCHMC_ENDLIST (0)
1387#define MSCHMC_UNCOMP (1)
1389#define MSCHMC_MSCOMP (2)
1392#define MSCHMC_PARAM_TIMESTAMP (0)
1394#define MSCHMC_PARAM_LANGUAGE (1)
1396#define MSCHMC_PARAM_LZXWINDOW (2)
1398#define MSCHMC_PARAM_DENSITY (3)
1400#define MSCHMC_PARAM_INDEX (4)
1443 const char *output_file);
1500 const char *temp_file);
1548 unsigned int value);
1590 const char *filename);
1670 const char *filename);
1746#define MSSZDDC_PARAM_MISSINGCHAR (0)
1749#define MSSZDD_FMT_NORMAL (0)
1752#define MSSZDD_FMT_QBASIC (1)
1847 unsigned int value);
1888 const char *filename);
1921 const char *filename);
1942 const char *output);
1961#define MSKWAJC_PARAM_COMP_TYPE (0)
1966#define MSKWAJC_PARAM_INCLUDE_LENGTH (1)
1969#define MSKWAJ_COMP_NONE (0)
1971#define MSKWAJ_COMP_XOR (1)
1973#define MSKWAJ_COMP_SZDD (2)
1975#define MSKWAJ_COMP_LZH (3)
1977#define MSKWAJ_COMP_MSZIP (4)
1980#define MSKWAJ_HDR_HASLENGTH (0x01)
1983#define MSKWAJ_HDR_HASUNKNOWN1 (0x02)
1986#define MSKWAJ_HDR_HASUNKNOWN2 (0x04)
1989#define MSKWAJ_HDR_HASFILENAME (0x08)
1992#define MSKWAJ_HDR_HASFILEEXT (0x10)
1995#define MSKWAJ_HDR_HASEXTRATEXT (0x20)
2085 unsigned int value);
2106 const char *filename);
2168 const char *filename);
2221 const char *output);
2263 const char *output);
2288 const char *output);
2316 const char *output);
2346 const char *output);
struct mscab_decompressor * mspack_create_cab_decompressor(struct mspack_system *sys)
Creates a new CAB decompressor.
struct msoab_compressor * mspack_create_oab_compressor(struct mspack_system *sys)
Creates a new OAB compressor.
void mspack_destroy_chm_compressor(struct mschm_compressor *self)
Destroys an existing CHM compressor.
void mspack_destroy_cab_decompressor(struct mscab_decompressor *self)
Destroys an existing CAB decompressor.
struct mskwaj_decompressor * mspack_create_kwaj_decompressor(struct mspack_system *sys)
Creates a new KWAJ decompressor.
void mspack_destroy_hlp_decompressor(struct mshlp_decompressor *self)
Destroys an existing hlp decompressor.
int mspack_version(int entity)
Enquire about the binary compatibility version of a specific interface in the library.
void mspack_destroy_cab_compressor(struct mscab_compressor *self)
Destroys an existing CAB compressor.
struct mshlp_compressor * mspack_create_hlp_compressor(struct mspack_system *sys)
Creates a new HLP compressor.
struct msszdd_compressor * mspack_create_szdd_compressor(struct mspack_system *sys)
Creates a new SZDD compressor.
struct mskwaj_compressor * mspack_create_kwaj_compressor(struct mspack_system *sys)
Creates a new KWAJ compressor.
void mspack_destroy_szdd_compressor(struct msszdd_compressor *self)
Destroys an existing SZDD compressor.
void mspack_destroy_chm_decompressor(struct mschm_decompressor *self)
Destroys an existing CHM decompressor.
void mspack_destroy_lit_decompressor(struct mslit_decompressor *self)
Destroys an existing LIT decompressor.
struct mschm_decompressor * mspack_create_chm_decompressor(struct mspack_system *sys)
Creates a new CHM decompressor.
void mspack_destroy_hlp_compressor(struct mshlp_compressor *self)
Destroys an existing hlp compressor.
struct mslit_decompressor * mspack_create_lit_decompressor(struct mspack_system *sys)
Creates a new LIT decompressor.
int mspack_sys_selftest_internal(int)
Part of the MSPACK_SYS_SELFTEST() macro, must not be used directly.
struct msoab_decompressor * mspack_create_oab_decompressor(struct mspack_system *sys)
Creates a new OAB decompressor.
struct mschm_compressor * mspack_create_chm_compressor(struct mspack_system *sys)
Creates a new CHM compressor.
void mspack_destroy_oab_decompressor(struct msoab_decompressor *self)
Destroys an existing OAB decompressor.
void mspack_destroy_szdd_decompressor(struct msszdd_decompressor *self)
Destroys an existing SZDD decompressor.
void mspack_destroy_lit_compressor(struct mslit_compressor *self)
Destroys an existing LIT compressor.
void mspack_destroy_kwaj_compressor(struct mskwaj_compressor *self)
Destroys an existing KWAJ compressor.
struct msszdd_decompressor * mspack_create_szdd_decompressor(struct mspack_system *sys)
Creates a new SZDD decompressor.
struct mshlp_decompressor * mspack_create_hlp_decompressor(struct mspack_system *sys)
Creates a new HLP decompressor.
void mspack_destroy_kwaj_decompressor(struct mskwaj_decompressor *self)
Destroys an existing KWAJ decompressor.
void mspack_destroy_oab_compressor(struct msoab_compressor *self)
Destroys an existing OAB compressor.
struct mslit_compressor * mspack_create_lit_compressor(struct mspack_system *sys)
Creates a new LIT compressor.
struct mscab_compressor * mspack_create_cab_compressor(struct mspack_system *sys)
Creates a new CAB compressor.
TODO.
Definition: mspack.h:937
int dummy
Definition: mspack.h:938
A decompressor for .CAB (Microsoft Cabinet) files.
Definition: mspack.h:948
int(* extract)(struct mscab_decompressor *self, struct mscabd_file *file, const char *filename)
Extracts a file from a cabinet or cabinet set.
Definition: mspack.h:1129
int(* prepend)(struct mscab_decompressor *self, struct mscabd_cabinet *cab, struct mscabd_cabinet *prevcab)
Prepends one mscabd_cabinet to another, forming or extending a cabinet set.
Definition: mspack.h:1103
int(* append)(struct mscab_decompressor *self, struct mscabd_cabinet *cab, struct mscabd_cabinet *nextcab)
Appends one mscabd_cabinet to another, forming or extending a cabinet set.
Definition: mspack.h:1081
int(* set_param)(struct mscab_decompressor *self, int param, int value)
Sets a CAB decompression engine parameter.
Definition: mspack.h:1155
void(* close)(struct mscab_decompressor *self, struct mscabd_cabinet *cab)
Closes a previously opened cabinet or cabinet set.
Definition: mspack.h:1001
int(* last_error)(struct mscab_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1170
A structure which represents a single cabinet file.
Definition: mspack.h:697
unsigned short set_id
The set ID of the cabinet.
Definition: mspack.h:750
char * prevname
The filename of the previous cabinet in a cabinet set, or NULL.
Definition: mspack.h:725
unsigned short set_index
The index number of the cabinet within the set.
Definition: mspack.h:757
struct mscabd_folder * folders
A list of all folders in the cabinet or cabinet set.
Definition: mspack.h:744
unsigned short header_resv
The number of bytes reserved in the header area of the cabinet.
Definition: mspack.h:769
int flags
Header flags.
Definition: mspack.h:782
unsigned int length
The length of the cabinet file in bytes.
Definition: mspack.h:716
const char * filename
The filename of the cabinet.
Definition: mspack.h:710
struct mscabd_cabinet * next
The next cabinet in a chained list, if this cabinet was opened with mscab_decompressor::search().
Definition: mspack.h:703
char * nextname
The filename of the next cabinet in a cabinet set, or NULL.
Definition: mspack.h:728
off_t base_offset
The file offset of cabinet within the physical file it resides in.
Definition: mspack.h:713
struct mscabd_file * files
A list of all files in the cabinet or cabinet set.
Definition: mspack.h:741
struct mscabd_cabinet * prevcab
The previous cabinet in a cabinet set, or NULL.
Definition: mspack.h:719
struct mscabd_cabinet * nextcab
The next cabinet in a cabinet set, or NULL.
Definition: mspack.h:722
char * nextinfo
The name of the disk containing the next cabinet in a cabinet set, or NULL.
Definition: mspack.h:738
char * previnfo
The name of the disk containing the previous cabinet in a cabinet set, or NULL.
Definition: mspack.h:733
A structure which represents a single file in a cabinet or cabinet set.
Definition: mspack.h:861
char * filename
The filename of the file.
Definition: mspack.h:876
unsigned int length
The uncompressed length of the file, in bytes.
Definition: mspack.h:879
struct mscabd_folder * folder
A pointer to the folder that contains this file.
Definition: mspack.h:910
char time_m
File's last modified time, minute field.
Definition: mspack.h:898
int attribs
File attributes.
Definition: mspack.h:893
char date_d
File's last modified date, day field.
Definition: mspack.h:903
unsigned int offset
The uncompressed offset of this file in its folder.
Definition: mspack.h:913
char time_h
File's last modified time, hour field.
Definition: mspack.h:896
int date_y
File's last modified date, year field.
Definition: mspack.h:907
char time_s
File's last modified time, second field.
Definition: mspack.h:900
struct mscabd_file * next
The next file in the cabinet or cabinet set, or NULL if this is the final file.
Definition: mspack.h:866
char date_m
File's last modified date, month field.
Definition: mspack.h:905
A structure which represents a single folder in a cabinet or cabinet set.
Definition: mspack.h:804
struct mscabd_folder * next
A pointer to the next folder in this cabinet or cabinet set, or NULL if this is the final folder.
Definition: mspack.h:809
unsigned int num_blocks
The total number of data blocks used by this folder.
Definition: mspack.h:827
int comp_type
The compression format used by this folder.
Definition: mspack.h:820
A compressor for .CHM (Microsoft HTMLHelp) files.
Definition: mspack.h:1409
int(* use_temporary_file)(struct mschm_compressor *self, int use_temp_file, const char *temp_file)
Specifies whether a temporary file is used during CHM generation.
Definition: mspack.h:1498
int(* set_param)(struct mschm_compressor *self, int param, unsigned int value)
Sets a CHM compression engine parameter.
Definition: mspack.h:1546
int(* last_error)(struct mschm_compressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1558
int(* generate)(struct mschm_compressor *self, struct mschmc_file file_list[], const char *output_file)
Generates a CHM help file.
Definition: mspack.h:1441
A decompressor for .CHM (Microsoft HTMLHelp) files.
Definition: mspack.h:1568
int(* fast_find)(struct mschm_decompressor *self, struct mschmd_header *chm, const char *filename, struct mschmd_file *f_ptr, int f_size)
Finds file details quickly.
Definition: mspack.h:1710
int(* extract)(struct mschm_decompressor *self, struct mschmd_file *file, const char *filename)
Extracts a file from a CHM helpfile.
Definition: mspack.h:1630
void(* close)(struct mschm_decompressor *self, struct mschmd_header *chm)
Closes a previously opened CHM helpfile.
Definition: mspack.h:1609
int(* last_error)(struct mschm_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1645
A structure which represents a file to be placed in a CHM helpfile.
Definition: mspack.h:1183
int section
One of MSCHMC_ENDLIST, MSCHMC_UNCOMP or MSCHMC_MSCOMP.
Definition: mspack.h:1185
const char * filename
The filename of the source file that will be added to the CHM.
Definition: mspack.h:1189
char * chm_filename
The full path and filename of the file within the CHM helpfile, a UTF-1 encoded null-terminated strin...
Definition: mspack.h:1193
off_t length
The length of the file, in bytes.
Definition: mspack.h:1198
A structure which represents a file stored in a CHM helpfile.
Definition: mspack.h:1361
char * filename
The filename of this file – a null terminated string in UTF-8.
Definition: mspack.h:1381
off_t length
The length of this file, in bytes.
Definition: mspack.h:1378
struct mschmd_file * next
A pointer to the next file in the list, or NULL if this is the final file.
Definition: mspack.h:1366
struct mschmd_section * section
A pointer to the section that this file is located in.
Definition: mspack.h:1372
off_t offset
The offset within the section data that this file is located at.
Definition: mspack.h:1375
A structure which represents the LZX compressed section of a CHM helpfile.
Definition: mspack.h:1239
struct mschmd_file * control
A pointer to the file which contains the LZX control data.
Definition: mspack.h:1247
struct mschmd_section base
Generic section data.
Definition: mspack.h:1241
struct mschmd_file * content
A pointer to the meta-file which represents all LZX compressed data.
Definition: mspack.h:1244
struct mschmd_file * rtable
A pointer to the file which contains the LZX reset table.
Definition: mspack.h:1250
struct mschmd_file * spaninfo
A pointer to the file which contains the LZX span information.
Definition: mspack.h:1255
A structure which represents the uncompressed section of a CHM helpfile.
Definition: mspack.h:1226
struct mschmd_section base
Generic section data.
Definition: mspack.h:1228
off_t offset
The file offset of where this section begins in the CHM helpfile.
Definition: mspack.h:1231
A structure which represents a section of a CHM helpfile.
Definition: mspack.h:1209
unsigned int id
The section ID.
Definition: mspack.h:1218
struct mschmd_header * chm
A pointer to the CHM helpfile that contains this section.
Definition: mspack.h:1211
TODO.
Definition: mspack.h:1733
int dummy
Definition: mspack.h:1734
TODO.
Definition: mspack.h:1738
int dummy
Definition: mspack.h:1739
A compressor for the KWAJ file format.
Definition: mspack.h:2036
int(* set_filename)(struct mskwaj_compressor *self, const char *filename)
Sets the original filename of the file before compression, which will be stored in the header of the ...
Definition: mspack.h:2105
int(* last_error)(struct mschm_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:2137
int(* set_extra_data)(struct mskwaj_compressor *self, void *data, size_t bytes)
Sets arbitrary data that will be stored in the header of the output file, uncompressed.
Definition: mspack.h:2125
int(* set_param)(struct mskwaj_compressor *self, int param, unsigned int value)
Sets an KWAJ compression engine parameter.
Definition: mspack.h:2083
int(* compress)(struct mskwaj_compressor *self, const char *input, const char *output, off_t length)
Reads an input file and creates a compressed output file in the KWAJ compressed file format.
Definition: mspack.h:2055
A decompressor for KWAJ compressed files.
Definition: mspack.h:2147
void(* close)(struct mskwaj_decompressor *self, struct mskwajd_header *kwaj)
Closes a previously opened KWAJ file.
Definition: mspack.h:2182
int(* extract)(struct mskwaj_decompressor *self, struct mskwajd_header *kwaj, const char *filename)
Extracts the compressed data from a KWAJ file.
Definition: mspack.h:2198
int(* decompress)(struct mskwaj_decompressor *self, const char *input, const char *output)
Decompresses an KWAJ file to an output file in one step.
Definition: mspack.h:2219
int(* last_error)(struct mskwaj_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:2234
TODO.
Definition: mspack.h:1720
int dummy
Definition: mspack.h:1721
TODO.
Definition: mspack.h:1725
int dummy
Definition: mspack.h:1726
A compressor for the Offline Address Book (OAB) format.
Definition: mspack.h:2246
int(* compress)(struct msoab_compressor *self, const char *input, const char *output)
Compress a full OAB file.
Definition: mspack.h:2261
int(* compress_incremental)(struct msoab_compressor *self, const char *input, const char *base, const char *output)
Generate a compressed incremental OAB patch file.
Definition: mspack.h:2285
A decompressor for .LZX (Offline Address Book) files.
Definition: mspack.h:2298
int(* decompress)(struct msoab_decompressor *self, const char *input, const char *output)
Decompresses a full Offline Address Book file.
Definition: mspack.h:2314
int(* decompress_incremental)(struct msoab_decompressor *self, const char *input, const char *base, const char *output)
Decompresses an Offline Address Book with an incremental patch file.
Definition: mspack.h:2343
A structure which represents an open file handle.
Definition: mspack.h:476
int dummy
Definition: mspack.h:477
A structure which abstracts file I/O and memory management.
Definition: mspack.h:285
int(* read)(struct mspack_file *file, void *buffer, int bytes)
Reads a given number of bytes from an open file.
Definition: mspack.h:334
void(* close)(struct mspack_file *file)
Closes a previously opened file.
Definition: mspack.h:321
void * null_ptr
A null pointer to mark the end of mspack_system.
Definition: mspack.h:452
off_t(* tell)(struct mspack_file *file)
Returns the current file position (in bytes) of the given file.
Definition: mspack.h:389
void(* copy)(void *src, void *dest, size_t bytes)
Copies from one region of memory to another.
Definition: mspack.h:442
void(* message)(struct mspack_file *file, const char *format,...)
Used to send messages from the library to the user.
Definition: mspack.h:405
int(* write)(struct mspack_file *file, void *buffer, int bytes)
Writes a given number of bytes to an open file.
Definition: mspack.h:351
void(* free)(void *ptr)
Frees memory.
Definition: mspack.h:428
int(* seek)(struct mspack_file *file, off_t offset, int mode)
Seeks to a specific file offset within an open file.
Definition: mspack.h:378
A compressor for the SZDD file format.
Definition: mspack.h:1783
int(* set_param)(struct msszdd_compressor *self, int param, unsigned int value)
Sets an SZDD compression engine parameter.
Definition: mspack.h:1845
int(* last_error)(struct mschm_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1857
int(* compress)(struct msszdd_compressor *self, const char *input, const char *output, off_t length)
Reads an input file and creates a compressed output file in the SZDD compressed file format.
Definition: mspack.h:1819
A decompressor for SZDD compressed files.
Definition: mspack.h:1867
int(* extract)(struct msszdd_decompressor *self, struct msszddd_header *szdd, const char *filename)
Extracts the compressed data from a SZDD file.
Definition: mspack.h:1919
void(* close)(struct msszdd_decompressor *self, struct msszddd_header *szdd)
Closes a previously opened SZDD file.
Definition: mspack.h:1903
int(* decompress)(struct msszdd_decompressor *self, const char *input, const char *output)
Decompresses an SZDD file to an output file in one step.
Definition: mspack.h:1940
int(* last_error)(struct msszdd_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1955