- Patch by Smiley <johnyadams@hotmail.com>: remove redundant system calls when window...
authorJames Tabor <james.tabor@reactos.org>
Tue, 15 Sep 2009 22:13:16 +0000 (22:13 +0000)
committerJames Tabor <james.tabor@reactos.org>
Tue, 15 Sep 2009 22:13:16 +0000 (22:13 +0000)
svn path=/trunk/; revision=43056

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

index 010e97e..3c7fd0c 100644 (file)
@@ -49,9 +49,6 @@
 #define NtUserSetGUIThreadHandle(field, hwnd) \
   (BOOL)NtUserCallTwoParam((DWORD)field, (DWORD)hwnd, TWOPARAM_ROUTINE_SETGUITHRDHANDLE)
 
-#define NtUserSetMenuItemRect(menu, mir) \
-  (BOOL)NtUserCallTwoParam((DWORD)menu, (DWORD)mir, TWOPARAM_ROUTINE_SETMENUITEMRECT)
-
 #define NtUserSetMenuBarHeight(menu, height) \
   (BOOL)NtUserCallTwoParam((DWORD)menu, (DWORD)height, TWOPARAM_ROUTINE_SETMENUBARHEIGHT)
 
 #define NtUserSwapMouseButton(fSwap) \
   (BOOL)NtUserCallOneParam((DWORD)fSwap, ONEPARAM_ROUTINE_SWAPMOUSEBUTTON)
 
-#define NtUserGetMenu(hWnd) \
-  (HMENU)NtUserCallOneParam((DWORD)hWnd, ONEPARAM_ROUTINE_GETMENU)
-
 #define NtUserSetMessageExtraInfo(lParam) \
   (LPARAM)NtUserCallOneParam((DWORD)lParam, ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO)
 
-#define NtUserIsWindowUnicode(hWnd) \
-  (BOOL)NtUserCallOneParam((DWORD)hWnd, ONEPARAM_ROUTINE_ISWINDOWUNICODE)
-
 #define NtUserGetWindowContextHelpId(hwnd) \
   NtUserCallOneParam((DWORD)hwnd, ONEPARAM_ROUTINE_GETWNDCONTEXTHLPID)
 
-#define NtUserGetWindowInstance(hwnd) \
-  (HINSTANCE)NtUserCallOneParam((DWORD)hwnd, ONEPARAM_ROUTINE_GETWINDOWINSTANCE)
-
 #define NtUserGetCursorPos(lpPoint) \
   (BOOL)NtUserCallOneParam((DWORD)lpPoint, ONEPARAM_ROUTINE_GETCURSORPOSITION)
 
index 98e6fa6..82e3ee5 100644 (file)
@@ -4234,7 +4234,12 @@ EndMenu(VOID)
 HMENU WINAPI
 GetMenu(HWND hWnd)
 {
-  return NtUserGetMenu(hWnd);
+       PWND Wnd = ValidateHwnd(hWnd);
+
+       if (!Wnd)
+               return NULL;
+
+       return (HMENU)Wnd->IDMenu;
 }
 
 
index 47a28b0..42b23c1 100644 (file)
@@ -1129,14 +1129,12 @@ GetWindowModuleFileNameA(HWND hwnd,
                          LPSTR lpszFileName,
                          UINT cchFileNameMax)
 {
-    HINSTANCE hWndInst;
+    PWND Wnd = ValidateHwnd(hwnd);
 
-    if(!(hWndInst = NtUserGetWindowInstance(hwnd)))
-    {
+    if (!Wnd)
         return 0;
-    }
 
-    return GetModuleFileNameA(hWndInst, lpszFileName, cchFileNameMax);
+    return GetModuleFileNameA(Wnd->hModule, lpszFileName, cchFileNameMax);
 }
 
 
@@ -1148,14 +1146,12 @@ GetWindowModuleFileNameW(HWND hwnd,
                          LPWSTR lpszFileName,
                          UINT cchFileNameMax)
 {
-    HINSTANCE hWndInst;
+       PWND Wnd = ValidateHwnd(hwnd);
 
-    if(!(hWndInst = NtUserGetWindowInstance(hwnd)))
-    {
+    if (!Wnd)
         return 0;
-    }
 
-    return GetModuleFileNameW(hWndInst, lpszFileName, cchFileNameMax);
+    return GetModuleFileNameW( Wnd->hModule, lpszFileName, cchFileNameMax );
 }
 
 
index bc11c9b..1f4081d 100644 (file)
@@ -3024,21 +3024,16 @@ typedef struct tagKMDDELPARAM
 #define NOPARAM_ROUTINE_ANYPOPUP              0xffff0006
 #define NOPARAM_ROUTINE_CSRSS_INITIALIZED     0xffff0007
 #define ONEPARAM_ROUTINE_CSRSS_GUICHECK       0xffff0008
