ReactOS
0.4.16-dev-456-ga97fcf1
chm.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
NOTE this file is mainly based on chm_lib.c from chmLib by Jed Wing
21
http://www.jedrea.com/chmlib/
22
23
*/
24
#ifndef CHMC_CHM_H
25
#define CHMC_CHM_H
26
27
/*
28
* architecture specific defines
29
*
30
* Note: as soon as C99 is more widespread, the below defines should
31
* probably just use the C99 sized-int types.
32
*
33
* The following settings will probably work for many platforms. The sizes
34
* don't have to be exactly correct, but the types must accommodate at least as
35
* many bits as they specify.
36
*/
37
38
/* i386, 32-bit/64-bit, Windows */
39
#ifdef _MSC_VER
40
typedef
unsigned
char
UChar
;
41
typedef
__int16
Int16
;
42
typedef
unsigned
__int16
UInt16
;
43
typedef
__int32
Int32
;
44
typedef
unsigned
__int32
UInt32
;
45
typedef
__int64
Int64
;
46
typedef
unsigned
__int64
UInt64
;
47
48
/* I386, 32-bit, non-Windows */
49
/* Sparc */
50
/* MIPS */
51
/* PPC */
52
/* ARM (32-bit) */
53
#elif __i386__ || __sun || __sgi || __ppc__ || __arm__
54
typedef
unsigned
char
UChar
;
55
typedef
short
Int16
;
56
typedef
unsigned
short
UInt16
;
57
typedef
long
Int32
;
58
typedef
unsigned
long
UInt32
;
59
typedef
long
long
Int64
;
60
typedef
unsigned
long
long
UInt64
;
61
62
/* x86-64 */
63
/* IA-64 */
64
/* ARM64/AArch64 */
65
/* Note that these may be appropriate for other 64-bit machines. */
66
#elif __x86_64__ || __ia64__ || __aarch64__
67
typedef
unsigned
char
UChar
;
68
typedef
short
Int16
;
69
typedef
unsigned
short
UInt16
;
70
typedef
int
Int32
;
71
typedef
unsigned
int
UInt32
;
72
typedef
long
Int64
;
73
typedef
unsigned
long
UInt64
;
74
75
#else
76
77
/* yielding an error is preferable to yielding incorrect behavior */
78
#error "Please define the sized types for your platform"
79
#endif
80
81
/* GCC */
82
#ifdef __GNUC__
83
#define memcmp __builtin_memcmp
84
#define memset __builtin_memset
85
#define memcpy __builtin_memcpy
86
#define strlen __builtin_strlen
87
#endif
88
89
#define _CHMC_ITSF_V3_LEN (0x60)
90
struct
chmcItsfHeader
{
91
char
signature
[4];
/* 0 (ITSF) */
92
Int32
version
;
/* 4 */
93
Int32
header_len
;
/* 8 */
94
Int32
unknown_000c
;
/* c */
95
UInt32
last_modified
;
/* 10 */
96
UInt32
lang_id
;
/* 14 */
97
UChar
dir_uuid
[16];
/* 18 */
98
UChar
stream_uuid
[16];
/* 28 */
99
UInt64
sect0_offset
;
/* 38 */
100
UInt64
sect0_len
;
/* 40 */
101
UInt64
dir_offset
;
/* 48 */
102
UInt64
dir_len
;
/* 50 */
103
UInt64
data_offset
;
/* 58 (Not present before V3) */
104
};
/* __attribute__ ((aligned (1))); */
105
106
#define _CHMC_SECT0_LEN (0x18)
107
struct
chmcSect0
{
108
Int32
unknown_0000
;
/* 0 */
109
Int32
unknown_0004
;
/* 4 */
110
UInt64
file_len
;
/* 8 */
111
Int32
unknown_0010
;
/* 10 */
112
Int32
unknown_0014
;
/* 14 */
113
};
114
115
#define CHM_IDX_INTVL 2
116
117
/* structure of ITSP headers */
118
#define _CHMC_ITSP_V1_LEN (0x54)
119
struct
chmcItspHeader
{
120
char
signature
[4];
/* 0 (ITSP) */
121
Int32
version
;
/* 4 */
122
Int32
header_len
;
/* 8 */
123
Int32
unknown_000c
;
/* c */
124
UInt32
block_len
;
/* 10 */
125
Int32
blockidx_intvl
;
/* 14 */
126
Int32
index_depth
;
/* 18 */
127
Int32
index_root
;
/* 1c */
128
Int32
index_head
;
/* 20 */
129
Int32
index_last
;
/* 24 */
130
Int32
unknown_0028
;
/* 28 */
131
UInt32
num_blocks
;
/* 2c */
132
UInt32
lang_id
;
/* 30 */
133
UChar
system_uuid
[16];
/* 34 */
134
UInt32
header_len2
;
/* 44 */
135
UChar
unknown_0048
[12];
/* 48 */
136
};
/* __attribute__ ((aligned (1))); */
137
138
/* structure of PMGL headers */
139
#define _CHMC_PMGL_LEN (0x14)
140
struct
chmcPmglHeader
141
{
142
char
signature
[4];
/* 0 (PMGL) */
143
UInt32
free_space
;
/* 4 */
144
UInt32
unknown_0008
;
/* 8 */
145
Int32
block_prev
;
/* c */
146
Int32
block_next
;
/* 10 */
147
};
/* __attribute__ ((aligned (1))); */
148
149
#define _CHMC_PMGI_LEN (0x08)
150
struct
chmcPmgiHeader
{
151
char
signature
[4];
/* 0 (PMGI) */
152
UInt32
free_space
;
/* 4 */
153
};
/* __attribute__ ((aligned (1))); */
154
155
/* structure of LZXC reset table */
156
#define _CHMC_LZXC_RESETTABLE_V1_LEN (0x28)
157
struct
chmcLzxcResetTable
{
158
UInt32
version
;
159
UInt32
block_count
;
160
UInt32
entry_size
;
161
UInt32
table_offset
;
162
UInt64
uncompressed_len
;
163
UInt64
compressed_len
;
164
UInt64
block_len
;
165
};
/* __attribute__ ((aligned (1))); */
166
167
/* structure of LZXC control data block */
168
#define _CHMC_LZXC_MIN_LEN (0x18)
169
#define _CHMC_LZXC_V2_LEN (0x1c)
170
struct
chmcLzxcControlData
{
171
UInt32
size
;
/* 0 */
172
char
signature
[4];
/* 4 (LZXC) */
173
UInt32
version
;
/* 8 */
174
UInt32
resetInterval
;
/* c */
175
UInt32
windowSize
;
/* 10 */
176
UInt32
windowsPerReset
;
/* 14 */
177
UInt32
unknown_18
;
/* 18 */
178
};
179
180
#endif
/* CHMC_CHM_H */
__int16
#define __int16
Definition:
basetyps.h:22
__int64
#define __int64
Definition:
basetyps.h:16
__int32
#define __int32
Definition:
basetyps.h:19
UInt32
DWORD UInt32
Definition:
chm_lib.c:104
Int16
SHORT Int16
Definition:
chm_lib.c:101
Int64
LONGLONG Int64
Definition:
chm_lib.c:105
Int32
LONG Int32
Definition:
chm_lib.c:103
UChar
BYTE UChar
Definition:
chm_lib.c:100
UInt64
ULONGLONG UInt64
Definition:
chm_lib.c:106
UInt32
#define UInt32
Definition:
interfaces.hpp:73
UInt16
#define UInt16
Definition:
interfaces.hpp:74
Int32
#define Int32
Definition:
interfaces.hpp:76
chmcItsfHeader
Definition:
chm.h:90
chmcItsfHeader::unknown_000c
Int32 unknown_000c
Definition:
chm.h:94
chmcItsfHeader::version
Int32 version
Definition:
chm.h:92
chmcItsfHeader::sect0_offset
UInt64 sect0_offset
Definition:
chm.h:99
chmcItsfHeader::stream_uuid
UChar stream_uuid[16]
Definition:
chm.h:98
chmcItsfHeader::dir_offset
UInt64 dir_offset
Definition:
chm.h:101
chmcItsfHeader::data_offset
UInt64 data_offset
Definition:
chm.h:103
chmcItsfHeader::dir_uuid
UChar dir_uuid[16]
Definition:
chm.h:97
chmcItsfHeader::last_modified
UInt32 last_modified
Definition:
chm.h:95
chmcItsfHeader::dir_len
UInt64 dir_len
Definition:
chm.h:102
chmcItsfHeader::lang_id
UInt32 lang_id
Definition:
chm.h:96
chmcItsfHeader::header_len
Int32 header_len
Definition:
chm.h:93
chmcItsfHeader::sect0_len
UInt64 sect0_len
Definition:
chm.h:100
chmcItspHeader
Definition:
chm.h:119
chmcItspHeader::block_len
UInt32 block_len
Definition:
chm.h:124
chmcItspHeader::num_blocks
UInt32 num_blocks
Definition:
chm.h:131
chmcItspHeader::index_head
Int32 index_head
Definition:
chm.h:128
chmcItspHeader::version
Int32 version
Definition:
chm.h:121
chmcItspHeader::index_depth
Int32 index_depth
Definition:
chm.h:126
chmcItspHeader::header_len2
UInt32 header_len2
Definition:
chm.h:134
chmcItspHeader::unknown_000c
Int32 unknown_000c
Definition:
chm.h:123
chmcItspHeader::lang_id
UInt32 lang_id
Definition:
chm.h:132
chmcItspHeader::unknown_0048
UChar unknown_0048[12]
Definition:
chm.h:135
chmcItspHeader::index_root
Int32 index_root
Definition:
chm.h:127
chmcItspHeader::header_len
Int32 header_len
Definition:
chm.h:122
chmcItspHeader::unknown_0028
Int32 unknown_0028
Definition:
chm.h:130
chmcItspHeader::system_uuid
UChar system_uuid[16]
Definition:
chm.h:133
chmcItspHeader::index_last
Int32 index_last
Definition:
chm.h:129
chmcItspHeader::blockidx_intvl
Int32 blockidx_intvl
Definition:
chm.h:125
chmcLzxcControlData
Definition:
chm.h:170
chmcLzxcControlData::version
UInt32 version
Definition:
chm.h:173
chmcLzxcControlData::windowSize
UInt32 windowSize
Definition:
chm.h:175
chmcLzxcControlData::size
UInt32 size
Definition:
chm.h:171
chmcLzxcControlData::resetInterval
UInt32 resetInterval
Definition:
chm.h:174
chmcLzxcControlData::windowsPerReset
UInt32 windowsPerReset
Definition:
chm.h:176
chmcLzxcControlData::unknown_18
UInt32 unknown_18
Definition:
chm.h:177
chmcLzxcResetTable
Definition:
chm.h:157
chmcLzxcResetTable::version
UInt32 version
Definition:
chm.h:158
chmcLzxcResetTable::entry_size
UInt32 entry_size
Definition:
chm.h:160
chmcLzxcResetTable::compressed_len
UInt64 compressed_len
Definition:
chm.h:163
chmcLzxcResetTable::table_offset
UInt32 table_offset
Definition:
chm.h:161
chmcLzxcResetTable::uncompressed_len
UInt64 uncompressed_len
Definition:
chm.h:162
chmcLzxcResetTable::block_count
UInt32 block_count
Definition:
chm.h:159
chmcLzxcResetTable::block_len
UInt64 block_len
Definition:
chm.h:164
chmcPmgiHeader
Definition:
chm.h:150
chmcPmgiHeader::free_space
UInt32 free_space
Definition:
chm.h:152
chmcPmglHeader
Definition:
chm.h:141
chmcPmglHeader::block_prev
Int32 block_prev
Definition:
chm.h:145
chmcPmglHeader::block_next
Int32 block_next
Definition:
chm.h:146
chmcPmglHeader::unknown_0008
UInt32 unknown_0008
Definition:
chm.h:144
chmcPmglHeader::free_space
UInt32 free_space
Definition:
chm.h:143
chmcSect0
Definition:
chm.h:107
chmcSect0::file_len
UInt64 file_len
Definition:
chm.h:110
chmcSect0::unknown_0010
Int32 unknown_0010
Definition:
chm.h:111
chmcSect0::unknown_0000
Int32 unknown_0000
Definition:
chm.h:108
chmcSect0::unknown_0014
Int32 unknown_0014
Definition:
chm.h:112
chmcSect0::unknown_0004
Int32 unknown_0004
Definition:
chm.h:109
signature
Definition:
appsearch.c:38
sdk
tools
hhpcomp
chmc
chm.h
Generated on Mon Jan 13 2025 06:14:20 for ReactOS by
1.9.6