source: trunk/kLdr/kLdr.h@ 2854

Last change on this file since 2854 was 2854, checked in by bird, 19 years ago

Hacking away on the PE module interpreter.

  • Property svn:keywords set to Id
File size: 41.0 KB
Line 
1/* $Id: kLdr.h 2854 2006-11-03 03:39:12Z bird $ */
2/** @file
3 *
4 * kLdr - The Dynamic Loader.
5 *
6 * Copyright (c) 2006 knut st. osmundsen <bird@anduin.net>
7 *
8 *
9 * This file is part of kLdr.
10 *
11 * kLdr is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * kLdr 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
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with kLdr; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#ifndef __kLdr_h__
28#define __kLdr_h__
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* kLdr depend on size_t, [u]intNN_t, [u]intptr_t and some related constants. */
35#include <sys/types.h>
36#include <stddef.h>
37#ifdef _MSC_VER
38typedef signed char int8_t;
39typedef unsigned char uint8_t;
40typedef signed short int16_t;
41typedef unsigned short uint16_t;
42typedef signed int int32_t;
43typedef unsigned int uint32_t;
44typedef signed __int64 int64_t;
45typedef unsigned __int64 uint64_t;
46typedef int64_t intmax_t;
47typedef uint64_t uintmax_t;
48#else
49# include <stdint.h>
50#endif
51
52
53/** @defgroup grp_kLdrRdr kLdrRdr - The file provider
54 * @{ */
55
56/** The kLdr address type. */
57typedef uint64_t KLDRADDR;
58/** Pointer to a kLdr address. */
59typedef KLDRADDR *PKLDRADDR;
60/** Pointer to a const kLdr address. */
61typedef const KLDRADDR *PCKLDRADDR;
62
63/** NIL address. */
64#define NIL_KLDRADDR (~(uint64_t)0)
65
66/** The kLdr size type. */
67typedef uint64_t KLDRSIZE;
68/** Pointer to a kLdr size. */
69typedef KLDRSIZE *PKLDRSIZE;
70/** Pointer to a const kLdr size. */
71typedef const KLDRSIZE *PCKLDRSIZE;
72
73
74
75/**
76 * Memory Mapping Protections.
77 *
78 * @remark Shared segments can be mapped using the non copy-on-write variant.
79 * (Normally the copy-on-write variant is used because changes must
80 * be private and not shared with other processes mapping the file.)
81 */
82typedef enum KLDRPROT
83{
84 /** The usual invalid 0. */
85 KLDRPROT_INVALID = 0,
86 /** No access (page not present). */
87 KLDRPROT_NOACCESS,
88 /** Read only. */
89 KLDRPROT_READONLY,
90 /** Read & write. */
91 KLDRPROT_READWRITE,
92 /** Read & copy on write. */
93 KLDRPROT_WRITECOPY,
94 /** Execute only. */
95 KLDRPROT_EXECUTE,
96 /** Execute & read. */
97 KLDRPROT_EXECUTE_READ,
98 /** Execute, read & write. */
99 KLDRPROT_EXECUTE_READWRITE,
100 /** Execute, read & copy on write. */
101 KLDRPROT_EXECUTE_WRITECOPY,
102 /** The usual end value. (exclusive) */
103 KLDRPROT_END,
104 /** Blow the type up to 32-bits. */
105 KLDRPROT_32BIT_HACK = 0x7fffffff
106} KLDRPROT;
107
108
109/** Pointer to a file provider instance core. */
110typedef struct KLDRRDR *PKLDRRDR;
111/** Pointer to a file provider instance core pointer. */
112typedef struct KLDRRDR **PPKLDRRDR;
113
114/**
115 * File provider instance operations.
116 */
117typedef struct KLDRRDROPS
118{
119 /** The name of this file provider. */
120 const char *pszName;
121 /** Pointer to the next file provider. */
122 const struct KLDRRDROPS *pNext;
123
124 /** Try create a new file provider instance.
125 *
126 * @returns 0 on success, OS specific error code on failure.
127 * @param ppRdr Where to store the file provider instance.
128 * @param pszFilename The filename to open.
129 */
130 int (* pfnCreate)( PPKLDRRDR ppRdr, const char *pszFilename);
131 /** Destroy the file provider instance.
132 *
133 * @returns 0 on success, OS specific error code on failure.
134 * On failure, the file provider instance will be in an indeterminate state - don't touch it!
135 * @param pRdr The file provider instance.
136 */
137 int (* pfnDestroy)( PKLDRRDR pRdr);
138 /** Read bits from the file.
139 *
140 * @returns 0 on success, OS specific error code on failure.
141 * @param pRdr The file provider instance.
142 * @param pvBuf Where to put the bits.
143 * @param cb The number of bytes to read.
144 * @param off Where to start reading.
145 */
146 int (* pfnRead)( PKLDRRDR pRdr, void *pvBuf, size_t cb, off_t off);
147 /** Map all the file bits into memory (read only).
148 *
149 * @returns 0 on success, OS specific error code on failure.
150 * @param pRdr The file provider instance.
151 * @param ppvBits Where to store the address of the mapping.
152 * The size can be obtained using pfnSize.
153 */
154 int (* pfnAllMap)( PKLDRRDR pRdr, const void **ppvBits);
155 /** Unmap a file bits mapping obtained by KLDRRDROPS::pfnAllMap.
156 *
157 * @returns 0 on success, OS specific error code on failure.
158 * @param pRdr The file provider instance.
159 * @param pvBits The mapping address.
160 */
161 int (* pfnAllUnmap)(PKLDRRDR pRdr, const void *pvBits);
162 /** Get the file size.
163 *
164 * @returns The file size. Returns -1 on failure.
165 * @param pRdr The file provider instance.
166 */
167 off_t (* pfnSize)( PKLDRRDR pRdr);
168 /** Get the file pointer offset.
169 *
170 * @returns The file pointer offset. Returns -1 on failure.
171 * @param pRdr The file provider instance.
172 */
173 off_t (* pfnTell)( PKLDRRDR pRdr);
174 /** Get the file name.
175 *
176 * @returns The file size. Returns -1 on failure.
177 * @param pRdr The file provider instance.
178 */
179 const char * (* pfnName)(PKLDRRDR pRdr);
180 /**
181 * Prepares a memory region to map file sections into.
182 *
183 * @returns 0 on success, OS specific error code on failure.
184 * @param pRdr The file provider instance.
185 * @param ppv If fFixed is set, *ppv contains the memory location which
186 * the region should be based at. If fFixed is clear the OS
187 * is free to choose the location.
188 * On successful return *ppv contains address of the prepared
189 * memory region.
190 * @param cb The size of the memory region to prepare.
191 * @param fFixed When set *ppv will contain the desired region address.
192 *
193 */
194 int (* pfnPrepare)(PKLDRRDR pRdr, void **ppv, size_t cb, unsigned fFixed);
195 /**
196 * Maps a section of the file into the memory region reserved by pfnPrepare.
197 *
198 * @returns 0 on success, OS specific error code on failure.
199 * @param pRdr The file provider instance.
200 * @param pv The address in the prepared region.
201 * @param cb The size of the memory mapping.
202 * @param enmProt The desired memory protection.
203 * @param offFile The start of the raw file bytes.
204 * @param cbFile The number of raw file bytes. This must be less or equal to cb.
205 */
206 int (* pfnMap)(PKLDRRDR pRdr, void *pv, size_t cb, KLDRPROT enmProt, off_t offFile, size_t cbFile);
207 /**
208 * Changes the page protection of a section mapped using pfnMap.
209 *
210 * This is typically used for applying fixups and similar.
211 *
212 * @returns 0 on success, OS specific error code on failure.
213 * @param pRdr The file provider instance.
214 * @param pv The address passed to pfnMap.
215 * @param cb The size passed to pfnMap.
216 * @param enmProt The desired memory protection.
217 */
218 int (* pfnProtect)(PKLDRRDR pRdr, void *pv, size_t cb, KLDRPROT enmProt);
219 /**
220 * Unmaps a section of the file previously mapped using pfnMap.
221 *
222 * @returns 0 on success, OS specific error code on failure.
223 * @param pRdr The file provider instance.
224 * @param pv The address passed to pfnMap.
225 * @param cb The size passed to pfnMap.
226 */
227 int (* pfnUnmap)(PKLDRRDR pRdr, void *pv, size_t cb);
228 /**
229 * Releases the memory region prepared by pfnPrepare().
230 *
231 * Before calling this function, all sections mapped by pfnMap must first be unmapped by calling pfnUnmap.
232 *
233 * @returns 0 on success, OS specific error code on failure.
234 * @param pRdr The file provider instance.
235 * @param pv The address of the prepared region.
236 * @param cb The size of the prepared region.
237 */
238 int (* pfnUnprepare)(PKLDRRDR pRdr, void *pv, size_t cb);
239 /**
240 * We're done reading from the file but would like to keep file mappings.
241 *
242 * If the OS support closing the file handle while the file is mapped,
243 * the reader should do so.
244 *
245 * @param pRdr The file provider instance.
246 */
247 void (* pfnDone)(PKLDRRDR pRdr);
248 /** The usual non-zero dummy that makes sure we've initialized all members. */
249 uint32_t u32Dummy;
250} KLDRRDROPS;
251/** Pointer to file provider operations. */
252typedef KLDRRDROPS *PKLDRRDROPS;
253/** Pointer to const file provider operations. */
254typedef const KLDRRDROPS *PCKLDRRDROPS;
255
256
257/**
258 * File provider instance core.
259 */
260typedef struct KLDRRDR
261{
262 /** Pointer to the file provider operations. */
263 PCKLDRRDROPS pOps;
264} KLDRRDR;
265
266void kLdrRdrAddProvider(PKLDRRDROPS pAdd);
267
268int kLdrRdrOpen( PPKLDRRDR ppRdr, const char *pszFilename);
269int kLdrRdrClose( PKLDRRDR pRdr);
270int kLdrRdrRead( PKLDRRDR pRdr, void *pvBuf, size_t cb, off_t off);
271int kLdrRdrAllMap( PKLDRRDR pRdr, const void **ppvBits);
272int kLdrRdrAllUnmap(PKLDRRDR pRdr, const void *pvBits);
273off_t kLdrRdrSize( PKLDRRDR pRdr);
274off_t kLdrRdrTell( PKLDRRDR pRdr);
275const char *kLdrRdrName(PKLDRRDR pRdr);
276
277/** @} */
278
279
280
281/** @defgroup grp_kLdrMod kLdrMod - The executable image intepreter
282 * @{ */
283
284
285/**
286 * Debug info type (from the loader point of view).
287 */
288typedef enum KLDRDBGINFOTYPE
289{
290 /** The usual invalid enum value. */
291 KLDRDBGINFOTYPE_INVALID = 0,
292 /** Stabs. */
293 KLDRDBGINFOTYPE_STABS,
294 /** Debug With Arbitrary Record Format (DWARF). */
295 KLDRDBGINFOTYPE_DWARF,
296 /** Microsoft Codeview debug info. */
297 KLDRDBGINFOTYPE_CODEVIEW,
298 /** Watcom debug info. */
299 KLDRDBGINFOTYPE_WATCOM,
300 /** IBM High Level Language debug info.. */
301 KLDRDBGINFOTYPE_HLL,
302 /** The end of the valid debug info values (exclusive). */
303 KLDRDBGINFOTYPE_END,
304 /** Blow the type up to 32-bit. */
305 KLDRDBGINFOTYPE_32BIT_HACK = 0x7fffffff
306} KLDRDBGINFOTYPE;
307/** Pointer to a kLdr debug info type. */
308typedef KLDRDBGINFOTYPE *PKLDRDBGINFOTYPE;
309
310
311/**
312 * Stack information.
313 */
314typedef struct KLDRSTACKINFO
315{
316 /** The base address of the stack (sub) segment.
317 * Set this to NIL_KLDRADDR if the module doesn't include any stack segment. */
318 KLDRADDR Address;
319 /** The base address of the stack (sub) segment, link address.
320 * Set this to NIL_KLDRADDR if the module doesn't include any stack (sub)segment. */
321 KLDRADDR LinkAddress;
322 /** The stack size of the main thread.
323 * If no stack (sub)segment in the module, this is the stack size of the main thread.
324 * If the module doesn't contain this kind of information this field will be set to 0. */
325 KLDRSIZE cbStack;
326 /** The stack size of non-main threads.
327 * If the module doesn't contain this kind of information this field will be set to 0. */
328 KLDRSIZE cbStackThread;
329} KLDRSTACKINFO;
330/** Pointer to stack information. */
331typedef KLDRSTACKINFO *PKLDRSTACKINFO;
332/** Pointer to const stack information. */
333typedef const KLDRSTACKINFO *PCKLDRSTACKINFO;
334
335
336/**
337 * Loader segment.
338 */
339typedef struct KLDRSEG
340{
341 /** Variable free to use for the kLdr user. */
342 void *pvUser;
343 /** The segment name. (Might not be zero terminated!) */
344 const char *pchName;
345 /** The length of the segment name. */
346 uint32_t cchName;
347 /** The size of the segment. */
348 KLDRSIZE cb;
349 /** The required segment alignment. */
350 KLDRADDR Alignment;
351 /** The link address.
352 * Set to NIL_KLDRADDR if the segment isn't supposed to be mapped. */
353 KLDRADDR LinkAddress;
354 /** The address the segment was mapped at by kLdrModMap().
355 * Set to NIL_KLDRADDR if not mapped. */
356 KLDRADDR MapAddress;
357 /** The segment protection. */
358 KLDRPROT enmProt;
359} KLDRSEG;
360/** Pointer to a loader segment. */
361typedef KLDRSEG *PKLDRSEG;
362/** Pointer to a loader segment. */
363typedef const KLDRSEG *PCKLDRSEG;
364
365
366/**
367 * Loader module format.
368 */
369typedef enum KLDRFMT
370{
371 /** The usual invalid 0 format. */
372 KLDRFMT_INVALID = 0,
373 /** The native OS loader. */
374 KLDRFMT_NATIVE,
375 /** The AOUT loader. */
376 KLDRFMT_AOUT,
377 /** The ELF loader. */
378 KLDRFMT_ELF,
379 /** The LX loader. */
380 KLDRFMT_LX,
381 /** The mach-o loader. */
382 KLDRFMT_MACHO,
383 /** The LX loader. */
384 KLDRFMT_PE,
385 /** The end of the valid format values (exclusive). */
386 KLDRFMT_END,
387 /** Hack to blow the type up to 32-bit. */
388 KLDRFMT_32BIT_HACK = 0x7fffffff
389} KLDRFMT;
390
391
392/**
393 * Loader module type.
394 */
395typedef enum KLDRTYPE
396{
397 /** The usual invalid 0 type. */
398 KLDRTYPE_INVALID = 0,
399 /** Object file. */
400 KLDRTYPE_OBJECT,
401 /** Executable module, fixed load address. */
402 KLDRTYPE_EXECUTABLE_FIXED,
403 /** Executable module, relocatable, non-fixed load address. */
404 KLDRTYPE_EXECUTABLE_RELOCATABLE,
405 /** Executable module, position independent code, non-fixed load address. */
406 KLDRTYPE_EXECUTABLE_PIC,
407 /** Shared library, fixed load address.
408 * Typically a system library. */
409 KLDRTYPE_SHARED_LIBRARY_FIXED,
410 /** Shared library, relocatable, non-fixed load address. */
411 KLDRTYPE_SHARED_LIBRARY_RELOCATABLE,
412 /** Shared library, position independent code, non-fixed load address. */
413 KLDRTYPE_SHARED_LIBRARY_PIC,
414 /** DLL that contains no code or data only imports and exports. (Chiefly OS/2.) */
415 KLDRTYPE_FORWARDER_DLL,
416 /** Core or dump. */
417 KLDRTYPE_CORE,
418 /** The end of the valid types values (exclusive). */
419 KLDRTYPE_END,
420 /** Hack to blow the type up to 32-bit. */
421 KLDRTYPE_32BIT_HACK = 0x7fffffff
422} KLDRTYPE;
423
424
425/**
426 * CPU Architecture.
427 * @todo Double check the non intel architectures.
428 */
429typedef enum KLDRARCH
430{
431 /** The usual invalid one. */
432 KLDRARCH_INVALID = 0,
433 /** Clone or Intel 16-bit x86. */
434 KLDRARCH_X86_16,
435 /** Clone or Intel 32-bit x86. */
436 KLDRARCH_X86_32,
437 /** AMD64 (including clones). */
438 KLDRARCH_AMD64,
439 /** Itanic (64-bit). */
440 KLDRARCH_IA64,
441 /** ALPHA (64-bit). */
442 KLDRARCH_ALPHA,
443 /** ALPHA limited to 32-bit. */
444 KLDRARCH_ALPHA_32,
445 /** 32-bit ARM. */
446 KLDRARCH_ARM_32,
447 /** 64-bit ARM. */
448 KLDRARCH_ARM_64,
449 /** 32-bit MIPS. */
450 KLDRARCH_MIPS_32,
451 /** 64-bit MIPS. */
452 KLDRARCH_MIPS_64,
453 /** 32-bit PowerPC. */
454 KLDRARCH_POWERPC_32,
455 /** 64-bit PowerPC. */
456 KLDRARCH_POWERPC_64,
457 /** 32-bit SPARC. */
458 KLDRARCH_SPARC_32,
459 /** 64-bit SPARC. */
460 KLDRARCH_SPARC_64,
461 /** The end of the valid architecture values (exclusive). */
462 KLDRARCH_END,
463 /** Hack to blow the type up to 32-bit. */
464 KLDRARCH_32BIT_HACK = 0x7fffffff
465} KLDRARCH;
466
467
468/**
469 * CPU models.
470 */
471typedef enum KLDRCPU
472{
473 /** The usual invalid cpu. */
474 KLDRCPU_INVALID = 0,
475 /** @name KLDRARCH_X86_16
476 * @{ */
477 KLDRCPU_I8086,
478 KLDRCPU_I8088,
479 KLDRCPU_I80186,
480 KLDRCPU_I80286,
481 KLDRCPU_I386_16,
482 KLDRCPU_I486_16,
483 KLDRCPU_I486SX_16,
484 KLDRCPU_I586_16,
485 KLDRCPU_I686_16,
486 KLDRCPU_K6_16,
487 KLDRCPU_K7_16,
488 KLDRCPU_K8_16,
489 /** @} */
490
491 /** @name KLDRARCH_X86_32
492 * @{ */
493 KLDRCPU_I386,
494 KLDRCPU_I486,
495 KLDRCPU_I486SX,
496 KLDRCPU_I586,
497 KLDRCPU_I686,
498 KLDRCPU_P4,
499 KLDRCPU_CORE2_32,
500 KLDRCPU_K6,
501 KLDRCPU_K7,
502 KLDRCPU_K8_32,
503 /** @} */
504
505 /** @name KLDRARCH_AMD64
506 * @{ */
507 KLDRCPU_K8,
508 KLDRCPU_P4_64,
509 KLDRCPU_CORE2,
510 /** @} */
511
512 /** The end of the valid cpu values (exclusive). */
513 KLDRCPU_END,
514 /** Hack to blow the type up to 32-bit. */
515 KLDRCPU_32BIT_HACK = 0x7fffffff
516} KLDRCPU;
517
518
519/**
520 * Loader endian indicator.
521 */
522typedef enum KLDRENDIAN
523{
524 /** The usual invalid endian. */
525 KLDRENDIAN_INVALID,
526 /** Little endian. */
527 KLDRENDIAN_LITTLE,
528 /** Bit endian. */
529 KLDRENDIAN_BIG,
530 /** Endianness doesn't have a meaning in the context. */
531 KLDRENDIAN_NA,
532 /** The end of the valid endian values (exclusive). */
533 KLDRENDIAN_END,
534 /** Hack to blow the type up to 32-bit. */
535 KLDRENDIAN_32BIT_HACK = 0x7fffffff
536} KLDRENDIAN;
537
538
539/** Pointer to a module interpreter method table. */
540typedef struct KLDRMODOPS *PKLDRMODOPS;
541/** Pointer to const module interpreter methods table. */
542typedef const struct KLDRMODOPS *PCKLDRMODOPS;
543
544/**
545 * Module interpreter instance.
546 * All members are read only unless you're kLdrMod or the module interpreter.
547 */
548typedef struct KLDRMOD
549{
550 /** Magic number. */
551 uint32_t u32Magic;
552 /** The format of this module. */
553 KLDRFMT enmFmt;
554 /** The type of module. */
555 KLDRTYPE enmType;
556 /** The architecture this module was built for. */
557 KLDRARCH enmArch;
558 /** The minium cpu this module was built for.
559 * This might not be accurate, so use kLdrModCanExecuteOn() to check. */
560 KLDRARCH enmCpu;
561 /** The endian used by the module. */
562 KLDRENDIAN enmEndian;
563 /** The filename length (bytes). */
564 uint32_t cchFilename;
565 /** The filename. */
566 const char *pszFilename;
567 /** The module name. */
568 const char *pszName;
569 /** The module name length (bytes). */
570 uint32_t cchName;
571 /** The number of segments in the module. */
572 uint32_t cSegments;
573 /** Pointer to the loader methods.
574 * Not meant for calling directly thru! */
575 PCKLDRMODOPS pOps;
576 /** Pointer to the read instance. (Can be NULL after kLdrModDone().)*/
577 PKLDRRDR pRdr;
578 /** The module data. */
579 void *pvData;
580 /** Segments. (variable size, can be zero) */
581 KLDRSEG aSegments[1];
582} KLDRMOD, *PKLDRMOD, **PPKLDRMOD;
583
584/** The magic for KLDRMOD::u32Magic. (Kosuke Fujishima) */
585#define KLDRMOD_MAGIC 0x19640707
586
587
588/** Special base address value alias for the link address. */
589#define KLDRMOD_BASEADDRESS_LINK (~(KLDRADDR)1)
590/** Special base address value alias for the actual load address (must be mapped). */
591#define KLDRMOD_BASEADDRESS_MAP (~(KLDRADDR)2)
592
593/** Special import module ordinal value used to indicate that there is no
594 * specific module associated with the requested symbol. */
595#define NIL_KLDRMOD_IMPORT (~(uint32_t)0)
596
597/** Special symbol ordinal value used to indicate that the symbol
598 * only has a string name. */
599#define NIL_KLDRMOD_SYM_ORDINAL (~(uint32_t)0)
600
601
602/** @name Load symbol kind flags.
603 * @{ */
604/** The bitness doesn't matter. */
605#define KLDRSYMKIND_NO_BIT 0x00000000
606/** 16-bit symbol. */
607#define KLDRSYMKIND_16BIT 0x00000001
608/** 32-bit symbol. */
609#define KLDRSYMKIND_32BIT 0x00000002
610/** 64-bit symbol. */
611#define KLDRSYMKIND_64BIT 0x00000003
612/** Mask out the bit.*/
613#define KLDRSYMKIND_BIT_MASK 0x00000003
614/** We don't know the type of symbol. */
615#define KLDRSYMKIND_NO_TYPE 0x00000000
616/** The symbol is a code object (method/function/procedure/whateveryouwannacallit). */
617#define KLDRSYMKIND_CODE 0x00000010
618/** The symbol is a data object. */
619#define KLDRSYMKIND_DATA 0x00000020
620/** Mask out the symbol type. */
621#define KLDRSYMKIND_TYPE_MASK 0x00000030
622/** Valid symbol kind mask. */
623#define KLDRSYMKIND_MASK 0x00000033
624/** Weak symbol. */
625#define KLDRSYMKIND_WEAK 0x00000100
626/** Forwarder symbol. */
627#define KLDRSYMKIND_FORWARDER 0x00000200
628/** @} */
629
630/** @name kLdrModEnumSymbols flags.
631 * @{ */
632/** Returns ALL kinds of symbols. The default is to only return public/exported symbols. */
633#define KLDRMOD_ENUM_SYMS_FLAGS_ALL 0x00000001
634/** @} */
635
636
637/**
638 * Callback for resolving imported symbols when applying fixups.
639 *
640 * @returns 0 on success and *pValue and *pfKind filled.
641 * @returns Non-zero OS specific or kLdr status code on failure.
642 *
643 * @param pMod The module which fixups are begin applied.
644 * @param iImport The import module ordinal number or NIL_KLDRMOD_IMPORT.
645 * @param uSymbol The symbol ordinal number or NIL_KLDRMOD_SYM_ORDINAL.
646 * @param pszSymbol The symbol name. Can be NULL if uSymbol isn't nil.
647 * @param puValue Where to store the symbol value.
648 * @param pfKind Where to store the symbol kind flags.
649 * @param pvUser The user parameter specified to the relocation function.
650 */
651typedef int FNKLDRMODGETIMPORT(PKLDRMOD pMod, uint32_t iImport, uint32_t uSymbol, const char *pszSymbol,
652 PKLDRADDR puValue, uint32_t *pfKind, void *pvUser);
653/** Pointer to a import callback. */
654typedef FNKLDRMODGETIMPORT *PFNKLDRMODGETIMPORT;
655
656/**
657 * Symbol enumerator callback.
658 *
659 * @returns 0 if enumeration should continue.
660 * @returns non-zero if the enumeration should stop. This status code will then be returned by kLdrModEnumSymbols().
661 *
662 * @param pMod The module which symbols are being enumerated.s
663 * @param uSymbol The symbol ordinal number or NIL_KLDRMOD_SYM_ORDINAL.
664 * @param pszSymbol The symbol name. This can be NULL if there is a symbol ordinal.
665 * This can also be an empty string if the symbol doesn't have a name
666 * or it's name has been stripped.
667 * @param uValue The symbol value.
668 * @param fKind The symbol kind flags.
669 * @param pvUser The user parameter specified to kLdrModEnumSymbols().
670 */
671typedef int FNKLDRMODENUMSYMS(PKLDRMOD pMod, uint32_t uSymbol, const char *pszSymbol,
672 KLDRADDR uValue, uint32_t fKind, void *pvUser);
673/** Pointer to a symbol enumerator callback. */
674typedef FNKLDRMODENUMSYMS *PFNKLDRMODENUMSYMS;
675
676/**
677 * Debug info enumerator callback.
678 *
679 * @returns 0 to continue the enumeration.
680 * @returns non-zero if the enumeration should stop. This status code will then be returned by kLdrModEnumDbgInfo().
681 *
682 * @param pMod The module.
683 * @param enmType The debug info type.
684 * @param iDbgInfo The debug info ordinal number / id.
685 * @param offFile The file offset *if* this type has one specific location in the executable image file.
686 * This is -1 if there isn't any specific file location.
687 * @param cbFile The file size.
688 * This is 0 if there isn't any specific file location.
689 * @param pszExtFile This points to the name of an external file containing the debug info.
690 * This is NULL if there isn't any external file.
691 * @param pvUser The user parameter specified to kLdrModEnumDbgInfo.
692 */
693typedef int FNKLDRENUMDBG(PKLDRMOD pMod, KLDRDBGINFOTYPE enmType, uint32_t iDbgInfo, off_t offFile, off_t cbFile,
694 const char *pszExtFile, void *pvUser);
695
696int kLdrModOpen(const char *pszFilename, PPKLDRMOD ppMod);
697int kLdrModOpenFromRdr(PKLDRRDR pRdr, PPKLDRMOD ppMod);
698int kLdrModOpenNative(const char *pszFilename, PPKLDRMOD ppMod);
699int kLdrModClose(PKLDRMOD pMod);
700
701int kLdrModQuerySymbol(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, uint32_t uSymbol,
702 const char *pszSymbol, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser,
703 PKLDRADDR puValue, uint32_t *pfKind);
704int kLdrModEnumSymbols(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress,
705 uint32_t fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser);
706int kLdrModGetImport(PKLDRMOD pMod, void *pvBits, uint32_t iImport, const char *pszName, size_t cchName);
707int32_t kLdrModNumberOfImports(PKLDRMOD pMod, void *pvBits);
708int kLdrModCanExecuteOn(PKLDRMOD pMod, void *pvBits, KLDRARCH enmArch, KLDRCPU enmCpu);
709int kLdrModGetStackInfo(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PKLDRSTACKINFO pStackInfo);
710int kLdrModQueryMainEntrypoint(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PKLDRADDR pMainEPAddress);
711/** Pointer to a debug info enumberator callback. */
712typedef FNKLDRENUMDBG *PFNKLDRENUMDBG;
713int kLdrModEnumDbgInfo(PKLDRMOD pMod, void *pvBits, PFNKLDRENUMDBG pfnCallback, void *pvUser);
714int kLdrModHasDbgInfo(PKLDRMOD pMod, void *pvBits);
715
716/** @name Operations On The Internally Managed Mapping
717 * @{ */
718int kLdrModMap(PKLDRMOD pMod);
719int kLdrModUnmap(PKLDRMOD pMod);
720int kLdrModAllocTLS(PKLDRMOD pMod);
721void kLdrModFreeTLS(PKLDRMOD pMod);
722int kLdrModReload(PKLDRMOD pMod);
723int kLdrModFixupMapping(PKLDRMOD pMod, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser);
724int kLdrModCallInit(PKLDRMOD pMod);
725int kLdrModCallTerm(PKLDRMOD pMod);
726int kLdrModCallThread(PKLDRMOD pMod, unsigned fAttachingOrDetaching);
727/** @} */
728
729/** @name Operations On The Externally Managed Mappings
730 * @{ */
731size_t kLdrModSize(PKLDRMOD pMod);
732int kLdrModGetBits(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser);
733int kLdrModRelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress,
734 PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser);
735/** @} */
736
737
738/**
739 * The loader module operation.
740 */
741typedef struct KLDRMODOPS
742{
743 /** The name of this module interpreter. */
744 const char *pszName;
745 /** Pointer to the next module interpreter. */
746 PCKLDRMODOPS pNext;
747
748 /**
749 * Create a loader module instance interpreting the executable image found
750 * in the specified file provider instance.
751 *
752 * @returns 0 on success and *ppMod pointing to a module instance.
753 * On failure, a non-zero OS specific error code is returned.
754 * @param pOps Pointer to the registered method table.
755 * @param pRdr The file provider instance to use.
756 * @param offNewHdr The offset of the new header in MZ files. -1 if not found.
757 * @param ppMod Where to store the module instance pointer.
758 */
759 int (* pfnCreate)(PCKLDRMODOPS pOps, PKLDRRDR pRdr, off_t offNewHdr, PPKLDRMOD ppMod);
760 /**
761 * Destroys an loader module instance.
762 *
763 * The caller is responsible for calling kLdrModUnmap() and kLdrFreeTLS() first.
764 *
765 * @returns 0 on success, non-zero on failure. The module instance state
766 * is unknown on failure, it's best not to touch it.
767 * @param pMod The module.
768 */
769 int (* pfnDestroy)(PKLDRMOD pMod);
770
771 /** @copydoc kLdrModQuerySymbol */
772 int (* pfnQuerySymbol)(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, uint32_t uSymbol,
773 const char *pszSymbol, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser,
774 PKLDRADDR puValue, uint32_t *pfKind);
775 /** @copydoc kLdrModEnumSymbols */
776 int (* pfnEnumSymbols)(PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, uint32_t fFlags,
777 PFNKLDRMODENUMSYMS pfnCallback, void *pvUser);
778 /** @copydoc kLdrModGetImport */
779 int (* pfnGetImport)(PKLDRMOD pMod, void *pvBits, uint32_t iImport, const char *pszName, size_t cchName);
780 /** @copydoc kLdrModNumberOfImports */
781 int32_t (* pfnNumberOfImports)(PKLDRMOD pMod, void *pvBits);
782 /** @copydoc kLdrModCanExecuteOn */
783 int (* pfnCanExecuteOn)(PKLDRMOD pMod, void *pvBits, KLDRARCH enmArch, KLDRCPU enmCpu);
784 /** @copydoc kLdrModGetStackInfo */
785 int (* pfnGetStackInfo)(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PKLDRSTACKINFO pStackInfo);
786 /** @copydoc kLdrModQueryMainEntrypoint */
787 int (* pfnQueryMainEntrypoint)(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PKLDRADDR pMainEPAddress);
788 /** @copydoc kLdrModEnumDbgInfo */
789 int (* pfnEnumDbgInfo)(PKLDRMOD pMod, void *pvBits, PFNKLDRENUMDBG pfnCallback, void *pvUser);
790 /** @copydoc kLdrModHasDbgInfo */
791 int (* pfnHasDbgInfo)(PKLDRMOD pMod, void *pvBits);
792 /** @copydoc kLdrModMap */
793 int (* pfnMap)(PKLDRMOD pMod);
794 /** @copydoc kLdrModUnmap */
795 int (* pfnUnmap)(PKLDRMOD pMod);
796 /** @copydoc kLdrModAllocTLS */
797 int (* pfnAllocTLS)(PKLDRMOD pMod);
798 /** @copydoc kLdrModFreeTLS */
799 void (* pfnFreeTLS)(PKLDRMOD pMod);
800 /** @copydoc kLdrModReload */
801 int (* pfnReload)(PKLDRMOD pMod);
802 /** @copydoc kLdrModFixupMapping */
803 int (* pfnFixupMapping)(PKLDRMOD pMod, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser);
804 /** @copydoc kLdrModCallInit */
805 int (* pfnCallInit)(PKLDRMOD pMod);
806 /** @copydoc kLdrModCallTerm */
807 int (* pfnCallTerm)(PKLDRMOD pMod);
808 /** @copydoc kLdrModCallThread */
809 int (* pfnCallThread)(PKLDRMOD pMod, unsigned fAttachingOrDetaching);
810 /** @copydoc kLdrModSize */
811 size_t (* pfnSize)(PKLDRMOD pMod);
812 /** @copydoc kLdrModGetBits */
813 int (* pfnGetBits)(PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser);
814 /** @copydoc kLdrModRelocateBits */
815 int (* pfnRelocateBits)(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress,
816 PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser);
817 /** Dummy which should be assigned a non-zero value. */
818 uint32_t uEndOfStructure;
819} KLDRMODOPS;
820
821
822/** @} */
823
824
825
826
827/** @defgroup grp_kLdrDyld kLdrDyld - The dynamic loader
828 * @{ */
829
830/** The handle to a dynamic loader module. */
831typedef struct KLDRDYLDMOD *HKLDRMOD;
832/** Pointer to the handle to a dynamic loader module. */
833typedef HKLDRMOD *PHKLDRMOD;
834/** NIL handle value. */
835#define NIL_HKLDRMOD ((HKLDRMOD)0)
836
837
838/**
839 * File search method.
840 *
841 * In addition to it's own way of finding files, kLdr emulates
842 * the methods employed by the most popular systems.
843 */
844typedef enum KLDRDYLDSEARCH
845{
846 /** The usual invalid file search method. */
847 KLDRDYLD_SEARCH_INVALID = 0,
848 /** Uses the kLdr file search method.
849 * @todo invent me. */
850 KLDRDYLD_SEARCH_KLDR,
851 /** Use the emulation closest to the host system. */
852 KLDRDYLD_SEARCH_HOST,
853 /** Emulate the OS/2 file search method.
854 * On non-OS/2 systems, BEGINLIBPATH, LIBPATH, ENDLIBPATH and LIBPATHSTRICT are
855 * taken form the environment. */
856 KLDRDYLD_SEARCH_OS2,
857 /** Emulate the standard window file search method. */
858 KLDRDYLD_SEARCH_WINDOWS,
859 /** Emulate the alternative window file search method. */
860 KLDRDYLD_SEARCH_WINDOWS_ALTERED,
861 /** Emulate the most common UNIX file search method. */
862 KLDRDYLD_SEARCH_UNIX_COMMON,
863 /** End of the valid file search method values. */
864 KLDRDYLD_SEARCH_END,
865 /** Hack to blow the type up to 32-bit. */
866 KLDRDYLD_SEARCH_32BIT_HACK = 0x7fffffff
867} KLDRDYLDSEARCH;
868
869/** @name kLdrDyldLoad and kLdrDyldFindByName flags.
870 * @{ */
871/** The symbols in the module should be loaded into the global unix namespace.
872 * If not specified, the symbols are local and can only be referenced directly. */
873#define KLDRYDLD_LOAD_FLAGS_GLOBAL_SYMBOLS 0x00000001
874/** The module shouldn't be found by a global module search.
875 * If not specified, the module can be found by unspecified module searches,
876 * typical used when loading import/dep modules. */
877#define KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE 0x00000002
878/** Do a recursive initialization calls instead of defering them to the outermost call. */
879#define KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT 0x00000004
880/** We're loading the executable module.
881 * Internal flag which will be rejected by kLdrDyldLoad. */
882#define KLDRDYLD_LOAD_FLAGS_EXECUTABLE 0x40000000
883/** @} */
884
885
886int kLdrDyldLoad(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch,
887 unsigned fFlags, PHKLDRMOD phMod, char *pszErr, size_t cchErr);
888int kLdrDyldUnload(HKLDRMOD hMod);
889int kLdrDyldFindByName(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch,
890 unsigned fFlags, PHKLDRMOD phMod);
891int kLdrDyldFindByAddress(uintptr_t Address, PHKLDRMOD phMod, uint32_t *piSegment, uintptr_t *poffSegment);
892int kLdrDyldGetName(HKLDRMOD hMod, char *pszName, size_t cchName);
893int kLdrDyldGetFilename(HKLDRMOD hMod, char *pszFilename, size_t cchFilename);
894int kLdrDyldQuerySymbol(HKLDRMOD hMod, uint32_t uSymbolOrdinal, const char *pszSymbolName, uintptr_t *pValue, uint32_t *pfKind);
895
896/** @name OS/2 like API
897 * @{ */
898int kLdrDosLoadModule(char *pszObject, size_t cbObject, const char *pszModule, PHKLDRMOD phMod);
899int kLdrDosFreeModule(HKLDRMOD hMod);
900int kLdrDosQueryModuleHandle(const char *pszModname, PHKLDRMOD phMod);
901int kLdrDosQueryModuleName(HKLDRMOD hMod, size_t cchName, char *pszName);
902int kLdrDosQueryProcAddr(HKLDRMOD hMod, uint32_t iOrdinal, const char *pszProcName, void **ppvProcAddr);
903int kLdrDosQueryProcType(HKLDRMOD hMod, uint32_t iOrdinal, const char *pszProcName, uint32_t *pfProcType);
904int kLdrDosQueryModFromEIP(PHKLDRMOD phMod, uint32_t *piObject, size_t cbName, char *pszName, uintptr_t *poffObject, uintptr_t ulEIP);
905int kLdrDosReplaceModule(const char *pszOldModule, const char *pszNewModule, const char *pszBackupModule);
906int kLdrDosGetResource(HKLDRMOD hMod, uint32_t idType, uint32_t idName, void **pvResAddr);
907int kLdrDosQueryResourceSize(HKLDRMOD hMod, uint32_t idTypeID, uint32_t idName, uint32_t *pcb);
908int kLdrDosFreeResource(void *pvResAddr);
909/** @} */
910
911/** @name POSIX like API
912 * @{ */
913HKLDRMOD kLdrDlOpen(const char *pszLibrary, int fFlags);
914const char *kLdrDlError(void);
915void * kLdrDlSym(HKLDRMOD hMod, const char *pszSymbol);
916int kLdrDlClose(HKLDRMOD hMod);
917/** @} */
918
919/** @name Win32 like API
920 * @{ */
921HKLDRMOD kLdrWLoadLibrary(const char *pszFilename);
922HKLDRMOD kLdrWLoadLibraryEx(const char *pszFilename, void *hFileReserved, uint32_t fFlags);
923uint32_t kLdrWGetModuleFileName(HKLDRMOD hMod, char *pszModName, size_t cchModName);
924HKLDRMOD kLdrWGetModuleHandle(const char *pszFilename);
925int kLdrWGetModuleHandleEx(uint32_t fFlags, const char *pszFilename, HKLDRMOD hMod);
926void * kLdrWGetProcAddress(HKLDRMOD hMod, const char *pszProcName);
927uint32_t kLdrWGetDllDirectory(size_t cchDir, char *pszDir);
928int kLdrWSetDllDirectory(const char *pszDir);
929int kLdrWFreeLibrary(HKLDRMOD hMod);
930int kLdrWDisableThreadLibraryCalls(HKLDRMOD hMod);
931
932/** @} */
933
934
935/** @name Process Bootstrapping
936 * @{ */
937
938/**
939 * Argument package from the stub.
940 */
941typedef struct KLDREXEARGS
942{
943 /** Flags. (Currently unused, MBZ.) */
944 uint32_t fFlags;
945 /** The search method to use when loading this executable. */
946 KLDRDYLDSEARCH enmSearch;
947 /** The executable file that the stub is supposed to load. */
948 char szExecutable[260];
949 /** The default prefix used when searching for DLLs. */
950 char szDefPrefix[16];
951 /** The default suffix used when searching for DLLs. */
952 char szDefSuffix[16];
953 /** The LD_LIBRARY_PATH prefix for the process.. */
954 char szLibPath[4096 - sizeof(uint32_t) - sizeof(KLDRDYLDSEARCH) - 16 - 16 - 260];
955} KLDREXEARGS, *PKLDREXEARGS;
956
957void kLdrLoadExe(PKLDREXEARGS pArgs, void *pvOS);
958
959/** @} */
960
961/** @} */
962
963
964/** @defgroup grp_kLdrErr kLdr Status Codes
965 * kLdr uses a mix of native status codes and it's own status codes.
966 * A status code of 0 means success, all other status codes means failure.
967 * @{
968 */
969#ifdef __OS2__
970# define KLDR_ERR_BASE 0x7face000
971#elif defined(__WIN__)
972# define KLDR_ERR_BASE 0x7face000
973#else
974# error "port me"
975#endif
976/** The image format is unknown. */
977#define KLDR_ERR_UNKNOWN_FORMAT (KLDR_ERR_BASE + 0)
978/** The MZ image format isn't supported by this kLdr build. */
979#define KLDR_ERR_MZ_NOT_SUPPORTED (KLDR_ERR_BASE + 1)
980/** The NE image format isn't supported by this kLdr build. */
981#define KLDR_ERR_NE_NOT_SUPPORTED (KLDR_ERR_BASE + 2)
982/** The LX image format isn't supported by this kLdr build. */
983#define KLDR_ERR_LX_NOT_SUPPORTED (KLDR_ERR_BASE + 3)
984/** The LE image format isn't supported by this kLdr build. */
985#define KLDR_ERR_LE_NOT_SUPPORTED (KLDR_ERR_BASE + 4)
986/** The PE image format isn't supported by this kLdr build. */
987#define KLDR_ERR_PE_NOT_SUPPORTED (KLDR_ERR_BASE + 5)
988/** The ELF image format isn't supported by this kLdr build. */
989#define KLDR_ERR_ELF_NOT_SUPPORTED (KLDR_ERR_BASE + 6)
990/** The mach-o image format isn't supported by this kLdr build. */
991#define KLDR_ERR_MACHO_NOT_SUPPORTED (KLDR_ERR_BASE + 7)
992/** The mach-o image format isn't supported by this kLdr build. */
993#define KLDR_ERR_AOUT_NOT_SUPPORTED (KLDR_ERR_BASE + 8)
994
995/** Invalid parameter to a kLdr API. */
996#define KLDR_ERR_INVALID_PARAMETER (KLDR_ERR_BASE + 32)
997/** Invalid handle parameter to a kLdr API. */
998#define KLDR_ERR_INVALID_HANDLE (KLDR_ERR_BASE + 33)
999/** The module wasn't loaded dynamically. */
1000#define KLDR_ERR_NOT_LOADED_DYNAMICALLY (KLDR_ERR_BASE + 34)
1001/** The module wasn't found. */
1002#define KLDR_ERR_MODULE_NOT_FOUND (KLDR_ERR_BASE + 35)
1003/** A prerequisit module wasn't found. */
1004#define KLDR_ERR_PREREQUISITE_MODULE_NOT_FOUND (KLDR_ERR_BASE + 36)
1005/** The module is being terminated and can therefore not be loaded. */
1006#define KLDR_ERR_MODULE_TERMINATING (KLDR_ERR_BASE + 37)
1007/** A prerequisit module is being terminated and can therefore not be loaded. */
1008#define KLDR_ERR_PREREQUISITE_MODULE_TERMINATING (KLDR_ERR_BASE + 38)
1009/** The module initialization failed. */
1010#define KLDR_ERR_MODULE_INIT_FAILED (KLDR_ERR_BASE + 39)
1011/** The initialization of a prerequisite module failed. */
1012#define KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED (KLDR_ERR_BASE + 40)
1013/** The module has already failed initialization and can't be attempted reloaded until
1014 * after we've finished garbage collection. */
1015#define KLDR_ERR_MODULE_INIT_FAILED_ALREADY (KLDR_ERR_BASE + 41)
1016/** A prerequisite module has already failed initialization and can't be attempted
1017 * reloaded until after we've finished garbage collection. */
1018#define KLDR_ERR_PREREQUISITE_MODULE_INIT_FAILED_ALREADY (KLDR_ERR_BASE + 42)
1019/** Prerequisite recursed too deeply. */
1020#define KLDR_ERR_PREREQUISITE_RECURSED_TOO_DEEPLY (KLDR_ERR_BASE + 43)
1021/** Failed to allocate the main stack. */
1022#define KLDR_ERR_MAIN_STACK_ALLOC_FAILED (KLDR_ERR_BASE + 44)
1023/** Buffer overflow. */
1024#define KLDR_ERR_BUFFER_OVERFLOW (KLDR_ERR_BASE + 45)
1025/** The specified ARCH+CPU isn't compatible with image. */
1026#define KLDR_ERR_ARCH_CPU_NOT_COMPATIBLE (KLDR_ERR_BASE + 45)
1027/** Symbol not found. */
1028#define KLDR_ERR_SYMBOL_NOT_FOUND (KLDR_ERR_BASE + 46)
1029/** A forward symbol was encountered but the caller didn't provide any means to resolve it. */
1030#define KLDR_ERR_FORWARDER_SYMBOL (KLDR_ERR_BASE + 47)
1031/** Encountered a bad fixup. */
1032#define KLDR_ERR_BAD_FIXUP (KLDR_ERR_BASE + 48)
1033/** A memory allocation failed. */
1034#define KLDR_ERR_NO_MEMORY (KLDR_ERR_BASE + 49)
1035
1036
1037/** @name kLdrModPE status codes
1038 * @{ */
1039#define KLDR_ERR_BASE_PE (KLDR_ERR_BASE + 96)
1040/** The machine isn't supported by the interpreter. */
1041#define KLDR_ERR_PE_UNSUPPORTED_MACHINE (KLDR_ERR_BASE_PE + 0)
1042/** The file handler isn't valid. */
1043#define KLDR_ERR_PE_BAD_FILE_HEADER (KLDR_ERR_BASE_PE + 1)
1044/** The the optional headers isn't valid. */
1045#define KLDR_ERR_PE_BAD_OPTIONAL_HEADER (KLDR_ERR_BASE_PE + 2)
1046/** One of the section headers aren't valid. */
1047#define KLDR_ERR_PE_BAD_SECTION_HEADER (KLDR_ERR_BASE_PE + 3)
1048/** Bad forwarder entry. */
1049#define KLDR_ERR_PE_BAD_FORWARDER (KLDR_ERR_BASE_PE + 4)
1050/** Forwarder module not found in the import descriptor table. */
1051#define KLDR_ERR_PE_FORWARDER_IMPORT_NOT_FOUND (KLDR_ERR_BASE_PE + 5)
1052/** @} */
1053
1054
1055/** @} */
1056
1057
1058#ifdef __cplusplus
1059}
1060#endif
1061
1062#endif
1063
Note: See TracBrowser for help on using the repository browser.