Author: hbelusca
Date: Wed Feb 22 20:19:50 2017
New Revision: 73889

URL: http://svn.reactos.org/svn/reactos?rev=73889&view=rev
Log:
[WIN32K]: Replace some checks against UserGetDesktopWindow() and 
UserGetMessageWindow() by checks against FNID_xxx flags.
Fixes some FIXMEs in the code encountered while investigating the origin of 
"err: NtUserSetWindowPos bad window handle!" messages.
Reviewed by James Tabor.
CORE-12819

Modified:
    trunk/reactos/win32ss/user/ntuser/desktop.c
    trunk/reactos/win32ss/user/ntuser/desktop.h
    trunk/reactos/win32ss/user/ntuser/message.c
    trunk/reactos/win32ss/user/ntuser/nonclient.c
    trunk/reactos/win32ss/user/ntuser/painting.c
    trunk/reactos/win32ss/user/ntuser/scrollbar.c
    trunk/reactos/win32ss/user/ntuser/scrollex.c
    trunk/reactos/win32ss/user/ntuser/window.c
    trunk/reactos/win32ss/user/ntuser/winpos.c

Modified: trunk/reactos/win32ss/user/ntuser/desktop.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/desktop.c?rev=73889&r1=73888&r2=73889&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] Wed Feb 22 
20:19:50 2017
@@ -1806,7 +1806,7 @@
     {
         ERR("Failed to open desktop\n");
         SetLastNtError(Status);
-        return 0;
+        return NULL;
     }
 
     TRACE("Opened desktop %S with handle 0x%p\n", 
ObjectAttributes->ObjectName->Buffer, Desktop);

Modified: trunk/reactos/win32ss/user/ntuser/desktop.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/desktop.h?rev=73889&r1=73888&r2=73889&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/desktop.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/desktop.h [iso-8859-1] Wed Feb 22 
20:19:50 2017
@@ -181,10 +181,35 @@
 HDC FASTCALL UserGetDesktopDC(ULONG,BOOL,BOOL);
 
 #define IntIsActiveDesktop(Desktop) \
-  ((Desktop)->rpwinstaParent->ActiveDesktop == (Desktop))
+    ((Desktop)->rpwinstaParent->ActiveDesktop == (Desktop))
 
 HWND FASTCALL IntGetMessageWindow(VOID);
 PWND FASTCALL UserGetMessageWindow(VOID);
+
+#if 0
+static __inline BOOL
+UserIsDesktopWindow(IN PWND pWnd)
+{
+    // return (pWnd == UserGetDesktopWindow());
+    return (pWnd && (pWnd->fnid == FNID_DESKTOP));
+}
+
+static __inline BOOL
+UserIsMessageWindow(IN PWND pWnd)
+{
+    // return (pWnd == UserGetMessageWindow());
+    return (pWnd && (pWnd->fnid == FNID_MESSAGEWND));
+}
+#else
+
+#define UserIsDesktopWindow(pWnd)   \
+    ((pWnd) && ((pWnd)->fnid == FNID_DESKTOP))
+
+#define UserIsMessageWindow(pWnd)   \
+    ((pWnd) && ((pWnd)->fnid == FNID_MESSAGEWND))
+
+#endif
+
 
 static __inline PVOID
 DesktopHeapAlloc(IN PDESKTOP Desktop,

Modified: trunk/reactos/win32ss/user/ntuser/message.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/message.c?rev=73889&r1=73888&r2=73889&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] Wed Feb 22 
20:19:50 2017
@@ -616,9 +616,7 @@
 //    USER_REFERENCE_ENTRY Ref;
 //    PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
 
-    if (!pWnd ||
-         pWnd == UserGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP
-         pWnd == UserGetMessageWindow() )  // pWnd->fnid == FNID_MESSAGEWND
+    if (!pWnd || UserIsDesktopWindow(pWnd) || UserIsMessageWindow(pWnd))
        return 0;
 
     TRACE("Internal Event Msg 0x%x hWnd 0x%p\n", msg, pWnd->head.h);

