[NTUSER] Check class style for CS_NOCLOSE instead of window style (#7123)
authorDoug Lyons <douglyons@douglyons.com>
Wed, 10 Jul 2024 10:30:53 +0000 (05:30 -0500)
committerGitHub <noreply@github.com>
Wed, 10 Jul 2024 10:30:53 +0000 (13:30 +0300)
Change 'pWnd->style' to 'pWnd->pcls->style' to check for CS_NOCLOSE.
Incorrect struct field was used for checking previously.

Fixes a bug with Ad Muncher that did not close when clicking on the window
title "X" button while being used with a Classic window style theme.
Patch by I_Kill_Bugs. CORE-11569

win32ss/user/ntuser/nonclient.c

index 796f577..2324cc0 100644 (file)
@@ -1478,7 +1478,7 @@ NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
       case HTCLOSE:
          SysMenu = IntGetSystemMenu(pWnd, FALSE);
          MenuState = IntGetMenuState(SysMenu ? UserHMGetHandle(SysMenu) : NULL, SC_CLOSE, MF_BYCOMMAND); /* in case of error MenuState==0xFFFFFFFF */
-         if (!(Style & WS_SYSMENU) || (MenuState & (MF_GRAYED|MF_DISABLED)) || (pWnd->style & CS_NOCLOSE))
+         if (!(Style & WS_SYSMENU) || (MenuState & (MF_GRAYED|MF_DISABLED)) || (pWnd->pcls->style & CS_NOCLOSE))
             return;
          ButtonType = DFCS_CAPTIONCLOSE;
          SCMsg = SC_CLOSE;