Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

kLdr.h File Reference


Detailed Description

kLdr - The Dynamic Loader.

Definition in file kLdr.h.

#include <k/kDefs.h>
#include <k/kTypes.h>
#include <k/kCpus.h>

Go to the source code of this file.

Classes

struct  KLDREXEARGS
struct  KLDRMOD
struct  KLDRMODOPS
union  KLDRPU
struct  KLDRSEG
struct  KLDRSTACKINFO
union  KLDRU

OS/2 like API

#define KLDROS2API
int kLdrDosFreeModule (HKLDRMOD hMod)
int kLdrDosFreeResource (void *pvResAddr)
int kLdrDosGetResource (HKLDRMOD hMod, KU32 idType, KU32 idName, void **pvResAddr)
int kLdrDosLoadModule (char *pszObject, KSIZE cbObject, const char *pszModule, PHKLDRMOD phMod)
int kLdrDosQueryModFromEIP (PHKLDRMOD phMod, KU32 *piObject, KSIZE cbName, char *pszName, KUPTR *poffObject, KUPTR ulEIP)
int kLdrDosQueryModuleHandle (const char *pszModname, PHKLDRMOD phMod)
int kLdrDosQueryModuleName (HKLDRMOD hMod, KSIZE cchName, char *pszName)
int kLdrDosQueryProcAddr (HKLDRMOD hMod, KU32 iOrdinal, const char *pszProcName, void **ppvProcAddr)
int kLdrDosQueryProcType (HKLDRMOD hMod, KU32 iOrdinal, const char *pszProcName, KU32 *pfProcType)
int kLdrDosQueryResourceSize (HKLDRMOD hMod, KU32 idType, KU32 idName, KU32 *pcb)
int kLdrDosReplaceModule (const char *pszOldModule, const char *pszNewModule, const char *pszBackupModule)

Win32 like API

Todo:
GNU extensions


