Release 1.1.37.
[wine/gsoc-2012-control.git] / dlls / itss / chm_lib.h
blob0b3718c110b157d899e2dbb17ba1a1dc0826ac3c
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);
77 /* close an ITS archive */
78 void chm_close(struct chmFile *h);
80 /* resolve a particular object from the archive */
81 #define CHM_RESOLVE_SUCCESS (0)
82 #define CHM_RESOLVE_FAILURE (1)
83 int chm_resolve_object(struct chmFile *h,
84 const WCHAR *objPath,
85 struct chmUnitInfo *ui);
87 /* retrieve part of an object from the archive */
88 LONGINT64 chm_retrieve_object(struct chmFile *h,
89 struct chmUnitInfo *ui,
90 unsigned char *buf,
91 LONGUINT64 addr,
92 LONGINT64 len);
94 /* enumerate the objects in the .chm archive */
95 typedef int (*CHM_ENUMERATOR)(struct chmFile *h,
96 struct chmUnitInfo *ui,
97 void *context);
98 #define CHM_ENUMERATE_NORMAL (1)
99 #define CHM_ENUMERATE_META (2)
100 #define CHM_ENUMERATE_SPECIAL (4)
101 #define CHM_ENUMERATE_FILES (8)
102 #define CHM_ENUMERATE_DIRS (16)
103 #define CHM_ENUMERATE_ALL (31)
104 #define CHM_ENUMERATOR_FAILURE (0)
105 #define CHM_ENUMERATOR_CONTINUE (1)
106 #define CHM_ENUMERATOR_SUCCESS (2)
107 int chm_enumerate_dir(struct chmFile *h,
108 const WCHAR *prefix,
109 int what,
110 CHM_ENUMERATOR e,
111 void *context);
113 #endif /* INCLUDED_CHMLIB_H */