Renamed all .cvsignore files to .gitignore.
[wine] / dlls / itss / chm_lib.h
1 /***************************************************************************
2  *             chm_lib.h - CHM archive manipulation routines               *
3  *                           -------------------                           *
4  *                                                                         *
5  *  author:     Jed Wing <jedwin@ugcs.caltech.edu>                         *
6  *  version:    0.3                                                        *
7  *  notes:      These routines are meant for the manipulation of microsoft *
8  *              .chm (compiled html help) files, but may likely be used    *
9  *              for the manipulation of any ITSS archive, if ever ITSS     *
10  *              archives are used for any other purpose.                   *
11  *                                                                         *
12  *              Note also that the section names are statically handled.   *
13  *              To be entirely correct, the section names should be read   *
14  *              from the section names meta-file, and then the various     *
15  *              content sections and the "transforms" to apply to the data *
16  *              they contain should be inferred from the section name and  *
17  *              the meta-files referenced using that name; however, all of *
18  *              the files I've been able to get my hands on appear to have *
19  *              only two sections: Uncompressed and MSCompressed.          *
20  *              Additionally, the ITSS.DLL file included with Windows does *
21  *              not appear to handle any different transforms than the     *
22  *              simple LZX-transform.  Furthermore, the list of transforms *
23  *              to apply is broken, in that only half the required space   *
24  *              is allocated for the list.  (It appears as though the      *
25  *              space is allocated for ASCII strings, but the strings are  *
26  *              written as unicode.  As a result, only the first half of   *
27  *              the string appears.)  So this is probably not too big of   *
28  *              a deal, at least until CHM v4 (MS .lit files), which also  *
29  *              incorporate encryption, of some description.               *
30  ***************************************************************************/
31
32 /***************************************************************************
33  *                                                                         *
34  *   This library is free software; you can redistribute it and/or modify  *
35  *   it under the terms of the GNU Lesser General Public License as        *
36  *   published by the Free Software Foundation; either version 2.1 of the  *
37  *   License, or (at your option) any later version.                       *
38  *                                                                         *
39  ***************************************************************************/
40
41 #ifndef INCLUDED_CHMLIB_H
42 #define INCLUDED_CHMLIB_H
43
44 typedef ULONGLONG LONGUINT64;
45 typedef LONGLONG  LONGINT64;
46
47 /* the two available spaces in a CHM file                      */
48 /* N.B.: The format supports arbitrarily many spaces, but only */
49 /*       two appear to be used at present.                     */
50 #define CHM_UNCOMPRESSED (0)
51 #define CHM_COMPRESSED   (1)
52
53 /* structure representing an ITS (CHM) file stream             */
54 struct chmFile;
55
56 /* structure representing an element from an ITS file stream   */
57 #define CHM_MAX_PATHLEN  (256)
58 struct chmUnitInfo
59 {
60     LONGUINT64         start;
61     LONGUINT64         length;
62     int                space;
63     WCHAR              path[CHM_MAX_PATHLEN+1];
64 };
65
66 struct chmFile* chm_openW(const WCHAR *filename);
67
68 /* close an ITS archive */
69 void chm_close(struct chmFile *h);
70
71 /* methods for ssetting tuning parameters for particular file */
72 #define CHM_PARAM_MAX_BLOCKS_CACHED 0
73 void chm_set_param(struct chmFile *h,
74                    int paramType,
75                    int paramVal);
76
77 /* resolve a particular object from the archive */
78 #define CHM_RESOLVE_SUCCESS (0)
79 #define CHM_RESOLVE_FAILURE (1)
80 int chm_resolve_object(struct chmFile *h,
81                        const WCHAR *objPath,
82                        struct chmUnitInfo *ui);
83
84 /* retrieve part of an object from the archive */
85 LONGINT64 chm_retrieve_object(struct chmFile *h,
86                               struct chmUnitInfo *ui,
87                               unsigned char *buf,
88                               LONGUINT64 addr,
89                               LONGINT64 len);
90
91 /* enumerate the objects in the .chm archive */
92 typedef int (*CHM_ENUMERATOR)(struct chmFile *h,
93                               struct chmUnitInfo *ui,
94                               void *context);
95 #define CHM_ENUMERATE_NORMAL    (1)
96 #define CHM_ENUMERATE_META      (2)
97 #define CHM_ENUMERATE_SPECIAL   (4)
98 #define CHM_ENUMERATE_FILES     (8)
99 #define CHM_ENUMERATE_DIRS      (16)
100 #define CHM_ENUMERATE_ALL       (31)
101 #define CHM_ENUMERATOR_FAILURE  (0)
102 #define CHM_ENUMERATOR_CONTINUE (1)
103 #define CHM_ENUMERATOR_SUCCESS  (2)
104 int chm_enumerate(struct chmFile *h,
105                   int what,
106                   CHM_ENUMERATOR e,
107                   void *context);
108
109 int chm_enumerate_dir(struct chmFile *h,
110                       const WCHAR *prefix,
111                       int what,
112                       CHM_ENUMERATOR e,
113                       void *context);
114
115 #endif /* INCLUDED_CHMLIB_H */