dbghelp: Constify some variables.
[wine/dibdrv.git] / dlls / itss / chm_lib.h
blob0413fe3b7c7a2c1275589ede833b62e63bbe81bf
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 /***************************************************************************
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 ***************************************************************************/
41 #ifndef INCLUDED_CHMLIB_H
42 #define INCLUDED_CHMLIB_H
44 typedef ULONGLONG LONGUINT64;
45 typedef LONGLONG LONGINT64;
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)
53 /* structure representing an ITS (CHM) file stream */
54 struct chmFile;
56 /* structure representing an element from an ITS file stream */
57 #define CHM_MAX_PATHLEN (256)
58 struct chmUnitInfo
60 LONGUINT64 start;
61 LONGUINT64 length;
62 int space;
63 WCHAR path[CHM_MAX_PATHLEN+1];
66 struct chmFile* chm_openW(const WCHAR *filename);
68 /* close an ITS archive */
69 void chm_close(struct chmFile *h);
71 /* resolve a particular object from the archive */
72 #define CHM_RESOLVE_SUCCESS (0)
73 #define CHM_RESOLVE_FAILURE (1)
74 int chm_resolve_object(struct chmFile *h,
75 const WCHAR *objPath,
76 struct chmUnitInfo *ui);
78 /* retrieve part of an object from the archive */
79 LONGINT64 chm_retrieve_object(struct chmFile *h,
80 struct chmUnitInfo *ui,
81 unsigned char *buf,
82 LONGUINT64 addr,
83 LONGINT64 len);
85 /* enumerate the objects in the .chm archive */
86 typedef int (*CHM_ENUMERATOR)(struct chmFile *h,
87 struct chmUnitInfo *ui,
88 void *context);
89 #define CHM_ENUMERATE_NORMAL (1)
90 #define CHM_ENUMERATE_META (2)
91 #define CHM_ENUMERATE_SPECIAL (4)
92 #define CHM_ENUMERATE_FILES (8)
93 #define CHM_ENUMERATE_DIRS (16)
94 #define CHM_ENUMERATE_ALL (31)
95 #define CHM_ENUMERATOR_FAILURE (0)
96 #define CHM_ENUMERATOR_CONTINUE (1)
97 #define CHM_ENUMERATOR_SUCCESS (2)
98 int chm_enumerate(struct chmFile *h,
99 int what,
100 CHM_ENUMERATOR e,
101 void *context);
103 int chm_enumerate_dir(struct chmFile *h,
104 const WCHAR *prefix,
105 int what,
106 CHM_ENUMERATOR e,
107 void *context);
109 #endif /* INCLUDED_CHMLIB_H */