General Info

Interface: RLibModFile
Files: rlibmodfile.h
Last change: 29/07/2002
Author: Luiz Henrique Shigunov
Description
Structures
Library module file format
Functions

0x00 - Close - Close a module file
0x01 - GetFuncsInfo - Get informations about functions
0x02 - GetImpInfo - Get informations about implementations
0x03 - GetInterInfo - Get informations about interfaces
0x04 - GetModuleInfo - Get informations about a module
0x05 - GetUsedFunc - Get informations about a used function

0x06 - GetUsedFuncReloc - Get informations about a used function relocation
0x07 - LoadCode - Load module's code
0x08 - LoadData - Load module's data
0x09 - LoadROData - Load module's read only data
0x0a - Open - Open a module file

Description

This page describes the RLibModFile interface which provides access to library module files.

The library module file reader provides informations about library module files, including module data, code, read only data, data, functions, used functions, relocations, etc.

Structures

typedef struct {
    unsigned int codeStart;
    unsigned int prop;
} RLibModFile_FunctionInfo;

typedef struct {
    const char *name;
} RLibModFile_ImpInfo;

typedef struct {
    const char *name;
    unsigned int nFunctions;
} RLibModFile_InterInfo;

typedef struct {
    char md5[16];
    const char *comment;
    void *start;
    void *shutdown;
    unsigned int codeSize;
    unsigned int roDataSize;
    unsigned int dataSize;
    unsigned int version;
    unsigned int prop;
} RLibModFile_ModuleInfo;

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

typedef struct {
    UsedFuncInfo function;
    unsigned int offset;
    unsigned int prop;
} RLibModFile_UsedFuncRelocInfo;

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

0x00 - Close

Syntax

int RLibModFile_Close(RLibModFile_File *file);

Properties

Description

This function closes file.

Return value

0x01 - GetFuncsInfo

Syntax

int RLibModFile_GetFuncsInfo(RLibModFile_File *file, unsigned int interface, unsigned int imp, RLibModFile_FunctionInfo *info);

Properties

Description

This function gets informations about all functions from implementation imp from interface from file.

info must be an array with at least the same number of positions as the number of functions from interface.

If all goes ok, info will be filled with the informations.

Return value

0x02 - GetImpInfo

Syntax

int RLibModFile_GetImpInfo(RLibModFile_File *file, unsigned int interface, unsigned int imp, RLibModFile_ImpInfo *info);

Properties

Description

This function gets informations about implementation imp from interface from file.

interface is the same number used on GetInterInfo.

If all goes ok, info will be filled with the informations.

Return value

0x03 - GetInterInfo

Syntax

int RLibModFile_GetInterInfo(RLibModFile_File *file, unsigned int interface, RLibModFile_InterInfo *info);

Properties

Description

This function gets informations about interface from file.

interface is the same number used on GetFuncInfo.

If all goes ok, info will be filled with the informations.

Return value

0x04 - GetModuleInfo

Syntax

int RLibModFile_GetModuleInfo(RLibModFile_File *file, RLibModFile_ModuleInfo *info);

Properties

Description

This function gets informations about module file.

If all goes ok, info will be filled with the informations.

Return value

0x05 - GetUsedFunc

Syntax

int RLibModFile_GetUsedFunc(RLibModFile_File *file, unsigned int n, RLibModFile_UsedFuncInfo *info);

Properties

Description

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

n starts with 0.

If all goes ok, info will be filled with the informations.

Return value

0x06 - GetUsedFuncReloc

Syntax

int RLibModFile_GetUsedFuncReloc(RLibModFile_File *file, unsigned int n, RLibModFile_UsedFuncRelocInfo *info);

Properties

Description

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

n starts with 0.

If all goes ok, info will be filled with the informations.

Return value

0x07 - LoadCode

Syntax

int RLibModFile_LoadCode(RLibModFile_File *file, unsigned int start, unsigned int size, void *where, void *codeStart, void *roDataStart, void *dataStart);

Properties

Description

This function loads code from file.

roDataStart is a pointer to the start of module's read only data, dataStart is a pointer to the start of module's data, codeStart is a pointer to the start of module's code and where is where code is going to be loaded.

roDataStart, dataStart and codeStart are used to make relocations on code.

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

0x08 - LoadData

Syntax

int RLibModFile_LoadData(RLibModFile_File *file, unsigned int start, unsigned int size, void *where, void *codeStart, void *roDataStart, void *dataStart);

Properties

Description

This function loads data from file.

roDataStart is a pointer to the start of module's read only data, dataStart is a pointer to the start of module's data, codeStart is a pointer to the start of module's code and where is where data is going to be loaded.

roDataStart, dataStart and codeStart are used to make relocations on data.

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

0x09 - LoadROData

Syntax

int RLibModFile_LoadROData(RLibModFile_File *file, unsigned int start, unsigned int size, void *where, void *codeStart, void *roDataStart, void *dataStart);

Properties

Description

This function loads read only data from file.

roDataStart is a pointer to the start of module's read only data, dataStart is a pointer to the start of module's data, codeStart is a pointer to the start of module's code and where is where read only data is going to be loaded.

roDataStart, dataStart and codeStart are used to make relocations on read only data.

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

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

Return value

0x0a - Open

Syntax

int RLibModFile_Open(const char *pathname, RLibModFile_File **file);

Properties

Description

This function opens module file pathname.

If all goes ok, file will contain file ID.

Return value