#define KLDRWINAPI
typedef struct KLDRWRSRCFOUND * HKLDRWRSRCFOUND
typedef struct KLDRWRSRCLOADED * HKLDRWRSRCLOADED
typedef int(KLDRWINAPI * PFNKLDRWENUMRESLANG )(HKLDRMOD hMod, const char *pszType, const char *pszName, KU16 idLang, KUPTR uUser)
typedef int(KLDRWINAPI * PFNKLDRWENUMRESNAME )(HKLDRMOD hMod, const char *pszType, char *pszName, KUPTR uUser)
typedef int(KLDRWINAPI * PFNKLDRWENUMRESTYPE )(HKLDRMOD hMod, const char *pszType, KUPTR uUser)
int KLDRWINAPI kLdrWDisableThreadLibraryCalls (HKLDRMOD hMod)
int KLDRWINAPI kLdrWEnumResourceLanguages (HKLDRMOD hMod, const char *pszType, const char *pszName, PFNKLDRWENUMRESLANG pfnEnum, KUPTR uUser)
int KLDRWINAPI kLdrWEnumResourceLanguagesEx (HKLDRMOD hMod, const char *pszType, const char *pszName, PFNKLDRWENUMRESLANG pfnEnum, KUPTR uUser, KU32 fFlags, KU16 idLang)
int KLDRWINAPI kLdrWEnumResourceNames (HKLDRMOD hMod, const char *pszType, PFNKLDRWENUMRESNAME pfnEnum, KUPTR uUser)
int KLDRWINAPI kLdrWEnumResourceNamesEx (HKLDRMOD hMod, const char *pszType, PFNKLDRWENUMRESNAME pfnEnum, KUPTR uUser, KU32 fFlags, KU16 idLang)
int KLDRWINAPI kLdrWEnumResourceTypes (HKLDRMOD hMod, PFNKLDRWENUMRESTYPE pfnEnum, KUPTR uUser)
int KLDRWINAPI kLdrWEnumResourceTypesEx (HKLDRMOD hMod, PFNKLDRWENUMRESTYPE pfnEnum, KUPTR uUser, KU32 fFlags, KU16 idLang)
HKLDRWRSRCFOUND KLDRWINAPI kLdrWFindResource (HKLDRMOD hMod, const char *pszType, const char *pszName)
HKLDRWRSRCFOUND KLDRWINAPI kLdrWFindResourceEx (HKLDRMOD hMod, const char *pszType, const char *pszName, KU16 idLang)
int KLDRWINAPI kLdrWFreeLibrary (HKLDRMOD hMod)
int KLDRWINAPI kLdrWFreeResource (HKLDRMOD hMod, HKLDRWRSRCLOADED hLoadedRsrc)
KU32 KLDRWINAPI kLdrWGetDllDirectory (KSIZE cchDir, char *pszDir)
KU32 KLDRWINAPI kLdrWGetModuleFileName (HKLDRMOD hMod, char *pszModName, KSIZE cchModName)
HKLDRMOD KLDRWINAPI kLdrWGetModuleHandle (const char *pszFilename)
int KLDRWINAPI kLdrWGetModuleHandleEx (KU32 fFlags, const char *pszFilename, HKLDRMOD hMod)
void *KLDRWINAPI kLdrWGetProcAddress (HKLDRMOD hMod, const char *pszProcName)
HKLDRMOD KLDRWINAPI kLdrWLoadLibrary (const char *pszFilename)
HKLDRMOD KLDRWINAPI kLdrWLoadLibraryEx (const char *pszFilename, void *hFileReserved, KU32 fFlags)
HKLDRWRSRCLOADED KLDRWINAPI kLdrWLoadResource (HKLDRMOD hMod, HKLDRWRSRCFOUND hFoundRsrc)
void *KLDRWINAPI kLdrWLockResource (HKLDRMOD hMod, HKLDRWRSRCLOADED hLoadedRsrc)
int KLDRWINAPI kLdrWSetDllDirectory (const char *pszDir)
KU32 KLDRWINAPI kLdrWSizeofResource (HKLDRMOD hMod, HKLDRWRSRCFOUND hFoundRsrc)

Process Bootstrapping

typedef const KLDREXEARGSPCKLDREXEARGS
typedef struct KLDREXEARGSPKLDREXEARGS
void kLdrDyldLoadExe (PCKLDREXEARGS pArgs, void *pvOS)
void kLdrLoadExe (PCKLDREXEARGS pArgs, void *pvOS)

Defines

#define KLDR_ALIGN_ADDR(val, align)   ( ((val) + ((align) - 1)) & ~(KLDRADDR)((align) - 1) )
#define KLDRMOD_BASEADDRESS_LINK   (~(KLDRADDR)1)
#define KLDRMOD_BASEADDRESS_MAP   (~(KLDRADDR)2)
#define KLDRMOD_MAGIC   0x19640707
#define NIL_HKLDRMOD   ((HKLDRMOD)0)
#define NIL_KLDRADDR   (~(KU64)0)
#define NIL_KLDRMOD_IMPORT   (~(KU32)0)
#define NIL_KLDRMOD_RSRC_NAME_ID   ( ~(KU32)0 )
#define NIL_KLDRMOD_RSRC_TYPE_ID   ( ~(KU32)0 )
#define NIL_KLDRMOD_SYM_ORDINAL   (~(KU32)0)
#define PRI_KLDRADDR   "llx"
#define PRI_KLDRFOFF   "lx"
#define PRI_KLDRSIZE   "llx"
Language ID
Except for the special IDs defined here, the values are considered format specific for now since it's only used by the PE resources.

