- Move GetWindowInfo support into user32. Use HWNDPARAM for SetWindowContextHelpId.
authorJames Tabor <james.tabor@reactos.org>
Wed, 12 Aug 2009 18:46:34 +0000 (18:46 +0000)
committerJames Tabor <james.tabor@reactos.org>
Wed, 12 Aug 2009 18:46:34 +0000 (18:46 +0000)
svn path=/trunk/; revision=42637

reactos/dll/win32/user32/include/user32.h
reactos/dll/win32/user32/include/user32p.h
reactos/dll/win32/user32/windows/window.c
reactos/include/reactos/win32k/ntuser.h
reactos/subsystems/win32/win32k/ntuser/simplecall.c
reactos/subsystems/win32/win32k/ntuser/window.c

index fb43302..d7ebe68 100644 (file)
@@ -119,3 +119,4 @@ PWND FASTCALL ValidateHwndNoErr(HWND hwnd);
 VOID FASTCALL GetConnected(VOID);
 BOOL FASTCALL DefSetText(HWND hWnd, PCWSTR String, BOOL Ansi);
 BOOL FASTCALL TestWindowProcess(PWND);
+VOID UserGetWindowBorders(DWORD, DWORD, SIZE *, BOOL);
index 5e3063c..8ed8fba 100644 (file)
@@ -41,7 +41,7 @@
   (BOOL)NtUserCallTwoParam((DWORD)hWnd, (DWORD)hRgn, TWOPARAM_ROUTINE_VALIDATERGN)
 
 #define NtUserSetWindowContextHelpId(hWnd, dwContextHelpId) \
-  (BOOL)NtUserCallTwoParam((DWORD)hwnd, dwContextHelpId, TWOPARAM_ROUTINE_SETWNDCONTEXTHLPID)
+  (BOOL)NtUserCallTwoParam((DWORD)hwnd, dwContextHelpId, HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID)
 
 #define NtUserSetCaretPos(X, Y) \
   (BOOL)NtUserCallTwoParam((DWORD)X, (DWORD)Y, TWOPARAM_ROUTINE_SETCARETPOS)
@@ -55,9 +55,6 @@
 #define NtUserSetMenuBarHeight(menu, height) \
   (BOOL)NtUserCallTwoParam((DWORD)menu, (DWORD)height, TWOPARAM_ROUTINE_SETMENUBARHEIGHT)
 
-#define NtUserGetWindowInfo(hwnd, pwi) \
-  (BOOL)NtUserCallTwoParam((DWORD)hwnd, (DWORD)pwi, TWOPARAM_ROUTINE_GETWINDOWINFO)
-
 #define NtUserRegisterLogonProcess(hproc, x) \
   (BOOL)NtUserCallTwoParam((DWORD)hproc, (DWORD)x, TWOPARAM_ROUTINE_REGISTERLOGONPROC)
 
index 4bd9a19..f76aa2c 100644 (file)
@@ -1043,10 +1043,63 @@ GetTopWindow(HWND hWnd)
  * @implemented
  */
 BOOL WINAPI
-GetWindowInfo(HWND hwnd,
+GetWindowInfo(HWND hWnd,
               PWINDOWINFO pwi)
 {
-    return NtUserGetWindowInfo(hwnd, pwi);
+    PWND pWnd;
+    PCLS pCls = NULL;
+    SIZE Size = {0,0};
+    BOOL Ret = FALSE;
+
+    if ( !pwi || pwi->cbSize != sizeof(WINDOWINFO))
+       SetLastError(ERROR_INVALID_PARAMETER); // Just set the error and go!
+
+    pWnd = ValidateHwnd(hWnd);
+    if (!pWnd)
+        return Ret;
+
+    UserGetWindowBorders(pWnd->style, pWnd->ExStyle, &Size, FALSE);
+
+    _SEH2_TRY
+    {
+       pCls = DesktopPtrToUser(pWnd->pcls);
+       pwi->rcWindow = pWnd->rcWindow;
+       pwi->rcClient = pWnd->rcClient;
+       pwi->dwStyle = pWnd->style;
+       pwi->dwExStyle = pWnd->ExStyle;
+       pwi->cxWindowBorders = Size.cx;
+       pwi->cyWindowBorders = Size.cy;
+       pwi->dwWindowStatus = 0;
+       if (pWnd->state & WNDS_ACTIVEFRAME)
+          pwi->dwWindowStatus = WS_ACTIVECAPTION;
+       pwi->atomWindowType = (pCls ? pCls->atomClassName : 0 );
+
+       if ( pWnd->state2 & WNDS2_WIN50COMPAT )
+       {
+          pwi->wCreatorVersion = 0x500;
+       }
+       else if ( pWnd->state2 & WNDS2_WIN40COMPAT )
+       {
+          pwi->wCreatorVersion = 0x400;
+       }
+       else if ( pWnd->state2 & WNDS2_WIN31COMPAT )
+       {
+          pwi->wCreatorVersion =  0x30A;
+       }
+       else
+       {
+          pwi->wCreatorVersion = 0x300;
+       }
+
+       Ret = TRUE;
+    }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+        /* Do nothing */
+    }
+    _SEH2_END;
+
+   return Ret;
 }
 
 
