Implemented ExLoadedImageName
This commit is contained in:
parent
bf8138a886
commit
f6f524b814
|
@ -316,6 +316,17 @@ void KernelState::SetExecutableModule(object_ref<UserModule> module) {
|
|||
*variable_ptr = executable_module_->hmodule_ptr();
|
||||
}
|
||||
|
||||
// Setup the kernel's ExLoadedImageName field
|
||||
export_entry = processor()->export_resolver()->GetExportByOrdinal(
|
||||
"xboxkrnl.exe", ordinals::ExLoadedImageName);
|
||||
|
||||
if (export_entry) {
|
||||
char* variable_ptr =
|
||||
memory()->TranslateVirtual<char*>(export_entry->variable_ptr);
|
||||
xe::string_util::copy_truncating(
|
||||
variable_ptr, executable_module_->path(),
|
||||
xboxkrnl::XboxkrnlModule::kExLoadedImageNameSize);
|
||||
}
|
||||
// Spin up deferred dispatch worker.
|
||||
// TODO(benvanik): move someplace more appropriate (out of ctor, but around
|
||||
// here).
|
||||
|
|
|
@ -189,6 +189,16 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
|||
ordinals::XexExecutableModuleHandle,
|
||||
ppXexExecutableModuleHandle);
|
||||
|
||||
// ExLoadedImageName (char*)
|
||||
// The full path to loaded image/xex including its name.
|
||||
// Used usually in custom dashboards (Aurora)
|
||||
// Todo(Gliniak): Confirm that official kernel always allocate space for this
|
||||
// variable.
|
||||
uint32_t ppExLoadedImageName =
|
||||
memory_->SystemHeapAlloc(kExLoadedImageNameSize);
|
||||
export_resolver_->SetVariableMapping(
|
||||
"xboxkrnl.exe", ordinals::ExLoadedImageName, ppExLoadedImageName);
|
||||
|
||||
// ExLoadedCommandLine (char*)
|
||||
// The name of the xex. Not sure this is ever really used on real devices.
|
||||
// Perhaps it's how swap disc/etc data is sent?
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace xboxkrnl {
|
|||
|
||||
class XboxkrnlModule : public KernelModule {
|
||||
public:
|
||||
static constexpr size_t kExLoadedImageNameSize = 255 + 1;
|
||||
|
||||
XboxkrnlModule(Emulator* emulator, KernelState* kernel_state);
|
||||
virtual ~XboxkrnlModule();
|
||||
|
||||
|
|
Loading…
Reference in New Issue