[0.4.13][NTUSER] Fix BSOD 0x1E nullptr deref CORE-18899 (#5212)

by porting back:
0.4.15-dev-5902-g 9ee9f73369

Likely that nullptr deref was introduced to the master branch by 0.4.13-dev-962-g 4193b8d8ac
This commit is contained in:
Joachim Henze 2023-04-07 19:06:26 +02:00
parent 6f01532b81
commit 4beb9cb4ea
3 changed files with 10 additions and 12 deletions

View file

@ -1,9 +1,7 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Win32k subsystem
* PURPOSE: Miscellaneous User functions
* FILE: win32ss/user/ntuser/defwnd.c
* PROGRAMER:
* PROJECT: ReactOS Win32k subsystem
* LICENSE: See COPYING in the top level directory
* PURPOSE: Miscellaneous User functions
*/
#include <win32k.h>
@ -786,6 +784,8 @@ IntDefWindowProc(
DWORD ExStyleTB;
HWND hwndTop = UserGetForegroundWindow();
PWND topWnd = UserGetWindowObject(hwndTop);
if (!topWnd)
return 0;
// We want to forbid snapping operations on the TaskBar
// We use a heuristic for detecting the TaskBar Wnd by its typical Style & ExStyle Values
@ -795,7 +795,7 @@ IntDefWindowProc(
&& (ExStyleTB == WS_EX_TOOLWINDOW);
TRACE("ExStyle=%x Style=%x IsTaskBar=%d\n", ExStyleTB, StyleTB, IsTaskBar);
if (topWnd && !IsTaskBar)
if (!IsTaskBar)
{
if ((topWnd->style & WS_THICKFRAME) == 0)
return 0;

View file

@ -2,8 +2,7 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: Window event handlers
* FILE: win32ss/user/ntuser/event.c
* PROGRAMER: James Tabor (james.tabor@rectos.org)
* PROGRAMER: James Tabor <james.tabor@reactos.org>
*/
#include <win32k.h>

View file

@ -2,10 +2,9 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: Window hooks
* FILE: win32ss/user/ntuser/hook.c
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* James Tabor (james.tabor@rectos.org)
* Rafal Harabien (rafalh@reactos.org)
* PROGRAMER: Casper S. Hornstrup <chorns@users.sourceforge.net>
* James Tabor <james.tabor@reactos.org>
* Rafal Harabien <rafalh@reactos.org>
* NOTE: Most of this code was adapted from Wine,
* Copyright (C) 2002 Alexandre Julliard
*/