[UXTHEME][NTUSER] Check class style for CS_NOCLOSE instead of window style (#7130)

CORE-11569, CORE-19684

Addendum to commit 71bed0f5f8 (PR #7123).

The problem in uxtheme was introduced in commit 685084b63c (as part
of a fix for CORE-17203), because it was a copy-paste and adaptation
of the corresponding code in `ntuser/nonclient.c!NC_DoButton()`.

The bugs in `win32ss/user/ntuser/defwnd.c` (and `nonclient.c` as fixed by
the previous commit) were in turn introduced from the migration of menu
and related code from user32 to win32k, see commit 6dfa71c487 (r68904).
This commit is contained in:
Hermès Bélusca-Maïto 2024-07-10 17:45:21 +02:00
parent 957bb89548
commit c02289a08a
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 2 additions and 2 deletions

View file

@ -297,7 +297,7 @@ ThemeDrawCaptionButton(PDRAW_CONTEXT pcontext,
case CLOSEBUTTON:
SysMenu = GetSystemMenu(pcontext->hWnd, FALSE);
MenuState = GetMenuState(SysMenu, SC_CLOSE, MF_BYCOMMAND);
if (!(pcontext->wi.dwStyle & WS_SYSMENU) || (MenuState & (MF_GRAYED | MF_DISABLED)) || pcontext->wi.dwStyle & CS_NOCLOSE)
if (!(pcontext->wi.dwStyle & WS_SYSMENU) || (MenuState & (MF_GRAYED | MF_DISABLED)) || (GetClassLongPtrW(pcontext->hWnd, GCL_STYLE) & CS_NOCLOSE))
{
iStateId = (pcontext->Active ? BUTTON_DISABLED : BUTTON_INACTIVE_DISABLED);
}

View file

@ -920,7 +920,7 @@ IntDefWindowProc(
if (wParam == VK_F4) /* Try to close the window */
{
PWND top = UserGetAncestor(Wnd, GA_ROOT);
if (!(top->style & CS_NOCLOSE))
if (!(top->pcls->style & CS_NOCLOSE))
UserPostMessage(UserHMGetHandle(top), WM_SYSCOMMAND, SC_CLOSE, 0);
}
else if (wParam == VK_SNAPSHOT) // Alt-VK_SNAPSHOT?