make co_WinPosShowWindow take pWnd, not hWnd
authorGunnar Dalsnes <hardon@online.no>
Wed, 7 Sep 2005 07:53:31 +0000 (07:53 +0000)
committerGunnar Dalsnes <hardon@online.no>
Wed, 7 Sep 2005 07:53:31 +0000 (07:53 +0000)
add co_ to some funcs

svn path=/trunk/; revision=17713

reactos/subsys/win32k/include/userfuncs.h
reactos/subsys/win32k/include/winpos.h
reactos/subsys/win32k/ntuser/scrollbar.c
reactos/subsys/win32k/ntuser/window.c
reactos/subsys/win32k/ntuser/winpos.c

index 378bed3..e69a7eb 100644 (file)
@@ -93,8 +93,6 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread);
 \r
 HWND FASTCALL UserGetShellWindow();\r
 \r
-HWND FASTCALL UserSetParent(HWND hWndChild, HWND hWndNewParent);\r
-\r
 HWND FASTCALL UserGetWindow(HWND hWnd, UINT Relationship);\r
 \r
 HDC FASTCALL\r
index 9be9f70..fe6861d 100644 (file)
@@ -29,7 +29,7 @@ BOOLEAN FASTCALL
 co_WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
                   INT cy, UINT flags);
 BOOLEAN FASTCALL
-co_WinPosShowWindow(HWND Wnd, INT Cmd);
+co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd);
 USHORT FASTCALL
 co_WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, PUSER_MESSAGE_QUEUE OnlyHitTests, POINT *WinPoint,
                      PWINDOW_OBJECT* Window);
index 50d4332..2f412a4 100644 (file)
@@ -853,7 +853,7 @@ co_UserShowScrollBar(PWINDOW_OBJECT Window, int wBar, DWORD bShow)
    {
       IntUpdateSBInfo(Window, SB_CTL);
 
-      co_WinPosShowWindow(Window->hSelf, bShow ? SW_SHOW : SW_HIDE);
+      co_WinPosShowWindow(Window, bShow ? SW_SHOW : SW_HIDE);
       return( TRUE);
    }
 
index ff3e175..b3c49bc 100644 (file)
@@ -913,7 +913,7 @@ IntSetOwner(HWND hWnd, HWND hWndNewOwner)
 }
 
 PWINDOW_OBJECT FASTCALL
-IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
+co_IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
 {
    PWINDOW_OBJECT WndOldParent, Sibling, InsertAfter;
    HWND hWnd, hWndNewParent, hWndOldParent;
@@ -930,7 +930,7 @@ IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
     * Windows hides the window first, then shows it again
     * including the WM_SHOWWINDOW messages and all
     */
-   WasVisible = co_WinPosShowWindow(hWnd, SW_HIDE);
+   WasVisible = co_WinPosShowWindow(Wnd, SW_HIDE);
 
    /* Validate that window and parent still exist */
    if (!IntIsWindow(hWnd) || !IntIsWindow(hWndNewParent))
@@ -1984,14 +1984,16 @@ co_IntCreateWindowEx(DWORD dwExStyle,
   {
      co_UserShowScrollBar(Window, SB_HORZ, TRUE);
   }
-  UserDereferenceWindowObjectCo(Window);
 
   if (dwStyle & WS_VISIBLE)
     {
       DPRINT("IntCreateWindow(): About to show window\n");
-      co_WinPosShowWindow(Window->hSelf, dwShowMode);
+      co_WinPosShowWindow(Window, dwShowMode);
     }
 
+   //faxme: temp hack
+  UserDereferenceWindowObjectCo(Window);
+
   DPRINT("IntCreateWindow(): = %X\n", Handle);
   DPRINT("WindowObject->SystemMenu = 0x%x\n", Window->SystemMenu);
   return((HWND)Handle);
@@ -2098,6 +2100,8 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
 {
   BOOLEAN isChild;
 
+  ASSERT_REFS(Window); 
+
   if (Window == NULL)
     {
       return FALSE;
@@ -2113,7 +2117,7 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
   /* Look whether the focus is within the tree of windows we will
    * be destroying.
    */
-  if (!co_WinPosShowWindow(Window->hSelf, SW_HIDE))
+  if (!co_WinPosShowWindow(Window, SW_HIDE))
     {
       if (UserGetActiveWindow() == Window->hSelf)
         {
@@ -2862,7 +2866,7 @@ CLEANUP:
 
 
 HWND FASTCALL
-UserSetParent(HWND hWndChild, HWND hWndNewParent)
+co_UserSetParent(HWND hWndChild, HWND hWndNewParent)
 {
    PWINDOW_OBJECT Wnd = NULL, WndParent = NULL, WndOldParent;
    HWND hWndOldParent = NULL;
@@ -2903,7 +2907,7 @@ UserSetParent(HWND hWndChild, HWND hWndNewParent)
       return( NULL);
    }
 
-   WndOldParent = IntSetParent(Wnd, WndParent);
+   WndOldParent = co_IntSetParent(Wnd, WndParent);
 
    if (WndOldParent)
    {
@@ -2944,7 +2948,7 @@ NtUserSetParent(HWND hWndChild, HWND hWndNewParent)
    DPRINT("Enter NtUserSetParent\n");
    UserEnterExclusive();
 
-   RETURN( UserSetParent(hWndChild, hWndNewParent));
+   RETURN( co_UserSetParent(hWndChild, hWndNewParent));
    
 CLEANUP:
    DPRINT("Leave NtUserSetParent, ret=%i\n",_ret_);
@@ -3408,7 +3412,7 @@ CLEANUP:
 
 
 LONG FASTCALL
-UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
+co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
 {
    PWINDOW_OBJECT Window, Parent;
    PWINSTATION_OBJECT WindowStation;
@@ -3499,7 +3503,7 @@ UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
             if (Parent && (Parent->hSelf == IntGetDesktopWindow()))
                OldValue = (LONG) IntSetOwner(Window->hSelf, (HWND) NewValue);
             else
-               OldValue = (LONG) UserSetParent(Window->hSelf, (HWND) NewValue);
+               OldValue = (LONG) co_UserSetParent(Window->hSelf, (HWND) NewValue);
             if(Parent)
               IntReleaseWindowObject(Parent);
             break;
@@ -3548,7 +3552,7 @@ NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
    DPRINT("Enter NtUserSetWindowLong\n");
    UserEnterExclusive();
 
-   RETURN( UserSetWindowLong(hWnd, Index, NewValue, Ansi));
+   RETURN( co_UserSetWindowLong(hWnd, Index, NewValue, Ansi));
    
 CLEANUP:
    DPRINT("Leave NtUserSetWindowLong, ret=%i\n",_ret_);
@@ -3580,7 +3584,7 @@ NtUserSetWindowWord(HWND hWnd, INT Index, WORD NewValue)
       case GWL_ID:
       case GWL_HINSTANCE:
       case GWL_HWNDPARENT:
-         RETURN( UserSetWindowLong(hWnd, Index, (UINT)NewValue, TRUE));
+         RETURN( co_UserSetWindowLong(hWnd, Index, (UINT)NewValue, TRUE));
       default:
          if (Index < 0)
          {
@@ -4064,7 +4068,7 @@ NtUserSetWindowPlacement(HWND hWnd,
   }
 
   /* FIXME - change window status */
-  co_WinPosShowWindow(Window->hSelf, Safepl.showCmd);
+  co_WinPosShowWindow(Window, Safepl.showCmd);
 
   if (Window->InternalPos == NULL)
      Window->InternalPos = ExAllocatePoolWithTag(PagedPool, sizeof(INTERNALPOS), TAG_WININTLIST);
@@ -4245,15 +4249,25 @@ CLEANUP:
  * @implemented
  */
 BOOL STDCALL
-NtUserShowWindow(HWND hWnd,
-                LONG nCmdShow)
+NtUserShowWindow(HWND hWnd, LONG nCmdShow)
 {
+  PWINDOW_OBJECT Window;
+  BOOL ret;
   DECLARE_RETURN(BOOL);
 
   DPRINT("Enter NtUserShowWindow\n");
   UserEnterExclusive();
-   
-  RETURN( co_WinPosShowWindow(hWnd, nCmdShow));
+  
+  if (!(Window = UserGetWindowObject(hWnd)))
+  {
+     RETURN(FALSE);
+  }
+  
+  UserReferenceWindowObjectCo(Window);
+  ret = co_WinPosShowWindow(Window, nCmdShow);
+  UserReferenceWindowObjectCo(Window);
+  
+  RETURN(ret);
    
 CLEANUP:
   DPRINT("Leave NtUserShowWindow, ret=%i\n",_ret_);
index 2cb2fac..0a9635c 100644 (file)
@@ -1236,25 +1236,15 @@ co_WinPosGetNonClientSize(HWND Wnd, RECT* WindowRect, RECT* ClientRect)
 }
 
 BOOLEAN FASTCALL
-co_WinPosShowWindow(HWND Wnd, INT Cmd)
+co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
 {
   BOOLEAN WasVisible;
-  PWINDOW_OBJECT Window;
-  NTSTATUS Status;
   UINT Swp = 0;
   RECT NewPos;
   BOOLEAN ShowFlag;
 //  HRGN VisibleRgn;
 
-  Status =
-    ObmReferenceObjectByHandle(gHandleTable,
-                              Wnd,
-                              otWindow,
-                              (PVOID*)&Window);
-  if (!NT_SUCCESS(Status))
-    {
-      return(FALSE);
-    }
+  ASSERT_REFS(Window); 
 
   WasVisible = (Window->Style & WS_VISIBLE) != 0;
 
@@ -1264,7 +1254,6 @@ co_WinPosShowWindow(HWND Wnd, INT Cmd)
       {
        if (!WasVisible)
          {
-           ObmDereferenceObject(Window);
            return(FALSE);
          }
        Swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE;
@@ -1336,14 +1325,14 @@ co_WinPosShowWindow(HWND Wnd, INT Cmd)
   ShowFlag = (Cmd != SW_HIDE);
   if (ShowFlag != WasVisible)
     {
-      co_IntSendMessage(Wnd, WM_SHOWWINDOW, ShowFlag, 0);
+      co_IntSendMessage(Window->hSelf, WM_SHOWWINDOW, ShowFlag, 0);
       /*
        * FIXME: Need to check the window wasn't destroyed during the
        * window procedure.
        */
       if (!(Window->Parent))
         {
-          co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Wnd);
+          co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Window->hSelf);
         }
     }
 
@@ -1371,15 +1360,15 @@ co_WinPosShowWindow(HWND Wnd, INT Cmd)
         }
 
       /* Revert focus to parent */
-      if (Wnd == IntGetThreadFocusWindow() ||
-          IntIsChildWindow(Wnd, IntGetThreadFocusWindow()))
+      if (Window->hSelf == IntGetThreadFocusWindow() ||
+          IntIsChildWindow(Window->hSelf, IntGetThreadFocusWindow()))
         {
           UserSetFocus(Window->Parent->hSelf);
         }
 
       if (!(Window->Parent))
         {
-          co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Wnd);
+          co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Window->hSelf);
         }
     }
 
@@ -1400,12 +1389,12 @@ co_WinPosShowWindow(HWND Wnd, INT Cmd)
          wParam = SIZE_MINIMIZED;
        }
 
-      co_IntSendMessage(Wnd, WM_SIZE, wParam,
+      co_IntSendMessage(Window->hSelf, WM_SIZE, wParam,
                      MAKELONG(Window->ClientRect.right -
                               Window->ClientRect.left,
                               Window->ClientRect.bottom -
                               Window->ClientRect.top));
-      co_IntSendMessage(Wnd, WM_MOVE, 0,
+      co_IntSendMessage(Window->hSelf, WM_MOVE, 0,
                      MAKELONG(Window->ClientRect.left,
                               Window->ClientRect.top));
       IntEngWindowChanged(Window, WOC_RGN_CLIENT);
@@ -1418,8 +1407,6 @@ co_WinPosShowWindow(HWND Wnd, INT Cmd)
       WinPosChangeActiveWindow(Wnd, FALSE);
     }
 */
-
-  ObmDereferenceObject(Window);
   return(WasVisible);
 }
 
@@ -1431,6 +1418,8 @@ co_WinPosSearchChildren(
    PWINDOW_OBJECT Current;
    HWND *List, *phWnd;
 
+   ASSERT_REFS(ScopeWin);
+
    if ((List = IntWinListChildren(ScopeWin)))
    {
       for (phWnd = List; *phWnd; ++phWnd)