#define KLDR_LANG_ID_ANY   ( ~(KU32)1 )
#define KLDR_LANG_ID_CUSTOM_DEFAULT   ( ~(KU32)5 )
#define KLDR_LANG_ID_CUSTOM_UNSPECIFIED   ( ~(KU32)6 )
#define KLDR_LANG_ID_NEUTRAL   ( ~(KU32)2 )
#define KLDR_LANG_ID_SYS_DEFAULT   ( ~(KU32)4 )
#define KLDR_LANG_ID_UI_CUSTOM_DEFAULT   ( ~(KU32)7 )
#define KLDR_LANG_ID_USER_DEFAULT   ( ~(KU32)3 )
#define NIL_KLDR_LANG_ID   ( ~(KU32)0 )
kLdrDyldLoad and kLdrDyldFindByName flags.
#define KLDRDYLD_LOAD_FLAGS_EXECUTABLE   0x40000000
#define KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT   0x00000008
#define KLDRYDLD_LOAD_FLAGS_DEEP_SYMBOLS   0x00000002
#define KLDRYDLD_LOAD_FLAGS_GLOBAL_SYMBOLS   0x00000001
#define KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE   0x00000004
kLdrModEnumSymbols flags.
#define KLDRMOD_ENUM_SYMS_FLAGS_ALL   0x00000001
Segment flags
#define KLDRSEG_FLAG_16BIT   1
#define KLDRSEG_FLAG_OS2_ALIAS16   2
#define KLDRSEG_FLAG_OS2_CONFORM   4
#define KLDRSEG_FLAG_OS2_IOPL   8
Load symbol kind flags.
#define KLDRSYMKIND_16BIT   0x00000001
#define KLDRSYMKIND_32BIT   0x00000002
#define KLDRSYMKIND_64BIT   0x00000003
#define KLDRSYMKIND_BIT_MASK   0x00000003
#define KLDRSYMKIND_CODE   0x00000010
#define KLDRSYMKIND_DATA   0x00000020
#define KLDRSYMKIND_FORWARDER   0x00000200
#define KLDRSYMKIND_MASK   0x00000033
#define KLDRSYMKIND_NO_BIT   0x00000000
#define KLDRSYMKIND_NO_TYPE   0x00000000
#define KLDRSYMKIND_REQ_FLAT   0x00000000
#define KLDRSYMKIND_REQ_SEGMENTED   0x40000000
#define KLDRSYMKIND_REQ_TYPE_MASK   0x40000000
#define KLDRSYMKIND_TYPE_MASK   0x00000030
#define KLDRSYMKIND_WEAK   0x00000100

Typedefs

typedef int FNKLDRENUMDBG (PKLDRMOD pMod, KU32 iDbgInfo, KLDRDBGINFOTYPE enmType, KI16 iMajorVer, KI16 iMinorVer, KLDRFOFF offFile, KLDRADDR LinkAddress, KLDRSIZE cb, const char *pszExtFile, void *pvUser)
typedef int FNKLDRENUMRSRC (PKLDRMOD pMod, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, KLDRADDR AddrRsrc, KLDRSIZE cbRsrc, void *pvUser)
typedef int FNKLDRMODENUMSYMS (PKLDRMOD pMod, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, KLDRADDR uValue, KU32 fKind, void *pvUser)
typedef int FNKLDRMODGETIMPORT (PKLDRMOD pMod, KU32 iImport, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PKLDRADDR puValue, KU32 *pfKind, void *pvUser)
typedef struct KLDRDYLDMODHKLDRMOD
typedef KU64 KLDRADDR
typedef long KLDRFOFF
typedef KU64 KLDRSIZE
typedef const KLDRADDRPCKLDRADDR
typedef const KLDRFOFFPCKLDRFOFF
typedef struct KLDRMODOPSPCKLDRMODOPS
typedef const KLDRPUPCKLDRPU
typedef const KLDRSIZEPCKLDRSIZE
typedef const KLDRSTACKINFOPCKLDRSTACKINFO
typedef const KLDRUPCKLDRU
typedef FNKLDRENUMDBGPFNKLDRENUMDBG
typedef FNKLDRENUMRSRCPFNKLDRENUMRSRC
typedef FNKLDRMODENUMSYMSPFNKLDRMODENUMSYMS
typedef FNKLDRMODGETIMPORTPFNKLDRMODGETIMPORT
typedef HKLDRMODPHKLDRMOD
typedef KLDRADDRPKLDRADDR
typedef KLDRDBGINFOTYPEPKLDRDBGINFOTYPE
typedef KLDRFOFFPKLDRFOFF
typedef struct KLDRMODPKLDRMOD
typedef struct KLDRMODOPSPKLDRMODOPS
typedef KLDRPUPKLDRPU
typedef KLDRSIZEPKLDRSIZE
typedef KLDRSTACKINFOPKLDRSTACKINFO
typedef KLDRUPKLDRU
typedef struct KLDRMOD ** PPKLDRMOD

