2019-12-09 11:57:37 +00:00
|
|
|
/*
|
2021-10-04 19:59:10 +00:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2019-12-09 11:57:37 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2021-10-04 19:33:09 +00:00
|
|
|
#include <stratosphere/os/os_native_handle.hpp>
|
2021-10-02 00:18:50 +00:00
|
|
|
#include <stratosphere/ncm/ncm_program_id.hpp>
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
namespace ams::os {
|
|
|
|
|
2021-10-04 19:33:09 +00:00
|
|
|
Result GetProcessId(os::ProcessId *out, NativeHandle handle);
|
|
|
|
|
|
|
|
ALWAYS_INLINE ProcessId GetProcessId(NativeHandle handle) {
|
|
|
|
ProcessId process_id;
|
|
|
|
R_ABORT_UNLESS(GetProcessId(std::addressof(process_id), handle));
|
|
|
|
return process_id;
|
|
|
|
}
|
2019-12-09 11:57:37 +00:00
|
|
|
|
2021-10-02 00:18:50 +00:00
|
|
|
ALWAYS_INLINE ProcessId GetCurrentProcessId() {
|
2019-12-09 11:57:37 +00:00
|
|
|
return GetProcessId(GetCurrentProcessHandle());
|
|
|
|
}
|
|
|
|
|
2021-10-04 19:33:09 +00:00
|
|
|
Result GetProgramId(ncm::ProgramId *out, NativeHandle handle);
|
|
|
|
|
|
|
|
ALWAYS_INLINE ncm::ProgramId GetProgramId(NativeHandle handle) {
|
|
|
|
ncm::ProgramId program_id;
|
|
|
|
R_ABORT_UNLESS(GetProgramId(std::addressof(program_id), handle));
|
|
|
|
return program_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
ALWAYS_INLINE ncm::ProgramId GetCurrentProgramId() {
|
|
|
|
return GetProgramId(GetCurrentProcessHandle());
|
|
|
|
}
|
2021-10-02 00:18:50 +00:00
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
}
|