wininet: Support the Cache-Control max-age directive for setting url cache entry...
[wine/testsucceed.git] / dlls / itss / chm_lib.h
blobfcd17b50cbfbda5a23a313ea8330fdbfc3d55009
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 ***************************************************************************/
32 /***************************************************************************
34 * This library is free software; you can redistribute it and/or
35 * modify it under the terms of the GNU Lesser General Public
36 * License as published by the Free Software Foundation; either
37 * version 2.1 of the License, or (at your option) any later version.
39 * This library is distributed in the hope that it will be useful,
40 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42 * Lesser General Public License for more details.
44 * You should have received a copy of the GNU Lesser General Public
45 * License along with this library; if not, write to the Free Software
46 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
48 ***************************************************************************/
50 #ifndef INCLUDED_CHMLIB_H
51 #define INCLUDED_CHMLIB_H
53 typedef ULONGLONG LONGUINT64;
54 typedef LONGLONG LONGINT64;
56 /* the two available spaces in a CHM file */
57 /* N.B.: The format supports arbitrarily many spaces, but only */
58 /* two appear to be used at present. */
59 #define CHM_UNCOMPRESSED (0)
60 #define CHM_COMPRESSED (1)
62 /* structure representing an ITS (CHM) file stream */
63 struct chmFile;
65 /* structure representing an element from an ITS file stream */
66 #define CHM_MAX_PATHLEN (256)
67 struct chmUnitInfo
69 LONGUINT64 start;
70 LONGUINT64 length;
71 int space;
72 WCHAR path[CHM_MAX_PATHLEN+1];
75 struct chmFile* chm_openW(const WCHAR *filename);
76 struct chmFile *chm_dup(struct chmFile *oldHandle);
78 /* close an ITS archive */
79 void chm_close(struct chmFile *h);
81 /* resolve a particular object from the archive */
82 #define CHM_RESOLVE_SUCCESS (0)
83 #define CHM_RESOLVE_FAILURE (1)
84 int chm_resolve_object(struct chmFile *h,
85 const WCHAR *objPath,
86 struct chmUnitInfo *ui);
88 /* retrieve part of an object from the archive */
89 LONGINT64 chm_retrieve_object(struct chmFile *h,
90 struct chmUnitInfo *ui,
91 unsigned char *buf,
92 LONGUINT64 addr,
93 LONGINT64 len);
95 /* enumerate the objects in the .chm archive */
96 typedef int (*CHM_ENUMERATOR)(struct chmFile *h,
97 struct chmUnitInfo *ui,
98 void *context);
99 #define CHM_ENUMERATE_NORMAL (1)
100 #define CHM_ENUMERATE_META (2)
101 #define CHM_ENUMERATE_SPECIAL (4)
102 #define CHM_ENUMERATE_FILES (8)
103 #define CHM_ENUMERATE_DIRS (16)
104 #define CHM_ENUMERATE_ALL (31)
105 #define CHM_ENUMERATOR_FAILURE (0)
106 #define CHM_ENUMERATOR_CONTINUE (1)
107 #define CHM_ENUMERATOR_SUCCESS (2)
108 int chm_enumerate_dir(struct chmFile *h,
109 const WCHAR *prefix,
110 int what,
111 CHM_ENUMERATOR e,
112 void *context);
114 #endif /* INCLUDED_CHMLIB_H */