Add helper to get currently executing process

This commit is contained in:
2026-06-18 20:34:28 +02:00
parent 9faf19b57e
commit 95ec18a1de
2 changed files with 16 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ namespace PS
{
public:
STATIC XTAPI XTSTATUS CreateIdleProcess(IN PKPROCESSOR_CONTROL_BLOCK Prcb);
STATIC XTFASTCALL PEPROCESS GetCurrentProcess(VOID);
};
}

View File

@@ -49,3 +49,18 @@ PS::Process::CreateIdleProcess(IN PKPROCESSOR_CONTROL_BLOCK Prcb)
/* Initialize IDLE thread */
return KE::KThread::InitializeIdleThread(IdleProcess, IdleThread, Prcb, AR::ProcessorSupport::GetBootStack());
}
/**
* Returns a pointer to the process object associated with the currently executing thread.
*
* @return This routine returns a pointer to the current process object.
*
* @since XT 1.0
*/
XTFASTCALL
PEPROCESS
PS::Process::GetCurrentProcess(VOID)
{
/* Return the current process */
return (PEPROCESS)KE::Processor::GetCurrentThread()->ApcState.Process;
}