index a5639de..4a6f3ba 100644 (file)
@@ -3051,9 +3051,7 @@ typedef struct tagKMDDELPARAM
   #define MSQ_STATE_MENUOWNER  0x4
   #define MSQ_STATE_MOVESIZE   0x5
   #define MSQ_STATE_CARET      0x6
-#define TWOPARAM_ROUTINE_SETWNDCONTEXTHLPID 0xfffd0058 // use HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID
 #define TWOPARAM_ROUTINE_SETCARETPOS        0xfffd0060
-#define TWOPARAM_ROUTINE_GETWINDOWINFO      0xfffd0061
 #define TWOPARAM_ROUTINE_REGISTERLOGONPROC  0xfffd0062
 #define TWOPARAM_ROUTINE_ROS_ISACTIVEICON   0x1001
 #define TWOPARAM_ROUTINE_ROS_NCDESTROY      0x1002
index e01717f..2a4c5a9 100644 (file)
@@ -514,65 +514,10 @@ NtUserCallTwoParam(
          UNIMPLEMENTED
          RETURN( 0);
 
-      case TWOPARAM_ROUTINE_SETWNDCONTEXTHLPID:
-
-         if(!(Window = UserGetWindowObject((HWND)Param1)))
-         {
-            RETURN( (DWORD)FALSE);
-         }
-
-         if ( Param2 )
-            IntSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param2);
-         else
-            IntRemoveProp(Window, gpsi->atomContextHelpIdProp);
-
-         RETURN( (DWORD)TRUE);
 
       case TWOPARAM_ROUTINE_SETCARETPOS:
          RETURN( (DWORD)co_IntSetCaretPos((int)Param1, (int)Param2));
 
-      case TWOPARAM_ROUTINE_GETWINDOWINFO:
-         {
-            WINDOWINFO wi;
-            DWORD Ret;
-
-            if(!(Window = UserGetWindowObject((HWND)Param1)))
-            {
-               RETURN( FALSE);
-            }
-
-#if 0
-            /*
-             * According to WINE, Windows' doesn't check the cbSize field
-             */
-
-            Status = MmCopyFromCaller(&wi.cbSize, (PVOID)Param2, sizeof(wi.cbSize));
-            if(!NT_SUCCESS(Status))
-            {
-               SetLastNtError(Status);
-               RETURN( FALSE);
-            }
-
-            if(wi.cbSize != sizeof(WINDOWINFO))
-            {
-               SetLastWin32Error(ERROR_INVALID_PARAMETER);
-               RETURN( FALSE);
-            }
-#endif
-
-            if((Ret = (DWORD)IntGetWindowInfo(Window, &wi)))
-            {
-               Status = MmCopyToCaller((PVOID)Param2, &wi, sizeof(WINDOWINFO));
-               if(!NT_SUCCESS(Status))
-               {
-                  SetLastNtError(Status);
-                  RETURN( FALSE);
-               }
-            }
-
-            RETURN( Ret);
-         }
-
       case TWOPARAM_ROUTINE_REGISTERLOGONPROC:
          RETURN( (DWORD)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
 
@@ -803,6 +748,26 @@ NtUserCallHwndParam(
       case HWNDPARAM_ROUTINE_KILLSYSTEMTIMER:
           return IntKillTimer(hWnd, (UINT_PTR)Param, TRUE);
 
+      case HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID:
+      {
+         PWINDOW_OBJECT Window;
+
+         UserEnterExclusive();
+         if(!(Window = UserGetWindowObject(hWnd)))
+         {
+            UserLeave();
+            return FALSE;
+         }
+
+         if ( Param )
+            IntSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param);
+         else
+            IntRemoveProp(Window, gpsi->atomContextHelpIdProp);
+
+         UserLeave();
+         return TRUE;
+      }
+
       case HWNDPARAM_ROUTINE_SETDIALOGPOINTER:
       {
          PWINDOW_OBJECT Window;
index eab6b94..04f8c08 100644 (file)
@@ -1678,6 +1678,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
        Wnd->head.pti = ti;
        Wnd->head.rpdesk = pti->Desktop;
        Wnd->hWndLastActive = hWnd;
+       Wnd->state2 |= WNDS2_WIN40COMPAT;
    }
 
    DPRINT("Created object with handle %X\n", hWnd);