ReactOS 0.4.15-dev-8102-g108db8f
chmc.h
Go to the documentation of this file.
1/*
2
3 Copyright (C) 2010 Alex Andreotti <alex.andreotti@gmail.com>
4
5 This file is part of chmc.
6
7 chmc is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 chmc is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with chmc. If not, see <http://www.gnu.org/licenses/>.
19
20*/
21#ifndef CHMC_CHMC_H
22#define CHMC_CHMC_H
23
24#include <stdlib.h>
25#include <limits.h>
26
27#include "chm.h"
28#include "list.h"
29
30#ifndef PATH_MAX
31#define PATH_MAX 260
32#endif
33
34#define CHMC_DIR_UUID \
35 "\x10\xfd\x01\x7c\xaa\x7b\xd0\x11\x9e\x0c\x00\xa0\xc9\x22\xe6\xec"
36#define CHMC_STREAM_UUID \
37 "\x11\xfd\x01\x7c\xaa\x7b\xd0\x11\x9e\x0c\x00\xa0\xc9\x22\xe6\xec"
38#define CHMC_SYSTEM_UUID \
39 "\x6a\x92\x02\x5d\x2e\x21\xd0\x11\x9d\xf9\x00\xa0\xc9\x22\xe6\xec"
40
42 char signature[4];
63};
64
65/* Sys Info Entry codes */
66#define SIEC_DEFTOPIC 2
67#define SIEC_TITLE 3
68#define SIEC_LCASEFILE 6
69#define SIEC_DEFWINDOW 5
70
71/* present in files with Binary Index turned on. (eg: af 08 63 ac)
72 The entry in the #URLTBL file that points to the sitemap index had
73 the same first DWORD */
74#define SIEC_HAVE_BINDX 7
75#define SIEC_NUMOFINFOT 12
76
77/* The #IDXHDR file contains exactly the same bytes (len 4096) */
78#define SIEC_IDXHDR 13
79
80#define SIEC_INFOCHKSUM 15
81#define SIEC_DEFFONT 16
82
83#define SIEC_TIMESTAMP 10
84#define SIEC_COMPVER 9
85#define SIEC_SYSINFO 4
86
87/* NOTE use only as pointer */
88#define _CHMC_SYS_ENTRY_HDR_LEN (sizeof(UInt16)*2)
90 UInt16 code; /* FIXME check unsigned */
91 UInt16 len; /* FIXME check unsigned */
92 UChar data[65535];
93};
94
95/* NOTE use only as pointer */
96#define _CHMC_SYS_ENTRY_NODE_HDR_LEN \
97 (sizeof(struct chmcSystemEntryNode *)+_CHMC_SYS_ENTRY_HDR_LEN)
98
102};
103
104/* HHA Version 4.72.7294 and earlier */
105#define _CHMC_SYS_INFO_V4_72_7294_LEN (28)
106/* HHA Version 4.72.8086 and later */
107#define _CHMC_SYS_INFO_V4_72_8086_LEN (36)
115 UInt32 unknown_1c; // >= 8086 only
116 UInt32 unknown_20; // >= 8086 only
117};
118
119
120/* /usr/include/freetype2/freetype/ttnameid.h maybe useful */
121#define CHMC_MS_LCID_EN_US (0x0409)
122
123#define _CHMC_SYSTEM_HDR_LEN (sizeof(Int32)+sizeof(struct chmcSystemInfo))
127
128/* private: */
130 UInt32 _size; /* keep track for alloc before save */
131};
132
133#define _CHMC_CHUNK_LEN (4096)
134#define CHMC_PMGL_DATA_LEN (_CHMC_CHUNK_LEN - _CHMC_PMGL_LEN - 2)
135
140};
141
147};
148
149#define CHMC_PMGI_DATA_LEN (_CHMC_CHUNK_LEN - _CHMC_PMGI_LEN - 2)
150
155};
156
162};
163
164#define CHMC_TNFL_STATIC (1 << 0) /* don't free() */
165
170 char *name;
175};
176
180 UChar data[4096];
181};
182
184 const char *title;
185 const char *tmpdir;
186 const char *hhc;
187 const char *hhk;
188 const char *deftopic;
190};
191
192struct chmcFile {
193 int fd;
213};
214
215#define CHMC_SECTNAME_MAXLEN (64)
216
223 int fd;
228};
229
230#define _CHMC_RSTTBL_MARK (sizeof(struct chmcResetTableMark))
231
235};
236
240};
241
246};
247
253 short unknown;
254};
255
256
257int chmc_init(struct chmcFile *chm, const char *filename,
258 struct chmcConfig *config);
259void chmc_sections_done(struct chmcFile *chm);
260void chmc_term(struct chmcFile *chm);
261int chmc_tree_done(struct chmcFile *chm);
262
263#define chmc_dump(fmt, ...) fprintf(stderr, fmt , ## __VA_ARGS__)
264
265#endif /* CHMC_CHMC_H */
USHORT UInt16
Definition: chm_lib.c:102
DWORD UInt32
Definition: chm_lib.c:104
LONG Int32
Definition: chm_lib.c:103
BYTE UChar
Definition: chm_lib.c:100
ULONGLONG UInt64
Definition: chm_lib.c:106
void chmc_term(struct chmcFile *chm)
Definition: chmc.c:461
#define CHMC_SECTNAME_MAXLEN
Definition: chmc.h:215
int chmc_tree_done(struct chmcFile *chm)
Definition: chmc.c:728
int chmc_init(struct chmcFile *chm, const char *filename, struct chmcConfig *config)
Definition: chmc.c:133
void chmc_sections_done(struct chmcFile *chm)
Definition: chmc.c:348
#define CHMC_PMGL_DATA_LEN
Definition: chmc.h:134
#define CHMC_PMGI_DATA_LEN
Definition: chmc.h:149
#define PATH_MAX
Definition: chmc.h:31
Definition: list.h:37
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
const char * filename
Definition: ioapi.h:137
const char * hhc
Definition: chmc.h:186
UInt16 language
Definition: chmc.h:189
const char * title
Definition: chmc.h:184
const char * hhk
Definition: chmc.h:187
const char * deftopic
Definition: chmc.h:188
const char * tmpdir
Definition: chmc.h:185
Definition: chmc.h:192
int entries_num
Definition: chmc.h:203
struct list_head entries_list
Definition: chmc.h:202
struct chmcSection ** sections
Definition: chmc.h:199
struct chmcItsfHeader itsf
Definition: chmc.h:194
struct chmcSystem system
Definition: chmc.h:207
int fd
Definition: chmc.h:193
struct chmcConfig * config
Definition: chmc.h:212
struct chmcPmglChunkNode * pmgl_last
Definition: chmc.h:201
struct chmcTreeNode ** sort_entries
Definition: chmc.h:204
struct list_head pmgl_list
Definition: chmc.h:200
UInt32 strings_offset
Definition: chmc.h:210
struct chmcSect0 sect0
Definition: chmc.h:195
struct chmcIndexHeader idxhdr
Definition: chmc.h:208
struct chmcPmgiChunkNode * pmgi_last
Definition: chmc.h:206
int sections_num
Definition: chmc.h:197
struct chmcItspHeader itsp
Definition: chmc.h:196
struct list_head sections_list
Definition: chmc.h:198
UChar * strings
Definition: chmc.h:209
UInt32 strings_len
Definition: chmc.h:211
struct list_head pmgi_list
Definition: chmc.h:205
Int32 unknown_4c
Definition: chmc.h:61
Int32 win_style
Definition: chmc.h:53
Int32 merge_files_offs[1004]
Definition: chmc.h:62
Int32 unknown_4
Definition: chmc.h:43
Int32 num_of_merge_files
Definition: chmc.h:60
Int32 unknown_8
Definition: chmc.h:44
Int32 ex_win_style
Definition: chmc.h:54
Int32 background
Definition: chmc.h:50
Int32 num_of_topic
Definition: chmc.h:45
Int32 unknown_18
Definition: chmc.h:48
Int32 off_img_list
Definition: chmc.h:47
Int32 foreground
Definition: chmc.h:51
Int32 img_type_folder
Definition: chmc.h:49
Int32 off_font
Definition: chmc.h:52
Int32 unknown_44
Definition: chmc.h:59
char signature[4]
Definition: chmc.h:42
Int32 off_frame_name
Definition: chmc.h:56
Int32 off_win_name
Definition: chmc.h:57
Int32 unknown_10
Definition: chmc.h:46
Int32 unknown_34
Definition: chmc.h:55
Int32 num_of_info
Definition: chmc.h:58
UInt16 entries_count
Definition: chmc.h:154
UInt16 entries_count
Definition: chmc.h:139
Definition: chm.h:107
struct chmcLzxcResetTable reset_table_header
Definition: chmc.h:224
struct chmcLzxcControlData control_data
Definition: chmc.h:225
int mark_count
Definition: chmc.h:227
int fd
Definition: chmc.h:223
struct list_head mark_list
Definition: chmc.h:226
UInt64 len
Definition: chmc.h:221
UInt64 offset
Definition: chmc.h:220
UInt16 used
Definition: chmc.h:179
struct chmcSystemEntry entry
Definition: chmc.h:101
struct chmcSystemEntryNode * next
Definition: chmc.h:100
UInt16 len
Definition: chmc.h:91
UInt16 code
Definition: chmc.h:90
UInt32 lcid
Definition: chmc.h:109
UInt32 klinks
Definition: chmc.h:112
UInt32 alinks
Definition: chmc.h:113
UInt32 dbcs
Definition: chmc.h:110
UInt32 unknown_20
Definition: chmc.h:116
UInt32 full_search
Definition: chmc.h:111
UInt32 unknown_1c
Definition: chmc.h:115
UInt64 timestamp
Definition: chmc.h:114
UInt32 _size
Definition: chmc.h:130
Int32 version
Definition: chmc.h:125
struct chmcSystemEntryNode * _entries
Definition: chmc.h:129
UInt32 strings_offset
Definition: chmc.h:250
short unknown
Definition: chmc.h:253
UInt32 urltbl_offset
Definition: chmc.h:251
short in_content
Definition: chmc.h:252
UInt32 tocidx_offset
Definition: chmc.h:249
UInt32 flags
Definition: chmc.h:168
UInt32 sect_id
Definition: chmc.h:169
UChar * buf
Definition: chmc.h:172
UInt64 len
Definition: chmc.h:174
char * name
Definition: chmc.h:170
UInt16 prefixlen
Definition: chmc.h:171
UInt64 offset
Definition: chmc.h:173
UInt32 framename_offset
Definition: chmc.h:239
UInt32 url_offset
Definition: chmc.h:238
UInt32 urlstr_offset
Definition: chmc.h:245
UInt32 unknown
Definition: chmc.h:243
UInt32 topic_index
Definition: chmc.h:244
Definition: list.h:15
Definition: name.c:39