mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
ro/dmnt: fix process address space detection
This commit is contained in:
parent
719ead824e
commit
306f413874
2 changed files with 14 additions and 13 deletions
|
@ -805,17 +805,18 @@ namespace ams::dmnt::cheat::impl {
|
||||||
os::NativeHandle proc_h = os::InvalidNativeHandle;
|
os::NativeHandle proc_h = os::InvalidNativeHandle;
|
||||||
ncm::ProgramLocation loc = {};
|
ncm::ProgramLocation loc = {};
|
||||||
cfg::OverrideStatus status = {};
|
cfg::OverrideStatus status = {};
|
||||||
ON_SCOPE_EXIT { os::CloseNativeHandle(proc_h); };
|
|
||||||
|
|
||||||
R_ABORT_UNLESS_IF_NEW_PROCESS(pm::dmnt::AtmosphereGetProcessInfo(&proc_h, &loc, &status, this->cheat_process_metadata.process_id));
|
R_ABORT_UNLESS_IF_NEW_PROCESS(pm::dmnt::AtmosphereGetProcessInfo(&proc_h, &loc, &status, this->cheat_process_metadata.process_id));
|
||||||
|
ON_SCOPE_EXIT { os::CloseNativeHandle(proc_h); };
|
||||||
|
|
||||||
this->cheat_process_metadata.program_id = loc.program_id;
|
this->cheat_process_metadata.program_id = loc.program_id;
|
||||||
|
|
||||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(this->cheat_process_metadata.heap_extents.base), svc::InfoType_HeapRegionAddress, svc::PseudoHandle::CurrentProcess, 0));
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(this->cheat_process_metadata.heap_extents.base), svc::InfoType_HeapRegionAddress, proc_h, 0));
|
||||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(this->cheat_process_metadata.heap_extents.size), svc::InfoType_HeapRegionSize, svc::PseudoHandle::CurrentProcess, 0));
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(this->cheat_process_metadata.heap_extents.size), svc::InfoType_HeapRegionSize, proc_h, 0));
|
||||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(this->cheat_process_metadata.alias_extents.base), svc::InfoType_AliasRegionAddress, svc::PseudoHandle::CurrentProcess, 0));
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(this->cheat_process_metadata.alias_extents.base), svc::InfoType_AliasRegionAddress, proc_h, 0));
|
||||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(this->cheat_process_metadata.alias_extents.size), svc::InfoType_AliasRegionSize, svc::PseudoHandle::CurrentProcess, 0));
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(this->cheat_process_metadata.alias_extents.size), svc::InfoType_AliasRegionSize, proc_h, 0));
|
||||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(this->cheat_process_metadata.aslr_extents.base), svc::InfoType_AslrRegionAddress, svc::PseudoHandle::CurrentProcess, 0));
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(this->cheat_process_metadata.aslr_extents.base), svc::InfoType_AslrRegionAddress, proc_h, 0));
|
||||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(this->cheat_process_metadata.aslr_extents.size), svc::InfoType_AslrRegionSize, svc::PseudoHandle::CurrentProcess, 0));
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(this->cheat_process_metadata.aslr_extents.size), svc::InfoType_AslrRegionSize, proc_h, 0));
|
||||||
|
|
||||||
/* If new process launch, we may not want to actually attach. */
|
/* If new process launch, we may not want to actually attach. */
|
||||||
if (on_process_launch) {
|
if (on_process_launch) {
|
||||||
|
|
|
@ -36,12 +36,12 @@ namespace ams::ro::impl {
|
||||||
u64 m_aslr_size;
|
u64 m_aslr_size;
|
||||||
public:
|
public:
|
||||||
ProcessRegionInfo(os::NativeHandle process) {
|
ProcessRegionInfo(os::NativeHandle process) {
|
||||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(m_heap_start), svc::InfoType_HeapRegionAddress, svc::PseudoHandle::CurrentProcess, 0));
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(m_heap_start), svc::InfoType_HeapRegionAddress, process, 0));
|
||||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(m_heap_size), svc::InfoType_HeapRegionSize, svc::PseudoHandle::CurrentProcess, 0));
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(m_heap_size), svc::InfoType_HeapRegionSize, process, 0));
|
||||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(m_alias_start), svc::InfoType_AliasRegionAddress, svc::PseudoHandle::CurrentProcess, 0));
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(m_alias_start), svc::InfoType_AliasRegionAddress, process, 0));
|
||||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(m_alias_size), svc::InfoType_AliasRegionSize, svc::PseudoHandle::CurrentProcess, 0));
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(m_alias_size), svc::InfoType_AliasRegionSize, process, 0));
|
||||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(m_aslr_start), svc::InfoType_AslrRegionAddress, svc::PseudoHandle::CurrentProcess, 0));
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(m_aslr_start), svc::InfoType_AslrRegionAddress, process, 0));
|
||||||
R_ABORT_UNLESS(svc::GetInfo(std::addressof(m_aslr_size), svc::InfoType_AslrRegionSize, svc::PseudoHandle::CurrentProcess, 0));
|
R_ABORT_UNLESS(svc::GetInfo(std::addressof(m_aslr_size), svc::InfoType_AslrRegionSize, process, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 GetAslrRegion(u64 mapping_size) const {
|
u64 GetAslrRegion(u64 mapping_size) const {
|
||||||
|
|
Loading…
Reference in a new issue