[NTUSER] Fix condition of HSHELL_WINDOWCREATED (#2046)

CORE-15655
If the owner window doesn't exist or is invisible or has WS_EX_TOOLWINDOW style, HSHELL_WINDOWCREATED regards the window a non-owned window. You can watch the shell hook information by using CORE-15655 ShellHookChecker.zip.
This commit is contained in:
Katayama Hirofumi MZ 2019-11-19 17:54:23 +09:00 committed by GitHub
parent fa264251a7
commit 141cf04239
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 11 deletions

View file

@ -2351,13 +2351,17 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
IntSendParentNotify(Window, WM_CREATE);
/* Notify the shell that a new window was created */
if (UserIsDesktopWindow(Window->spwndParent) &&
Window->spwndOwner == NULL &&
(Window->style & WS_VISIBLE) &&
(!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
(Window->ExStyle & WS_EX_APPWINDOW)))
if (Window->spwndOwner == NULL ||
!(Window->spwndOwner->style & WS_VISIBLE) ||
(Window->spwndOwner->ExStyle & WS_EX_TOOLWINDOW))
{
co_IntShellHookNotify(HSHELL_WINDOWCREATED, (WPARAM)hWnd, 0);
if (UserIsDesktopWindow(Window->spwndParent) &&
(Window->style & WS_VISIBLE) &&
(!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
(Window->ExStyle & WS_EX_APPWINDOW)))
{
co_IntShellHookNotify(HSHELL_WINDOWCREATED, (WPARAM)hWnd, 0);
}
}
/* Initialize and show the window's scrollbars */

View file

@ -1904,11 +1904,17 @@ co_WinPosSetWindowPos(
}
else if (WinPos.flags & SWP_SHOWWINDOW)
{
if (UserIsDesktopWindow(Window->spwndParent) &&
Window->spwndOwner == NULL &&
(!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
(Window->ExStyle & WS_EX_APPWINDOW)))
co_IntShellHookNotify(HSHELL_WINDOWCREATED, (WPARAM)Window->head.h, 0);
if (Window->spwndOwner == NULL ||
!(Window->spwndOwner->style & WS_VISIBLE) ||
(Window->spwndOwner->ExStyle & WS_EX_TOOLWINDOW))
{
if (UserIsDesktopWindow(Window->spwndParent) &&
(!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
(Window->ExStyle & WS_EX_APPWINDOW)))
{
co_IntShellHookNotify(HSHELL_WINDOWCREATED, (WPARAM)Window->head.h, 0);
}
}
Window->style |= WS_VISIBLE; //IntSetStyle( Window, WS_VISIBLE, 0 );
Window->head.pti->cVisWindows++;