[WIN32K] Add some NULL checks for THREADINFO::rpdesk

rpdesk should probably never be NULL, but it happens in rare circumstances, like csrss being terminated.
This commit is contained in:
Timo Kreuzer 2022-12-26 16:11:14 +01:00
parent e56da4854f
commit abb75b6214
3 changed files with 11 additions and 3 deletions

View file

@ -1788,6 +1788,14 @@ BOOL IntDeRegisterShellHookWindow(HWND hWnd)
PLIST_ENTRY ListEntry;
PSHELL_HOOK_WINDOW Current;
// FIXME: This probably shouldn't happen, but it does
if (Desktop == NULL)
{
Desktop = IntGetActiveDesktop();
if (Desktop == NULL)
return FALSE;
}
ListEntry = Desktop->ShellHookWindows.Flink;
while (ListEntry != &Desktop->ShellHookWindows)
{

View file

@ -493,7 +493,7 @@ static void IntSendDestroyMsg(HWND hWnd)
}
/* If the window being destroyed is currently tracked... */
if (ti->rpdesk->spwndTrack == Window)
if (ti->rpdesk && ti->rpdesk->spwndTrack == Window)
{
IntRemoveTrackMouseEvent(ti->rpdesk);
}

View file

@ -436,12 +436,12 @@ co_WinPosActivateOtherWindow(PWND Wnd)
// Find any window to bring to top. Works Okay for wine since it does not see X11 windows.
WndTo = UserGetDesktopWindow();
WndTo = WndTo->spwndChild;
if ( WndTo == NULL )
if ((WndTo == NULL) || (WndTo->spwndChild == NULL))
{
//ERR("WinPosActivateOtherWindow No window!\n");
return;
}
WndTo = WndTo->spwndChild;
for (;;)
{
if (WndTo == Wnd)