[2826] | 1 | /* $Id: kLdrInternal.h 2826 2006-10-22 15:58:55Z bird $ */
|
---|
[2825] | 2 | /** @file
|
---|
| 3 | *
|
---|
| 4 | * kLdr - The Dynamic Loader, internal header.
|
---|
| 5 | *
|
---|
| 6 | * Copyright (c) 2006 knut st. osmundsen <bird-kbuild-src@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 |
|
---|
| 28 | #ifndef __kLdrInternal_h__
|
---|
| 29 | #define __kLdrInternal_h__
|
---|
| 30 |
|
---|
| 31 | #ifdef __cplusplus
|
---|
| 32 | extern "C" {
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
| 35 | /** Native file provider operations. */
|
---|
| 36 | extern const KLDRRDROPS g_kLdrRdrFileOps;
|
---|
| 37 |
|
---|
| 38 |
|
---|
| 39 | /**
|
---|
| 40 | * The state of a dynamic loader module.
|
---|
| 41 | */
|
---|
| 42 | typedef enum KLDRSTATE
|
---|
| 43 | {
|
---|
| 44 | /** The usual invalid 0 enum. */
|
---|
| 45 | KLDRSTATE_INVALID = 0,
|
---|
| 46 | /** kldrOpen succeeded.
|
---|
| 47 | * Modules in this state will be freed at */
|
---|
| 48 | KLDRSTATE_OPEN,
|
---|
| 49 | /** Dependencies has been loaded. */
|
---|
| 50 | KLDRSTATE_DEPS,
|
---|
| 51 | /** Fixups has been applied. */
|
---|
| 52 | KLDRSTATE_FIXED,
|
---|
| 53 | /** The module has been initialized. */
|
---|
| 54 | KLDRSTATE_INITED,
|
---|
| 55 | /** The module is loaded successfully. */
|
---|
| 56 | KLDRSTATE_LOADED,
|
---|
| 57 | /** The end of valid states (exclusive) */
|
---|
| 58 | KLDRSTATE_END,
|
---|
| 59 | /** The usual 32-bit blowup. */
|
---|
| 60 | KLDRSTATE_32BIT_HACK = 0x7fffffff
|
---|
| 61 | } KLDRSTATE;
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | /**
|
---|
| 65 | * Dynamic loader module.
|
---|
| 66 | */
|
---|
| 67 | typedef struct KLDRDY
|
---|
| 68 | {
|
---|
| 69 | /** The next module in the list. */
|
---|
| 70 | PKLDRDY pNext;
|
---|
| 71 | /** The prev module in the list. */
|
---|
| 72 | PKLDRDY pPrev;
|
---|
| 73 | /** The module. */
|
---|
| 74 | PKLDRMOD pMod;
|
---|
| 75 | /** The module state. */
|
---|
| 76 | KLDRSTATE enmState;
|
---|
| 77 | /** The number of references. */
|
---|
| 78 | uint32_t cRefs;
|
---|
| 79 | /** The number of dynamic references. */
|
---|
| 80 | uint32_t cDynRefs;
|
---|
| 81 | /** Magic number. */
|
---|
| 82 | uint32_t u32Magic;
|
---|
| 83 | /** Set if this is the executable module. */
|
---|
| 84 | uint32_t fExecutable : 1;
|
---|
| 85 | /** Global DLL (set) or specific DLL (clear). */
|
---|
| 86 | uint32_t fGlobal : 1;
|
---|
| 87 | /** Load stage one. */
|
---|
| 88 | uint32_t fLoadStageOne : 1;
|
---|
| 89 | /** Reserved for future use. */
|
---|
| 90 | uint32_t fReserved : 29;
|
---|
| 91 | } KLDRDY;
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 | /** Pointer to the head module (the executable). */
|
---|
| 95 | extern PKLDRDY kLdrModuleHead;
|
---|
| 96 | /** Pointer to the tail module. */
|
---|
| 97 | extern PKLDRDY kLdrModuleTail;
|
---|
| 98 | /** The Library search path. */
|
---|
| 99 | extern char kLdrLibraryPath[4096];
|
---|
| 100 |
|
---|
| 101 | /** @name The Internal APIs
|
---|
| 102 | * @internal
|
---|
| 103 | * @{ */
|
---|
| 104 | #if 0
|
---|
| 105 | int kldrDyOpenExe(const char *pszFilename, PPKLDRMOD ppMod)
|
---|
| 106 | int kldrDyOpen(const char *pszFilename, unsigned fFlags, PPKLDRMOD ppMod);
|
---|
| 107 | int kldrClose(PKLDRMOD pMod);
|
---|
| 108 |
|
---|
| 109 | void kldrFailure(const char *pszFilename, ...);
|
---|
| 110 | #endif
|
---|
| 111 | /** @} */
|
---|
| 112 |
|
---|
| 113 | #ifdef __cplusplus
|
---|
| 114 | }
|
---|
| 115 | #endif
|
---|
| 116 |
|
---|
| 117 | #endif
|
---|