Fixing module export.
This commit is contained in:
parent
0359184bc0
commit
e772a8cb92
|
@ -180,8 +180,10 @@ void KernelState::SetExecutableModule(object_ref<XUserModule> module) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
executable_module_ = std::move(module);
|
executable_module_ = std::move(module);
|
||||||
|
if (!executable_module_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (executable_module_) {
|
|
||||||
auto header = executable_module_->xex_header();
|
auto header = executable_module_->xex_header();
|
||||||
if (header) {
|
if (header) {
|
||||||
auto pib = memory_->TranslateVirtual<ProcessInfoBlock*>(
|
auto pib = memory_->TranslateVirtual<ProcessInfoBlock*>(
|
||||||
|
@ -190,18 +192,15 @@ void KernelState::SetExecutableModule(object_ref<XUserModule> module) {
|
||||||
pib->tls_raw_data_size = header->tls_info.raw_data_size;
|
pib->tls_raw_data_size = header->tls_info.raw_data_size;
|
||||||
pib->tls_slot_size = header->tls_info.slot_count * 4;
|
pib->tls_slot_size = header->tls_info.slot_count * 4;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Setup the kernel's XexExecutableModuleHandle field
|
// Setup the kernel's XexExecutableModuleHandle field.
|
||||||
auto exp = processor()->export_resolver()->GetExportByOrdinal(
|
auto export = processor()->export_resolver()->GetExportByOrdinal(
|
||||||
"xboxkrnl.exe", ordinals::XexExecutableModuleHandle);
|
"xboxkrnl.exe", ordinals::XexExecutableModuleHandle);
|
||||||
|
assert_not_null(export);
|
||||||
if (exp) {
|
assert_not_zero(export->variable_ptr);
|
||||||
auto variable_ptr =
|
auto variable_ptr =
|
||||||
memory()->TranslateVirtual<xe::be<uint32_t>*>(exp->variable_ptr);
|
memory()->TranslateVirtual<xe::be<uint32_t>*>(export->variable_ptr);
|
||||||
|
*variable_ptr = executable_module_->hmodule_ptr();
|
||||||
*variable_ptr = module->hmodule_ptr();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KernelState::LoadKernelModule(object_ref<XKernelModule> kernel_module) {
|
void KernelState::LoadKernelModule(object_ref<XKernelModule> kernel_module) {
|
||||||
|
|
Loading…
Reference in New Issue