[ros-diffs] [mjmartin] 47434: [user32] - Pass a pointer to a structure, that holds the CallBack procedure and data, as the 5th parameter to NtUserMessageCall. - Fix a bug In User32CallSendAsyncProcForKernel, the ArgumentLength is the size of SENDASYNCPROC_CALLBACK_ARGUMENTS. [win32k] - For types FNID_SENDMESSAGECALLBACK call co_IntSendMessageWithCallBack to put the message in the send queue. - Rewrite code for when messages have a completioncallback

mjmartin at svn.reactos.org mjmartin at svn.reactos.org
Sun May 30 08:23:42 CEST 2010


Author: mjmartin
Date: Sun May 30 08:23:41 2010
New Revision: 47434

URL: http://svn.reactos.org/svn/reactos?rev=47434&view=rev
Log:
[user32]
- Pass a pointer to a structure, that holds the CallBack procedure and data, as the 5th parameter to NtUserMessageCall.
- Fix a bug In User32CallSendAsyncProcForKernel, the ArgumentLength is the size of SENDASYNCPROC_CALLBACK_ARGUMENTS.
[win32k]
- For types FNID_SENDMESSAGECALLBACK call co_IntSendMessageWithCallBack to put the message in the send queue.
- Rewrite code for when messages have a completioncallback

Modified:
    trunk/reactos/dll/win32/user32/windows/message.c
    trunk/reactos/dll/win32/user32/windows/window.c
    trunk/reactos/include/reactos/win32k/callback.h
    trunk/reactos/subsystems/win32/win32k/ntuser/message.c
    trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c

Modified: trunk/reactos/dll/win32/user32/windows/message.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/message.c?rev=47434&r1=47433&r2=47434&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] Sun May 30 08:23:41 2010
@@ -60,6 +60,7 @@
  * content). When a ACK message is generated, the list of pair is searched for a
  * matching pair, so that the client memory handle can be returned.
  */
+
 typedef struct tagDDEPAIR
 {
   HGLOBAL     ClientMem;
@@ -2214,11 +2215,16 @@
   SENDASYNCPROC lpCallBack,
   ULONG_PTR dwData)
 {
+  CALL_BACK_INFO CallBackInfo;
+
+  CallBackInfo.CallBack = lpCallBack;
+  CallBackInfo.Context = dwData;
+
   return NtUserMessageCall(hWnd,
                             Msg, 
                          wParam,
                          lParam,
-         (ULONG_PTR)&lpCallBack,
+       (ULONG_PTR)&CallBackInfo,
        FNID_SENDMESSAGECALLBACK,
                            TRUE);
 }
@@ -2236,11 +2242,17 @@
   SENDASYNCPROC lpCallBack,
   ULONG_PTR dwData)
 {
+
+  CALL_BACK_INFO CallBackInfo;
+
+  CallBackInfo.CallBack = lpCallBack;
+  CallBackInfo.Context = dwData;
+
   return NtUserMessageCall(hWnd,
                             Msg, 
                          wParam,
                          lParam,
-         (ULONG_PTR)&lpCallBack,
+       (ULONG_PTR)&CallBackInfo,
        FNID_SENDMESSAGECALLBACK,
                           FALSE);
 }

Modified: trunk/reactos/dll/win32/user32/windows/window.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/window.c?rev=47434&r1=47433&r2=47434&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] Sun May 30 08:23:41 2010
@@ -29,9 +29,10 @@
     PSENDASYNCPROC_CALLBACK_ARGUMENTS CallbackArgs;
 
     TRACE("User32CallSendAsyncProcKernel()\n");
+
     CallbackArgs = (PSENDASYNCPROC_CALLBACK_ARGUMENTS)Arguments;
 
-    if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS))
+    if (ArgumentLength != sizeof(SENDASYNCPROC_CALLBACK_ARGUMENTS))
     {
         return(STATUS_INFO_LENGTH_MISMATCH);
     }

