Call a DLL's entry-point function in XexLoadImage

This commit is contained in:
Dr. Chat 2015-05-08 22:43:54 -05:00
parent 8deb622abb
commit 0f2b1491b7
1 changed files with 10 additions and 1 deletions

View File

@ -231,8 +231,17 @@ SHIM_CALL XexLoadImage_shim(PPCContext* ppc_state, KernelState* state) {
// If the module has an entry point function, we have to call it.
const xe_xex2_header_t* header = usermod->xex_header();
if (header->exe_entry_point) {
// Return address
uint32_t lr = ppc_state->thread_state->context()->lr;
// TODO: What are these args for?
// param 2: val 1 seems to make CRT initialize
uint64_t args[] = { 0, 1, 0 };
state->processor()->Execute(ppc_state->thread_state,
header->exe_entry_point);
header->exe_entry_point,
args, xe::countof(args));
ppc_state->thread_state->context()->lr = lr;
}
result = X_STATUS_SUCCESS;