-#define ONEPARAM_ROUTINE_GETMENU              0xfffe0001 // usermode
-#define ONEPARAM_ROUTINE_ISWINDOWUNICODE      0xfffe0002
-#define ONEPARAM_ROUTINE_GETCARETINFO         0xfffe0007
 #define ONEPARAM_ROUTINE_SWITCHCARETSHOWING   0xfffe0008
 #define ONEPARAM_ROUTINE_ISWINDOWINDESTROY    0xfffe000c
 #define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0xfffe000d
 #define ONEPARAM_ROUTINE_GETDESKTOPMAPPING    0xfffe000e
-#define ONEPARAM_ROUTINE_GETWINDOWINSTANCE    0xfffe0010
 #define ONEPARAM_ROUTINE_CREATECURICONHANDLE  0xfffe0025 // CREATE_EMPTY_CURSOR_OBJECT ?
 #define ONEPARAM_ROUTINE_MSQSETWAKEMASK       0xfffe0027
 #define ONEPARAM_ROUTINE_GETCURSORPOSITION    0xfffe0048 // use ONEPARAM_ or TWOPARAM routine ?
 #define TWOPARAM_ROUTINE_GETWINDOWRGNBOX    0xfffd0048 // user mode
 #define TWOPARAM_ROUTINE_GETWINDOWRGN       0xfffd0049 // user mode
 #define TWOPARAM_ROUTINE_SETMENUBARHEIGHT   0xfffd0050
-#define TWOPARAM_ROUTINE_SETMENUITEMRECT    0xfffd0051
 #define TWOPARAM_ROUTINE_SETGUITHRDHANDLE   0xfffd0052
   #define MSQ_STATE_CAPTURE    0x1
   #define MSQ_STATE_ACTIVE     0x2
@@ -3048,8 +3043,6 @@ typedef struct tagKMDDELPARAM
   #define MSQ_STATE_CARET      0x6
 #define TWOPARAM_ROUTINE_SETCARETPOS        0xfffd0060
 #define TWOPARAM_ROUTINE_REGISTERLOGONPROC  0xfffd0062
-#define TWOPARAM_ROUTINE_ROS_ISACTIVEICON   0x1001
-#define TWOPARAM_ROUTINE_ROS_NCDESTROY      0x1002
 #define TWOPARAM_ROUTINE_ROS_UPDATEUISTATE  0x1004
 
 DWORD
index e14966d..53ee983 100644 (file)
@@ -178,35 +178,6 @@ NtUserCallOneParam(
              }
          }
 
-      case ONEPARAM_ROUTINE_GETMENU:
-         {
-            PWINDOW_OBJECT Window;
-            DWORD Result;
-
-            if(!(Window = UserGetWindowObject((HWND)Param)))
-            {
-               RETURN( FALSE);
-            }
-
-            Result = (DWORD)Window->Wnd->IDMenu;
-
-            RETURN( Result);
-         }
-
-      case ONEPARAM_ROUTINE_ISWINDOWUNICODE:
-         {
-            PWINDOW_OBJECT Window;
-            DWORD Result;
-
-            Window = UserGetWindowObject((HWND)Param);
-            if(!Window)
-            {
-               RETURN( FALSE);
-            }
-            Result = Window->Wnd->Unicode;
-            RETURN( Result);
-         }
-
       case ONEPARAM_ROUTINE_WINDOWFROMDC:
          RETURN( (DWORD)IntWindowFromDC((HDC)Param));
 
@@ -226,20 +197,6 @@ NtUserCallOneParam(
       case ONEPARAM_ROUTINE_SETCARETBLINKTIME:
          RETURN( (DWORD)IntSetCaretBlinkTime((UINT)Param));
 
-      case ONEPARAM_ROUTINE_GETWINDOWINSTANCE:
-         {
-            PWINDOW_OBJECT Window;
-            DWORD Result;
-
-            if(!(Window = UserGetWindowObject((HWND)Param)))
-            {
-               RETURN( FALSE);
-            }
-
-            Result = (DWORD)Window->Wnd->hModule;
-            RETURN( Result);
-         }
-
       case ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO:
          RETURN( (DWORD)MsqSetMessageExtraInfo((LPARAM)Param));
 
@@ -457,25 +414,6 @@ NtUserCallTwoParam(
             IntReleaseMenuObject(MenuObject);
             RETURN( Ret);
          }
-      case TWOPARAM_ROUTINE_SETMENUITEMRECT:
-         {
-            BOOL Ret;
-            SETMENUITEMRECT smir;
-            PMENU_OBJECT MenuObject = IntGetMenuObject((HMENU)Param1);
-            if(!MenuObject)
-               RETURN( 0);
-
-            if(!NT_SUCCESS(MmCopyFromCaller(&smir, (PVOID)Param2, sizeof(SETMENUITEMRECT))))
-            {
-               IntReleaseMenuObject(MenuObject);
-               RETURN( 0);
-            }
-
-            Ret = IntSetMenuItemRect(MenuObject, smir.uItem, smir.fByPosition, &smir.rcRect);
-
-            IntReleaseMenuObject(MenuObject);
-            RETURN( (DWORD)Ret);
-         }
 
       case TWOPARAM_ROUTINE_SETGUITHRDHANDLE:
          {