Quick fix for RtlImageXexHeaderField - still some more to do.

This commit is contained in:
Ben Vanik 2015-06-28 12:17:48 -07:00
parent e772a8cb92
commit 996f99bd85
2 changed files with 11 additions and 11 deletions

View File

@ -196,12 +196,13 @@ void KernelState::SetExecutableModule(object_ref<XUserModule> module) {
// Setup the kernel's XexExecutableModuleHandle field.
auto export = processor()->export_resolver()->GetExportByOrdinal(
"xboxkrnl.exe", ordinals::XexExecutableModuleHandle);
assert_not_null(export);
if (export) {
assert_not_zero(export->variable_ptr);
auto variable_ptr =
memory()->TranslateVirtual<xe::be<uint32_t>*>(export->variable_ptr);
*variable_ptr = executable_module_->hmodule_ptr();
}
}
void KernelState::LoadKernelModule(object_ref<XKernelModule> kernel_module) {
std::lock_guard<xe::recursive_mutex> lock(object_mutex_);

View File

@ -390,17 +390,16 @@ SHIM_CALL RtlImageXexHeaderField_shim(PPCContext* ppc_context,
auto header =
kernel_memory()->TranslateVirtual<xex2_header*>(xex_header_base);
if (!header) {
SHIM_SET_RETURN_32(X_STATUS_UNSUCCESSFUL);
SHIM_SET_RETURN_32(0);
return;
}
uint8_t* hdr = xex2_get_opt_header(header, image_field);
if (!hdr) {
SHIM_SET_RETURN_32(X_STATUS_NOT_FOUND);
uint8_t* field_ptr = xex2_get_opt_header(header, image_field);
if (!field_ptr) {
SHIM_SET_RETURN_32(0);
return;
}
SHIM_SET_RETURN_32((uint32_t)(hdr - kernel_memory()->virtual_membase()));
SHIM_SET_RETURN_32(uint32_t(field_ptr - kernel_memory()->virtual_membase()));
}
// Unfortunately the Windows RTL_CRITICAL_SECTION object is bigger than the one