ReXGlue SDK
Loading...
Searching...
No Matches
rex::kernel::XEXModule Class Reference

#include <rex/kernel/module.h>

Inheritance diagram for rex::kernel::XEXModule:
[legend]

Classes

struct  LibraryImport
struct  ImportLibrary

Public Member Functions

 XEXModule (FunctionDispatcher *function_dispatcher, TitleRuntime &runtime)
bool IsLoaded () const
const filesystem::IXEXImage & GetImage () const
const filesystem::PEInfo & GetPE () const
u32 GetImageSize () const override
u32 GetBaseAddress () const override
u32 GetEntryPoint () const override
u32 GetExportTableAddress () const override
u32 GetExceptionDirectoryRVA () const override
u32 GetExceptionDirectorySize () const override
u32 GetExceptionDirectoryAddress () const override
std::span< const BinarySection > GetBinarySections () const override
std::span< const BinarySymbol > GetBinarySymbols () const override
u32 GetExportAddress (u16 ordinal) const
const std::vector< ImportLibrary > & GetImportLibraries () const
u32 GetExportAddress (const std::string_view name) const
int ApplyPatch (XEXModule *module)
bool Load (const std::string_view name, const std::string_view path, const void *xex_addr, size_t xex_length)
std::span< const u8 > GetPendingImage () const
bool LoadContinue ()
bool Unload ()
const std::string & GetName () const override
bool IsExecutable () const override
Public Member Functions inherited from rex::kernel::GuestModule
 GuestModule (FunctionDispatcher *function_dispatcher)
kernel::GuestAddressSpace * GetAddressSpace () const
FunctionDispatcher * GetFunctionDispatcher () const
bool IsExecutableAddress (u32 address) const
virtual const BinarySection * FindSectionByAddress (u32 address) const

Additional Inherited Members

Protected Attributes inherited from rex::kernel::GuestModule
FunctionDispatcher * function_dispatcher_ = nullptr
kernel::GuestAddressSpace * memory_ = nullptr
std::vector< BinarySection > binary_sections_
std::vector< BinarySymbol > binary_symbols_

Detailed Description

A module loaded from an XEX image, or from an XEX patch image.

Constructor & Destructor Documentation

◆ XEXModule()

rex::kernel::XEXModule::XEXModule ( FunctionDispatcher * function_dispatcher,
TitleRuntime & runtime )

Builds an unloaded module.

Parameters
function_dispatcherThe dispatcher whose memory the module loads into.

Member Function Documentation

◆ ApplyPatch()

int rex::kernel::XEXModule::ApplyPatch ( XEXModule * module)

Applies this patch image to a loaded module.

Returns
0 on success, 1 when this image is not a patch, another nonzero value on failure.

◆ GetBaseAddress()

u32 rex::kernel::XEXModule::GetBaseAddress ( ) const
inlineoverridevirtual
Returns
The guest address, 0 before the image is loaded.

Reimplemented from rex::kernel::GuestModule.

◆ GetBinarySections()

std::span< const BinarySection > rex::kernel::XEXModule::GetBinarySections ( ) const
overridevirtual

Returns the binary sections, empty by default.

Reimplemented from rex::kernel::GuestModule.

◆ GetBinarySymbols()

std::span< const BinarySymbol > rex::kernel::XEXModule::GetBinarySymbols ( ) const
overridevirtual

Returns the import symbols of the image.

Reimplemented from rex::kernel::GuestModule.

◆ GetEntryPoint()

u32 rex::kernel::XEXModule::GetEntryPoint ( ) const
overridevirtual
Returns
The guest address, 0 when the image has none.

Reimplemented from rex::kernel::GuestModule.

◆ GetExceptionDirectoryAddress()

u32 rex::kernel::XEXModule::GetExceptionDirectoryAddress ( ) const
overridevirtual

Returns the guest address of the PDATA table in the exception data directory, 0 by default.

Reimplemented from rex::kernel::GuestModule.

◆ GetExceptionDirectoryRVA()

u32 rex::kernel::XEXModule::GetExceptionDirectoryRVA ( ) const
overridevirtual

Returns the RVA of the PDATA table in the exception data directory, 0 by default.

Reimplemented from rex::kernel::GuestModule.

◆ GetExceptionDirectorySize()

u32 rex::kernel::XEXModule::GetExceptionDirectorySize ( ) const
overridevirtual

Returns the size of the PDATA table in the exception data directory, 0 by default.

Reimplemented from rex::kernel::GuestModule.

◆ GetExportAddress() [1/2]

u32 rex::kernel::XEXModule::GetExportAddress ( const std::string_view name) const

Looks up an export by name.

Returns
The guest address, 0 when the module has no such export.

◆ GetExportAddress() [2/2]

u32 rex::kernel::XEXModule::GetExportAddress ( u16 ordinal) const

Looks up an export by ordinal.

Returns
The guest address, 0 when the module has no such export.

◆ GetExportTableAddress()

u32 rex::kernel::XEXModule::GetExportTableAddress ( ) const
overridevirtual
Returns
The guest address, 0 when the image has none.

Reimplemented from rex::kernel::GuestModule.

◆ GetImageSize()

u32 rex::kernel::XEXModule::GetImageSize ( ) const
overridevirtual
Returns
Size in bytes, summed over the page ranges of the image.

Reimplemented from rex::kernel::GuestModule.

◆ GetName()

const std::string & rex::kernel::XEXModule::GetName ( ) const
inlineoverridevirtual

◆ GetPendingImage()

std::span< const u8 > rex::kernel::XEXModule::GetPendingImage ( ) const
inline

Returns the decoded image that waits in host memory between Load and LoadContinue, empty once LoadContinue has copied the image into guest memory.

◆ IsExecutable()

bool rex::kernel::XEXModule::IsExecutable ( ) const
overridevirtual

Reports whether the module flags mark a title module.

Implements rex::kernel::GuestModule.

◆ Load()

bool rex::kernel::XEXModule::Load ( const std::string_view name,
const std::string_view path,
const void * xex_addr,
size_t xex_length )

Parses and decodes an XEX image into host memory and reserves its guest memory.

Parameters
xex_addrThe host address of the XEX file.

◆ LoadContinue()

bool rex::kernel::XEXModule::LoadContinue ( )

Parses the PE image, copies it into guest memory without its header, then registers the imports and page protections.


The documentation for this class was generated from the following file: