C# Class Emul8.Utilities.SharedLibraries

显示文件 Open project: emul8/emul8 Class Usage Examples

Public Methods

Method Description
GetAllSymbols ( string path ) : IEnumerable

Gets all exported symbol names for a given library.

Currently it works only with ELF files.

GetSymbolAddress ( IntPtr libraryAddress, string name ) : IntPtr

Gets the address of the symbol with a given name.

LoadLibrary ( string path ) : IntPtr

Loads the given library to memory.

TryLoadLibrary ( string path, IntPtr &address ) : bool
UnloadLibrary ( IntPtr address ) : void

Unloads the library and frees memory taken by it.

Private Methods

Method Description
HandleError ( string operation ) : void
WindowsCloseLibrary ( IntPtr hModule ) : bool
WindowsGetLastError ( ) : UInt32
WindowsGetSymbolAddress ( IntPtr hModule, string symbolName ) : IntPtr
WindowsLoadLibrary ( [ lpFileName ) : IntPtr
dlclose ( IntPtr handle ) : int
dlerror ( ) : IntPtr
dlopen ( string file, int mode ) : IntPtr
dlsym ( IntPtr handle, string name ) : IntPtr

Method Details

GetAllSymbols() public static method

Gets all exported symbol names for a given library.
Currently it works only with ELF files.
public static GetAllSymbols ( string path ) : IEnumerable
path string /// Path to a library file. ///
return IEnumerable

GetSymbolAddress() public static method

Gets the address of the symbol with a given name.
public static GetSymbolAddress ( IntPtr libraryAddress, string name ) : IntPtr
libraryAddress System.IntPtr /// Address to library returned by the function. ///
name string /// Name of the symbol to retrieve. ///
return System.IntPtr

LoadLibrary() public static method

Loads the given library to memory.
public static LoadLibrary ( string path ) : IntPtr
path string /// Path to the library file. ///
return System.IntPtr

TryLoadLibrary() public static method

public static TryLoadLibrary ( string path, IntPtr &address ) : bool
path string
address System.IntPtr
return bool

UnloadLibrary() public static method

Unloads the library and frees memory taken by it.
public static UnloadLibrary ( IntPtr address ) : void
address System.IntPtr /// Address of the library, returned by the function. ///
return void