1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-22 18:32:05 +00:00

kern: add extension InfoType for retrieving current process handle.

This commit is contained in:
Michael Scire 2021-03-17 17:48:30 -07:00
parent 5362ee9450
commit a7564cf303
2 changed files with 20 additions and 0 deletions

View file

@ -276,6 +276,25 @@ namespace ams::kern::svc {
}
}
break;
case ams::svc::InfoType_MesosphereCurrentProcess:
{
/* Verify the input handle is invalid. */
R_UNLESS(handle == ams::svc::InvalidHandle, svc::ResultInvalidHandle());
/* Verify the sub-type is valid. */
R_UNLESS(info_subtype == 0, svc::ResultInvalidCombination());
/* Get the handle table. */
KHandleTable &handle_table = GetCurrentProcess().GetHandleTable();
/* Get a new handle for the current process. */
ams::svc::Handle tmp;
R_TRY(handle_table.Add(std::addressof(tmp), GetCurrentProcessPointer()));
/* Set the output. */
*out = tmp;
}
break;
default:
{
/* For debug, log the invalid info call. */

View file

@ -159,6 +159,7 @@ namespace ams::svc {
InfoType_FreeThreadCount = 24,
InfoType_MesosphereMeta = 65000,
InfoType_MesosphereCurrentProcess = 65001,
InfoType_ThreadTickCount = 0xF0000002,
};