os: remove ManagedHandle, refactor to use NativeHandle typename

This commit is contained in:
Michael Scire
2021-10-04 12:33:09 -07:00
parent a774833790
commit 6f76066d24
71 changed files with 473 additions and 397 deletions

View File

@@ -47,7 +47,7 @@ namespace ams::ro {
Result RoService::RegisterModuleInfo(const sf::ClientProcessId &client_pid, u64 nrr_address, u64 nrr_size) {
R_TRY(impl::ValidateProcess(this->context_id, client_pid.GetValue()));
return impl::RegisterModuleInfo(this->context_id, svc::InvalidHandle, nrr_address, nrr_size, NrrKind_User, true);
return impl::RegisterModuleInfo(this->context_id, os::InvalidNativeHandle, nrr_address, nrr_size, NrrKind_User, true);
}
Result RoService::UnregisterModuleInfo(const sf::ClientProcessId &client_pid, u64 nrr_address) {
@@ -56,20 +56,20 @@ namespace ams::ro {
}
Result RoService::RegisterProcessHandle(const sf::ClientProcessId &client_pid, sf::CopyHandle process_h) {
/* Ensure we manage references to the process handle correctly. */
os::ManagedHandle process_handle(process_h.GetValue());
/* Register the process. */
return impl::RegisterProcess(std::addressof(this->context_id), std::move(process_handle), client_pid.GetValue());
return impl::RegisterProcess(std::addressof(this->context_id), process_h.GetValue(), client_pid.GetValue());
}
Result RoService::RegisterProcessModuleInfo(const sf::ClientProcessId &client_pid, u64 nrr_address, u64 nrr_size, sf::CopyHandle process_h) {
/* Ensure we manage references to the process handle correctly. */
os::ManagedHandle process_handle(process_h.GetValue());
/* Validate the process, ensuring we manage the process handle correctly. */
{
auto handle_guard = SCOPE_GUARD { os::CloseNativeHandle(process_h.GetValue()); };
R_TRY(impl::ValidateProcess(this->context_id, client_pid.GetValue()));
handle_guard.Cancel();
}
/* Register the module. */
R_TRY(impl::ValidateProcess(this->context_id, client_pid.GetValue()));
return impl::RegisterModuleInfo(this->context_id, std::move(process_handle), nrr_address, nrr_size, this->nrr_kind, this->nrr_kind == NrrKind_JitPlugin);
return impl::RegisterModuleInfo(this->context_id, process_h.GetValue(), nrr_address, nrr_size, this->nrr_kind, this->nrr_kind == NrrKind_JitPlugin);
}
}