Modified: trunk/reactos/include/reactos/win32k/callback.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/callback.h?rev=47434&r1=47433&r2=47434&view=diff
==============================================================================
--- trunk/reactos/include/reactos/win32k/callback.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/callback.h [iso-8859-1] Sun May 30 08:23:41 2010
@@ -32,6 +32,13 @@
   ULONG_PTR Context;
   LRESULT Result;
 } SENDASYNCPROC_CALLBACK_ARGUMENTS, *PSENDASYNCPROC_CALLBACK_ARGUMENTS;
+
+typedef struct _CALL_BACK_INFO
+{
+   SENDASYNCPROC CallBack;
+   ULONG_PTR Context;
+} CALL_BACK_INFO, * PCALL_BACK_INFO;
+
 
 typedef struct _HOOKPROC_CALLBACK_ARGUMENTS
 {

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/message.c?rev=47434&r1=47433&r2=47434&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Sun May 30 08:23:41 2010
@@ -1625,12 +1625,11 @@
 
    IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult);
 
-   if (Window->pti->MessageQueue == Win32Thread->MessageQueue)
+   if ((Window->pti->MessageQueue == Win32Thread->MessageQueue) && (CompletionCallback == NULL))
    {
       if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE)))
       {
          DPRINT1("Failed to unpack message parameters\n");
-         RETURN(TRUE);
       }
       RETURN(TRUE);
    }
@@ -2621,6 +2620,18 @@
       }
       break;
       case FNID_SENDMESSAGECALLBACK:
+      {
+         PCALL_BACK_INFO CallBackInfo = (PCALL_BACK_INFO)ResultInfo;
+
+         if (!CallBackInfo)
+            break;
+
+         if (!co_IntSendMessageWithCallBack(hWnd, Msg, wParam, lParam,
+             CallBackInfo->CallBack, CallBackInfo->Context, NULL))
+         {
+            DPRINT1("Callback failure!\n");
+         }
+      }
       break;
       // CallNextHook bypass.
       case FNID_CALLWNDPROC:

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c?rev=47434&r1=47433&r2=47434&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Sun May 30 08:23:41 2010
@@ -894,7 +894,6 @@
    PLIST_ENTRY Entry;
    LRESULT Result;
    BOOL SenderReturned;
-   PUSER_SENT_MESSAGE_NOTIFY NotifyMessage;
 
    if (IsListEmpty(&MessageQueue->SentMessagesListHead))
    {
@@ -965,26 +964,16 @@
       KeSetEvent(Message->CompletionEvent, IO_NO_INCREMENT, FALSE);
    }
 
-   /* Notify the sender if they specified a callback. */
+   /* Call the callback if the message was sent with SendMessageCallback */
    if (!SenderReturned && Message->CompletionCallback != NULL)
    {
-      if(!(NotifyMessage = ExAllocatePoolWithTag(NonPagedPool,
-                           sizeof(USER_SENT_MESSAGE_NOTIFY), TAG_USRMSG)))
-      {
-         DPRINT1("MsqDispatchOneSentMessage(): Not enough memory to create a callback notify message\n");
-         goto Notified;
-      }
-      NotifyMessage->CompletionCallback =
-         Message->CompletionCallback;
-      NotifyMessage->CompletionCallbackContext =
-         Message->CompletionCallbackContext;
-      NotifyMessage->Result = Result;
-      NotifyMessage->hWnd = Message->Msg.hwnd;
-      NotifyMessage->Msg = Message->Msg.message;
-      MsqSendNotifyMessage(Message->SenderQueue, NotifyMessage);
-   }
-
-Notified:
+      co_IntCallSentMessageCallback(Message->CompletionCallback,
+                                    Message->Msg.hwnd,
+                                    Message->Msg.message,
+                                    Message->CompletionCallbackContext,
+                                    Result);
+   }
+
 
    /* Only if it is not a no wait message */
    if (!(Message->HookMessage & MSQ_SENTNOWAIT))




More information about the Ros-diffs mailing list