https://git.reactos.org/?p=reactos.git;a=commitdiff;h=141cf04239f3049c1c180fb2c6c3aa84b13c8590

commit 141cf04239f3049c1c180fb2c6c3aa84b13c8590
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Tue Nov 19 17:54:23 2019 +0900
Commit:     GitHub <[email protected]>
CommitDate: Tue Nov 19 17:54:23 2019 +0900

    [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.
---
 win32ss/user/ntuser/window.c | 18 +++++++++++-------
 win32ss/user/ntuser/winpos.c | 16 +++++++++++-----
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/win32ss/user/ntuser/window.c b/win32ss/user/ntuser/window.c
index c34dcea55f0..ee65215959d 100644
--- a/win32ss/user/ntuser/window.c
+++ b/win32ss/user/ntuser/window.c
@@ -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 */
diff --git a/win32ss/user/ntuser/winpos.c b/win32ss/user/ntuser/winpos.c
index 10ec112e346..6467c2cad86 100644
--- a/win32ss/user/ntuser/winpos.c
+++ b/win32ss/user/ntuser/winpos.c
@@ -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++;

Reply via email to