Modified: trunk/reactos/win32ss/user/ntuser/nonclient.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/nonclient.c?rev=73889&r1=73888&r2=73889&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/nonclient.c       [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/nonclient.c       [iso-8859-1] Wed Feb 22 
20:19:50 2017
@@ -1501,7 +1501,7 @@
                 if ((TopWnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
                     break;
                 parent = UserGetAncestor( TopWnd, GA_PARENT );
-                if (!parent || parent == UserGetDesktopWindow()) break;
+                if (!parent || UserIsDesktopWindow(parent)) break;
                 TopWnd = parent;
             }
 
@@ -1885,7 +1885,7 @@
 
    if (!pWnd) return HTNOWHERE;
 
-   if (pWnd == UserGetDesktopWindow()) // pWnd->fnid == FNID_DESKTOP)
+   if (UserIsDesktopWindow(pWnd))
    {
       rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
       rcWindow.right  = UserGetSystemMetrics(SM_CXSCREEN);

Modified: trunk/reactos/win32ss/user/ntuser/painting.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/painting.c?rev=73889&r1=73888&r2=73889&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/painting.c        [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/painting.c        [iso-8859-1] Wed Feb 22 
20:19:50 2017
@@ -175,7 +175,7 @@
    }
 
    // Send to all the children if this is the desktop window.
-   if ( Wnd == UserGetDesktopWindow() )
+   if (UserIsDesktopWindow(Wnd))
    {
       if ( Flags & RDW_ALLCHILDREN ||
           ( !(Flags & RDW_NOCHILDREN) && Wnd->style & WS_CLIPCHILDREN))
@@ -567,9 +567,9 @@
    * Update child windows.
    */
 
-   if (!(Flags & RDW_NOCHILDREN) && 
-         Flags & RDW_ALLCHILDREN &&
-         Wnd != UserGetDesktopWindow() )
+   if (!(Flags & RDW_NOCHILDREN)  && 
+        (Flags & RDW_ALLCHILDREN) &&
+        !UserIsDesktopWindow(Wnd))
    {
       PWND Child;
 
@@ -1239,7 +1239,7 @@
    PaintWnd->state &= ~WNDS_UPDATEDIRTY;
 
    Window = PaintWnd;
-   while( Window && Window != UserGetDesktopWindow())
+   while (Window && !UserIsDesktopWindow(Window))
    {
       // Role back and check for clip children, do not set if any.
       if (Window->spwndParent && !(Window->spwndParent->style & 
WS_CLIPCHILDREN))
@@ -1578,7 +1578,7 @@
       POINT ppt;
       INT x = 0, y = 0;
 
-      if ( pWndParent != UserGetDesktopWindow())
+      if (!UserIsDesktopWindow(pWndParent))
       {
           x = pWndParent->rcClient.left - pWnd->rcClient.left;
           y = pWndParent->rcClient.top  - pWnd->rcClient.top;
@@ -1825,7 +1825,7 @@
 
       RegionType = SIMPLEREGION;
 
-      if (Window != UserGetDesktopWindow()) // Window->fnid == FNID_DESKTOP
+      if (!UserIsDesktopWindow(Window))
       {
          RECTL_vOffsetRect(&Rect,
                           -Window->rcClient.left,
@@ -1846,7 +1846,7 @@
          return RegionType;
       }
 
-      if (Window != UserGetDesktopWindow()) // Window->fnid == FNID_DESKTOP
+      if (!UserIsDesktopWindow(Window))
       {
          NtGdiOffsetRgn(hRgn,
                        -Window->rcClient.left,
@@ -1896,7 +1896,7 @@
 
       if (IntIntersectWithParents(Window, pRect))
       {
-         if (Window != UserGetDesktopWindow()) // Window->fnid == FNID_DESKTOP
+         if (!UserIsDesktopWindow(Window))
          {
             RECTL_vOffsetRect(pRect,
                               -Window->rcClient.left,
@@ -2593,9 +2593,8 @@
 
     if (hwnd)
     {
-       if (!(Window = UserGetWindowObject(hwnd)) || // FIXME:
-             Window == UserGetDesktopWindow() ||    // pWnd->fnid == 
FNID_DESKTOP
-             Window == UserGetMessageWindow() )     // pWnd->fnid == 
FNID_MESSAGEWND
+       if (!(Window = UserGetWindowObject(hwnd)) ||
+            UserIsDesktopWindow(Window) || UserIsMessageWindow(Window))
        {
           goto Exit;
        }

Modified: trunk/reactos/win32ss/user/ntuser/scrollbar.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/scrollbar.c?rev=73889&r1=73888&r2=73889&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/scrollbar.c       [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/scrollbar.c       [iso-8859-1] Wed Feb 22 
20:19:50 2017
@@ -1161,9 +1161,8 @@
    TRACE("Enter NtUserEnableScrollBar\n");
    UserEnterExclusive();
 
-   if (!(Window = UserGetWindowObject(hWnd)) || // FIXME:
-         Window == UserGetDesktopWindow() ||    // pWnd->fnid == FNID_DESKTOP
-         Window == UserGetMessageWindow() )     // pWnd->fnid == 
FNID_MESSAGEWND
+   if (!(Window = UserGetWindowObject(hWnd)) ||
+        UserIsDesktopWindow(Window) || UserIsMessageWindow(Window))
    {
       RETURN(FALSE);
    }
@@ -1247,9 +1246,8 @@
    TRACE("Enter NtUserSetScrollInfo\n");
    UserEnterExclusive();
 
-   if(!(Window = UserGetWindowObject(hWnd)) || // FIXME:
-        Window == UserGetDesktopWindow() ||    // pWnd->fnid == FNID_DESKTOP
-        Window == UserGetMessageWindow() )     // pWnd->fnid == FNID_MESSAGEWND
+   if(!(Window = UserGetWindowObject(hWnd)) ||
+        UserIsDesktopWindow(Window) || UserIsMessageWindow(Window))
    {
       RETURN( 0);
    }

Modified: trunk/reactos/win32ss/user/ntuser/scrollex.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/scrollex.c?rev=73889&r1=73888&r2=73889&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/scrollex.c        [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/scrollex.c        [iso-8859-1] Wed Feb 22 
20:19:50 2017
@@ -392,7 +392,7 @@
          {
             UserRefObjectCo(Child, &WndRef);
 
-            if (Window->spwndParent == UserGetDesktopWindow()) // 
Window->spwndParent->fnid == FNID_DESKTOP )
+            if (UserIsDesktopWindow(Window->spwndParent))
                lParam = MAKELONG(Child->rcClient.left, Child->rcClient.top);
             else
                lParam = MAKELONG(rcChild.left + dx, rcChild.top + dy);

Modified: trunk/reactos/win32ss/user/ntuser/window.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window.c?rev=73889&r1=73888&r2=73889&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/window.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/window.c  [iso-8859-1] Wed Feb 22 
20:19:50 2017
@@ -1125,8 +1125,7 @@
       /* Link the window with its new siblings */
       IntLinkHwnd( Wnd,
                   ((0 == (Wnd->ExStyle & WS_EX_TOPMOST) &&
-                    WndNewParent == UserGetDesktopWindow() ) ? HWND_TOP : 
HWND_TOPMOST ) );
-
+                    UserIsDesktopWindow(WndNewParent) ) ? HWND_TOP : 
HWND_TOPMOST ) );
    }
 
    if ( WndNewParent == co_GetDesktopWindow(Wnd) &&
@@ -1158,7 +1157,7 @@
       }
    }
 
-   if (WndOldParent == UserGetMessageWindow() || WndNewParent == 
UserGetMessageWindow())
+   if (UserIsMessageWindow(WndOldParent) || UserIsMessageWindow(WndNewParent))
       swFlags |= SWP_NOACTIVATE;
 
    IntNotifyWinEvent(EVENT_OBJECT_PARENTCHANGE, Wnd ,OBJID_WINDOW, 
CHILDID_SELF, WEF_SETBYWNDPTI);
@@ -1437,7 +1436,7 @@
     if ( (pWindow->style & (WS_CHILD | WS_POPUP)) == WS_CHILD &&
          !(pWindow->ExStyle & WS_EX_NOPARENTNOTIFY))
     {
-        if (VerifyWnd(pWindow->spwndParent) && pWindow->spwndParent != 
UserGetDesktopWindow())
+        if (VerifyWnd(pWindow->spwndParent) && 
!UserIsDesktopWindow(pWindow->spwndParent))
         {
             USER_REFERENCE_ENTRY Ref;
             UserRefObjectCo(pWindow->spwndParent, &Ref);
@@ -2252,7 +2251,7 @@
    IntSendParentNotify(Window, WM_CREATE);
 
    /* Notify the shell that a new window was created */
-   if (Window->spwndParent == UserGetDesktopWindow() &&
+   if (UserIsDesktopWindow(Window->spwndParent) &&
        Window->spwndOwner == NULL &&
        (Window->style & WS_VISIBLE) &&
        (!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
@@ -3452,7 +3451,7 @@
       RETURN(FALSE);
    }
 
-   if(!(WndListView = UserGetWindowObject(hwndListView)))
+   if (!(WndListView = UserGetWindowObject(hwndListView)))
    {
       RETURN(FALSE);
    }
@@ -3623,7 +3622,7 @@
                 co_IntSendMessage(hWnd, WM_STYLECHANGING, GWL_STYLE, (LPARAM) 
&Style);
 
             /* WS_CLIPSIBLINGS can't be reset on top-level windows */
-            if (Window->spwndParent == UserGetDesktopWindow()) Style.styleNew 
|= WS_CLIPSIBLINGS;
+            if (UserIsDesktopWindow(Window->spwndParent)) Style.styleNew |= 
WS_CLIPSIBLINGS;
             /* WS_MINIMIZE can't be reset */
             if (OldValue & WS_MINIMIZE) Style.styleNew |= WS_MINIMIZE;
             /* Fixes wine FIXME: changing WS_DLGFRAME | WS_THICKFRAME is 
supposed to change WS_EX_WINDOWEDGE too */

Modified: trunk/reactos/win32ss/user/ntuser/winpos.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winpos.c?rev=73889&r1=73888&r2=73889&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/winpos.c  [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/winpos.c  [iso-8859-1] Wed Feb 22 
20:19:50 2017
@@ -99,7 +99,7 @@
       Rect->bottom = UserGetSystemMetrics(SM_CYMINIMIZED);
       return;
    }
-   if ( Wnd != UserGetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
+   if (!UserIsDesktopWindow(Wnd))
    {
       *Rect = Wnd->rcClient;
       RECTL_vOffsetRect(Rect, -Wnd->rcClient.left, -Wnd->rcClient.top);
@@ -122,7 +122,7 @@
    ASSERT( Wnd );
    ASSERT( Rect );
    if (!Wnd) return FALSE;
-   if ( Wnd != UserGetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
+   if (!UserIsDesktopWindow(Wnd))
    {
        *Rect = Wnd->rcWindow;
    }
@@ -151,7 +151,7 @@
     Delta.x = Delta.y = 0;
     mirror_from = mirror_to = FALSE;
 
-    if (FromWnd && FromWnd != UserGetDesktopWindow()) // FromWnd->fnid != 
FNID_DESKTOP)
+    if (FromWnd && !UserIsDesktopWindow(FromWnd))
     {
        if (FromWnd->ExStyle & WS_EX_LAYOUTRTL)
        {
@@ -164,7 +164,7 @@
        Delta.y = FromWnd->rcClient.top;
     }
 
-    if (ToWnd && ToWnd != UserGetDesktopWindow()) // ToWnd->fnid != 
FNID_DESKTOP)
+    if (ToWnd && !UserIsDesktopWindow(ToWnd))
     {
        if (ToWnd->ExStyle & WS_EX_LAYOUTRTL)
        {
@@ -255,7 +255,7 @@
 }
 
 VOID
-SelectWindowRgn( PWND Window, HRGN hRgnClip)
+SelectWindowRgn(PWND Window, HRGN hRgnClip)
 {
     if (Window->hrgnClip)
     {
@@ -267,7 +267,7 @@
 
     if (hRgnClip > HRGN_WINDOW)
     {
-        /*if (Window != UserGetDesktopWindow()) // Window->fnid != 
FNID_DESKTOP)
+        /*if (!UserIsDesktopWindow(Window))
         {
             NtGdiOffsetRgn(hRgnClip, Window->rcWindow.left, 
Window->rcWindow.top);
         }*/
@@ -480,7 +480,7 @@
    POINT Size;
    RECTL Rect = *RestoreRect;
 
-   if (Wnd->spwndParent && Wnd->spwndParent != UserGetDesktopWindow())
+   if (Wnd->spwndParent && !UserIsDesktopWindow(Wnd->spwndParent))
    {
       RECTL_vOffsetRect(&Rect,
                         -Wnd->spwndParent->rcClient.left,
@@ -782,7 +782,7 @@
    int x, y, xspacing, yspacing;
 
    pwndParent = Window->spwndParent;
-   if (pwndParent == UserGetDesktopWindow())
+   if (UserIsDesktopWindow(pwndParent))
    {
       ERR("FIXME: Parent is Desktop, Min off screen!\n");
       /* FIXME: ReactOS doesn't support iconic minimize to desktop */
@@ -1972,7 +1972,7 @@
                            0,
                            RDW_VALIDATE | RDW_NOFRAME | RDW_NOERASE | 
RDW_NOINTERNALPAINT | RDW_ALLCHILDREN);
 
-      if (Window->spwndParent == UserGetDesktopWindow())
+      if (UserIsDesktopWindow(Window->spwndParent))
          co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (WPARAM)Window->head.h, 
0);
 
       Window->style &= ~WS_VISIBLE; //IntSetStyle( Window, 0, WS_VISIBLE );
@@ -1981,7 +1981,7 @@
    }
    else if (WinPos.flags & SWP_SHOWWINDOW)
    {
-       if (Window->spwndParent == UserGetDesktopWindow() &&
+       if (UserIsDesktopWindow(Window->spwndParent) &&
            Window->spwndOwner == NULL &&
            (!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
             (Window->ExStyle & WS_EX_APPWINDOW)))
@@ -2330,7 +2330,7 @@
 
     co_IntSendMessageNoWait(UserHMGetHandle(Wnd), WM_SIZE, wParam, lParam);
 
-    if (Wnd->spwndParent == UserGetDesktopWindow()) // Wnd->spwndParent->fnid 
== FNID_DESKTOP )
+    if (UserIsDesktopWindow(Wnd->spwndParent))
        lParam = MAKELONG(Wnd->rcClient.left, Wnd->rcClient.top);
     else
        lParam = MAKELONG(Wnd->rcClient.left-Wnd->spwndParent->rcClient.left, 
Wnd->rcClient.top-Wnd->spwndParent->rcClient.top);
@@ -2582,7 +2582,7 @@
    {
       if ( Wnd == pti->MessageQueue->spwndActive && pti->MessageQueue == 
IntGetFocusMessageQueue()  )
       {
-          if ( Wnd->spwndParent == UserGetDesktopWindow())
+          if (UserIsDesktopWindow(Wnd->spwndParent))
           {
               if (!ActivateOtherWindowMin(Wnd))
               {
@@ -2599,7 +2599,8 @@
       if (Wnd == pti->MessageQueue->spwndFocus)
       {
          Parent = Wnd->spwndParent;
-         if (Wnd->spwndParent == UserGetDesktopWindow()) Parent = 0;
+         if (UserIsDesktopWindow(Wnd->spwndParent))
+             Parent = 0;
          co_UserSetFocus(Parent);
       }
       // Hide, just return.
@@ -2753,7 +2754,7 @@
    Pt.x = x;
    Pt.y = y;
 
-   if (Parent != UserGetDesktopWindow())
+   if (!UserIsDesktopWindow(Parent))
    {
       Pt.x += Parent->rcClient.left;
       Pt.y += Parent->rcClient.top;
@@ -2795,7 +2796,7 @@
    Pt.x = x;
    Pt.y = y;
 
-   if (Parent != UserGetDesktopWindow())
+   if (!UserIsDesktopWindow(Parent))
    {
       if (Parent->ExStyle & WS_EX_LAYOUTRTL)
          Pt.x = Parent->rcClient.right - Pt.x;
@@ -3059,9 +3060,7 @@
    }
 
    pWnd = UserGetWindowObject(Wnd);
-   if ( !pWnd ||                           // FIXME:
-         pWnd == UserGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP
-         pWnd == UserGetMessageWindow() )  // pWnd->fnid == FNID_MESSAGEWND
+   if (!pWnd || UserIsDesktopWindow(pWnd) || UserIsMessageWindow(pWnd))
    {
       goto Exit;
    }
@@ -3072,9 +3071,7 @@
         WndInsertAfter != HWND_NOTOPMOST )
    {
       pWndIA = UserGetWindowObject(WndInsertAfter);
-      if ( !pWndIA ||
-            pWndIA == UserGetDesktopWindow() ||
-            pWndIA == UserGetMessageWindow() )
+      if (!pWndIA || UserIsDesktopWindow(pWndIA) || 
UserIsMessageWindow(pWndIA))
       {
          goto Exit;
       }
@@ -3221,9 +3218,7 @@
   UserEnterExclusive();
 
   pWnd = UserGetWindowObject(hWnd);
-  if ( !pWnd ||                           // FIXME:
-        pWnd == UserGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP
-        pWnd == UserGetMessageWindow() )  // pWnd->fnid == FNID_MESSAGEWND
+  if (!pWnd || UserIsDesktopWindow(pWnd) || UserIsMessageWindow(pWnd))
   {
      goto Exit;
   }
@@ -3302,9 +3297,8 @@
    TRACE("Enter NtUserSetWindowPos\n");
    UserEnterExclusive();
 
-   if (!(Window = UserGetWindowObject(hWnd)) || // FIXME:
-         Window == UserGetDesktopWindow() ||    // pWnd->fnid == FNID_DESKTOP
-         Window == UserGetMessageWindow() )     // pWnd->fnid == 
FNID_MESSAGEWND
+   if (!(Window = UserGetWindowObject(hWnd)) ||
+        UserIsDesktopWindow(Window) || UserIsMessageWindow(Window))
    {
       ERR("NtUserSetWindowPos bad window handle!\n");
       RETURN(FALSE);
@@ -3316,8 +3310,7 @@
         hWndInsertAfter != HWND_NOTOPMOST )
    {
       if (!(pWndIA = UserGetWindowObject(hWndInsertAfter)) ||
-            pWndIA == UserGetDesktopWindow() ||
-            pWndIA == UserGetMessageWindow() )
+            UserIsDesktopWindow(pWndIA) || UserIsMessageWindow(pWndIA))
       {
          ERR("NtUserSetWindowPos bad insert window handle!\n");
          RETURN(FALSE);
@@ -3370,9 +3363,8 @@
    TRACE("Enter NtUserSetWindowRgn\n");
    UserEnterExclusive();
 
-   if (!(Window = UserGetWindowObject(hWnd)) || // FIXME:
-         Window == UserGetDesktopWindow() ||    // pWnd->fnid == FNID_DESKTOP
-         Window == UserGetMessageWindow() )     // pWnd->fnid == 
FNID_MESSAGEWND
+   if (!(Window = UserGetWindowObject(hWnd)) ||
+        UserIsDesktopWindow(Window) || UserIsMessageWindow(Window))
    {
       RETURN( 0);
    }
@@ -3432,8 +3424,7 @@
    UserEnterExclusive();
 
    if (!(Wnd = UserGetWindowObject(hwnd)) || // FIXME:
-         Wnd == UserGetDesktopWindow() ||    // pWnd->fnid == FNID_DESKTOP
-         Wnd == UserGetMessageWindow() )     // pWnd->fnid == FNID_MESSAGEWND
+        UserIsDesktopWindow(Wnd) || UserIsMessageWindow(Wnd))
    {
       RETURN( FALSE);
    }
@@ -3501,9 +3492,8 @@
    TRACE("Enter NtUserSetWindowPlacement\n");
    UserEnterExclusive();
 
-   if (!(Wnd = UserGetWindowObject(hWnd)) || // FIXME:
-        Wnd == UserGetDesktopWindow() ||     // pWnd->fnid == FNID_DESKTOP
-        Wnd == UserGetMessageWindow() )      // pWnd->fnid == FNID_MESSAGEWND
+   if (!(Wnd = UserGetWindowObject(hWnd)) ||
+        UserIsDesktopWindow(Wnd) || UserIsMessageWindow(Wnd))
    {
       RETURN( FALSE);
    }
@@ -3552,9 +3542,8 @@
    TRACE("Enter NtUserShowWindowAsync\n");
    UserEnterExclusive();
 
-   if (!(Window = UserGetWindowObject(hWnd)) || // FIXME:
-         Window == UserGetDesktopWindow() ||    // pWnd->fnid == FNID_DESKTOP
-         Window == UserGetMessageWindow() )     // pWnd->fnid == 
FNID_MESSAGEWND
+   if (!(Window = UserGetWindowObject(hWnd)) ||
+        UserIsDesktopWindow(Window) || UserIsMessageWindow(Window))
    {
       RETURN(FALSE);
    }
@@ -3592,9 +3581,8 @@
    TRACE("Enter NtUserShowWindow hWnd %p SW_ %d\n",hWnd, nCmdShow);
    UserEnterExclusive();
 
-   if (!(Window = UserGetWindowObject(hWnd)) || // FIXME:
-         Window == UserGetDesktopWindow() ||    // pWnd->fnid == FNID_DESKTOP
-         Window == UserGetMessageWindow() )     // pWnd->fnid == 
FNID_MESSAGEWND
+   if (!(Window = UserGetWindowObject(hWnd)) ||
+        UserIsDesktopWindow(Window) || UserIsMessageWindow(Window))
    {
       RETURN(FALSE);
    }


Reply via email to