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

commit ee3659d5d50b08755dd97e785214ad36e33036b8
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Thu Dec 9 00:39:57 2021 +0900
Commit:     GitHub <[email protected]>
CommitDate: Thu Dec 9 00:39:57 2021 +0900

    [NTUSER][USER32] Simplify user32.IsHungAppWindow (#4150)
    
    Check FNID_GHOST and MsqIsHung. CORE-17894
---
 win32ss/user/ntuser/window.c         |  2 +-
 win32ss/user/user32/windows/window.c | 17 +----------------
 2 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/win32ss/user/ntuser/window.c b/win32ss/user/ntuser/window.c
index 7d2a97f3584..8e42d693d45 100644
--- a/win32ss/user/ntuser/window.c
+++ b/win32ss/user/ntuser/window.c
@@ -3991,7 +3991,7 @@ NtUserQueryWindow(HWND hWnd, DWORD Index)
          break;
 
       case QUERY_WINDOW_ISHUNG:
-         Result = (DWORD_PTR)MsqIsHung(pWnd->head.pti, MSQ_HUNG);
+         Result = (pWnd->fnid == FNID_GHOST) || MsqIsHung(pWnd->head.pti, 
MSQ_HUNG);
          break;
 
       case QUERY_WINDOW_REAL_ID:
diff --git a/win32ss/user/user32/windows/window.c 
b/win32ss/user/user32/windows/window.c
index 078e496a0ea..8aa237ba397 100644
--- a/win32ss/user/user32/windows/window.c
+++ b/win32ss/user/user32/windows/window.c
@@ -1875,22 +1875,7 @@ InternalGetWindowText(HWND hWnd, LPWSTR lpString, int 
nMaxCount)
 BOOL WINAPI
 IsHungAppWindow(HWND hwnd)
 {
-    PWND Window;
-    UNICODE_STRING ClassName;
-    WCHAR szClass[16];
-    static const UNICODE_STRING GhostClass = RTL_CONSTANT_STRING(L"Ghost");
-
-    /* Ghost is a hung window */
-    RtlInitEmptyUnicodeString(&ClassName, szClass, sizeof(szClass));
-    Window = ValidateHwnd(hwnd);
-    if (Window && Window->fnid == FNID_GHOST &&
-        NtUserGetClassName(hwnd, FALSE, &ClassName) &&
-        RtlEqualUnicodeString(&ClassName, &GhostClass, TRUE))
-    {
-        return TRUE;
-    }
-
-    return (NtUserQueryWindow(hwnd, QUERY_WINDOW_ISHUNG) != 0);
+    return !!NtUserQueryWindow(hwnd, QUERY_WINDOW_ISHUNG);
 }
 
 /*

Reply via email to