|
ReXGlue SDK
|
Public Member Functions | |
| ModuleObject (TitleRuntime *runtime_in, ModuleType type_in) | |
| ~ModuleObject () | |
| bool | IsNamed (std::string_view query) const |
| X_STATUS | GetSection (std::string_view section_name, u32 *out_section_data, u32 *out_section_size) const override |
| u32 | GetExportAddress (TitleRuntime &owning_runtime, u16 ordinal, u32 caller_address=0) |
| u32 | GetExportAddress (std::string_view export_name) const |
| rex::kernel::XEXModule * | GetXEX () |
| const rex::kernel::XEXModule * | GetXEX () const |
| u32 | GetTitleID () const override |
| std::vector< u32 > | GetAlternateTitleIDs () const override |
| const std::string & | GetPath () const override |
| X_STATUS | LoadFromFile (TitleRuntime &owning_runtime, std::string_view guest_path) |
| X_STATUS | LoadFromMemory (TitleRuntime &owning_runtime, const void *addr, size_t length) |
| X_STATUS | Unload () |
| X_STATUS | GetOptHeader (XEXHeaderKey key, void **out_ptr) override |
| template<typename T> | |
| X_STATUS | OptHeader (XEXHeaderKey key, T *out_ptr) |
| X_STATUS | GetOptHeaderGuestAddress (XEXHeaderKey key, u32 *out_guest_address) const override |
| void | InvalidateThunkCache (u32 lo, u32 hi) |
| void | SetVariable (u16 ordinal, u32 address) |
| u32 | GetVariable (u16 ordinal) const |
| Public Member Functions inherited from rex::kernel::ILoadedModule | |
| template<typename T> | |
| X_STATUS | OptHeader (XEXHeaderKey key, T *out_ptr) |
Static Public Member Functions | |
| static u32 | HandleFromHModule (void *hmodule) |
| static X_HANDLE | FromHModule (TitleRuntime &runtime, void *hmodule) |
| static X_HANDLE | CreateKernelModule (TitleRuntime &runtime, std::string_view path) |
| static X_HANDLE | CreateUserModule (TitleRuntime &runtime) |
| static X_STATUS | GetOptHeader (const kernel::GuestAddressSpace *memory, const XEXHeader *header, XEXHeaderKey key, u32 *out_header_guest_ptr) |
Public Attributes | |
| ModuleType | type |
| std::string | name |
| std::string | path |
| PropagateConst< std::unique_ptr< rex::kernel::GuestModule > > | processor_module |
| u32 | hmodule_ptr = 0 |
| TitleRuntime * | runtime |
| UserModuleState | user |
| KernelModuleState | kernel |
Additional Inherited Members | |
| Protected Member Functions inherited from rex::NonCopyable | |
| NonCopyable (const NonCopyable &)=delete | |
| NonCopyable & | operator= (const NonCopyable &)=delete |
| rex::kernel::ModuleObject::ModuleObject | ( | TitleRuntime * | runtime_in, |
| ModuleType | type_in ) |
Allocates the loader data entry.
| type_in | Whether the module is kernel or user. |
| rex::kernel::ModuleObject::~ModuleObject | ( | ) |
Unloads a user module and frees the loader data entry.
|
static |
Creates the KernelObject of a kernel module with its first handle.
| path | Guest path of the module. Its file name is the module name. |
|
static |
Creates the KernelObject of a user module with its first handle.
|
static |
Finds the module of an HMODULE.
| hmodule | The host pointer of the loader data entry. |
|
overridevirtual |
Lists the alternate title IDs of the XEX header of a user module.
Implements rex::kernel::ILoadedModule.
| u32 rex::kernel::ModuleObject::GetExportAddress | ( | std::string_view | export_name | ) | const |
Finds an exported function of a module by name.
| u32 rex::kernel::ModuleObject::GetExportAddress | ( | TitleRuntime & | owning_runtime, |
| u16 | ordinal, | ||
| u32 | caller_address = 0 ) |
Finds an exported function of a module. A kernel module returns a thunk.
| caller_address | The guest address of the caller, used to key kernel thunks. |
|
static |
Finds an optional header in an XEX header in memory and returns an address that the title can read.
| header | The XEX header. |
| out_header_guest_ptr | Receives the header value or the guest address of its data. |
|
overridevirtual |
Finds an optional XEX header. For host use only.
| out_ptr | Receives the header value or a pointer to its data. |
Implements rex::kernel::ILoadedModule.
|
overridevirtual |
Finds an optional XEX header the way RtlImageXexHeaderField does: the value for a key whose low byte is 0, otherwise the guest address of the field.
| key | The header key. |
| out_guest_address | Receives the value or the guest address, 0 when absent. |
Implements rex::kernel::ILoadedModule.
|
inlineoverridevirtual |
Returns the absolute path of the file a user module was loaded from.
Implements rex::kernel::ILoadedModule.
|
overridevirtual |
Finds a resource section of a module.
| out_section_data | Receives the guest address of the section. |
| out_section_size | Receives the size of the section. |
Implements rex::kernel::ILoadedModule.
|
overridevirtual |
Returns the title ID of a user module, 0 when the module is not an XEX or has none.
Implements rex::kernel::ILoadedModule.
|
inline |
Returns the address of a variable export, or 0 when the module never created the variable.
| rex::kernel::XEXModule * rex::kernel::ModuleObject::GetXEX | ( | ) |
Returns the XEX image of a user module, null when the module is not an XEX.
|
static |
Reads the handle that the loader data entry of an HMODULE holds.
| hmodule | The host pointer of the loader data entry. |
| void rex::kernel::ModuleObject::InvalidateThunkCache | ( | u32 | lo, |
| u32 | hi ) |
Erases the cached thunks whose guest address falls in a range.
| hi | The address after the last address of the range. |
| bool rex::kernel::ModuleObject::IsNamed | ( | std::string_view | query | ) | const |
Reports whether a name matches the module.
| query | A path, a file name or a module name, compared case insensitively. |
| X_STATUS rex::kernel::ModuleObject::LoadFromFile | ( | TitleRuntime & | owning_runtime, |
| std::string_view | guest_path ) |
Loads a module image from a file and applies a sibling XEX patch when one exists.
| X_STATUS rex::kernel::ModuleObject::LoadFromMemory | ( | TitleRuntime & | owning_runtime, |
| const void * | addr, | ||
| size_t | length ) |
Loads a module image from memory.
|
inline |
Finds an optional XEX header. For host use only.
| T | The type of the value the header holds. |
| out_ptr | Receives the header value or a pointer to its data. |
|
inline |
Binds a variable export to the guest address that holds it.
| X_STATUS rex::kernel::ModuleObject::Unload | ( | ) |
Unloads the image of a user module.
| u32 rex::kernel::ModuleObject::hmodule_ptr = 0 |
Guest address of the module X_LDR_DATA_TABLE_ENTRY, the HMODULE titles use.
| KernelModuleState rex::kernel::ModuleObject::kernel |
State of a kernel module, unused for a user module.
| std::string rex::kernel::ModuleObject::name |
Module name, the file name of path for a user module.
| std::string rex::kernel::ModuleObject::path |
Absolute path of the file a user module was loaded from.
| PropagateConst<std::unique_ptr<rex::kernel::GuestModule> > rex::kernel::ModuleObject::processor_module |
Loaded XEX or ELF image of a user module, owned by this object, null until loaded.
| TitleRuntime* rex::kernel::ModuleObject::runtime |
TitleRuntime that owns the module, used to free hmodule_ptr.
| ModuleType rex::kernel::ModuleObject::type |
| UserModuleState rex::kernel::ModuleObject::user |
State of a user module, unused for a kernel module.