From: Derek Lesho Subject: [PATCH 4/5] ntoskrnl.exe: Export and set PsInitialSystemProcess. Message-Id: <20190424142509.528-4-dereklesho52@Gmail.com> Date: Wed, 24 Apr 2019 10:25:08 -0400 In-Reply-To: <20190424142509.528-1-dereklesho52@Gmail.com> References: <20190424142509.528-1-dereklesho52@Gmail.com> Signed-off-by: Derek Lesho --- dlls/ntoskrnl.exe/ntoskrnl.c | 4 ++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 711386c5ad..5abd9b5469 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -940,6 +940,8 @@ static void unload_driver( struct wine_rb_entry *entry, void *context ) CloseServiceHandle( (void *)service_handle ); } +PEPROCESS PsInitialSystemProcess = NULL; + /*********************************************************************** * wine_ntoskrnl_main_loop (Not a Windows API) */ @@ -953,6 +955,8 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event ) void *in_buff = NULL; HANDLE handles[2]; + /* Set the system process global before setting up the request thread trickery */ + PsInitialSystemProcess = IoGetCurrentProcess(); request_thread = GetCurrentThreadId(); handles[0] = stop_event; diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 97fc4ec0db..f8240c529a 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -906,7 +906,7 @@ @ stub PsGetThreadWin32Thread @ stdcall PsGetVersion(ptr ptr ptr ptr) @ stdcall PsImpersonateClient(ptr ptr long long long) -@ stub PsInitialSystemProcess +@ extern PsInitialSystemProcess @ stub PsIsProcessBeingDebugged @ stub PsIsSystemThread @ stub PsIsThreadImpersonating -- 2.20.1