From 7db52a816f26e4693ea5adf5e6d7e391af2ebc66 Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Thu, 9 Jul 2026 08:54:22 +0200 Subject: [PATCH] Expose system process object --- xtoskrnl/includes/ps/process.hh | 4 ++++ xtoskrnl/ps/data.cc | 3 +++ xtoskrnl/ps/process.cc | 15 +++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/xtoskrnl/includes/ps/process.hh b/xtoskrnl/includes/ps/process.hh index a1ab081..17338f6 100644 --- a/xtoskrnl/includes/ps/process.hh +++ b/xtoskrnl/includes/ps/process.hh @@ -17,9 +17,13 @@ namespace PS { class Process { + private: + STATIC PEPROCESS SystemProcess; + public: STATIC XTAPI XTSTATUS CreateIdleProcess(IN PKPROCESSOR_CONTROL_BLOCK Prcb); STATIC XTFASTCALL PEPROCESS GetCurrentProcess(VOID); + STATIC XTFASTCALL PEPROCESS GetSystemProcess(VOID); }; } diff --git a/xtoskrnl/ps/data.cc b/xtoskrnl/ps/data.cc index bd3d092..6b2930a 100644 --- a/xtoskrnl/ps/data.cc +++ b/xtoskrnl/ps/data.cc @@ -9,5 +9,8 @@ #include +/* Pointer to the system process object */ +PEPROCESS PS::Process::SystemProcess; + /* Default system-wide quota block assigned to processes */ EPROCESS_QUOTA_BLOCK PS::Quota::DefaultQuotaBlock; diff --git a/xtoskrnl/ps/process.cc b/xtoskrnl/ps/process.cc index a9f23da..d54013d 100644 --- a/xtoskrnl/ps/process.cc +++ b/xtoskrnl/ps/process.cc @@ -64,3 +64,18 @@ PS::Process::GetCurrentProcess(VOID) /* Return the current process */ return (PEPROCESS)KE::Processor::GetCurrentThread()->ApcState.Process; } + +/** + * Returns a pointer to the primary system process object. + * + * @return This routine returns a pointer to the system process object. + * + * @since XT 1.0 + */ +XTFASTCALL +PEPROCESS +PS::Process::GetSystemProcess(VOID) +{ + /* Return the system process */ + return SystemProcess; +}