diff --git a/xtoskrnl/includes/ps/thread.hh b/xtoskrnl/includes/ps/thread.hh index dd3ff57..a6a0f2c 100644 --- a/xtoskrnl/includes/ps/thread.hh +++ b/xtoskrnl/includes/ps/thread.hh @@ -21,6 +21,7 @@ namespace PS STATIC XTAPI XTSTATUS CreateIdleThread(IN PKPROCESSOR_CONTROL_BLOCK Prcb, IN PVOID Stack); STATIC XTAPI VOID DeleteThread(IN PVOID ThreadObject); + STATIC XTAPI PETHREAD GetCurrentThread(VOID); }; } diff --git a/xtoskrnl/ps/thread.cc b/xtoskrnl/ps/thread.cc index 2e08821..2d93b52 100644 --- a/xtoskrnl/ps/thread.cc +++ b/xtoskrnl/ps/thread.cc @@ -78,3 +78,18 @@ PS::Thread::DeleteThread(IN PVOID ThreadObject) { UNIMPLEMENTED; } + +/** + * Retrieves a pointer to the currently executing executive thread object. + * + * @return This routine returns the address of the current executive thread object. + * + * @since XT 1.0 + */ +XTAPI +PETHREAD +PS::Thread::GetCurrentThread(VOID) +{ + /* Retrieve the active kernel thread and cast it to the executive thread */ + return (PETHREAD)KE::Processor::GetCurrentThread(); +}