Alexandre Julliard : user32: Avoid accessing the window structure directly in DispatchMessage16.

Alexandre Julliard julliard at winehq.org
Wed Dec 23 10:04:10 CST 2009


Module: wine
Branch: master
Commit: 4e343b6f3a345912a2263fe18f5f520ae033007a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4e343b6f3a345912a2263fe18f5f520ae033007a

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec 22 15:24:53 2009 +0100

user32: Avoid accessing the window structure directly in DispatchMessage16.

---

 dlls/user32/msg16.c |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/dlls/user32/msg16.c b/dlls/user32/msg16.c
index b8421d4..710dfa0 100644
--- a/dlls/user32/msg16.c
+++ b/dlls/user32/msg16.c
@@ -1797,7 +1797,6 @@ BOOL16 WINAPI TranslateMessage16( const MSG16 *msg )
  */
 LONG WINAPI DispatchMessage16( const MSG16* msg )
 {
-    WND * wndPtr;
     WNDPROC16 winproc;
     LONG retval;
     HWND hwnd = WIN_Handle32( msg->hwnd );
@@ -1810,20 +1809,11 @@ LONG WINAPI DispatchMessage16( const MSG16* msg )
                                      msg->message, msg->wParam, GetTickCount() );
     }
 
-    if (!(wndPtr = WIN_GetPtr( hwnd )))
+    if (!(winproc = (WNDPROC16)GetWindowLong16( msg->hwnd, GWLP_WNDPROC )))
     {
-        if (msg->hwnd) SetLastError( ERROR_INVALID_WINDOW_HANDLE );
+        SetLastError( ERROR_INVALID_WINDOW_HANDLE );
         return 0;
     }
-    if (wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP)
-    {
-        if (IsWindow( hwnd )) SetLastError( ERROR_MESSAGE_SYNC_ONLY );
-        else SetLastError( ERROR_INVALID_WINDOW_HANDLE );
-        return 0;
-    }
-    winproc = WINPROC_GetProc16( wndPtr->winproc, wndPtr->flags & WIN_ISUNICODE );
-    WIN_ReleasePtr( wndPtr );
-
     SPY_EnterMessage( SPY_DISPATCHMESSAGE16, hwnd, msg->message, msg->wParam, msg->lParam );
     retval = CallWindowProc16( winproc, msg->hwnd, msg->message, msg->wParam, msg->lParam );
     SPY_ExitMessage( SPY_RESULT_OK16, hwnd, msg->message, retval, msg->wParam, msg->lParam );




More information about the wine-cvs mailing list