Enumerations

enum  KLDRDBGINFOTYPE {
  KLDRDBGINFOTYPE_INVALID = 0, KLDRDBGINFOTYPE_UNKNOWN, KLDRDBGINFOTYPE_STABS, KLDRDBGINFOTYPE_DWARF,
  KLDRDBGINFOTYPE_CODEVIEW, KLDRDBGINFOTYPE_WATCOM, KLDRDBGINFOTYPE_HLL, KLDRDBGINFOTYPE_END,
  KLDRDBGINFOTYPE_32BIT_HACK = 0x7fffffff
}
enum  KLDRDYLDSEARCH {
  KLDRDYLD_SEARCH_INVALID = 0, KLDRDYLD_SEARCH_KLDR, KLDRDYLD_SEARCH_HOST, KLDRDYLD_SEARCH_OS2,
  KLDRDYLD_SEARCH_WINDOWS, KLDRDYLD_SEARCH_WINDOWS_ALTERED, KLDRDYLD_SEARCH_UNIX_COMMON, KLDRDYLD_SEARCH_END,
  KLDRDYLD_SEARCH_32BIT_HACK = 0x7fffffff
}
enum  KLDRENDIAN {
  KLDRENDIAN_INVALID, KLDRENDIAN_LITTLE, KLDRENDIAN_BIG, KLDRENDIAN_NA,
  KLDRENDIAN_END, KLDRENDIAN_32BIT_HACK = 0x7fffffff
}
enum  KLDRFMT {
  KLDRFMT_INVALID = 0, KLDRFMT_NATIVE, KLDRFMT_AOUT, KLDRFMT_ELF,
  KLDRFMT_LX, KLDRFMT_MACHO, KLDRFMT_PE, KLDRFMT_END,
  KLDRFMT_32BIT_HACK = 0x7fffffff
}
enum  KLDRTYPE {
  KLDRTYPE_INVALID = 0, KLDRTYPE_OBJECT, KLDRTYPE_EXECUTABLE_FIXED, KLDRTYPE_EXECUTABLE_RELOCATABLE,
  KLDRTYPE_EXECUTABLE_PIC, KLDRTYPE_SHARED_LIBRARY_FIXED, KLDRTYPE_SHARED_LIBRARY_RELOCATABLE, KLDRTYPE_SHARED_LIBRARY_PIC,
  KLDRTYPE_FORWARDER_DLL, KLDRTYPE_CORE, KLDRTYPE_END, KLDRTYPE_32BIT_HACK = 0x7fffffff
}

Functions

