pm: add Atmosphere GetProcessHandle command to pm:dmnt (#133)

This commit is contained in:
misson20000
2018-06-07 23:32:45 -07:00
committed by SciresM
parent e964bcf872
commit 28d630a23e
2 changed files with 21 additions and 0 deletions

View File

@@ -24,6 +24,9 @@ Result DebugMonitorService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64
case Dmnt_Cmd_5X_EnableDebugForApplication:
rc = WrapIpcCommandImpl<&DebugMonitorService::enable_debug_for_application>(this, r, out_c, pointer_buffer, pointer_buffer_size);
break;
case Dmnt_Cmd_5X_AtmosphereGetProcessHandle:
rc = WrapIpcCommandImpl<&DebugMonitorService::get_process_handle>(this, r, out_c, pointer_buffer, pointer_buffer_size);
break;
default:
break;
}
@@ -50,6 +53,9 @@ Result DebugMonitorService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64
case Dmnt_Cmd_EnableDebugForApplication:
rc = WrapIpcCommandImpl<&DebugMonitorService::enable_debug_for_application>(this, r, out_c, pointer_buffer, pointer_buffer_size);
break;
case Dmnt_Cmd_AtmosphereGetProcessHandle:
rc = WrapIpcCommandImpl<&DebugMonitorService::get_process_handle>(this, r, out_c, pointer_buffer, pointer_buffer_size);
break;
default:
break;
}
@@ -117,3 +123,11 @@ std::tuple<Result, CopiedHandle> DebugMonitorService::enable_debug_for_applicati
Result rc = Registration::EnableDebugForApplication(&h);
return {rc, h};
}
std::tuple<Result, CopiedHandle> DebugMonitorService::get_process_handle(u64 pid) {
Registration::Process *proc = Registration::GetProcess(pid);
if(proc == NULL) {
return {0x20F, 0};
}
return {0, proc->handle};
}