https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f12e6016b6882a14b21ee…
commit f12e6016b6882a14b21ee86e708a28179885b630
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Wed Feb 10 15:09:48 2021 +0100
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Wed Feb 10 17:48:30 2021 +0100
[CONSRV] Set 0 as a console leader PID/TID when unsetting it.
Instead of whatever is behind the NULL pointer.
---
win32ss/user/winsrv/consrv/frontends/gui/conwnd.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c
b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c
index de9eea6053a..6dc4249dbe8 100644
--- a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c
+++ b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c
@@ -48,14 +48,25 @@ VOID
SetConWndConsoleLeaderCID(IN PGUI_CONSOLE_DATA GuiData)
{
PCONSOLE_PROCESS_DATA ProcessData;
- CLIENT_ID ConsoleLeaderCID;
ProcessData = ConSrvGetConsoleLeaderProcess(GuiData->Console);
- ConsoleLeaderCID = ProcessData->Process->ClientId;
- SetWindowLongPtrW(GuiData->hWindow, GWLP_CONSOLE_LEADER_PID,
- (LONG_PTR)(ConsoleLeaderCID.UniqueProcess));
- SetWindowLongPtrW(GuiData->hWindow, GWLP_CONSOLE_LEADER_TID,
- (LONG_PTR)(ConsoleLeaderCID.UniqueThread));
+
+ DPRINT("ProcessData: %p, ProcessData->Process %p.\n", ProcessData,
ProcessData->Process);
+ ASSERT(ProcessData != NULL);
+
+ if (ProcessData->Process)
+ {
+ CLIENT_ID ConsoleLeaderCID = ProcessData->Process->ClientId;
+ SetWindowLongPtrW(GuiData->hWindow, GWLP_CONSOLE_LEADER_PID,
+ (LONG_PTR)(ConsoleLeaderCID.UniqueProcess));
+ SetWindowLongPtrW(GuiData->hWindow, GWLP_CONSOLE_LEADER_TID,
+ (LONG_PTR)(ConsoleLeaderCID.UniqueThread));
+ }
+ else
+ {
+ SetWindowLongPtrW(GuiData->hWindow, GWLP_CONSOLE_LEADER_PID, 0);
+ SetWindowLongPtrW(GuiData->hWindow, GWLP_CONSOLE_LEADER_TID, 0);
+ }
}
/**************************************************************/