XexModule class loads and manages Xbox 360 executable (XEX) files in the ReXGlue runtime. It handles XEX decompression, PE header parsing, import resolution, and provides access to module metadata.
Class Definition
<rex/system/xex_module.h>
Overview
XexModule represents a loaded XEX executable in guest memory. It:- Loads XEX files - Decompresses and loads XEX1/XEX2 format executables
- Parses PE headers - Extracts section information and exports
- Resolves imports - Links against kernel modules (xboxkrnl.xex, xam.xex)
- Provides metadata - Exposes execution info, security info, and optional headers
Types
XexFormat
ImportLibrary
name- Library nameid- Library identifierversion- Required library versionmin_version- Minimum compatible versionimports- List of imported functions
ImportLibraryFn
ordinal- Function ordinal in the import libraryvalue_address- Guest address where function pointer is storedthunk_address- Import thunk address
SecurityInfoContext
Constructor & Destructor
XexModule
processor- Processor instance for code executionkernel_state- Kernel state for object management
~XexModule
Loading
Load
- Validates the XEX signature (XEX1/XEX2)
- Reads and decrypts the XEX headers
- Decompresses the executable image (if compressed)
- Loads the PE image into guest memory
name- Module name (e.g., “default.xex”)path- Full virtual path to the modulexex_addr- Pointer to XEX file data in host memoryxex_length- Size of XEX file in bytes
true if load succeeded, false on error.
Example:
LoadContinue
Load() has succeeded.
This method:
- Parses PE headers and sections
- Resolves import libraries
- Populates binary symbols for debugging
true if completion succeeded, false on error.
Note: Call Load() first, then LoadContinue() to finish initialization.
Unload
true if unload succeeded, false on error.
Module Properties
loaded
true if the module has been loaded into memory.
name
base_address
image_size
xex_module.h:72-86
entry_point
is_executable
true if this is a title executable (has XEX_MODULE_TITLE flag).
is_patch
true if this is a patch module (title update).
is_dev_kit
true if the XEX was signed with a development key.
XEX Headers
xex_header
xex_security_info
GetOptHeader
key- Header key (e.g.,XEX_HEADER_EXECUTION_INFO)out_ptr- Output parameter receiving header pointer (or value for inline headers)
true if header exists, false otherwise.
Example:
opt_execution_info
opt_file_format_info
opt_alternate_title_ids
Import Resolution
import_libraries
PE Sections
pe_sections
.text, .data, .rdata, etc.).
GetPESection
name- Section name (e.g., “.text”)
PESection, or nullptr if not found.
Export Resolution
export_table_address
GetProcAddress (by ordinal)
ordinal- Function ordinal
0 if not found.
GetProcAddress (by name)
name- Function name
0 if not found.
Exception Handling
exception_directory_rva
exception_directory_size
exception_directory_address
Binary Introspection
binary_sections
FindSectionByName
binary_symbols
ContainsAddress
address- Guest virtual address
true if address is within module bounds.
XEX Format Constants
xex_module.h:25-27
Usage Example
See Also
- Runtime - Load XEX modules through
Runtime::LoadXexImage() - Module - Base class for all module types
- UserModule - User-space module wrapper