ReactOS  0.4.15-dev-1206-g731eddf
chm_lib.h
Go to the documentation of this file.
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
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.
38  *
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.
43  *
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
47  *
48  ***************************************************************************/
49 
50 #ifndef INCLUDED_CHMLIB_H
51 #define INCLUDED_CHMLIB_H
52 
55 
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)
61 
62 /* structure representing an ITS (CHM) file stream */
63 struct chmFile;
64 
65 /* structure representing an element from an ITS file stream */
66 #define CHM_MAX_PATHLEN (256)
68 {
71  int space;
73 };
74 
76 struct chmFile *chm_dup(struct chmFile *oldHandle) DECLSPEC_HIDDEN;
77 
78 /* close an ITS archive */
79 void chm_close(struct chmFile *h) DECLSPEC_HIDDEN;
80 
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,
87 
88 /* retrieve part of an object from the archive */
90  struct chmUnitInfo *ui,
91  unsigned char *buf,
94 
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)
109  const WCHAR *prefix,
110  int what,
112  void *context) DECLSPEC_HIDDEN;
113 
114 #endif /* INCLUDED_CHMLIB_H */
#define CHM_MAX_PATHLEN
Definition: chm_lib.h:66
LONGLONG LONGINT64
Definition: chm_lib.h:54
Definition: http.c:7094
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LONGINT64 chm_retrieve_object(struct chmFile *h, struct chmUnitInfo *ui, unsigned char *buf, LONGUINT64 addr, LONGINT64 len) DECLSPEC_HIDDEN
Definition: chm_lib.c:1342
UINT ui
Definition: oleauto.h:49
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
const char * filename
Definition: ioapi.h:135
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
unsigned int BOOL
Definition: ntddk_ex.h:94
#define e
Definition: ke_i.h:82
int chm_resolve_object(struct chmFile *h, const WCHAR *objPath, struct chmUnitInfo *ui) DECLSPEC_HIDDEN
Definition: chm_lib.c:1048
LONGUINT64 start
Definition: chm_lib.h:69
void chm_close(struct chmFile *h) DECLSPEC_HIDDEN
Definition: chm_lib.c:863
BOOL chm_enumerate_dir(struct chmFile *h, const WCHAR *prefix, int what, CHM_ENUMERATOR e, void *context) DECLSPEC_HIDDEN
Definition: chm_lib.c:1400
int64_t LONGLONG
Definition: typedefs.h:68
__wchar_t WCHAR
Definition: xmlstorage.h:180
int space
Definition: chm_lib.h:71
uint64_t ULONGLONG
Definition: typedefs.h:67
ULONGLONG LONGUINT64
Definition: chm_lib.h:53
int(* CHM_ENUMERATOR)(struct chmFile *h, struct chmUnitInfo *ui, void *context)
Definition: chm_lib.h:96
GLenum const GLvoid * addr
Definition: glext.h:9621
GLenum GLsizei len
Definition: glext.h:6722
LONGUINT64 length
Definition: chm_lib.h:70
struct chmFile * chm_openW(const WCHAR *filename) DECLSPEC_HIDDEN
Definition: chm_lib.c:678
struct chmFile * chm_dup(struct chmFile *oldHandle) DECLSPEC_HIDDEN
Definition: chm_lib.c:831
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31