[NTUSER] Fix condition of HSHELL_WINDOWCREATED (#2046)
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Tue, 19 Nov 2019 08:54:23 +0000 (17:54 +0900)
committerGitHub <noreply@github.com>
Tue, 19 Nov 2019 08:54:23 +0000 (17:54 +0900)
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.

win32ss/user/ntuser/window.c
win32ss/user/ntuser/winpos.c

index c34dcea..ee65215 100644 (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)))
-   {
-      co_IntShellHookNotify(HSHELL_WINDOWCREATED, (WPARAM)hWnd, 0);
+   if (Window->spwndOwner == NULL ||
+       !(Window->spwndOwner->style & WS_VISIBLE) ||
+       (Window->spwndOwner->ExStyle & WS_EX_TOOLWINDOW))
+   {
+      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 */
index 10ec112..6467c2c 100644 (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++;