scrollbar:
[reactos.git] / reactos / subsys / win32k / ntuser / window.c
index 87c43b7..ff3e175 100644 (file)
@@ -78,7 +78,7 @@ CleanupWindowImpl(VOID)
 
 
 /* temp hack */
-PWINDOW_OBJECT FASTCALL UserGetWindowObjectNoRef(HWND hWnd)
+PWINDOW_OBJECT FASTCALL UserGetWindowObject(HWND hWnd)
 {
    
    PWINDOW_OBJECT w = IntGetWindowObject(hWnd);
@@ -728,7 +728,7 @@ IntGetSystemMenu(PWINDOW_OBJECT Window, BOOL bRevert, BOOL RetMenu)
       {
         NewMenu->MenuInfo.Flags |= MF_SYSMENU | MF_POPUP;
         IntReleaseMenuObject(NewMenu);
-        UserSetMenuDefaultItem(NewMenu->MenuInfo.Self, SC_CLOSE, FALSE);
+        UserSetMenuDefaultItem(NewMenu, SC_CLOSE, FALSE);
 
         ItemInfo.cbSize = sizeof(MENUITEMINFOW);
         ItemInfo.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_STATE | MIIM_SUBMENU;
@@ -766,7 +766,7 @@ IntIsChildWindow(HWND Parent, HWND Child)
 {
   PWINDOW_OBJECT BaseWindow, Window;
 
-  if(!(BaseWindow = UserGetWindowObjectNoRef(Child)))
+  if(!(BaseWindow = UserGetWindowObject(Child)))
   {
     return FALSE;
   }
@@ -1973,15 +1973,18 @@ co_IntCreateWindowEx(DWORD dwExStyle,
       IntReleaseWindowObject(ParentWindow);
     }
 
+  //faxme:temp hack 
+  UserReferenceWindowObjectCo(Window); 
   /* Initialize and show the window's scrollbars */
   if (Window->Style & WS_VSCROLL)
   {
-     co_UserShowScrollBar(Window->hSelf, SB_VERT, TRUE);
+     co_UserShowScrollBar(Window, SB_VERT, TRUE);
   }
   if (Window->Style & WS_HSCROLL)
   {
-     co_UserShowScrollBar(Window->hSelf, SB_HORZ, TRUE);
+     co_UserShowScrollBar(Window, SB_HORZ, TRUE);
   }
+  UserDereferenceWindowObjectCo(Window);
 
   if (dwStyle & WS_VISIBLE)
     {
@@ -3109,7 +3112,6 @@ CLEANUP:
 HMENU STDCALL
 NtUserGetSystemMenu(HWND hWnd, BOOL bRevert)
 {
-   HMENU Result = 0;
    PWINDOW_OBJECT Window;
    PMENU_OBJECT Menu;
    DECLARE_RETURN(HMENU);
@@ -3117,20 +3119,17 @@ NtUserGetSystemMenu(HWND hWnd, BOOL bRevert)
    DPRINT("Enter NtUserGetSystemMenu\n");
    UserEnterShared();
 
-   if (!(Window = IntGetWindowObject(hWnd)))
+   if (!(Window = UserGetWindowObject(hWnd)))
    {
-      SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
-      RETURN( 0);
+      RETURN(NULL);
    }
 
    if (!(Menu = IntGetSystemMenu(Window, bRevert, FALSE)))
    {
-      Result = Menu->MenuInfo.Self;
-      IntReleaseMenuObject(Menu);
+      RETURN(NULL);
    }
 
-   IntReleaseWindowObject(Window);
-   RETURN( Result);
+   RETURN(Menu->MenuInfo.Self);
    
 CLEANUP:
    DPRINT("Leave NtUserGetSystemMenu, ret=%i\n",_ret_);
@@ -3199,7 +3198,7 @@ UserGetWindow(HWND hWnd, UINT Relationship)
    PWINDOW_OBJECT Parent, Window;
    HWND hWndResult = NULL;
 
-   if (!(Window = UserGetWindowObjectNoRef(hWnd))) return NULL;
+   if (!(Window = UserGetWindowObject(hWnd))) return NULL;
 
    switch (Relationship)
    {