VirtualBox

source: kStuff/trunk/include/k/kErrors.h@ 81

Last change on this file since 81 was 58, checked in by bird, 11 years ago

Mach-O: Carve segments from the mach-o segments instead of the sections inside them. This works better for non-object files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 16.4 KB
Line 
1/* $Id: kErrors.h 58 2013-10-12 20:18:21Z bird $ */
2/** @file
3 * kErrors - Status Codes.
4 */
5
6/*
7 * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
8 *
9 * Permission is hereby granted, free of charge, to any person
10 * obtaining a copy of this software and associated documentation
11 * files (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use,
13 * copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following
16 * conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31#ifndef ___k_kErrors_h___
32#define ___k_kErrors_h___
33
34/** @defgroup grp_kErrors Status Codes.
35 * @{
36 */
37/** The base of the kErrors status codes. */
38#define KERR_BASE 42000
39
40/** @name General
41 * @{
42 */
43/** The base of the general status codes. */
44#define KERR_GENERAL_BASE (KERR_BASE)
45/** Generic error. */
46#define KERR_GENERAL_FAILURE (KERR_GENERAL_BASE + 1)
47/** Out of memory. */
48#define KERR_NO_MEMORY (KERR_GENERAL_BASE + 2)
49/** Hit some unimplemented functionality - feel free to implement it :-) . */
50#define KERR_NOT_IMPLEMENTED (KERR_GENERAL_BASE + 3)
51/** An environment variable wasn't found. */
52#define KERR_ENVVAR_NOT_FOUND (KERR_GENERAL_BASE + 4)
53/** Buffer overflow. */
54#define KERR_BUFFER_OVERFLOW (KERR_GENERAL_BASE + 5)
55/** @}*/
56
57/** @name Input Validation
58 * @{
59 */
60/** The base of the input validation status codes. */
61#define KERR_INPUT_BASE (KERR_GENERAL_BASE + 6)
62/** An API was given an invalid parameter. */
63#define KERR_INVALID_PARAMETER (KERR_INPUT_BASE + 0)
64/** A pointer argument is not valid. */
65#define KERR_INVALID_POINTER (KERR_INPUT_BASE + 1)
66/** A handle argument is not valid. */
67#define KERR_INVALID_HANDLE (KERR_INPUT_BASE + 2)
68/** An offset argument is not valid. */
69#define KERR_INVALID_OFFSET (KERR_INPUT_BASE + 3)
70/** A size argument is not valid. */
71#define KERR_INVALID_SIZE (KERR_INPUT_BASE + 4)
72/** A range argument is not valid. */
73#define KERR_INVALID_RANGE (KERR_INPUT_BASE + 5)
74/** A parameter is out of range. */
75#define KERR_OUT_OF_RANGE (KERR_INPUT_BASE + 6)
76/** @} */
77
78/** @name File System and I/O
79 * @{
80 */
81/** The base of the file system and I/O status cdoes. */
82#define KERR_FILE_SYSTEM_AND_IO_BASE (KERR_INPUT_BASE + 7)
83/** The specified file was not found. */
84#define KERR_FILE_NOT_FOUND (KERR_FILE_SYSTEM_AND_IO_BASE + 0)
85/** End of file. */
86#define KERR_EOF (KERR_FILE_SYSTEM_AND_IO_BASE + 1)
87/** @} */
88
89/** @name kDbg Specific
90 * @{
91 */
92/** The base of the kDbg specific status codes. */
93#define KDBG_ERR_BASE (KERR_FILE_SYSTEM_AND_IO_BASE + 2)
94/** The (module) format isn't known to use. */
95#define KDBG_ERR_UNKOWN_FORMAT (KDBG_ERR_BASE + 0)
96/** The (module) format isn't supported by this kDbg build. */
97#define KDBG_ERR_FORMAT_NOT_SUPPORTED (KDBG_ERR_BASE + 1)
98/** The (module) format isn't supported by this kDbg build. */
99#define KDBG_ERR_BAD_EXE_FORMAT (KDBG_ERR_BASE + 2)
100/** A specified address or an address found in the debug info is invalid. */
101#define KDBG_ERR_INVALID_ADDRESS (KDBG_ERR_BASE + 3)
102/** The dbghelp.dll is too old or something like that. */
103#define KDBG_ERR_DBGHLP_VERSION_MISMATCH (KDBG_ERR_BASE + 4)
104/** @} */
105
106/** @name kRdr Specific
107 * @{
108 */
109/** the base of the kRdr specific status codes. */
110#define KRDR_ERR_BASE (KDBG_ERR_BASE + 5)
111/** The file reader can't take more concurrent mappings. */
112#define KRDR_ERR_TOO_MANY_MAPPINGS (KRDR_ERR_BASE + 0)
113/** The pRdr instance passed to a kRdrBuf* API isn't a buffered instance. */
114#define KRDR_ERR_NOT_BUFFERED_RDR (KRDR_ERR_BASE + 1)
115/** The line is too long to fit in the buffer passed to kRdrBufLine or kRdrBufLineEx. */
116#define KRDR_ERR_LINE_TOO_LONG (KRDR_ERR_BASE + 2)
117/** @} */
118
119/** @name kLdr Specific
120 * @{
121 */
122/** The base of the kLdr specific status codes. */
123#define KLDR_ERR_BASE (KRDR_ERR_BASE + 3)
124
125/** The image format is unknown. */
126#define KLDR_ERR_UNKNOWN_FORMAT (KLDR_ERR_BASE + 0)
127/** The MZ image format isn't supported by this kLdr build. */
128#define KLDR_ERR_MZ_NOT_SUPPORTED (KLDR_ERR_BASE + 1)
129/** The NE image format isn't supported by this kLdr build. */
130#define KLDR_ERR_NE_NOT_SUPPORTED (KLDR_ERR_BASE + 2)
131/** The LX image format isn't supported by this kLdr build. */
132#define KLDR_ERR_LX_NOT_SUPPORTED (KLDR_ERR_BASE + 3)
133/** The LE image format isn't supported by this kLdr build. */
134#define KLDR_ERR_LE_NOT_SUPPORTED (KLDR_ERR_BASE + 4)
135/** The PE image format isn't supported by this kLdr build. */
136#define KLDR_ERR_PE_NOT_SUPPORTED (KLDR_ERR_BASE + 5)
137/** The ELF image format isn't supported by this kLdr build. */
138#define KLDR_ERR_ELF_NOT_SUPPORTED (KLDR_ERR_BASE + 6)
139/** The mach-o image format isn't supported by this kLdr build. */
140#define KLDR_ERR_MACHO_NOT_SUPPORTED (KLDR_ERR_BASE + 7)
141/** The FAT image format isn't supported by this kLdr build or
142 * a direct open was attempt without going thru the FAT file provider.
143 * FAT images are also known as Universal Binaries. */
144#define KLDR_ERR_FAT_NOT_SUPPORTED (KLDR_ERR_BASE + 8)
145/** The a.out image format isn't supported by this kLdr build. */
146#define KLDR_ERR_AOUT_NOT_SUPPORTED (KLDR_ERR_BASE + 9)
147
148/** The module wasn't loaded dynamically. */
149#define KLDR_ERR_NOT_LOADED_DYNAMICALLY (KLDR_ERR_BASE + 10)
150/** The module wasn't found. */
151#define KLDR_ERR_MODULE_NOT_FOUND (KLDR_ERR_BASE + 11)
152/** A prerequisit module wasn't found. */
153#define KLDR_ERR_PREREQUISITE_MODULE_NOT_FOUND (KLDR_ERR_BASE + 12)
154/** The module is being terminated and can therefore not be loaded. */
155#define KLDR_ERR_MODULE_TERMINATING (KLDR_ERR_BASE + 13)
156/** A prerequisit module is being terminated and can therefore not be loaded. */
157#define KLDR_ERR_PREREQUISITE_MODULE_TERMINATING (KLDR_ERR_BASE + 14)
158/** The module initialization failed. */
159#define KLDR_ERR_MODULE_INIT_FAILED (KLDR_ERR_BASE + 15)
160/** The initialization of a prerequisite module failed. */
161#define KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED (KLDR_ERR_BASE + 16)
162/** The module has already failed initialization and can't be attempted reloaded until
163 * after we've finished garbage collection. */
164#define KLDR_ERR_MODULE_INIT_FAILED_ALREADY (KLDR_ERR_BASE + 17)
165/** A prerequisite module has already failed initialization and can't be attempted
166 * reloaded until after we've finished garbage collection. */
167#define KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED_ALREADY (KLDR_ERR_BASE + 18)
168/** Prerequisite recursed too deeply. */
169#define KLDR_ERR_PREREQUISITE_RECURSED_TOO_DEEPLY (KLDR_ERR_BASE + 19)
170/** Failed to allocate the main stack. */
171#define KLDR_ERR_MAIN_STACK_ALLOC_FAILED (KLDR_ERR_BASE + 20)
172/** Symbol not found. */
173#define KLDR_ERR_SYMBOL_NOT_FOUND (KLDR_ERR_BASE + 21)
174/** A forward symbol was encountered but the caller didn't provide any means to resolve it. */
175#define KLDR_ERR_FORWARDER_SYMBOL (KLDR_ERR_BASE + 22)
176/** Encountered a bad fixup. */
177#define KLDR_ERR_BAD_FIXUP (KLDR_ERR_BASE + 23)
178/** The import ordinal was out of bounds. */
179#define KLDR_ERR_IMPORT_ORDINAL_OUT_OF_BOUNDS (KLDR_ERR_BASE + 24)
180/** A forwarder chain was too long. */
181#define KLDR_ERR_TOO_LONG_FORWARDER_CHAIN (KLDR_ERR_BASE + 25)
182/** The module has no debug info. */
183#define KLDR_ERR_NO_DEBUG_INFO (KLDR_ERR_BASE + 26)
184/** The module is already mapped.
185 * kLdrModMap() can only be called once (without kLdrModUnmap() in between). */
186#define KLDR_ERR_ALREADY_MAPPED (KLDR_ERR_BASE + 27)
187/** The module was not mapped.
188 * kLdrModUnmap() should not called without being preceeded by a kLdrModMap(). */
189#define KLDR_ERR_NOT_MAPPED (KLDR_ERR_BASE + 28)
190/** Couldn't fit the address value into the field. Typically a relocation kind of error. */
191#define KLDR_ERR_ADDRESS_OVERFLOW (KLDR_ERR_BASE + 29)
192/** Couldn't fit a calculated size value into the native size type of the host. */
193#define KLDR_ERR_SIZE_OVERFLOW (KLDR_ERR_BASE + 30)
194/** Thread attach failed. */
195#define KLDR_ERR_THREAD_ATTACH_FAILED (KLDR_ERR_BASE + 31)
196/** The module wasn't a DLL or object file. */
197#define KLDR_ERR_NOT_DLL (KLDR_ERR_BASE + 32)
198/** The module wasn't an EXE. */
199#define KLDR_ERR_NOT_EXE (KLDR_ERR_BASE + 33)
200/** Not implemented yet. */
201#define KLDR_ERR_TODO (KLDR_ERR_BASE + 34)
202/** No image matching the requested CPU. */
203#define KLDR_ERR_CPU_ARCH_MISMATCH (KLDR_ERR_BASE + 35)
204/** Invalid FAT image header. */
205#define KLDR_ERR_FAT_INVALID (KLDR_ERR_BASE + 36)
206/** Unsupported CPU subtype found in a FAT entry. */
207#define KLDR_ERR_FAT_UNSUPPORTED_CPU_SUBTYPE (KLDR_ERR_BASE + 37)
208/** The image has no UUID. */
209#define KLDR_ERR_NO_IMAGE_UUID (KLDR_ERR_BASE + 38)
210/** Duplicate segment name. */
211#define KLDR_ERR_DUPLICATE_SEGMENT_NAME (KLDR_ERR_BASE + 39)
212/** @} */
213
214/** @name kLdrModPE Specific
215 * @{
216 */
217/** The base of the kLdrModPE specific status codes. */
218#define KLDR_ERR_PE_BASE (KLDR_ERR_BASE + 40)
219/** The machine isn't supported by the interpreter. */
220#define KLDR_ERR_PE_UNSUPPORTED_MACHINE (KLDR_ERR_PE_BASE + 0)
221/** The file handler isn't valid. */
222#define KLDR_ERR_PE_BAD_FILE_HEADER (KLDR_ERR_PE_BASE + 1)
223/** The the optional headers isn't valid. */
224#define KLDR_ERR_PE_BAD_OPTIONAL_HEADER (KLDR_ERR_PE_BASE + 2)
225/** One of the section headers aren't valid. */
226#define KLDR_ERR_PE_BAD_SECTION_HEADER (KLDR_ERR_PE_BASE + 3)
227/** Bad forwarder entry. */
228#define KLDR_ERR_PE_BAD_FORWARDER (KLDR_ERR_PE_BASE + 4)
229/** Forwarder module not found in the import descriptor table. */
230#define KLDR_ERR_PE_FORWARDER_IMPORT_NOT_FOUND (KLDR_ERR_PE_BASE + 5)
231/** Bad PE fixups. */
232#define KLDR_ERR_PE_BAD_FIXUP (KLDR_ERR_PE_BASE + 6)
233/** Bad PE import (thunk). */
234#define KLDR_ERR_PE_BAD_IMPORT (KLDR_ERR_PE_BASE + 7)
235/** @} */
236
237/** @name kLdrModLX Specific
238 * @{
239 */
240/** The base of the kLdrModLX specific status codes. */
241#define KLDR_ERR_LX_BASE (KLDR_ERR_PE_BASE + 8)
242/** validation of LX header failed. */
243#define KLDR_ERR_LX_BAD_HEADER (KLDR_ERR_LX_BASE + 0)
244/** validation of the loader section (in the LX header) failed. */
245#define KLDR_ERR_LX_BAD_LOADER_SECTION (KLDR_ERR_LX_BASE + 1)
246/** validation of the fixup section (in the LX header) failed. */
247#define KLDR_ERR_LX_BAD_FIXUP_SECTION (KLDR_ERR_LX_BASE + 2)
248/** validation of the LX object table failed. */
249#define KLDR_ERR_LX_BAD_OBJECT_TABLE (KLDR_ERR_LX_BASE + 3)
250/** A bad page map entry was encountered. */
251#define KLDR_ERR_LX_BAD_PAGE_MAP (KLDR_ERR_LX_BASE + 4)
252/** Bad iterdata (EXEPACK) data. */
253#define KLDR_ERR_LX_BAD_ITERDATA (KLDR_ERR_LX_BASE + 5)
254/** Bad iterdata2 (EXEPACK2) data. */
255#define KLDR_ERR_LX_BAD_ITERDATA2 (KLDR_ERR_LX_BASE + 6)
256/** Bad bundle data. */
257#define KLDR_ERR_LX_BAD_BUNDLE (KLDR_ERR_LX_BASE + 7)
258/** No soname. */
259#define KLDR_ERR_LX_NO_SONAME (KLDR_ERR_LX_BASE + 8)
260/** Bad soname. */
261#define KLDR_ERR_LX_BAD_SONAME (KLDR_ERR_LX_BASE + 9)
262/** Bad forwarder entry. */
263#define KLDR_ERR_LX_BAD_FORWARDER (KLDR_ERR_LX_BASE + 10)
264/** internal fixup chain isn't implemented yet. */
265#define KLDR_ERR_LX_NRICHAIN_NOT_SUPPORTED (KLDR_ERR_LX_BASE + 11)
266/** @} */
267
268/** @name kLdrModMachO Specific
269 * @{
270 */
271/** The base of the kLdrModMachO specific status codes. */
272#define KLDR_ERR_MACHO_BASE (KLDR_ERR_LX_BASE + 12)
273/** Only native endian Mach-O files are supported. */
274#define KLDR_ERR_MACHO_OTHER_ENDIAN_NOT_SUPPORTED (KLDR_ERR_MACHO_BASE + 0)
275/** The Mach-O header is bad or contains new and unsupported features. */
276#define KLDR_ERR_MACHO_BAD_HEADER (KLDR_ERR_MACHO_BASE + 1)
277/** The file type isn't supported. */
278#define KLDR_ERR_MACHO_UNSUPPORTED_FILE_TYPE (KLDR_ERR_MACHO_BASE + 2)
279/** The machine (cputype / cpusubtype combination) isn't supported. */
280#define KLDR_ERR_MACHO_UNSUPPORTED_MACHINE (KLDR_ERR_MACHO_BASE + 3)
281/** Bad load command(s). */
282#define KLDR_ERR_MACHO_BAD_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 4)
283/** Encountered an unknown load command.*/
284#define KLDR_ERR_MACHO_UNKNOWN_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 5)
285/** Encountered a load command that's not implemented.*/
286#define KLDR_ERR_MACHO_UNSUPPORTED_LOAD_COMMAND (KLDR_ERR_MACHO_BASE + 6)
287/** Bad section. */
288#define KLDR_ERR_MACHO_BAD_SECTION (KLDR_ERR_MACHO_BASE + 7)
289/** Encountered a section type that's not implemented.*/
290#define KLDR_ERR_MACHO_UNSUPPORTED_SECTION (KLDR_ERR_MACHO_BASE + 8)
291/** Encountered a init function section. */
292#define KLDR_ERR_MACHO_UNSUPPORTED_INIT_SECTION (KLDR_ERR_MACHO_BASE + 9)
293/** Encountered a term function section. */
294#define KLDR_ERR_MACHO_UNSUPPORTED_TERM_SECTION (KLDR_ERR_MACHO_BASE + 10)
295/** Encountered a section type that's not known to the loader. (probably invalid) */
296#define KLDR_ERR_MACHO_UNKNOWN_SECTION (KLDR_ERR_MACHO_BASE + 11)
297/** The sections aren't ordered by segment as expected by the loader. */
298#define KLDR_ERR_MACHO_BAD_SECTION_ORDER (KLDR_ERR_MACHO_BASE + 12)
299/** The image is 32-bit and contains 64-bit load commands or vise versa. */
300#define KLDR_ERR_MACHO_BIT_MIX (KLDR_ERR_MACHO_BASE + 13)
301/** Bad MH_OBJECT file. */
302#define KLDR_ERR_MACHO_BAD_OBJECT_FILE (KLDR_ERR_MACHO_BASE + 14)
303/** Bad symbol table entry. */
304#define KLDR_ERR_MACHO_BAD_SYMBOL (KLDR_ERR_MACHO_BASE + 15)
305/** Unsupported fixup type. */
306#define KLDR_ERR_MACHO_UNSUPPORTED_FIXUP_TYPE (KLDR_ERR_MACHO_BASE + 16)
307/** Both debug and non-debug sections in segment. */
308#define KLDR_ERR_MACHO_MIXED_DEBUG_SECTION_FLAGS (KLDR_ERR_MACHO_BASE + 17)
309/** The segment bits are non-contiguous in the file. */
310#define KLDR_ERR_MACHO_NON_CONT_SEG_BITS (KLDR_ERR_MACHO_BASE + 18)
311/** @} */
312
313/** @name kCpu Specific
314 * @{
315 */
316/** The base of the kCpu specific status codes. */
317#define KCPU_ERR_BASE (KLDR_ERR_MACHO_BASE + 19)
318/** The specified ARCH+CPU pairs aren't compatible. */
319#define KCPU_ERR_ARCH_CPU_NOT_COMPATIBLE (KCPU_ERR_BASE + 0)
320/** @} */
321
322/** End of the valid status codes. */
323#define KERR_END (KCPU_ERR_BASE + 1)
324/** @}*/
325
326#endif
327
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette