[ros-diffs] [jimtabor] 32884: - Implement SendMessageCallbackA/W, user32 only. - Add client thread infomation structure to W32THREADINFO. Nothing is plugged in yet, the code is there. - Fix IntBroadcastSystemMessage to correct filter action. More work is needed since our message system has issues. - This could be a good project for newbies, rewrite message system could be placed into a branch.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Sun Apr 6 20:24:31 CEST 2008


Author: jimtabor
Date: Sun Apr  6 13:24:30 2008
New Revision: 32884

URL: http://svn.reactos.org/svn/reactos?rev=32884&view=rev
Log:
- Implement SendMessageCallbackA/W, user32 only.
- Add client thread infomation structure to W32THREADINFO. Nothing is plugged in yet, the code is there.
- Fix IntBroadcastSystemMessage to correct filter action. More work is needed since our message system has issues.
- This could be a good project for newbies, rewrite message system could be placed into a branch.

Modified:
    trunk/reactos/dll/win32/user32/windows/message.c
    trunk/reactos/include/reactos/win32k/ntuser.h
    trunk/reactos/subsystems/win32/win32k/ntuser/misc.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=32884&r1=32883&r2=32884&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 Apr  6 13:24:30 2008
@@ -1827,9 +1827,8 @@
   return Result;
 }
 
-
-/*
- * @unimplemented
+/*
+ * @implemented
  */
 BOOL
 STDCALL
@@ -1841,13 +1840,17 @@
   SENDASYNCPROC lpCallBack,
   ULONG_PTR dwData)
 {
-  UNIMPLEMENTED;
-  return FALSE;
-}
-
-
-/*
- * @unimplemented
+  return NtUserMessageCall(hWnd,
+                            Msg, 
+                         wParam,
+                         lParam,
+         (ULONG_PTR)&lpCallBack,
+       NUMC_SENDMESSAGECALLBACK,
+                           TRUE);
+}
+
+/*
+ * @implemented
  */
 BOOL
 STDCALL
@@ -1859,10 +1862,14 @@
   SENDASYNCPROC lpCallBack,
   ULONG_PTR dwData)
 {
-  UNIMPLEMENTED;
-  return FALSE;
-}
-
+  return NtUserMessageCall(hWnd,
+                            Msg, 
+                         wParam,
+                         lParam,
+         (ULONG_PTR)&lpCallBack,
+       NUMC_SENDMESSAGECALLBACK,
+                          FALSE);
+}
 
 /*
  * @implemented
@@ -2303,22 +2310,10 @@
 
 BOOL WINAPI IsInsideMessagePumpHook()
 {
-	if(!gfMessagePumpHook)
-		return FALSE;
-
-    /* This code checks if we're inside SendMessage. */
-#if 0
-	/* Since our TEB doesnt match that of real windows, testing this value is useless until we know what it does
-	PUCHAR NtTeb = (PUCHAR)NtCurrentTeb();
-
-	if(!*(PLONG*)&NtTeb[0x708])
-		return FALSE;
-
-	if(**(PLONG*)&NtTeb[0x708] <= 0)
-		return FALSE;*/
-#endif
-
-	return TRUE;
+//   PCLIENTTHREADINFO pcti = ((PW32CLIENTINFO)GetWin32ClientInfo())->pClientThreadInfo;
+//   return (gfMessagePumpHook && pcti && (pcti->dwcPumpHook > 0));
+    if(!gfMessagePumpHook) return FALSE;
+    return TRUE;
 }
 
 void WINAPI ResetMessagePumpHook(PUSER_MESSAGE_PUMP_ADDRESSES Addresses)
@@ -2564,6 +2559,9 @@
 {
     DWORD flags;
     LPDWORD recipients;
+    HDESK hDesk;
+    HWND  hWnd;
+    LUID  luid;
 } BROADCASTPARM, *PBROADCASTPARM;
 
 LONG
@@ -2579,12 +2577,13 @@
 {
     BROADCASTPARM parm;
     DWORD recips = BSM_ALLCOMPONENTS;
-    BOOL ret = TRUE;
+    BOOL ret = -1; // Set to return fail
     static const DWORD all_flags = ( BSF_QUERY | BSF_IGNORECURRENTTASK | BSF_FLUSHDISK | BSF_NOHANG
                                    | BSF_POSTMESSAGE | BSF_FORCEIFHUNG | BSF_NOTIMEOUTIFNOTHUNG
                                    | BSF_ALLOWSFW | BSF_SENDNOTIFYMESSAGE | BSF_RETURNHDESK | BSF_LUID );
 
-    if (dwflags & ~all_flags)
+    if ((dwflags & ~all_flags) || 
+        (!pBSMInfo && (dwflags & (BSF_RETURNHDESK|BSF_LUID))) )
     {
         SetLastError(ERROR_INVALID_PARAMETER);
         return 0;
@@ -2596,37 +2595,54 @@
         return 0;
     }
 
+    if (dwflags & BSF_FORCEIFHUNG) dwflags |= BSF_NOHANG;
+    
+    if (dwflags & BSF_QUERY) dwflags &= ~BSF_SENDNOTIFYMESSAGE|BSF_POSTMESSAGE;
+
     if (!lpdwRecipients)
         lpdwRecipients = &recips;
 
-    if ( pBSMInfo && dwflags & BSF_QUERY )
+    if (*lpdwRecipients & ~(BSM_APPLICATIONS|BSM_ALLDESKTOPS|BSM_INSTALLABLEDRIVERS|BSM_NETDRIVER|BSM_VXDS))
+    {
+       SetLastError(ERROR_INVALID_PARAMETER);
+       return 0;
+    }
+
+    if ( pBSMInfo && (dwflags & BSF_QUERY) )
     {
        if (pBSMInfo->cbSize != sizeof(BSMINFO))
        {
            SetLastError(ERROR_INVALID_PARAMETER);
            return 0;
        }
-       FIXME("Not returning PBSMINFO information yet\n");
-    }
-
+    }
+
+    parm.hDesk = NULL;
+    parm.hWnd = NULL;
     parm.flags = dwflags;
     parm.recipients = lpdwRecipients;
 
+    if (dwflags & BSF_LUID) parm.luid = pBSMInfo->luid;
+
     if (*lpdwRecipients & BSM_APPLICATIONS)
     {
-        return NtUserMessageCall(GetDesktopWindow(),
-                                          uiMessage,
-                                             wParam,
-                                             lParam,
-                                   (ULONG_PTR)&parm,
-                        NUMC_BROADCASTSYSTEMMESSAGE,
-                                               Ansi);
-    }
-    else
-    {
-       FIXME("Recipients %08x not supported!\n", *lpdwRecipients);
-    }
-
+        ret = NtUserMessageCall(GetDesktopWindow(),
+                                         uiMessage,
+                                            wParam,
+                                            lParam,
+                                  (ULONG_PTR)&parm,
+                       NUMC_BROADCASTSYSTEMMESSAGE,
+                                              Ansi);
+    }
+
+    if (!ret)
+    {
+       if ( pBSMInfo && (dwflags & BSF_QUERY) )
+       {
+          pBSMInfo->hdesk = parm.hDesk;
+          pBSMInfo->hwnd = parm.hWnd;
+       }
+    }
     return ret;
 }
 

Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntuser.h?rev=32884&r1=32883&r2=32884&view=diff
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Sun Apr  6 13:24:30 2008
@@ -181,6 +181,11 @@
 
 } W32PROCESSINFO, *PW32PROCESSINFO;
 
+typedef struct _CLIENTTHREADINFO
+{
+    DWORD dwcPumpHook;
+} CLIENTTHREADINFO, *PCLIENTTHREADINFO;
+
 typedef struct _W32THREADINFO
 {
     PW32PROCESSINFO pi; /* [USER] */
@@ -194,6 +199,7 @@
     /* Application compatibility flags */
     DWORD AppCompatFlags;
     DWORD AppCompatFlags2;
+    CLIENTTHREADINFO ClientThreadInfo;
 } W32THREADINFO, *PW32THREADINFO;
 
 /* Window Client Information structure */
@@ -221,7 +227,7 @@
     PVOID pvWND; // " "
     DWORD dwHookCurrent;
     ULONG Win32ClientInfo1;
-    PVOID pClientThreadInfo;
+    PCLIENTTHREADINFO pClientThreadInfo;
     DWORD dwHookData;
     ULONG Win32ClientInfo2[8];
     HANDLE hKL;

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/misc.c?rev=32884&r1=32883&r2=32884&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] Sun Apr  6 13:24:30 2008
@@ -436,6 +436,7 @@
 {
     PTEB Teb;
     PW32THREADINFO ti;
+//    PW32CLIENTINFO ci;
     PW32THREAD W32Thread = PsGetCurrentThreadWin32Thread();
 
     if (W32Thread == NULL)
@@ -475,6 +476,7 @@
             W32Thread->ThreadInfo = ti;
             /* update the TEB */
             Teb = NtCurrentTeb();
+//            ci = GetWin32ClientInfo();
             _SEH_TRY
             {
                 ProbeForWrite(Teb,
@@ -482,6 +484,7 @@
                               sizeof(ULONG));
 
                 Teb->Win32ThreadInfo = UserHeapAddressToUser(W32Thread->ThreadInfo);
+//                ci->pClientThreadInfo = UserHeapAddressToUser(&ti->ClientThreadInfo);
             }
             _SEH_HANDLE
             {



More information about the Ros-diffs mailing list