General Info

Interface: RExecModFile
Files: rexecmodfile.h
Last change: 23/03/2003
Author: Luiz Henrique Shigunov
Description
Structures
Executable module file format
Functions

0x00 - Close - Close a module file
0x09 - CheckFormat - Check for a valid executable module
0x01 - GetModuleInfo - Get informations about a module
0x02 - GetUsedFunc - Get informations about a used function
0x03 - GetUsedFuncReloc - Get informations about a used function relocation

0x04 - LoadCode - Load module's code
0x05 - LoadData - Load module's data
0x06 - LoadROData - Load module's RO data
0x07 - Open - Open a module file
0x08 - OpenFD - Open a module file

Description

This page describes the RExecModFile interface which provides access to executable module files.

The executable module file reader gets module data, code, data, used functions, relocations, etc.

Structures

typedef struct {
    char md5[16];
    const char *comment;
    unsigned int codeSize;
    unsigned int roDataSize;
    unsigned int dataSize;
    unsigned int stackSize;
} RExecModFile_ModuleInfo;

comment is the file comment, codeSize the code size in bytes, roDataSize the read only data size in bytes, dataSize the initialized and uninitialized data size in bytes and stackSize the stack size in bytes like a power of 2 (12 = 4096 bytes, 14 = 16384 bytes, etc).

typedef struct {
    const char *interface;
    const char *imp;
    unsigned int function;
    unsigned int prop;
} RExecModFile_UsedFuncInfo;

prop can be:

typedef struct {
    RExecModFile_UsedFuncInfo function;
    unsigned int offset;
    unsigned int prop;
} RExecModFile_UsedFuncRelocInfo;

prop is 0 or:

All names can't be changed because they are the original name, not a copy.

0x00 - Close

Syntax

int RExecModFile_Close(RExecModFile_File *file);

Properties

Description

This function closes file.

Return value

0x09 - CheckFormat

Syntax

int RExecModFile_CheckFormat(void *buf, unsigned int size);

Properties

Description

This function checks whether buf which size has a valid executable module header.

buf must contain the start of the executable module.

Return value

0x01 - GetModuleInfo

Syntax

int RExecModFile_GetModuleInfo(RExecModFile_File *file, RExecModFile_ModuleInfo *info);

Properties

Description

This function gets informations about module file.

In case of success, info will be filled with the informations.

Return value

0x02 - GetUsedFunc

Syntax

int RExecModFile_GetUsedFunc(RExecModFile_File *file, unsigned int n, RExecModFile_UsedFuncInfo *info);

Properties

Description

This function gets informations about the n function used by file.

n starts with 0.

In case of success, info will be filled with the informations.

Return value

0x03 - GetUsedFuncReloc

Syntax

int RExecModFile_GetUsedFuncReloc(RExecModFile_File *file, unsigned int n, RExecModFile_UsedFuncRelocInfo *info);

Properties

Description

This function gets informations about the n used function relocation used by file.

n starts with 0.

In case of success, info will be filled with the informations.

Return value

0x04 - LoadCode

Syntax

int RExecModFile_LoadCode(RExecModFile_File *file, unsigned int start, unsigned int size, void *where);

Properties

Description

This function loads code from file.

size bytes of code starting at start are going to be loaded.

start is relative to the start of code and 0 is the first byte of code.

Return value

0x05 - LoadData

Syntax

int RExecModFile_LoadData(RExecModFile_File *file, unsigned int start, unsigned int size, void *where);

Properties

Description

This function loads data from file.

size bytes of data starting at start are going to be loaded.

start is relative to the start of data and 0 is the first byte of data.

Uninitialized data are initialized with zero.

Return value

0x06 - LoadROData

Syntax

int RExecModFile_LoadROData(RExecModFile_File *file, unsigned int start, unsigned int size, void *where);

Properties

Description

This function loads RO data from file.

size bytes of RO data starting at start are going to be loaded.

start is relative to the start of RO data and 0 is the first byte of RO data.

Return value

0x07 - Open

Syntax

int RExecModFile_Open(const char *pathname, RExecModFile_File **file);

Properties

Description

This function opens the module file pathname.

In case of success, file will contain file ID.

Return value

0x08 - OpenFD

Syntax

int RExecModFile_OpenFD(FSManager_Handle *fd, int prop, RExecModFile_File **file);

Properties

Description

This function opens the module file fd, which must have been opened by the Open function of the FSManager interface.

prop must be zero or:

If this function fails fd won't be closed.

In case of success, file will contain file ID.

Return value