make co_WinPosShowWindow take pWnd, not hWnd
add co_ to some funcs
Modified: trunk/reactos/subsys/win32k/include/userfuncs.h
Modified: trunk/reactos/subsys/win32k/include/winpos.h
Modified: trunk/reactos/subsys/win32k/ntuser/scrollbar.c
Modified: trunk/reactos/subsys/win32k/ntuser/window.c
Modified: trunk/reactos/subsys/win32k/ntuser/winpos.c

Modified: trunk/reactos/subsys/win32k/include/userfuncs.h
--- trunk/reactos/subsys/win32k/include/userfuncs.h	2005-09-07 00:02:39 UTC (rev 17712)
+++ trunk/reactos/subsys/win32k/include/userfuncs.h	2005-09-07 07:53:31 UTC (rev 17713)
@@ -93,8 +93,6 @@
 
 HWND FASTCALL UserGetShellWindow();
 
-HWND FASTCALL UserSetParent(HWND hWndChild, HWND hWndNewParent);
-
 HWND FASTCALL UserGetWindow(HWND hWnd, UINT Relationship);
 
 HDC FASTCALL

Modified: trunk/reactos/subsys/win32k/include/winpos.h
--- trunk/reactos/subsys/win32k/include/winpos.h	2005-09-07 00:02:39 UTC (rev 17712)
+++ trunk/reactos/subsys/win32k/include/winpos.h	2005-09-07 07:53:31 UTC (rev 17713)
@@ -29,7 +29,7 @@
 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);

Modified: trunk/reactos/subsys/win32k/ntuser/scrollbar.c
--- trunk/reactos/subsys/win32k/ntuser/scrollbar.c	2005-09-07 00:02:39 UTC (rev 17712)
+++ trunk/reactos/subsys/win32k/ntuser/scrollbar.c	2005-09-07 07:53:31 UTC (rev 17713)
@@ -853,7 +853,7 @@
    {
       IntUpdateSBInfo(Window, SB_CTL);
 
-      co_WinPosShowWindow(Window->hSelf, bShow ? SW_SHOW : SW_HIDE);
+      co_WinPosShowWindow(Window, bShow ? SW_SHOW : SW_HIDE);
       return( TRUE);
    }
 

Modified: trunk/reactos/subsys/win32k/ntuser/window.c
--- trunk/reactos/subsys/win32k/ntuser/window.c	2005-09-07 00:02:39 UTC (rev 17712)
+++ trunk/reactos/subsys/win32k/ntuser/window.c	2005-09-07 07:53:31 UTC (rev 17713)
@@ -913,7 +913,7 @@
 }
 
 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 @@
     * 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_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 isChild;
 
+  ASSERT_REFS(Window); 
+
   if (Window == NULL)
     {
       return FALSE;
@@ -2113,7 +2117,7 @@
   /* 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 @@
 
 
 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 @@
       return( NULL);
    }
 
-   WndOldParent = IntSetParent(Wnd, WndParent);
+   WndOldParent = co_IntSetParent(Wnd, WndParent);
 
    if (WndOldParent)
    {
@@ -2944,7 +2948,7 @@
    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 @@
 
 
 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 @@
             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 @@
    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 @@
       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 @@
   }
 
   /* 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,16 +4249,26 @@
  * @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();
+  
+  if (!(Window = UserGetWindowObject(hWnd)))
+  {
+     RETURN(FALSE);
+  }
+  
+  UserReferenceWindowObjectCo(Window);
+  ret = co_WinPosShowWindow(Window, nCmdShow);
+  UserReferenceWindowObjectCo(Window);
+  
+  RETURN(ret);
    
-  RETURN( co_WinPosShowWindow(hWnd, nCmdShow));
-   
 CLEANUP:
   DPRINT("Leave NtUserShowWindow, ret=%i\n",_ret_);
   UserLeave();

Modified: trunk/reactos/subsys/win32k/ntuser/winpos.c
--- trunk/reactos/subsys/win32k/ntuser/winpos.c	2005-09-07 00:02:39 UTC (rev 17712)
+++ trunk/reactos/subsys/win32k/ntuser/winpos.c	2005-09-07 07:53:31 UTC (rev 17713)
@@ -1236,25 +1236,15 @@
 }
 
 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 @@
       {
 	if (!WasVisible)
 	  {
-	    ObmDereferenceObject(Window);
 	    return(FALSE);
 	  }
 	Swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE;
@@ -1336,14 +1325,14 @@
   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 @@
         }
 
       /* 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 @@
 	  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 @@
       WinPosChangeActiveWindow(Wnd, FALSE);
     }
 */
-
-  ObmDereferenceObject(Window);
   return(WasVisible);
 }
 
@@ -1431,6 +1418,8 @@
    PWINDOW_OBJECT Current;
    HWND *List, *phWnd;
 
+   ASSERT_REFS(ScopeWin);
+
    if ((List = IntWinListChildren(ScopeWin)))
    {
       for (phWnd = List; *phWnd; ++phWnd)