1 | /* $Id: kErrors.h 2 2007-11-16 16:07:14Z bird $ */
|
---|
2 | /** @file
|
---|
3 | * kErrors - Status Codes.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net>
|
---|
8 | *
|
---|
9 | * This file is part of kStuff.
|
---|
10 | *
|
---|
11 | * kStuff is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU Lesser General Public
|
---|
13 | * License as published by the Free Software Foundation; either
|
---|
14 | * version 2.1 of the License, or (at your option) any later version.
|
---|
15 | *
|
---|
16 | * kStuff is distributed in the hope that it will be useful,
|
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * Lesser General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU Lesser General Public
|
---|
22 | * License along with kStuff; if not, write to the Free Software
|
---|
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
24 | *
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___k_kErrors_h___
|
---|
28 | #define ___k_kErrors_h___
|
---|
29 |
|
---|
30 | /** @defgroup grp_kErrors Status Codes.
|
---|
31 | * @{
|
---|
32 | */
|
---|
33 | /** The base of the kErrors status codes. */
|
---|
34 | #define KERR_BASE 42000
|
---|
35 |
|
---|
36 | /** @name General
|
---|
37 | * @{
|
---|
38 | */
|
---|
39 | /** The base of the general status codes. */
|
---|
40 | #define KERR_GENERAL_BASE (KERR_BASE)
|
---|
41 | /** Generic error. */
|
---|
42 | #define KERR_GENERAL_FAILURE (KERR_GENERAL_BASE + 1)
|
---|
43 | /** Out of memory. */
|
---|
44 | #define KERR_NO_MEMORY (KERR_GENERAL_BASE + 2)
|
---|
45 | /** Hit some unimplemented functionality - feel free to implement it :-) . */
|
---|
46 | #define KERR_NOT_IMPLEMENTED (KERR_GENERAL_BASE + 3)
|
---|
47 | /** An environment variable wasn't found. */
|
---|
48 | #define KERR_ENVVAR_NOT_FOUND (KERR_GENERAL_BASE + 4)
|
---|
49 | /** Buffer overflow. */
|
---|
50 | #define KERR_BUFFER_OVERFLOW (KERR_GENERAL_BASE + 5)
|
---|
51 | /** @}*/
|
---|
52 |
|
---|
53 | /** @name Input Validation
|
---|
54 | * @{
|
---|
55 | */
|
---|
56 | /** The base of the input validation status codes. */
|
---|
57 | #define KERR_INPUT_BASE (KERR_GENERAL_BASE + 6)
|
---|
58 | /** An API was given an invalid parameter. */
|
---|
59 | #define KERR_INVALID_PARAMETER (KERR_INPUT_BASE + 0)
|
---|
60 | /** A pointer argument is not valid. */
|
---|
61 | #define KERR_INVALID_POINTER (KERR_INPUT_BASE + 1)
|
---|
62 | /** A handle argument is not valid. */
|
---|
63 | #define KERR_INVALID_HANDLE (KERR_INPUT_BASE + 2)
|
---|
64 | /** An offset argument is not valid. */
|
---|
65 | #define KERR_INVALID_OFFSET (KERR_INPUT_BASE + 3)
|
---|
66 | /** A size argument is not valid. */
|
---|
67 | #define KERR_INVALID_SIZE (KERR_INPUT_BASE + 4)
|
---|
68 | /** A range argument is not valid. */
|
---|
69 | #define KERR_INVALID_RANGE (KERR_INPUT_BASE + 5)
|
---|
70 | /** A parameter is out of range. */
|
---|
71 | #define KERR_OUT_OF_RANGE (KERR_INPUT_BASE + 6)
|
---|
72 | /** @} */
|
---|
73 |
|
---|
74 | /** @name File System and I/O
|
---|
75 | * @{
|
---|
76 | */
|
---|
77 | /** The base of the file system and I/O status cdoes. */
|
---|
78 | #define KERR_FILE_SYSTEM_AND_IO_BASE (KERR_INPUT_BASE + 7)
|
---|
79 | /** The specified file was not found. */
|
---|
80 | #define KERR_FILE_NOT_FOUND (KERR_FILE_SYSTEM_AND_IO_BASE + 0)
|
---|
81 | /** End of file. */
|
---|
82 | #define KERR_EOF (KERR_FILE_SYSTEM_AND_IO_BASE + 1)
|
---|
83 | /** @} */
|
---|
84 |
|
---|
85 | /** @name kDbg Specific
|
---|
86 | * @{
|
---|
87 | */
|
---|
88 | /** The base of the kDbg specific status codes. */
|
---|
89 | #define KDBG_ERR_BASE (KERR_FILE_SYSTEM_AND_IO_BASE + 2)
|
---|
90 | /** The (module) format isn't known to use. */
|
---|
91 | #define KDBG_ERR_UNKOWN_FORMAT (KDBG_ERR_BASE + 0)
|
---|
92 | /** The (module) format isn't supported by this kDbg build. */
|
---|
93 | #define KDBG_ERR_FORMAT_NOT_SUPPORTED (KDBG_ERR_BASE + 1)
|
---|
94 | /** The (module) format isn't supported by this kDbg build. */
|
---|
95 | #define KDBG_ERR_BAD_EXE_FORMAT (KDBG_ERR_BASE + 2)
|
---|
96 | /** A specified address or an address found in the debug info is invalid. */
|
---|
97 | #define KDBG_ERR_INVALID_ADDRESS (KDBG_ERR_BASE + 3)
|
---|
98 | /** The dbghelp.dll is too old or something like that. */
|
---|
99 | #define KDBG_ERR_DBGHLP_VERSION_MISMATCH (KDBG_ERR_BASE + 4)
|
---|
100 | /** @} */
|
---|
101 |
|
---|
102 | /** @name kRdr Specific
|
---|
103 | * @{
|
---|
104 | */
|
---|
105 | /** the base of the kRdr specific status codes. */
|
---|
106 | #define KRDR_ERR_BASE (KDBG_ERR_BASE + 5)
|
---|
107 | /** The file reader can't take more concurrent mappings. */
|
---|
108 | #define KRDR_ERR_TOO_MANY_MAPPINGS (KRDR_ERR_BASE + 0)
|
---|
109 | /** The pRdr instance passed to a kRdrBuf* API isn't a buffered instance. */
|
---|
110 | #define KRDR_ERR_NOT_BUFFERED_RDR (KRDR_ERR_BASE + 1)
|
---|
111 | /** The line is too long to fit in the buffer passed to kRdrBufLine or kRdrBufLineEx. */
|
---|
112 | #define KRDR_ERR_LINE_TOO_LONG (KRDR_ERR_BASE + 2)
|
---|
113 | /** @} */
|
---|
114 |
|
---|
115 | /** @name kLdr Specific
|
---|
116 | * @{
|
---|
117 | */
|
---|
118 | /** The base of the kLdr specific status codes. */
|
---|
119 | #define KLDR_ERR_BASE (KRDR_ERR_BASE + 3)
|
---|
120 |
|
---|
121 | /** The image format is unknown. */
|
---|
122 | #define KLDR_ERR_UNKNOWN_FORMAT (KLDR_ERR_BASE + 0)
|
---|
123 | /** The MZ image format isn't supported by this kLdr build. */
|
---|
124 | #define KLDR_ERR_MZ_NOT_SUPPORTED (KLDR_ERR_BASE + 1)
|
---|
125 | /** The NE image format isn't supported by this kLdr build. */
|
---|
126 | #define KLDR_ERR_NE_NOT_SUPPORTED (KLDR_ERR_BASE + 2)
|
---|
127 | /** The LX image format isn't supported by this kLdr build. */
|
---|
128 | #define KLDR_ERR_LX_NOT_SUPPORTED (KLDR_ERR_BASE + 3)
|
---|
129 | /** The LE image format isn't supported by this kLdr build. */
|
---|
130 | #define KLDR_ERR_LE_NOT_SUPPORTED (KLDR_ERR_BASE + 4)
|
---|
131 | /** The PE image format isn't supported by this kLdr build. */
|
---|
132 | #define KLDR_ERR_PE_NOT_SUPPORTED (KLDR_ERR_BASE + 5)
|
---|
133 | /** The ELF image format isn't supported by this kLdr build. */
|
---|
134 | #define KLDR_ERR_ELF_NOT_SUPPORTED (KLDR_ERR_BASE + 6)
|
---|
135 | /** The mach-o image format isn't supported by this kLdr build. */
|
---|
136 | #define KLDR_ERR_MACHO_NOT_SUPPORTED (KLDR_ERR_BASE + 7)
|
---|
137 | /** The FAT image format isn't supported by this kLdr build or
|
---|
138 | * a direct open was attempt without going thru the FAT file provider.
|
---|
139 | * FAT images are also known as Universal Binaries. */
|
---|
140 | #define KLDR_ERR_FAT_NOT_SUPPORTED (KLDR_ERR_BASE + 8)
|
---|
141 | /** The a.out image format isn't supported by this kLdr build. */
|
---|
142 | #define KLDR_ERR_AOUT_NOT_SUPPORTED (KLDR_ERR_BASE + 9)
|
---|
143 |
|
---|
144 | /** The module wasn't loaded dynamically. */
|
---|
145 | #define KLDR_ERR_NOT_LOADED_DYNAMICALLY (KLDR_ERR_BASE + 10)
|
---|
146 | /** The module wasn't found. */
|
---|
147 | #define KLDR_ERR_MODULE_NOT_FOUND (KLDR_ERR_BASE + 11)
|
---|
148 | /** A prerequisit module wasn't found. */
|
---|
149 | #define KLDR_ERR_PREREQUISITE_MODULE_NOT_FOUND (KLDR_ERR_BASE + 12)
|
---|
150 | /** The module is being terminated and can therefore not be loaded. */
|
---|
151 | #define KLDR_ERR_MODULE_TERMINATING (KLDR_ERR_BASE + 13)
|
---|
152 | /** A prerequisit module is being terminated and can therefore not be loaded. */
|
---|
153 | #define KLDR_ERR_PREREQUISITE_MODULE_TERMINATING (KLDR_ERR_BASE + 14)
|
---|
154 | /** The module initialization failed. */
|
---|
155 | #define KLDR_ERR_MODULE_INIT_FAILED (KLDR_ERR_BASE + 15)
|
---|
156 | /** The initialization of a prerequisite module failed. */
|
---|
157 | #define KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED (KLDR_ERR_BASE + 16)
|
---|
158 | /** The module has already failed initialization and can't be attempted reloaded until
|
---|
159 | * after we've finished garbage collection. */
|
---|
160 | #define KLDR_ERR_MODULE_INIT_FAILED_ALREADY (KLDR_ERR_BASE + 17)
|
---|
161 | /** A prerequisite module has already failed initialization and can't be attempted
|
---|
162 | * reloaded until after we've finished garbage collection. */
|
---|
163 | #define KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED_ALREADY (KLDR_ERR_BASE + 18)
|
---|
164 | /** Prerequisite recursed too deeply. */
|
---|
165 | #define KLDR_ERR_PREREQUISITE_RECURSED_TOO_DEEPLY (KLDR_ERR_BASE + 19)
|
---|
166 | /** Failed to allocate the main stack. */
|
---|
167 | #define KLDR_ERR_MAIN_STACK_ALLOC_FAILED (KLDR_ERR_BASE + 20)
|
---|
168 | /** Symbol not found. */
|
---|
169 | #define KLDR_ERR_SYMBOL_NOT_FOUND (KLDR_ERR_BASE + 21)
|
---|
170 | /** A forward symbol was encountered but the caller didn't provide any means to resolve it. */
|
---|
171 | #define KLDR_ERR_FORWARDER_SYMBOL (KLDR_ERR_BASE + 22)
|
---|
172 | /** Encountered a bad fixup. */
|
---|
173 | #define KLDR_ERR_BAD_FIXUP (KLDR_ERR_BASE + 23)
|
---|
174 | /** The import ordinal was out of bounds. */
|
---|
175 | #define KLDR_ERR_IMPORT_ORDINAL_OUT_OF_BOUNDS (KLDR_ERR_BASE + 24)
|
---|
176 | /** A forwarder chain was too long. */
|
---|
177 | #define KLDR_ERR_TOO_LONG_FORWARDER_CHAIN (KLDR_ERR_BASE + 25)
|
---|
178 | /** The module has no debug info. */
|
---|
179 | #define KLDR_ERR_NO_DEBUG_INFO (KLDR_ERR_BASE + 26)
|
---|
180 | /** The module is already mapped.
|
---|
181 | * kLdrModMap() can only be called once (without kLdrModUnmap() in between). */
|
---|
182 | #define KLDR_ERR_ALREADY_MAPPED (KLDR_ERR_BASE + 27)
|
---|
183 | /** The module was not mapped.
|
---|
184 | * kLdrModUnmap() should not called without being preceeded by a kLdrModMap(). */
|
---|
185 | #define KLDR_ERR_NOT_MAPPED (KLDR_ERR_BASE + 28)
|
---|
186 | /** Couldn't fit the address value into the field. Typically a relocation kind of error. */
|
---|
187 | #define KLDR_ERR_ADDRESS_OVERFLOW (KLDR_ERR_BASE + 29)
|
---|
188 | /** Couldn't fit a calculated size value into the native size type of the host. */
|
---|
189 | #define KLDR_ERR_SIZE_OVERFLOW (KLDR_ERR_BASE + 30)
|
---|
190 | /** Thread attach failed. */
|
---|
191 | #define KLDR_ERR_THREAD_ATTACH_FAILED (KLDR_ERR_BASE + 31)
|
---|
192 | /** The module wasn't a DLL or object file. */
|
---|
193 | #define KLDR_ERR_NOT_DLL (KLDR_ERR_BASE + 32)
|
---|
194 | /** The module wasn't an EXE. */
|
---|
195 | #define KLDR_ERR_NOT_EXE (KLDR_ERR_BASE + 33)
|
---|
196 | /** Not implemented yet. */
|
---|
197 | #define KLDR_ERR_TODO (KLDR_ERR_BASE + 34)
|
---|
198 | /** @} */
|
---|
199 |
|
---|
200 | /** @name kLdrModPE Specific
|
---|
201 | * @{
|
---|
202 | */
|
---|
203 | /** The base of the kLdrModPE specific status codes. */
|
---|
204 | #define KLDR_ERR_PE_BASE (KLDR_ERR_BASE + 35)
|
---|
205 | /** The machine isn't supported by the interpreter. */
|
---|
206 | #define KLDR_ERR_PE_UNSUPPORTED_MACHINE (KLDR_ERR_PE_BASE + 0)
|
---|
207 | /** The file handler isn't valid. */
|
---|
208 | #define KLDR_ERR_PE_BAD_FILE_HEADER (KLDR_ERR_PE_BASE + 1)
|
---|
209 | /** The the optional headers isn't valid. */
|
---|
210 | #define KLDR_ERR_PE_BAD_OPTIONAL_HEADER (KLDR_ERR_PE_BASE + 2)
|
---|
211 | /** One of the section headers aren't valid. */
|
---|
212 | #define KLDR_ERR_PE_BAD_SECTION_HEADER (KLDR_ERR_PE_BASE + 3)
|
---|
213 | /** Bad forwarder entry. */
|
---|
214 | #define KLDR_ERR_PE_BAD_FORWARDER (KLDR_ERR_PE_BASE + 4)
|
---|
215 | /** Forwarder module not found in the import descriptor table. */
|
---|
216 | #define KLDR_ERR_PE_FORWARDER_IMPORT_NOT_FOUND (KLDR_ERR_PE_BASE + 5)
|
---|
217 | /** Bad PE fixups. */
|
---|
218 | #define KLDR_ERR_PE_BAD_FIXUP (KLDR_ERR_PE_BASE + 6)
|
---|
219 | /** Bad PE import (thunk). */
|
---|
220 | #define KLDR_ERR_PE_BAD_IMPORT (KLDR_ERR_PE_BASE + 7)
|
---|
221 | /** @} */
|
---|
222 |
|
---|
223 | /** @name kLdrModLX Specific
|
---|
224 | * @{
|
---|
225 | */
|
---|
226 | /** The base of the kLdrModLX specific status codes. */
|
---|
227 | #define KLDR_ERR_LX_BASE (KLDR_ERR_PE_BASE + 8)
|
---|
228 | /** validation of LX header failed. */
|
---|
229 | #define KLDR_ERR_LX_BAD_HEADER (KLDR_ERR_LX_BASE + 0)
|
---|
230 | /** validation of the loader section (in the LX header) failed. */
|
---|
231 | #define KLDR_ERR_LX_BAD_LOADER_SECTION (KLDR_ERR_LX_BASE + 1)
|
---|
232 | /** validation of the fixup section (in the LX header) failed. */
|
---|
233 | #define KLDR_ERR_LX_BAD_FIXUP_SECTION (KLDR_ERR_LX_BASE + 2)
|
---|
234 | /** validation of the LX object table failed. */
|
---|
235 | #define KLDR_ERR_LX_BAD_OBJECT_TABLE (KLDR_ERR_LX_BASE + 3)
|
---|
236 | /** A bad page map entry was encountered. */
|
---|
237 | #define KLDR_ERR_LX_BAD_PAGE_MAP (KLDR_ERR_LX_BASE + 4)
|
---|
238 | /** Bad iterdata (EXEPACK) data. */
|
---|
239 | #define KLDR_ERR_LX_BAD_ITERDATA (KLDR_ERR_LX_BASE + 5)
|
---|
240 | /** Bad iterdata2 (EXEPACK2) data. */
|
---|
241 | #define KLDR_ERR_LX_BAD_ITERDATA2 (KLDR_ERR_LX_BASE + 6)
|
---|
242 | /** Bad bundle data. */
|
---|
243 | #define KLDR_ERR_LX_BAD_BUNDLE (KLDR_ERR_LX_BASE + 7)
|
---|
244 | /** No soname. */
|
---|
245 | #define KLDR_ERR_LX_NO_SONAME (KLDR_ERR_LX_BASE + 8)
|
---|
246 | /** Bad soname. */
|
---|
247 | #define KLDR_ERR_LX_BAD_SONAME (KLDR_ERR_LX_BASE + 9)
|
---|
248 | /** Bad forwarder entry. */
|
---|
249 | #define KLDR_ERR_LX_BAD_FORWARDER (KLDR_ERR_LX_BASE + 10)
|
---|
250 | /** internal fixup chain isn't implemented yet. */
|
---|
251 | #define KLDR_ERR_LX_NRICHAIN_NOT_SUPPORTED (KLDR_ERR_LX_BASE + 11)
|
---|
252 | /** @} */
|
---|
253 |
|
---|
254 | /** @name kLdrModMachO Specific
|
---|
255 | * @{
|
---|
256 | */
|
---|
257 | /** The base of the kLdrModMachO specific status codes. */
|
---|
258 | #define KLDR_ERR_MACHO_BASE (KLDR_ERR_LX_BASE + 12)
|
---|
259 | /** Only native endian Mach-O files are supported. */
|
---|
260 | #define KLDR_ERR_MACHO_OTHER_ENDIAN_NOT_SUPPORTED (KLDR_ERR_MACHO_BASE + 0)
|
---|
261 | /** 64-bit Mach-O files aren't supported yet. */
|
---|
262 | #define KLDR_ERR_MACHO_64BIT_NOT_SUPPORTED (KLDR_ERR_MACHO_BASE + 1)
|
---|
263 | /** The Mach-O header is bad or contains new and unsupported features. */
|
---|
264 | #define KLDR_ERR_MACHO_BAD_HEADER (KLDR_ERR_MACHO_BASE + 2)
|
---|
265 | /** The file type isn't supported. */
|
---|
266 | #define KLDR_ERR_MACHO_UNSUPPORTED_FILE_TYPE (KLDR_ERR_MACHO_BASE + 3)
|
---|
267 | /** The machine (cputype / cpusubtype combination) isn't supported. */
|
---|
268 | #define KLDR_ERR_MACHO_UNSUPPORTED_MACHINE (KLDR_ERR_MACHO_BASE + 4)
|
---|
269 | /** Bad load command(s). */
|
---|
270 | #define KLDR_ERR_MACHO_BAD_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 5)
|
---|
271 | /** Encountered an unknown load command.*/
|
---|
272 | #define KLDR_ERR_MACHO_UNKNOWN_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 6)
|
---|
273 | /** Encountered a load command that's not implemented.*/
|
---|
274 | #define KLDR_ERR_MACHO_UNSUPPORTED_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 7)
|
---|
275 | /** Bad section. */
|
---|
276 | #define KLDR_ERR_MACHO_BAD_SECTION (KLDR_ERR_MACHO_BASE + 8)
|
---|
277 | /** Encountered a section type that's not implemented.*/
|
---|
278 | #define KLDR_ERR_MACHO_UNSUPPORTED_SECTION (KLDR_ERR_MACHO_BASE + 9)
|
---|
279 | /** Encountered a section type that's not known to the loader. (probably invalid) */
|
---|
280 | #define KLDR_ERR_MACHO_UNKNOWN_SECTION (KLDR_ERR_MACHO_BASE + 10)
|
---|
281 | /** The sections aren't ordered by segment as expected by the loader. */
|
---|
282 | #define KLDR_ERR_MACHO_BAD_SECTION_ORDER (KLDR_ERR_MACHO_BASE + 11)
|
---|
283 | /** The image is 32-bit and contains 64-bit load commands or vise versa. */
|
---|
284 | #define KLDR_ERR_MACHO_BIT_MIX (KLDR_ERR_MACHO_BASE + 12)
|
---|
285 | /** Bad MH_OBJECT file. */
|
---|
286 | #define KLDR_ERR_MACHO_BAD_OBJECT_FILE (KLDR_ERR_MACHO_BASE + 13)
|
---|
287 | /** Bad symbol table entry. */
|
---|
288 | #define KLDR_ERR_MACHO_BAD_SYMBOL (KLDR_ERR_MACHO_BASE + 14)
|
---|
289 | /** Unsupported fixup type. */
|
---|
290 | #define KLDR_ERR_MACHO_UNSUPPORTED_FIXUP_TYPE (KLDR_ERR_MACHO_BASE + 15)
|
---|
291 | /** @} */
|
---|
292 |
|
---|
293 | /** @name kCpu Specific
|
---|
294 | * @{
|
---|
295 | */
|
---|
296 | /** The base of the kCpu specific status codes. */
|
---|
297 | #define KCPU_ERR_BASE (KLDR_ERR_MACHO_BASE + 16)
|
---|
298 | /** The specified ARCH+CPU pairs aren't compatible. */
|
---|
299 | #define KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE (KCPU_ERR_BASE + 0)
|
---|
300 | /** @} */
|
---|
301 |
|
---|
302 | /** End of the valid status codes. */
|
---|
303 | #define KERR_END (KCPU_ERR_BASE + 1)
|
---|
304 | /** @}*/
|
---|
305 |
|
---|
306 | #endif
|
---|
307 |
|
---|