libmspack

mspack.h
Go to the documentation of this file.
1 /* libmspack -- a library for working with Microsoft compression formats.
2 * (C) 2003-2019 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
285 struct mspack_system {
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
336 int (*read)(struct mspack_file *file,
337 void *buffer,
338 int bytes);
339
353 int (*write)(struct mspack_file *file,
354 void *buffer,
355 int bytes);
356
380 int (*seek)(struct mspack_file *file,
381 off_t offset,
382 int mode);
383
391 off_t (*tell)(struct mspack_file *file);
392
407 void (*message)(struct mspack_file *file,
408 const char *format,
409 ...);
410
421 void * (*alloc)(struct mspack_system *self,
422 size_t bytes);
423
430 void (*free)(void *ptr);
431
444 void (*copy)(void *src,
445 void *dest,
446 size_t bytes);
447
454 void *null_ptr;
455 };
456
458 #define MSPACK_SYS_OPEN_READ (0)
459
460 #define MSPACK_SYS_OPEN_WRITE (1)
461
462 #define MSPACK_SYS_OPEN_UPDATE (2)
463
464 #define MSPACK_SYS_OPEN_APPEND (3)
465
467 #define MSPACK_SYS_SEEK_START (0)
468
469 #define MSPACK_SYS_SEEK_CUR (1)
470
471 #define MSPACK_SYS_SEEK_END (2)
472
478 struct mspack_file {
479 int dummy;
480 };
481
482 /* --- error codes --------------------------------------------------------- */
483
485 #define MSPACK_ERR_OK (0)
486
487 #define MSPACK_ERR_ARGS (1)
488
489 #define MSPACK_ERR_OPEN (2)
490
491 #define MSPACK_ERR_READ (3)
492
493 #define MSPACK_ERR_WRITE (4)
494
495 #define MSPACK_ERR_SEEK (5)
496
497 #define MSPACK_ERR_NOMEMORY (6)
498
499 #define MSPACK_ERR_SIGNATURE (7)
500
501 #define MSPACK_ERR_DATAFORMAT (8)
502
503 #define MSPACK_ERR_CHECKSUM (9)
504
505 #define MSPACK_ERR_CRUNCH (10)
506
507 #define MSPACK_ERR_DECRUNCH (11)
508
509 /* --- functions available in library -------------------------------------- */
510
515 extern struct mscab_compressor *
516 mspack_create_cab_compressor(struct mspack_system *sys);
517
522 extern struct mscab_decompressor *
523 mspack_create_cab_decompressor(struct mspack_system *sys);
524
528 extern void mspack_destroy_cab_compressor(struct mscab_compressor *self);
529
533 extern void mspack_destroy_cab_decompressor(struct mscab_decompressor *self);
534
535
540 extern struct mschm_compressor *
541 mspack_create_chm_compressor(struct mspack_system *sys);
542
547 extern struct mschm_decompressor *
548 mspack_create_chm_decompressor(struct mspack_system *sys);
549
553 extern void mspack_destroy_chm_compressor(struct mschm_compressor *self);
554
558 extern void mspack_destroy_chm_decompressor(struct mschm_decompressor *self);
559
560
565 extern struct mslit_compressor *
566 mspack_create_lit_compressor(struct mspack_system *sys);
567
572 extern struct mslit_decompressor *
573 mspack_create_lit_decompressor(struct mspack_system *sys);
574
578 extern void mspack_destroy_lit_compressor(struct mslit_compressor *self);
579
583 extern void mspack_destroy_lit_decompressor(struct mslit_decompressor *self);
584
585
590 extern struct mshlp_compressor *
591 mspack_create_hlp_compressor(struct mspack_system *sys);
592
597 extern struct mshlp_decompressor *
598 mspack_create_hlp_decompressor(struct mspack_system *sys);
599
603 extern void mspack_destroy_hlp_compressor(struct mshlp_compressor *self);
604
608 extern void mspack_destroy_hlp_decompressor(struct mshlp_decompressor *self);
609
610
615 extern struct msszdd_compressor *
616 mspack_create_szdd_compressor(struct mspack_system *sys);
617
622 extern struct msszdd_decompressor *
623 mspack_create_szdd_decompressor(struct mspack_system *sys);
624
628 extern void mspack_destroy_szdd_compressor(struct msszdd_compressor *self);
629
633 extern void mspack_destroy_szdd_decompressor(struct msszdd_decompressor *self);
634
635
640 extern struct mskwaj_compressor *
641 mspack_create_kwaj_compressor(struct mspack_system *sys);
642
647 extern struct mskwaj_decompressor *
648 mspack_create_kwaj_decompressor(struct mspack_system *sys);
649
653 extern void mspack_destroy_kwaj_compressor(struct mskwaj_compressor *self);
654
658 extern void mspack_destroy_kwaj_decompressor(struct mskwaj_decompressor *self);
659
660
665 extern struct msoab_compressor *
666 mspack_create_oab_compressor(struct mspack_system *sys);
667
672 extern struct msoab_decompressor *
673 mspack_create_oab_decompressor(struct mspack_system *sys);
674
678 extern void mspack_destroy_oab_compressor(struct msoab_compressor *self);
679
683 extern void mspack_destroy_oab_decompressor(struct msoab_decompressor *self);
684
685
686 /* --- support for .CAB (MS Cabinet) file format --------------------------- */
687
699 struct mscabd_cabinet {
705 struct mscabd_cabinet *next;
706
712 const char *filename;
713
715 off_t base_offset;
716
718 unsigned int length;
719
721 struct mscabd_cabinet *prevcab;
722
724 struct mscabd_cabinet *nextcab;
725
727 char *prevname;
728
730 char *nextname;
731
735 char *previnfo;
736
740 char *nextinfo;
741
743 struct mscabd_file *files;
744
746 struct mscabd_folder *folders;
747
752 unsigned short set_id;
753
759 unsigned short set_index;
760
771 unsigned short header_resv;
772
784 int flags;
785 };
786
788 #define MSCAB_HDR_RESV_OFFSET (0x28)
789
791 #define MSCAB_HDR_PREVCAB (0x01)
792
793 #define MSCAB_HDR_NEXTCAB (0x02)
794
795 #define MSCAB_HDR_RESV (0x04)
796
806 struct mscabd_folder {
811 struct mscabd_folder *next;
812
822 int comp_type;
823
829 unsigned int num_blocks;
830 };
831
839 #define MSCABD_COMP_METHOD(comp_type) ((comp_type) & 0x0F)
840
847 #define MSCABD_COMP_LEVEL(comp_type) (((comp_type) >> 8) & 0x1F)
848
850 #define MSCAB_COMP_NONE (0)
851
852 #define MSCAB_COMP_MSZIP (1)
853
854 #define MSCAB_COMP_QUANTUM (2)
855
856 #define MSCAB_COMP_LZX (3)
857
863 struct mscabd_file {
868 struct mscabd_file *next;
869
878 char *filename;
879
881 unsigned int length;
882
895 int attribs;
896
898 char time_h;
900 char time_m;
902 char time_s;
903
905 char date_d;
907 char date_m;
909 int date_y;
910
912 struct mscabd_folder *folder;
913
915 unsigned int offset;
916 };
917
919 #define MSCAB_ATTRIB_RDONLY (0x01)
920
921 #define MSCAB_ATTRIB_HIDDEN (0x02)
922
923 #define MSCAB_ATTRIB_SYSTEM (0x04)
924
925 #define MSCAB_ATTRIB_ARCH (0x20)
926
927 #define MSCAB_ATTRIB_EXEC (0x40)
928
929 #define MSCAB_ATTRIB_UTF_NAME (0x80)
930
932 #define MSCABD_PARAM_SEARCHBUF (0)
933
934 #define MSCABD_PARAM_FIXMSZIP (1)
935
936 #define MSCABD_PARAM_DECOMPBUF (2)
937
943 #define MSCABD_PARAM_SALVAGE (3)
944
946 struct mscab_compressor {
947 int dummy;
948 };
949
957 struct mscab_decompressor {
978 struct mscabd_cabinet * (*open) (struct mscab_decompressor *self,
979 const char *filename);
980
1010 void (*close)(struct mscab_decompressor *self,
1011 struct mscabd_cabinet *cab);
1012
1047 struct mscabd_cabinet * (*search) (struct mscab_decompressor *self,
1048 const char *filename);
1049
1090 int (*append) (struct mscab_decompressor *self,
1091 struct mscabd_cabinet *cab,
1092 struct mscabd_cabinet *nextcab);
1093
1112 int (*prepend) (struct mscab_decompressor *self,
1113 struct mscabd_cabinet *cab,
1114 struct mscabd_cabinet *prevcab);
1115
1138 int (*extract)(struct mscab_decompressor *self,
1139 struct mscabd_file *file,
1140 const char *filename);
1141
1164 int (*set_param)(struct mscab_decompressor *self,
1165 int param,
1166 int value);
1167
1179 int (*last_error)(struct mscab_decompressor *self);
1180 };
1181
1182 /* --- support for .CHM (HTMLHelp) file format ----------------------------- */
1183
1192 struct mschmc_file {
1194 int section;
1195
1198 const char *filename;
1199
1202 char *chm_filename;
1203
1207 off_t length;
1208 };
1209
1218 struct mschmd_section {
1220 struct mschmd_header *chm;
1221
1227 unsigned int id;
1228 };
1229
1235 struct mschmd_sec_uncompressed {
1237 struct mschmd_section base;
1238
1240 off_t offset;
1241 };
1242
1248 struct mschmd_sec_mscompressed {
1250 struct mschmd_section base;
1251
1253 struct mschmd_file *content;
1254
1256 struct mschmd_file *control;
1257
1259 struct mschmd_file *rtable;
1260
1264 struct mschmd_file *spaninfo;
1265 };
1266
1272 struct mschmd_header {
1274 unsigned int version;
1275
1283 unsigned int timestamp;
1284
1289 unsigned int language;
1290
1295 const char *filename;
1296
1298 off_t length;
1299
1301 struct mschmd_file *files;
1302
1309 struct mschmd_file *sysfiles;
1310
1312 struct mschmd_sec_uncompressed sec0;
1313
1315 struct mschmd_sec_mscompressed sec1;
1316
1318 off_t dir_offset;
1319
1321 unsigned int num_chunks;
1322
1324 unsigned int chunk_size;
1325
1327 unsigned int density;
1328
1337 unsigned int depth;
1338
1344 unsigned int index_root;
1345
1350 unsigned int first_pmgl;
1351
1356 unsigned int last_pmgl;
1357
1362 unsigned char **chunk_cache;
1363 };
1364
1370 struct mschmd_file {
1375 struct mschmd_file *next;
1376
1381 struct mschmd_section *section;
1382
1384 off_t offset;
1385
1387 off_t length;
1388
1390 char *filename;
1391 };
1392
1394 #define MSCHMC_ENDLIST (0)
1395
1396 #define MSCHMC_UNCOMP (1)
1397
1398 #define MSCHMC_MSCOMP (2)
1399
1401 #define MSCHMC_PARAM_TIMESTAMP (0)
1402
1403 #define MSCHMC_PARAM_LANGUAGE (1)
1404
1405 #define MSCHMC_PARAM_LZXWINDOW (2)
1406
1407 #define MSCHMC_PARAM_DENSITY (3)
1408
1409 #define MSCHMC_PARAM_INDEX (4)
1410
1418 struct mschm_compressor {
1450 int (*generate)(struct mschm_compressor *self,
1451 struct mschmc_file file_list[],
1452 const char *output_file);
1453
1507 int (*use_temporary_file)(struct mschm_compressor *self,
1508 int use_temp_file,
1509 const char *temp_file);
1555 int (*set_param)(struct mschm_compressor *self,
1556 int param,
1557 int value);
1558
1567 int (*last_error)(struct mschm_compressor *self);
1568 };
1569
1577 struct mschm_decompressor {
1598 struct mschmd_header *(*open)(struct mschm_decompressor *self,
1599 const char *filename);
1600
1618 void (*close)(struct mschm_decompressor *self,
1619 struct mschmd_header *chm);
1620
1639 int (*extract)(struct mschm_decompressor *self,
1640 struct mschmd_file *file,
1641 const char *filename);
1642
1654 int (*last_error)(struct mschm_decompressor *self);
1655
1678 struct mschmd_header *(*fast_open)(struct mschm_decompressor *self,
1679 const char *filename);
1680
1719 int (*fast_find)(struct mschm_decompressor *self,
1720 struct mschmd_header *chm,
1721 const char *filename,
1722 struct mschmd_file *f_ptr,
1723 int f_size);
1724 };
1725
1726 /* --- support for .LIT (EBook) file format -------------------------------- */
1727
1729 struct mslit_compressor {
1730 int dummy;
1731 };
1732
1734 struct mslit_decompressor {
1735 int dummy;
1736 };
1737
1738
1739 /* --- support for .HLP (MS Help) file format ------------------------------ */
1740
1742 struct mshlp_compressor {
1743 int dummy;
1744 };
1745
1747 struct mshlp_decompressor {
1748 int dummy;
1749 };
1750
1751
1752 /* --- support for SZDD file format ---------------------------------------- */
1753
1755 #define MSSZDDC_PARAM_MISSINGCHAR (0)
1756
1758 #define MSSZDD_FMT_NORMAL (0)
1759
1761 #define MSSZDD_FMT_QBASIC (1)
1762
1768 struct msszddd_header {
1770 int format;
1771
1773 off_t length;
1774
1782 char missing_char;
1783 };
1784
1792 struct msszdd_compressor {
1828 int (*compress)(struct msszdd_compressor *self,
1829 const char *input,
1830 const char *output,
1831 off_t length);
1832
1854 int (*set_param)(struct msszdd_compressor *self,
1855 int param,
1856 int value);
1857
1866 int (*last_error)(struct mschm_decompressor *self);
1867 };
1868
1876 struct msszdd_decompressor {
1896 struct msszddd_header *(*open)(struct msszdd_decompressor *self,
1897 const char *filename);
1898
1912 void (*close)(struct msszdd_decompressor *self,
1913 struct msszddd_header *szdd);
1914
1928 int (*extract)(struct msszdd_decompressor *self,
1929 struct msszddd_header *szdd,
1930 const char *filename);
1931
1949 int (*decompress)(struct msszdd_decompressor *self,
1950 const char *input,
1951 const char *output);
1952
1964 int (*last_error)(struct msszdd_decompressor *self);
1965 };
1966
1967 /* --- support for KWAJ file format ---------------------------------------- */
1968
1970 #define MSKWAJC_PARAM_COMP_TYPE (0)
1971
1975 #define MSKWAJC_PARAM_INCLUDE_LENGTH (1)
1976
1978 #define MSKWAJ_COMP_NONE (0)
1979
1980 #define MSKWAJ_COMP_XOR (1)
1981
1982 #define MSKWAJ_COMP_SZDD (2)
1983
1984 #define MSKWAJ_COMP_LZH (3)
1985
1986 #define MSKWAJ_COMP_MSZIP (4)
1987
1989 #define MSKWAJ_HDR_HASLENGTH (0x01)
1990
1992 #define MSKWAJ_HDR_HASUNKNOWN1 (0x02)
1993
1995 #define MSKWAJ_HDR_HASUNKNOWN2 (0x04)
1996
1998 #define MSKWAJ_HDR_HASFILENAME (0x08)
1999
2001 #define MSKWAJ_HDR_HASFILEEXT (0x10)
2002
2004 #define MSKWAJ_HDR_HASEXTRATEXT (0x20)
2005
2011 struct mskwajd_header {
2015 unsigned short comp_type;
2016
2018 off_t data_offset;
2019
2021 int headers;
2022
2024 off_t length;
2025
2027 char *filename;
2028
2032 char *extra;
2033
2035 unsigned short extra_length;
2036 };
2037
2045 struct mskwaj_compressor {
2064 int (*compress)(struct mskwaj_compressor *self,
2065 const char *input,
2066 const char *output,
2067 off_t length);
2068
2092 int (*set_param)(struct mskwaj_compressor *self,
2093 int param,
2094 int value);
2095
2096
2114 int (*set_filename)(struct mskwaj_compressor *self,
2115 const char *filename);
2116
2134 int (*set_extra_data)(struct mskwaj_compressor *self,
2135 void *data,
2136 size_t bytes);
2137
2146 int (*last_error)(struct mschm_decompressor *self);
2147 };
2148
2156 struct mskwaj_decompressor {
2176 struct mskwajd_header *(*open)(struct mskwaj_decompressor *self,
2177 const char *filename);
2178
2191 void (*close)(struct mskwaj_decompressor *self,
2192 struct mskwajd_header *kwaj);
2193
2207 int (*extract)(struct mskwaj_decompressor *self,
2208 struct mskwajd_header *kwaj,
2209 const char *filename);
2210
2228 int (*decompress)(struct mskwaj_decompressor *self,
2229 const char *input,
2230 const char *output);
2231
2243 int (*last_error)(struct mskwaj_decompressor *self);
2244 };
2245
2246 /* --- support for .LZX (Offline Address Book) file format ----------------- */
2247
2255 struct msoab_compressor {
2270 int (*compress) (struct msoab_compressor *self,
2271 const char *input,
2272 const char *output);
2273
2294 int (*compress_incremental) (struct msoab_compressor *self,
2295 const char *input,
2296 const char *base,
2297 const char *output);
2298 };
2299
2307 struct msoab_decompressor {
2323 int (*decompress) (struct msoab_decompressor *self,
2324 const char *input,
2325 const char *output);
2326
2352 int (*decompress_incremental) (struct msoab_decompressor *self,
2353 const char *input,
2354 const char *base,
2355 const char *output);
2356
2372 int (*set_param)(struct msoab_decompressor *self,
2373 int param,
2374 int value);
2375
2376 };
2377
2379 #define MSOABD_PARAM_DECOMPBUF (0)
2380
2381 #ifdef __cplusplus
2382 }
2383 #endif
2384
2385 #endif
mspack_system::copy
void(* copy)(void *src, void *dest, size_t bytes)
Copies from one region of memory to another.
Definition: mspack.h:444
msszdd_decompressor
A decompressor for SZDD compressed files.
Definition: mspack.h:1876
mscabd_file::offset
unsigned int offset
The uncompressed offset of this file in its folder.
Definition: mspack.h:915
mspack_create_oab_decompressor
struct msoab_decompressor * mspack_create_oab_decompressor(struct mspack_system *sys)
Creates a new OAB decompressor.
mskwaj_compressor
A compressor for the KWAJ file format.
Definition: mspack.h:2045
mspack_create_szdd_compressor
struct msszdd_compressor * mspack_create_szdd_compressor(struct mspack_system *sys)
Creates a new SZDD compressor.
mspack_destroy_lit_compressor
void mspack_destroy_lit_compressor(struct mslit_compressor *self)
Destroys an existing LIT compressor.
mspack_system::message
void(* message)(struct mspack_file *file, const char *format,...)
Used to send messages from the library to the user.
Definition: mspack.h:407
mspack_create_cab_compressor
struct mscab_compressor * mspack_create_cab_compressor(struct mspack_system *sys)
Creates a new CAB compressor.
mscabd_file::filename
char * filename
The filename of the file.
Definition: mspack.h:878
mspack_create_chm_decompressor
struct mschm_decompressor * mspack_create_chm_decompressor(struct mspack_system *sys)
Creates a new CHM decompressor.
mspack_system::tell
off_t(* tell)(struct mspack_file *file)
Returns the current file position (in bytes) of the given file.
Definition: mspack.h:391
mspack_system::write
int(* write)(struct mspack_file *file, void *buffer, int bytes)
Writes a given number of bytes to an open file.
Definition: mspack.h:353
mschmd_file::offset
off_t offset
The offset within the section data that this file is located at.
Definition: mspack.h:1384
mspack_destroy_hlp_compressor
void mspack_destroy_hlp_compressor(struct mshlp_compressor *self)
Destroys an existing hlp compressor.
msszddd_header::missing_char
char missing_char
The last character in the filename, traditionally replaced with an underscore to show the file is com...
Definition: mspack.h:1782
mschmd_header::language
unsigned int language
The default Language and Country ID (LCID) of the user who ran the HTMLHelp Compiler.
Definition: mspack.h:1289
mschmc_file
A structure which represents a file to be placed in a CHM helpfile.
Definition: mspack.h:1192
mspack_file::dummy
int dummy
Definition: mspack.h:479
mspack_create_szdd_decompressor
struct msszdd_decompressor * mspack_create_szdd_decompressor(struct mspack_system *sys)
Creates a new SZDD decompressor.
mscabd_cabinet::set_id
unsigned short set_id
The set ID of the cabinet.
Definition: mspack.h:752
mschmd_sec_mscompressed
A structure which represents the LZX compressed section of a CHM helpfile.
Definition: mspack.h:1248
mscabd_file::date_d
char date_d
File&#39;s last modified date, day field.
Definition: mspack.h:905
mspack_create_hlp_compressor
struct mshlp_compressor * mspack_create_hlp_compressor(struct mspack_system *sys)
Creates a new HLP compressor.
mscabd_folder::comp_type
int comp_type
The compression format used by this folder.
Definition: mspack.h:822
mspack_create_kwaj_decompressor
struct mskwaj_decompressor * mspack_create_kwaj_decompressor(struct mspack_system *sys)
Creates a new KWAJ decompressor.
mspack_destroy_szdd_compressor
void mspack_destroy_szdd_compressor(struct msszdd_compressor *self)
Destroys an existing SZDD compressor.
mscabd_cabinet::nextinfo
char * nextinfo
The name of the disk containing the next cabinet in a cabinet set, or NULL.
Definition: mspack.h:740
mspack_destroy_hlp_decompressor
void mspack_destroy_hlp_decompressor(struct mshlp_decompressor *self)
Destroys an existing hlp decompressor.
mscabd_file::folder
struct mscabd_folder * folder
A pointer to the folder that contains this file.
Definition: mspack.h:912
msszdd_compressor::last_error
int(* last_error)(struct mschm_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1866
mschm_decompressor
A decompressor for .CHM (Microsoft HTMLHelp) files.
Definition: mspack.h:1577
mspack_system
A structure which abstracts file I/O and memory management.
Definition: mspack.h:285
mschmd_section
A structure which represents a section of a CHM helpfile.
Definition: mspack.h:1218
mshlp_decompressor
TODO.
Definition: mspack.h:1747
mspack_sys_selftest_internal
int mspack_sys_selftest_internal(int)
Part of the MSPACK_SYS_SELFTEST() macro, must not be used directly.
mschmd_section::chm
struct mschmd_header * chm
A pointer to the CHM helpfile that contains this section.
Definition: mspack.h:1220
msszdd_decompressor::last_error
int(* last_error)(struct msszdd_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1964
mschmd_file::filename
char * filename
The filename of this file – a null terminated string in UTF-8.
Definition: mspack.h:1390
mschm_decompressor::fast_find
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:1719
mslit_decompressor
TODO.
Definition: mspack.h:1734
mscab_decompressor::append
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:1090
msoab_compressor
A compressor for the Offline Address Book (OAB) format.
Definition: mspack.h:2255
mscabd_cabinet::next
struct mscabd_cabinet * next
The next cabinet in a chained list, if this cabinet was opened with mscab_decompressor::search().
Definition: mspack.h:705
mscabd_cabinet::prevname
char * prevname
The filename of the previous cabinet in a cabinet set, or NULL.
Definition: mspack.h:727
msszddd_header::format
int format
The file format; either MSSZDD_FMT_NORMAL or MSSZDD_FMT_QBASIC.
Definition: mspack.h:1770
mscabd_folder
A structure which represents a single folder in a cabinet or cabinet set.
Definition: mspack.h:806
mscabd_folder::num_blocks
unsigned int num_blocks
The total number of data blocks used by this folder.
Definition: mspack.h:829
mschmd_header::index_root
unsigned int index_root
The number of the root PMGI chunk.
Definition: mspack.h:1344
msoab_decompressor
A decompressor for .LZX (Offline Address Book) files.
Definition: mspack.h:2307
mscabd_file::attribs
int attribs
File attributes.
Definition: mspack.h:895
mscab_compressor
TODO.
Definition: mspack.h:946
mskwajd_header
A structure which represents an KWAJ compressed file.
Definition: mspack.h:2011
mspack_system::read
int(* read)(struct mspack_file *file, void *buffer, int bytes)
Reads a given number of bytes from an open file.
Definition: mspack.h:336
mspack_system::seek
int(* seek)(struct mspack_file *file, off_t offset, int mode)
Seeks to a specific file offset within an open file.
Definition: mspack.h:380
mspack_create_lit_compressor
struct mslit_compressor * mspack_create_lit_compressor(struct mspack_system *sys)
Creates a new LIT compressor.
mschmd_sec_mscompressed::rtable
struct mschmd_file * rtable
A pointer to the file which contains the LZX reset table.
Definition: mspack.h:1259
mscabd_cabinet::prevcab
struct mscabd_cabinet * prevcab
The previous cabinet in a cabinet set, or NULL.
Definition: mspack.h:721
mschmd_sec_mscompressed::spaninfo
struct mschmd_file * spaninfo
A pointer to the file which contains the LZX span information.
Definition: mspack.h:1264
mspack_destroy_lit_decompressor
void mspack_destroy_lit_decompressor(struct mslit_decompressor *self)
Destroys an existing LIT decompressor.
mscabd_cabinet::files
struct mscabd_file * files
A list of all files in the cabinet or cabinet set.
Definition: mspack.h:743
mschmd_sec_mscompressed::content
struct mschmd_file * content
A pointer to the meta-file which represents all LZX compressed data.
Definition: mspack.h:1253
mschmd_header::sysfiles
struct mschmd_file * sysfiles
A list of all system files in the CHM helpfile.
Definition: mspack.h:1309
mskwaj_compressor::set_param
int(* set_param)(struct mskwaj_compressor *self, int param, int value)
Sets an KWAJ compression engine parameter.
Definition: mspack.h:2092
msoab_decompressor::decompress_incremental
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:2352
mspack_destroy_szdd_decompressor
void mspack_destroy_szdd_decompressor(struct msszdd_decompressor *self)
Destroys an existing SZDD decompressor.
mschmd_sec_uncompressed::offset
off_t offset
The file offset of where this section begins in the CHM helpfile.
Definition: mspack.h:1240
mspack_create_chm_compressor
struct mschm_compressor * mspack_create_chm_compressor(struct mspack_system *sys)
Creates a new CHM compressor.
mspack_system::close
void(* close)(struct mspack_file *file)
Closes a previously opened file.
Definition: mspack.h:321
mspack_system::null_ptr
void * null_ptr
A null pointer to mark the end of mspack_system.
Definition: mspack.h:454
mspack_file
A structure which represents an open file handle.
Definition: mspack.h:478
mskwaj_decompressor::last_error
int(* last_error)(struct mskwaj_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:2243
mschmd_header::length
off_t length
The length of the CHM helpfile, in bytes.
Definition: mspack.h:1298
mspack_system::free
void(* free)(void *ptr)
Frees memory.
Definition: mspack.h:430
mscabd_cabinet::previnfo
char * previnfo
The name of the disk containing the previous cabinet in a cabinet set, or NULL.
Definition: mspack.h:735
mschmd_header::files
struct mschmd_file * files
A list of all non-system files in the CHM helpfile.
Definition: mspack.h:1301
mskwajd_header::length
off_t length
The amount of uncompressed data in the file, or 0 if not present.
Definition: mspack.h:2024
mskwaj_compressor::last_error
int(* last_error)(struct mschm_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:2146
mshlp_compressor::dummy
int dummy
Definition: mspack.h:1743
mscabd_file::time_h
char time_h
File&#39;s last modified time, hour field.
Definition: mspack.h:898
mspack_version
int mspack_version(int entity)
Enquire about the binary compatibility version of a specific interface in the library.
mscabd_file
A structure which represents a single file in a cabinet or cabinet set.
Definition: mspack.h:863
mscabd_folder::next
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:811
mschmd_header::first_pmgl
unsigned int first_pmgl
The number of the first PMGL chunk.
Definition: mspack.h:1350
mschmd_file
A structure which represents a file stored in a CHM helpfile.
Definition: mspack.h:1370
mscabd_file::date_m
char date_m
File&#39;s last modified date, month field.
Definition: mspack.h:907
mschmd_header::num_chunks
unsigned int num_chunks
The number of PMGL/PMGI directory chunks in this CHM helpfile.
Definition: mspack.h:1321
mschmd_header::chunk_size
unsigned int chunk_size
The size of each PMGL/PMGI chunk, in bytes.
Definition: mspack.h:1324
mscab_decompressor
A decompressor for .CAB (Microsoft Cabinet) files.
Definition: mspack.h:957
mschmd_header::last_pmgl
unsigned int last_pmgl
The number of the last PMGL chunk.
Definition: mspack.h:1356
mschmd_header::version
unsigned int version
The version of the CHM file format used in this file.
Definition: mspack.h:1274
mscabd_cabinet::nextname
char * nextname
The filename of the next cabinet in a cabinet set, or NULL.
Definition: mspack.h:730
msoab_decompressor::set_param
int(* set_param)(struct msoab_decompressor *self, int param, int value)
Sets an OAB decompression engine parameter.
Definition: mspack.h:2372
mspack_destroy_cab_compressor
void mspack_destroy_cab_compressor(struct mscab_compressor *self)
Destroys an existing CAB compressor.
mschmd_file::section
struct mschmd_section * section
A pointer to the section that this file is located in.
Definition: mspack.h:1381
mscab_decompressor::last_error
int(* last_error)(struct mscab_decompressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1179
mscabd_file::time_s
char time_s
File&#39;s last modified time, second field.
Definition: mspack.h:902
mschmd_header
A structure which represents a CHM helpfile.
Definition: mspack.h:1272
mscabd_cabinet::nextcab
struct mscabd_cabinet * nextcab
The next cabinet in a cabinet set, or NULL.
Definition: mspack.h:724
mschmd_file::length
off_t length
The length of this file, in bytes.
Definition: mspack.h:1387
mscabd_cabinet
A structure which represents a single cabinet file.
Definition: mspack.h:699
mscabd_cabinet::set_index
unsigned short set_index
The index number of the cabinet within the set.
Definition: mspack.h:759
mschmc_file::section
int section
One of MSCHMC_ENDLIST, MSCHMC_UNCOMP or MSCHMC_MSCOMP.
Definition: mspack.h:1194
mskwajd_header::extra
char * extra
extra uncompressed data (usually text) in the header.
Definition: mspack.h:2032
mschmd_header::dir_offset
off_t dir_offset
The file offset of the first PMGL/PMGI directory chunk.
Definition: mspack.h:1318
mskwajd_header::filename
char * filename
output filename, or NULL if not present
Definition: mspack.h:2027
mspack_destroy_kwaj_decompressor
void mspack_destroy_kwaj_decompressor(struct mskwaj_decompressor *self)
Destroys an existing KWAJ decompressor.
msszdd_compressor
A compressor for the SZDD file format.
Definition: mspack.h:1792
mschmd_header::chunk_cache
unsigned char ** chunk_cache
A cache of loaded chunks, filled in by mschm_decoder::fast_find().
Definition: mspack.h:1362
mspack_create_cab_decompressor
struct mscab_decompressor * mspack_create_cab_decompressor(struct mspack_system *sys)
Creates a new CAB decompressor.
mscabd_cabinet::filename
const char * filename
The filename of the cabinet.
Definition: mspack.h:712
mshlp_compressor
TODO.
Definition: mspack.h:1742
mslit_compressor
TODO.
Definition: mspack.h:1729
msszddd_header::length
off_t length
The amount of data in the SZDD file once uncompressed.
Definition: mspack.h:1773
mshlp_decompressor::dummy
int dummy
Definition: mspack.h:1748
mschmd_file::next
struct mschmd_file * next
A pointer to the next file in the list, or NULL if this is the final file.
Definition: mspack.h:1375
mslit_compressor::dummy
int dummy
Definition: mspack.h:1730
msszdd_compressor::set_param
int(* set_param)(struct msszdd_compressor *self, int param, int value)
Sets an SZDD compression engine parameter.
Definition: mspack.h:1854
mschmd_header::filename
const char * filename
The filename of the CHM helpfile.
Definition: mspack.h:1295
mspack_create_lit_decompressor
struct mslit_decompressor * mspack_create_lit_decompressor(struct mspack_system *sys)
Creates a new LIT decompressor.
mscabd_file::date_y
int date_y
File&#39;s last modified date, year field.
Definition: mspack.h:909
mskwaj_compressor::set_filename
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:2114
mskwajd_header::comp_type
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:2015
mscabd_cabinet::flags
int flags
Header flags.
Definition: mspack.h:784
mscabd_file::time_m
char time_m
File&#39;s last modified time, minute field.
Definition: mspack.h:900
mskwaj_compressor::set_extra_data
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:2134
mschmc_file::length
off_t length
The length of the file, in bytes.
Definition: mspack.h:1207
mscab_compressor::dummy
int dummy
Definition: mspack.h:947
mschm_compressor::last_error
int(* last_error)(struct mschm_compressor *self)
Returns the error code set by the most recently called method.
Definition: mspack.h:1567
mslit_decompressor::dummy
int dummy
Definition: mspack.h:1735
mschmd_section::id
unsigned int id
The section ID.
Definition: mspack.h:1227
mskwajd_header::extra_length
unsigned short extra_length
length of extra uncompressed data in the header
Definition: mspack.h:2035
mschmd_header::depth
unsigned int depth
The depth of the index tree.
Definition: mspack.h:1337
msszddd_header
A structure which represents an SZDD compressed file.
Definition: mspack.h:1768
mschm_compressor::set_param
int(* set_param)(struct mschm_compressor *self, int param, int value)
Sets a CHM compression engine parameter.
Definition: mspack.h:1555
mschmd_sec_mscompressed::control
struct mschmd_file * control
A pointer to the file which contains the LZX control data.
Definition: mspack.h:1256
mspack_destroy_chm_decompressor
void mspack_destroy_chm_decompressor(struct mschm_decompressor *self)
Destroys an existing CHM decompressor.
mscabd_cabinet::folders
struct mscabd_folder * folders
A list of all folders in the cabinet or cabinet set.
Definition: mspack.h:746
mskwajd_header::data_offset
off_t data_offset
The offset in the file where the compressed data stream begins.
Definition: mspack.h:2018
mskwaj_decompressor
A decompressor for KWAJ compressed files.
Definition: mspack.h:2156
mschmc_file::chm_filename
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:1202
mspack_destroy_cab_decompressor
void mspack_destroy_cab_decompressor(struct mscab_decompressor *self)
Destroys an existing CAB decompressor.
mspack_destroy_oab_compressor
void mspack_destroy_oab_compressor(struct msoab_compressor *self)
Destroys an existing OAB compressor.
mschmd_sec_uncompressed
A structure which represents the uncompressed section of a CHM helpfile.
Definition: mspack.h:1235
mscabd_cabinet::base_offset
off_t base_offset
The file offset of cabinet within the physical file it resides in.
Definition: mspack.h:715
mscabd_cabinet::header_resv
unsigned short header_resv
The number of bytes reserved in the header area of the cabinet.
Definition: mspack.h:771
mspack_create_hlp_decompressor
struct mshlp_decompressor * mspack_create_hlp_decompressor(struct mspack_system *sys)
Creates a new HLP decompressor.
mspack_create_kwaj_compressor
struct mskwaj_compressor * mspack_create_kwaj_compressor(struct mspack_system *sys)
Creates a new KWAJ compressor.
mspack_destroy_kwaj_compressor
void mspack_destroy_kwaj_compressor(struct mskwaj_compressor *self)
Destroys an existing KWAJ compressor.
mscabd_file::length
unsigned int length
The uncompressed length of the file, in bytes.
Definition: mspack.h:881
mschmd_header::timestamp
unsigned int timestamp
The "timestamp" of the CHM helpfile.
Definition: mspack.h:1283
mscabd_file::next
struct mscabd_file * next
The next file in the cabinet or cabinet set, or NULL if this is the final file.
Definition: mspack.h:868
mscabd_cabinet::length
unsigned int length
The length of the cabinet file in bytes.
Definition: mspack.h:718
mschm_compressor
A compressor for .CHM (Microsoft HTMLHelp) files.
Definition: mspack.h:1418
mschmc_file::filename
const char * filename
The filename of the source file that will be added to the CHM.
Definition: mspack.h:1198
mskwajd_header::headers
int headers
Flags indicating which optional headers were included.
Definition: mspack.h:2021
mspack_create_oab_compressor
struct msoab_compressor * mspack_create_oab_compressor(struct mspack_system *sys)
Creates a new OAB compressor.
mspack_destroy_oab_decompressor
void mspack_destroy_oab_decompressor(struct msoab_decompressor *self)
Destroys an existing OAB decompressor.
mspack_destroy_chm_compressor
void mspack_destroy_chm_compressor(struct mschm_compressor *self)
Destroys an existing CHM compressor.
mschmd_header::density
unsigned int density
The "density" of the quick-reference section in PMGL/PMGI chunks.
Definition: mspack.h:1327
msoab_compressor::compress_incremental
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:2294