int kLdrDyldEnumResources (HKLDRMOD hMod, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, PFNKLDRENUMRSRC pfnCallback, void *pvUser)
int kLdrDyldFindByAddress (KUPTR Address, PHKLDRMOD phMod, KU32 *piSegment, KUPTR *poffSegment)
int kLdrDyldFindByName (const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PHKLDRMOD phMod)
int kLdrDyldGetFilename (HKLDRMOD hMod, char *pszFilename, KSIZE cchFilename)
int kLdrDyldGetName (HKLDRMOD hMod, char *pszName, KSIZE cchName)
int kLdrDyldLoad (const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch, unsigned fFlags, PHKLDRMOD phMod, char *pszErr, KSIZE cchErr)
int kLdrDyldQueryResource (HKLDRMOD hMod, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, void **pvRsrc, KSIZE *pcbRsrc)
int kLdrDyldQuerySymbol (HKLDRMOD hMod, KU32 uSymbolOrdinal, const char *pszSymbolName, const char *pszSymbolVersion, KUPTR *pValue, KU32 *pfKind)
int kLdrDyldUnload (HKLDRMOD hMod)
int kLdrModCanExecuteOn (PKLDRMOD pMod, const void *pvBits, KCPUARCH enmArch, KCPU enmCpu)
int kLdrModClose (PKLDRMOD pMod)
int kLdrModEnumDbgInfo (PKLDRMOD pMod, const void *pvBits, PFNKLDRENUMDBG pfnCallback, void *pvUser)
int kLdrModEnumResources (PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, PFNKLDRENUMRSRC pfnCallback, void *pvUser)
int kLdrModEnumSymbols (PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 fFlags, PFNKLDRMODENUMSYMS pfnCallback, void *pvUser)
int kLdrModGetImport (PKLDRMOD pMod, const void *pvBits, KU32 iImport, char *pszName, KSIZE cchName)
int kLdrModGetStackInfo (PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRSTACKINFO pStackInfo)
int kLdrModHasDbgInfo (PKLDRMOD pMod, const void *pvBits)
int kLdrModMostlyDone (PKLDRMOD pMod)
KI32 kLdrModNumberOfImports (PKLDRMOD pMod, const void *pvBits)
int kLdrModOpen (const char *pszFilename, KU32 fFlags, KCPUARCH enmCpuArch, PPKLDRMOD ppMod)
int kLdrModOpenFromRdr (PKRDR pRdr, KU32 fFlags, KCPUARCH enmCpuArch, PPKLDRMOD ppMod)
int kLdrModOpenNative (const char *pszFilename, PPKLDRMOD ppMod)
int kLdrModOpenNativeByHandle (KUPTR uHandle, PPKLDRMOD ppMod)
int kLdrModQueryMainEntrypoint (PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, PKLDRADDR pMainEPAddress)
int kLdrModQueryResource (PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 idType, const char *pszType, KU32 idName, const char *pszName, KU32 idLang, PKLDRADDR pAddrRsrc, KSIZE *pcbRsrc)
int kLdrModQuerySymbol (PKLDRMOD pMod, const void *pvBits, KLDRADDR BaseAddress, KU32 iSymbol, const char *pchSymbol, KSIZE cchSymbol, const char *pszVersion, PFNKLDRMODGETIMPORT pfnGetForwarder, void *pvUser, PKLDRADDR puValue, KU32 *pfKind)
POSIX like API
int kLdrDlClose (HKLDRMOD hMod)
const char * kLdrDlError (void)
HKLDRMOD kLdrDlOpen (const char *pszLibrary, int fFlags)
void * kLdrDlSym (HKLDRMOD hMod, const char *pszSymbol)
Operations On The Internally Managed Mapping
int kLdrModAllocTLS (PKLDRMOD pMod)
int kLdrModCallInit (PKLDRMOD pMod, KUPTR uHandle)
int kLdrModCallTerm (PKLDRMOD pMod, KUPTR uHandle)
int kLdrModCallThread (PKLDRMOD pMod, KUPTR uHandle, unsigned fAttachingOrDetaching)
int kLdrModFixupMapping (PKLDRMOD pMod, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser)
void kLdrModFreeTLS (PKLDRMOD pMod)
int kLdrModMap (PKLDRMOD pMod)
int kLdrModReload (PKLDRMOD pMod)
int kLdrModUnmap (PKLDRMOD pMod)
Operations On The Externally Managed Mappings
int kLdrModGetBits (PKLDRMOD pMod, void *pvBits, KLDRADDR BaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser)
int kLdrModRelocateBits (PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser)
KLDRADDR kLdrModSize (PKLDRMOD pMod)


Generated by  Doxygen 1.6.0   Back to index