libmspack
mspack.h
Go to the documentation of this file.
1 /* libmspack -- a library for working with Microsoft compression formats.
2  * (C) 2003-2016 Stuart Caie <kyzer@cabextract.org.uk>
3  *
4  * libmspack is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License (LGPL) version 2.1
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15  */
16 
158 #ifndef LIB_MSPACK_H
159 #define LIB_MSPACK_H 1
160 
161 #ifdef __cplusplus
162 extern "C" {
163 #endif
164 
165 #include <sys/types.h>
166 #include <stdlib.h>
167 
191 #define MSPACK_SYS_SELFTEST(result) do { \
192  (result) = mspack_sys_selftest_internal(sizeof(off_t)); \
193 } while (0)
194 
196 extern int mspack_sys_selftest_internal(int);
197 
229 extern int mspack_version(int entity);
230 
232 #define MSPACK_VER_LIBRARY (0)
233 
234 #define MSPACK_VER_SYSTEM (1)
235 
236 #define MSPACK_VER_MSCABD (2)
237 
238 #define MSPACK_VER_MSCABC (3)
239 
240 #define MSPACK_VER_MSCHMD (4)
241 
242 #define MSPACK_VER_MSCHMC (5)
243 
244 #define MSPACK_VER_MSLITD (6)
245 
246 #define MSPACK_VER_MSLITC (7)
247 
248 #define MSPACK_VER_MSHLPD (8)
249 
250 #define MSPACK_VER_MSHLPC (9)
251 
252 #define MSPACK_VER_MSSZDDD (10)
253 
254 #define MSPACK_VER_MSSZDDC (11)
255 
256 #define MSPACK_VER_MSKWAJD (12)
257 
258 #define MSPACK_VER_MSKWAJC (13)
259 
260 #define MSPACK_VER_MSOABD (14)
261 
262 #define MSPACK_VER_MSOABC (15)
263 
264 /* --- file I/O abstraction ------------------------------------------------ */
265 
310  struct mspack_file * (*open)(struct mspack_system *self,
311  const char *filename,
312  int mode);
313 
321  void (*close)(struct mspack_file *file);
322 
334  int (*read)(struct mspack_file *file,
335  void *buffer,
336  int bytes);
337 
351  int (*write)(struct mspack_file *file,
352  void *buffer,
353  int bytes);
354 
378  int (*seek)(struct mspack_file *file,
379  off_t offset,
380  int mode);
381 
389  off_t (*tell)(struct mspack_file *file);
390 
405  void (*message)(struct mspack_file *file,
406  const char *format,
407  ...);
408 
419  void * (*alloc)(struct mspack_system *self,
420  size_t bytes);
421 
428  void (*free)(void *ptr);
429 
442  void (*copy)(void *src,
443  void *dest,
444  size_t bytes);
445 
452  void *null_ptr;
453 };
454 
456 #define MSPACK_SYS_OPEN_READ (0)
457 
458 #define MSPACK_SYS_OPEN_WRITE (1)
459 
460 #define MSPACK_SYS_OPEN_UPDATE (2)
461 
462 #define MSPACK_SYS_OPEN_APPEND (3)
463 
465 #define MSPACK_SYS_SEEK_START (0)
466 
467 #define MSPACK_SYS_SEEK_CUR (1)
468 
469 #define MSPACK_SYS_SEEK_END (2)
470 
476 struct mspack_file {
477  int dummy;
478 };
479 
480 /* --- error codes --------------------------------------------------------- */
481 
483 #define MSPACK_ERR_OK (0)
484 
485 #define MSPACK_ERR_ARGS (1)
486 
487 #define MSPACK_ERR_OPEN (2)
488 
489 #define MSPACK_ERR_READ (3)
490 
491 #define MSPACK_ERR_WRITE (4)
492 
493 #define MSPACK_ERR_SEEK (5)
494 
495 #define MSPACK_ERR_NOMEMORY (6)
496 
497 #define MSPACK_ERR_SIGNATURE (7)
498 
499 #define MSPACK_ERR_DATAFORMAT (8)
500 
501 #define MSPACK_ERR_CHECKSUM (9)
502 
503 #define MSPACK_ERR_CRUNCH (10)
504 
505 #define MSPACK_ERR_DECRUNCH (11)
506 
507 /* --- functions available in library -------------------------------------- */
508 
513 extern struct mscab_compressor *
515 
520 extern struct mscab_decompressor *
522 
526 extern void mspack_destroy_cab_compressor(struct mscab_compressor *self);
527 
531 extern void mspack_destroy_cab_decompressor(struct mscab_decompressor *self);
532 
533 
538 extern struct mschm_compressor *
540 
545 extern struct mschm_decompressor *
547 
551 extern void mspack_destroy_chm_compressor(struct mschm_compressor *self);
552 
556 extern void mspack_destroy_chm_decompressor(struct mschm_decompressor *self);
557 
558 
563 extern struct mslit_compressor *
565 
570 extern struct mslit_decompressor *
572 
576 extern void mspack_destroy_lit_compressor(struct mslit_compressor *self);
577 
581 extern void mspack_destroy_lit_decompressor(struct mslit_decompressor *self);
582 
583 
588 extern struct mshlp_compressor *
590 
595 extern struct mshlp_decompressor *
597 
601 extern void mspack_destroy_hlp_compressor(struct mshlp_compressor *self);
602 
606 extern void mspack_destroy_hlp_decompressor(struct mshlp_decompressor *self);
607 
608 
613 extern struct msszdd_compressor *
615 
620 extern struct msszdd_decompressor *
622 
626 extern void mspack_destroy_szdd_compressor(struct msszdd_compressor *self);
627 
631 extern void mspack_destroy_szdd_decompressor(struct msszdd_decompressor *self);
632 
633 
638 extern struct mskwaj_compressor *
640 
645 extern struct mskwaj_decompressor *
647 
651 extern void mspack_destroy_kwaj_compressor(struct mskwaj_compressor *self);
652 
656 extern void mspack_destroy_kwaj_decompressor(struct mskwaj_decompressor *self);
657 
658 
663 extern struct msoab_compressor *
665 
670 extern struct msoab_decompressor *
672 
676 extern void mspack_destroy_oab_compressor(struct msoab_compressor *self);
677 
681 extern void mspack_destroy_oab_decompressor(struct msoab_decompressor *self);
682 
683 
684 /* --- support for .CAB (MS Cabinet) file format --------------------------- */
685 
704 
710  const char *filename;
711 
713  off_t base_offset;
714 
716  unsigned int length;
717 
720 
723 
725  char *prevname;
726 
728  char *nextname;
729 
733  char *previnfo;
734 
738  char *nextinfo;
739 
742 
745 
750  unsigned short set_id;
751 
757  unsigned short set_index;
758 
769  unsigned short header_resv;
770 
782  int flags;
783 };
784 
786 #define MSCAB_HDR_RESV_OFFSET (0x28)
787 
789 #define MSCAB_HDR_PREVCAB (0x01)
790 
791 #define MSCAB_HDR_NEXTCAB (0x02)
792 
793 #define MSCAB_HDR_RESV (0x04)
794 
810 
821 
827  unsigned int num_blocks;
828 };
829 
837 #define MSCABD_COMP_METHOD(comp_type) ((comp_type) & 0x0F)
838 
845 #define MSCABD_COMP_LEVEL(comp_type) (((comp_type) >> 8) & 0x1F)
846 
848 #define MSCAB_COMP_NONE (0)
849 
850 #define MSCAB_COMP_MSZIP (1)
851 
852 #define MSCAB_COMP_QUANTUM (2)
853 
854 #define MSCAB_COMP_LZX (3)
855 
861 struct mscabd_file {
866  struct mscabd_file *next;
867 
876  char *filename;
877 
879  unsigned int length;
880 
893  int attribs;
894 
896  char time_h;
898  char time_m;
900  char time_s;
901 
903  char date_d;
905  char date_m;
907  int date_y;
908 
911 
913  unsigned int offset;
914 };
915 
917 #define MSCAB_ATTRIB_RDONLY (0x01)
918 
919 #define MSCAB_ATTRIB_HIDDEN (0x02)
920 
921 #define MSCAB_ATTRIB_SYSTEM (0x04)
922 
923 #define MSCAB_ATTRIB_ARCH (0x20)
924 
925 #define MSCAB_ATTRIB_EXEC (0x40)
926 
927 #define MSCAB_ATTRIB_UTF_NAME (0x80)
928 
930 #define MSCABD_PARAM_SEARCHBUF (0)
931 
932 #define MSCABD_PARAM_FIXMSZIP (1)
933 
934 #define MSCABD_PARAM_DECOMPBUF (2)
935 
938  int dummy;
939 };
940 
969  struct mscabd_cabinet * (*open) (struct mscab_decompressor *self,
970  const char *filename);
971 
1001  void (*close)(struct mscab_decompressor *self,
1002  struct mscabd_cabinet *cab);
1003 
1038  struct mscabd_cabinet * (*search) (struct mscab_decompressor *self,
1039  const char *filename);
1040 
1081  int (*append) (struct mscab_decompressor *self,
1082  struct mscabd_cabinet *cab,
1083  struct mscabd_cabinet *nextcab);
1084 
1103  int (*prepend) (struct mscab_decompressor *self,
1104  struct mscabd_cabinet *cab,
1105  struct mscabd_cabinet *prevcab);
1106 
1129  int (*extract)(struct mscab_decompressor *self,
1130  struct mscabd_file *file,
1131  const char *filename);
1132 
1155  int (*set_param)(struct mscab_decompressor *self,
1156  int param,
1157  int value);
1158 
1170  int (*last_error)(struct mscab_decompressor *self);
1171 };
1172 
1173 /* --- support for .CHM (HTMLHelp) file format ----------------------------- */
1174 
1183 struct mschmc_file {
1185  int section;
1186 
1189  const char *filename;
1190 
1194 
1198  off_t length;
1199 };
1200 
1212 
1218  unsigned int id;
1219 };
1220 
1229 
1231  off_t offset;
1232 };
1233 
1242 
1245 
1248 
1251 
1256 };
1257 
1265  unsigned int version;
1266 
1274  unsigned int timestamp;
1275 
1280  unsigned int language;
1281 
1286  const char *filename;
1287 
1289  off_t length;
1290 
1293 
1301 
1304 
1307 
1309  off_t dir_offset;
1310 
1312  unsigned int num_chunks;
1313 
1315  unsigned int chunk_size;
1316 
1318  unsigned int density;
1319 
1328  unsigned int depth;
1329 
1335  unsigned int index_root;
1336 
1341  unsigned int first_pmgl;
1342 
1347  unsigned int last_pmgl;
1348 
1353  unsigned char **chunk_cache;
1354 };
1355 
1361 struct mschmd_file {
1367 
1373 
1375  off_t offset;
1376 
1378  off_t length;
1379 
1381  char *filename;
1382 };
1383 
1385 #define MSCHMC_ENDLIST (0)
1386 
1387 #define MSCHMC_UNCOMP (1)
1388 
1389 #define MSCHMC_MSCOMP (2)
1390 
1392 #define MSCHMC_PARAM_TIMESTAMP (0)
1393 
1394 #define MSCHMC_PARAM_LANGUAGE (1)
1395 
1396 #define MSCHMC_PARAM_LZXWINDOW (2)
1397 
1398 #define MSCHMC_PARAM_DENSITY (3)
1399 
1400 #define MSCHMC_PARAM_INDEX (4)
1401 
1441  int (*generate)(struct mschm_compressor *self,
1442  struct mschmc_file file_list[],
1443  const char *output_file);
1444 
1499  int use_temp_file,
1500  const char *temp_file);
1546  int (*set_param)(struct mschm_compressor *self,
1547  int param,
1548  unsigned int value);
1549 
1558  int (*last_error)(struct mschm_compressor *self);
1559 };
1560 
1589  struct mschmd_header *(*open)(struct mschm_decompressor *self,
1590  const char *filename);
1591 
1609  void (*close)(struct mschm_decompressor *self,
1610  struct mschmd_header *chm);
1611 
1630  int (*extract)(struct mschm_decompressor *self,
1631  struct mschmd_file *file,
1632  const char *filename);
1633 
1645  int (*last_error)(struct mschm_decompressor *self);
1646 
1669  struct mschmd_header *(*fast_open)(struct mschm_decompressor *self,
1670  const char *filename);
1671 
1710  int (*fast_find)(struct mschm_decompressor *self,
1711  struct mschmd_header *chm,
1712  const char *filename,
1713  struct mschmd_file *f_ptr,
1714  int f_size);
1715 };
1716 
1717 /* --- support for .LIT (EBook) file format -------------------------------- */
1718 
1721  int dummy;
1722 };
1723 
1726  int dummy;
1727 };
1728 
1729 
1730 /* --- support for .HLP (MS Help) file format ------------------------------ */
1731 
1734  int dummy;
1735 };
1736 
1739  int dummy;
1740 };
1741 
1742 
1743 /* --- support for SZDD file format ---------------------------------------- */
1744 
1746 #define MSSZDDC_PARAM_MISSINGCHAR (0)
1747 
1749 #define MSSZDD_FMT_NORMAL (0)
1750 
1752 #define MSSZDD_FMT_QBASIC (1)
1753 
1761  int format;
1762 
1764  off_t length;
1765 
1774 };
1775 
1819  int (*compress)(struct msszdd_compressor *self,
1820  const char *input,
1821  const char *output,
1822  off_t length);
1823 
1845  int (*set_param)(struct msszdd_compressor *self,
1846  int param,
1847  unsigned int value);
1848 
1857  int (*last_error)(struct mschm_decompressor *self);
1858 };
1859 
1887  struct msszddd_header *(*open)(struct msszdd_decompressor *self,
1888  const char *filename);
1889 
1903  void (*close)(struct msszdd_decompressor *self,
1904  struct msszddd_header *szdd);
1905 
1919  int (*extract)(struct msszdd_decompressor *self,
1920  struct msszddd_header *szdd,
1921  const char *filename);
1922 
1940  int (*decompress)(struct msszdd_decompressor *self,
1941  const char *input,
1942  const char *output);
1943 
1955  int (*last_error)(struct msszdd_decompressor *self);
1956 };
1957 
1958 /* --- support for KWAJ file format ---------------------------------------- */
1959 
1961 #define MSKWAJC_PARAM_COMP_TYPE (0)
1962 
1966 #define MSKWAJC_PARAM_INCLUDE_LENGTH (1)
1967 
1969 #define MSKWAJ_COMP_NONE (0)
1970 
1971 #define MSKWAJ_COMP_XOR (1)
1972 
1973 #define MSKWAJ_COMP_SZDD (2)
1974 
1975 #define MSKWAJ_COMP_LZH (3)
1976 
1977 #define MSKWAJ_COMP_MSZIP (4)
1978 
1980 #define MSKWAJ_HDR_HASLENGTH (0x01)
1981 
1983 #define MSKWAJ_HDR_HASUNKNOWN1 (0x02)
1984 
1986 #define MSKWAJ_HDR_HASUNKNOWN2 (0x04)
1987 
1989 #define MSKWAJ_HDR_HASFILENAME (0x08)
1990 
1992 #define MSKWAJ_HDR_HASFILEEXT (0x10)
1993 
1995 #define MSKWAJ_HDR_HASEXTRATEXT (0x20)
1996 
2006  unsigned short comp_type;
2007 
2010 
2012  int headers;
2013 
2015  off_t length;
2016 
2018  char *filename;
2019 
2023  char *extra;
2024 
2026  unsigned short extra_length;
2027 };
2028 
2055  int (*compress)(struct mskwaj_compressor *self,
2056  const char *input,
2057  const char *output,
2058  off_t length);
2059 
2083  int (*set_param)(struct mskwaj_compressor *self,
2084  int param,
2085  unsigned int value);
2086 
2087 
2105  int (*set_filename)(struct mskwaj_compressor *self,
2106  const char *filename);
2107 
2125  int (*set_extra_data)(struct mskwaj_compressor *self,
2126  void *data,
2127  size_t bytes);
2128 
2137  int (*last_error)(struct mschm_decompressor *self);
2138 };
2139 
2167  struct mskwajd_header *(*open)(struct mskwaj_decompressor *self,
2168  const char *filename);
2169 
2182  void (*close)(struct mskwaj_decompressor *self,
2183  struct mskwajd_header *kwaj);
2184 
2198  int (*extract)(struct mskwaj_decompressor *self,
2199  struct mskwajd_header *kwaj,
2200  const char *filename);
2201 
2219  int (*decompress)(struct mskwaj_decompressor *self,
2220  const char *input,
2221  const char *output);
2222 
2234  int (*last_error)(struct mskwaj_decompressor *self);
2235 };
2236 
2237 /* --- support for .LZX (Offline Address Book) file format ----------------- */
2238 
2261  int (*compress) (struct msoab_compressor *self,
2262  const char *input,
2263  const char *output);
2264 
2286  const char *input,
2287  const char *base,
2288  const char *output);
2289 };
2290 
2314  int (*decompress) (struct msoab_decompressor *self,
2315  const char *input,
2316  const char *output);
2317 
2344  const char *input,
2345  const char *base,
2346  const char *output);
2347 };
2348 
2349 #ifdef __cplusplus
2350 }
2351 #endif
2352 
2353 #endif
void(* copy)(void *src, void *dest, size_t bytes)
Copies from one region of memory to another.
Definition: mspack.h:442
A decompressor for SZDD compressed files.
Definition: mspack.h:1867
unsigned int offset
The uncompressed offset of this file in its folder.
Definition: mspack.h:913
struct msoab_decompressor * mspack_create_oab_decompressor(struct mspack_system *sys)
Creates a new OAB decompressor.
A compressor for the KWAJ file format.
Definition: mspack.h:2036
struct msszdd_compressor * mspack_create_szdd_compressor(struct mspack_system *sys)
Creates a new SZDD compressor.
void(* close)(struct mscab_decompressor *self, struct mscabd_cabinet *cab)
Closes a previously opened cabinet or cabinet set.
Definition: mspack.h:1001
void mspack_destroy_lit_compressor(struct mslit_compressor *self)
Destroys an existing LIT compressor.
int(* decompress)(struct msoab_decompressor *self, const char *input, const char *output)
Decompresses a full Offline Address Book file.
Definition: mspack.h:2314
void(* message)(struct mspack_file *file, const char *format,...)
Used to send messages from the library to the user.
Definition: mspack.h:405
struct mscab_compressor * mspack_create_cab_compressor(struct mspack_system *sys)
Creates a new CAB compressor.
char * filename
The filename of the file.
Definition: mspack.h:876
struct mschm_decompressor * mspack_create_chm_decompressor(struct mspack_system *sys)
Creates a new CHM decompressor.
off_t(* tell)(struct mspack_file *file)
Returns the current file position (in bytes) of the given file.
Definition: mspack.h:389
int(* write)(struct mspack_file *file, void *buffer, int bytes)
Writes a given number of bytes to an open file.
Definition: mspack.h:351
off_t offset
The offset within the section data that this file is located at.
Definition: mspack.h:1375
void mspack_destroy_hlp_compressor(struct mshlp_compressor *self)
Destroys an existing hlp compressor.
char missing_char
The last character in the filename, traditionally replaced with an underscore to show the file is com...
Definition: mspack.h:1773
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(* compress)(struct msoab_compressor *self, const char *input, const char *output)
Compress a full OAB file.
Definition: mspack.h:2261
unsigned int language
The default Language and Country ID (LCID) of the user who ran the HTMLHelp Compiler.
Definition: mspack.h:1280
A structure which represents a file to be placed in a CHM helpfile.
Definition: mspack.h:1183
int dummy
Definition: mspack.h:477
struct msszdd_decompressor * mspack_create_szdd_decompressor(struct mspack_system *sys)
Creates a new SZDD decompressor.
unsigned short set_id
The set ID of the cabinet.
Definition: mspack.h:750
A structure which represents the LZX compressed section of a CHM helpfile.
Definition: mspack.h:1239
char date_d
File&#39;s last modified date, day field.
Definition: mspack.h:903
struct mshlp_compressor * mspack_create_hlp_compressor(struct mspack_system *sys)
Creates a new HLP compressor.
int comp_type
The compression format used by this folder.
Definition: mspack.h:820
struct mskwaj_decompressor * mspack_create_kwaj_decompressor(struct mspack_system *sys)
Creates a new KWAJ decompressor.
void mspack_destroy_szdd_compressor(struct msszdd_compressor *self)
Destroys an existing SZDD compressor.
char * nextinfo
The name of the disk containing the next cabinet in a cabinet set, or NULL.
Definition: mspack.h:738
void mspack_destroy_hlp_decompressor(struct mshlp_decompressor *self)
Destroys an existing hlp decompressor.
struct mscabd_folder * folder
A pointer to the folder that contains this file.
Definition: mspack.h:910
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(* 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
struct mschmd_section base
Generic section data.
Definition: mspack.h:1228
A decompressor for .CHM (Microsoft HTMLHelp) files.
Definition: mspack.h:1568
A structure which abstracts file I/O and memory management.
Definition: mspack.h:285
A structure which represents a section of a CHM helpfile.
Definition: mspack.h:1209
TODO.
Definition: mspack.h:1738
int mspack_sys_selftest_internal(int)
Part of the MSPACK_SYS_SELFTEST() macro, must not be used directly.
int(* set_param)(struct mscab_decompressor *self, int param, int value)
Sets a CAB decompression engine parameter.
Definition: mspack.h:1155
struct mschmd_header * chm
A pointer to the CHM helpfile that contains this section.
Definition: mspack.h:1211
int(* last_error)(struct msszdd_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1955
char * filename
The filename of this file – a null terminated string in UTF-8.
Definition: mspack.h:1381
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
TODO.
Definition: mspack.h:1725
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 msszdd_compressor *self, int param, unsigned int value)
Sets an SZDD compression engine parameter.
Definition: mspack.h:1845
A compressor for the Offline Address Book (OAB) format.
Definition: mspack.h:2246
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 * prevname
The filename of the previous cabinet in a cabinet set, or NULL.
Definition: mspack.h:725
int format
The file format; either MSSZDD_FMT_NORMAL or MSSZDD_FMT_QBASIC.
Definition: mspack.h:1761
A structure which represents a single folder in a cabinet or cabinet set.
Definition: mspack.h:804
unsigned int num_blocks
The total number of data blocks used by this folder.
Definition: mspack.h:827
unsigned int index_root
The number of the root PMGI chunk.
Definition: mspack.h:1335
A decompressor for .LZX (Offline Address Book) files.
Definition: mspack.h:2298
int attribs
File attributes.
Definition: mspack.h:893
TODO.
Definition: mspack.h:937
A structure which represents an KWAJ compressed file.
Definition: mspack.h:2002
int(* read)(struct mspack_file *file, void *buffer, int bytes)
Reads a given number of bytes from an open file.
Definition: mspack.h:334
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
struct mslit_compressor * mspack_create_lit_compressor(struct mspack_system *sys)
Creates a new LIT compressor.
struct mschmd_file * rtable
A pointer to the file which contains the LZX reset table.
Definition: mspack.h:1250
struct mscabd_cabinet * prevcab
The previous cabinet in a cabinet set, or NULL.
Definition: mspack.h:719
int(* set_param)(struct mschm_compressor *self, int param, unsigned int value)
Sets a CHM compression engine parameter.
Definition: mspack.h:1546
struct mschmd_file * spaninfo
A pointer to the file which contains the LZX span information.
Definition: mspack.h:1255
void mspack_destroy_lit_decompressor(struct mslit_decompressor *self)
Destroys an existing LIT decompressor.
struct mscabd_file * files
A list of all files in the cabinet or cabinet set.
Definition: mspack.h:741
struct mschmd_file * content
A pointer to the meta-file which represents all LZX compressed data.
Definition: mspack.h:1244
struct mschmd_sec_uncompressed sec0
The section 0 (uncompressed) data in this CHM helpfile.
Definition: mspack.h:1303
struct mschmd_file * sysfiles
A list of all system files in the CHM helpfile.
Definition: mspack.h:1300
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
void mspack_destroy_szdd_decompressor(struct msszdd_decompressor *self)
Destroys an existing SZDD decompressor.
off_t offset
The file offset of where this section begins in the CHM helpfile.
Definition: mspack.h:1231
struct mschm_compressor * mspack_create_chm_compressor(struct mspack_system *sys)
Creates a new CHM compressor.
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
A structure which represents an open file handle.
Definition: mspack.h:476
int(* last_error)(struct mskwaj_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:2234
off_t length
The length of the CHM helpfile, in bytes.
Definition: mspack.h:1289
void(* free)(void *ptr)
Frees memory.
Definition: mspack.h:428
void(* close)(struct msszdd_decompressor *self, struct msszddd_header *szdd)
Closes a previously opened SZDD file.
Definition: mspack.h:1903
char * previnfo
The name of the disk containing the previous cabinet in a cabinet set, or NULL.
Definition: mspack.h:733
struct mschmd_file * files
A list of all non-system files in the CHM helpfile.
Definition: mspack.h:1292
off_t length
The amount of uncompressed data in the file, or 0 if not present.
Definition: mspack.h:2015
int(* last_error)(struct mschm_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:2137
int dummy
Definition: mspack.h:1734
char time_h
File&#39;s last modified time, hour field.
Definition: mspack.h:896
int mspack_version(int entity)
Enquire about the binary compatibility version of a specific interface in the library.
A structure which represents a single file in a cabinet or cabinet set.
Definition: mspack.h:861
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
int(* set_param)(struct mskwaj_compressor *self, int param, unsigned int value)
Sets an KWAJ compression engine parameter.
Definition: mspack.h:2083
unsigned int first_pmgl
The number of the first PMGL chunk.
Definition: mspack.h:1341
A structure which represents a file stored in a CHM helpfile.
Definition: mspack.h:1361
char date_m
File&#39;s last modified date, month field.
Definition: mspack.h:905
unsigned int num_chunks
The number of PMGL/PMGI directory chunks in this CHM helpfile.
Definition: mspack.h:1312
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
unsigned int chunk_size
The size of each PMGL/PMGI chunk, in bytes.
Definition: mspack.h:1315
A decompressor for .CAB (Microsoft Cabinet) files.
Definition: mspack.h:948
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
unsigned int last_pmgl
The number of the last PMGL chunk.
Definition: mspack.h:1347
unsigned int version
The version of the CHM file format used in this file.
Definition: mspack.h:1265
struct mschmd_sec_mscompressed sec1
The section 1 (MSCompressed) data in this CHM helpfile.
Definition: mspack.h:1306
char * nextname
The filename of the next cabinet in a cabinet set, or NULL.
Definition: mspack.h:728
void mspack_destroy_cab_compressor(struct mscab_compressor *self)
Destroys an existing CAB compressor.
struct mschmd_section * section
A pointer to the section that this file is located in.
Definition: mspack.h:1372
int(* last_error)(struct mscab_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1170
void(* close)(struct mskwaj_decompressor *self, struct mskwajd_header *kwaj)
Closes a previously opened KWAJ file.
Definition: mspack.h:2182
char time_s
File&#39;s last modified time, second field.
Definition: mspack.h:900
A structure which represents a CHM helpfile.
Definition: mspack.h:1263
struct mscabd_cabinet * nextcab
The next cabinet in a cabinet set, or NULL.
Definition: mspack.h:722
off_t length
The length of this file, in bytes.
Definition: mspack.h:1378
A structure which represents a single cabinet file.
Definition: mspack.h:697
int(* last_error)(struct mschm_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1645
unsigned short set_index
The index number of the cabinet within the set.
Definition: mspack.h:757
int section
One of MSCHMC_ENDLIST, MSCHMC_UNCOMP or MSCHMC_MSCOMP.
Definition: mspack.h:1185
char * extra
extra uncompressed data (usually text) in the header.
Definition: mspack.h:2023
off_t dir_offset
The file offset of the first PMGL/PMGI directory chunk.
Definition: mspack.h:1309
char * filename
output filename, or NULL if not present
Definition: mspack.h:2018
void mspack_destroy_kwaj_decompressor(struct mskwaj_decompressor *self)
Destroys an existing KWAJ decompressor.
A compressor for the SZDD file format.
Definition: mspack.h:1783
unsigned char ** chunk_cache
A cache of loaded chunks, filled in by mschm_decoder::fast_find().
Definition: mspack.h:1353
struct mscab_decompressor * mspack_create_cab_decompressor(struct mspack_system *sys)
Creates a new CAB decompressor.
void(* close)(struct mschm_decompressor *self, struct mschmd_header *chm)
Closes a previously opened CHM helpfile.
Definition: mspack.h:1609
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
const char * filename
The filename of the cabinet.
Definition: mspack.h:710
TODO.
Definition: mspack.h:1733
TODO.
Definition: mspack.h:1720
off_t length
The amount of data in the SZDD file once uncompressed.
Definition: mspack.h:1764
int dummy
Definition: mspack.h:1739
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
int dummy
Definition: mspack.h:1721
const char * filename
The filename of the CHM helpfile.
Definition: mspack.h:1286
struct mslit_decompressor * mspack_create_lit_decompressor(struct mspack_system *sys)
Creates a new LIT decompressor.
int date_y
File&#39;s last modified date, year field.
Definition: mspack.h:907
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(* extract)(struct mschm_decompressor *self, struct mschmd_file *file, const char *filename)
Extracts a file from a CHM helpfile.
Definition: mspack.h:1630
unsigned short comp_type
The compression type; should be one of MSKWAJ_COMP_NONE, MSKWAJ_COMP_XOR, MSKWAJ_COMP_SZDD or MSKWAJ_...
Definition: mspack.h:2006
int flags
Header flags.
Definition: mspack.h:782
char time_m
File&#39;s last modified time, minute field.
Definition: mspack.h:898
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
off_t length
The length of the file, in bytes.
Definition: mspack.h:1198
int dummy
Definition: mspack.h:938
int(* last_error)(struct mschm_compressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1558
int dummy
Definition: mspack.h:1726
unsigned int id
The section ID.
Definition: mspack.h:1218
unsigned short extra_length
length of extra uncompressed data in the header
Definition: mspack.h:2026
unsigned int depth
The depth of the index tree.
Definition: mspack.h:1328
A structure which represents an SZDD compressed file.
Definition: mspack.h:1759
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
struct mschmd_file * control
A pointer to the file which contains the LZX control data.
Definition: mspack.h:1247
void mspack_destroy_chm_decompressor(struct mschm_decompressor *self)
Destroys an existing CHM decompressor.
struct mscabd_folder * folders
A list of all folders in the cabinet or cabinet set.
Definition: mspack.h:744
off_t data_offset
The offset in the file where the compressed data stream begins.
Definition: mspack.h:2009
A decompressor for KWAJ compressed files.
Definition: mspack.h:2147
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
void mspack_destroy_cab_decompressor(struct mscab_decompressor *self)
Destroys an existing CAB decompressor.
void mspack_destroy_oab_compressor(struct msoab_compressor *self)
Destroys an existing OAB compressor.
A structure which represents the uncompressed section of a CHM helpfile.
Definition: mspack.h:1226
off_t base_offset
The file offset of cabinet within the physical file it resides in.
Definition: mspack.h:713
struct mschmd_section base
Generic section data.
Definition: mspack.h:1241
int(* generate)(struct mschm_compressor *self, struct mschmc_file file_list[], const char *output_file)
Generates a CHM help file.
Definition: mspack.h:1441
unsigned short header_resv
The number of bytes reserved in the header area of the cabinet.
Definition: mspack.h:769
struct mshlp_decompressor * mspack_create_hlp_decompressor(struct mspack_system *sys)
Creates a new HLP decompressor.
struct mskwaj_compressor * mspack_create_kwaj_compressor(struct mspack_system *sys)
Creates a new KWAJ compressor.
void mspack_destroy_kwaj_compressor(struct mskwaj_compressor *self)
Destroys an existing KWAJ compressor.
unsigned int length
The uncompressed length of the file, in bytes.
Definition: mspack.h:879
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
unsigned int timestamp
The "timestamp" of the CHM helpfile.
Definition: mspack.h:1274
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
unsigned int length
The length of the cabinet file in bytes.
Definition: mspack.h:716
A compressor for .CHM (Microsoft HTMLHelp) files.
Definition: mspack.h:1409
const char * filename
The filename of the source file that will be added to the CHM.
Definition: mspack.h:1189
int headers
Flags indicating which optional headers were included.
Definition: mspack.h:2012
struct msoab_compressor * mspack_create_oab_compressor(struct mspack_system *sys)
Creates a new OAB compressor.
void mspack_destroy_oab_decompressor(struct msoab_decompressor *self)
Destroys an existing OAB decompressor.
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
void mspack_destroy_chm_compressor(struct mschm_compressor *self)
Destroys an existing CHM compressor.
unsigned int density
The "density" of the quick-reference section in PMGL/PMGI chunks.
Definition: mspack.h:1318
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