Author: jimtabor Date: Sat Apr 5 13:05:11 2008 New Revision: 32874
URL: http://svn.reactos.org/svn/reactos?rev=32874&view=rev Log: BroadcastSystemMessage: - Implement User half only. - Introduce example use for NtUserMessageCall. - IntBroadcastSystemMessage is based on Wine LGPL implementation http://www.winehq.org/pipermail/wine-cvs/2008-April/042051.html . - Wine testing needed to be change by adding message range parameter check. The range was from 0 to -1 and check for resulting errors that conformed to XP. - Need to move BROADCASTPARM to include/X/X/ntuser.h or other after Dr. Timo finishes header realignment.
Modified: trunk/reactos/dll/win32/user32/misc/stubs.c trunk/reactos/dll/win32/user32/windows/message.c
Modified: trunk/reactos/dll/win32/user32/misc/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/stubs... ============================================================================== --- trunk/reactos/dll/win32/user32/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/stubs.c [iso-8859-1] Sat Apr 5 13:05:11 2008 @@ -34,40 +34,6 @@ /* * @unimplemented */ -long -STDCALL -BroadcastSystemMessageA( - DWORD dwFlags, - LPDWORD lpdwRecipients, - UINT uiMessage, - WPARAM wParam, - LPARAM lParam) -{ - UNIMPLEMENTED; - return 0; -} - - -/* - * @unimplemented - */ -long -STDCALL -BroadcastSystemMessageW( - DWORD dwFlags, - LPDWORD lpdwRecipients, - UINT uiMessage, - WPARAM wParam, - LPARAM lParam) -{ - UNIMPLEMENTED; - return 0; -} - - -/* - * @unimplemented - */ int STDCALL GetMouseMovePointsEx( @@ -357,23 +323,6 @@ */ LONG STDCALL -BroadcastSystemMessageExW( - DWORD dwflags, - LPDWORD lpdwRecipients, - UINT uiMessage, - WPARAM wParam, - LPARAM lParam, - PBSMINFO pBSMInfo) -{ - UNIMPLEMENTED; - return FALSE; -} - -/* - * @unimplemented - */ -LONG -STDCALL CsrBroadcastSystemMessageExW( DWORD dwflags, LPDWORD lpdwRecipients, @@ -404,23 +353,6 @@ /* * @unimplemented */ -LONG -STDCALL -BroadcastSystemMessageExA( - DWORD dwflags, - LPDWORD lpdwRecipients, - UINT uiMessage, - WPARAM wParam, - LPARAM lParam, - PBSMINFO pBSMInfo) -{ - UNIMPLEMENTED; - return FALSE; -} - -/* - * @unimplemented - */ BOOL STDCALL AlignRects(LPRECT rect, DWORD b, DWORD c, DWORD d)
Modified: trunk/reactos/dll/win32/user32/windows/message.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/me... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] Sat Apr 5 13:05:11 2008 @@ -2559,3 +2559,136 @@ msg.wParam = map_wparam_AtoW( msg.message, msg.wParam ); return IsDialogMessageW( hwndDlg, &msg ); } + +typedef struct _BROADCASTPARM +{ + DWORD flags; + LPDWORD recipients; +} BROADCASTPARM, *PBROADCASTPARM; + +LONG +STDCALL +IntBroadcastSystemMessage( + DWORD dwflags, + LPDWORD lpdwRecipients, + UINT uiMessage, + WPARAM wParam, + LPARAM lParam, + PBSMINFO pBSMInfo, + BOOL Ansi) +{ + BROADCASTPARM parm; + DWORD recips = BSM_ALLCOMPONENTS; + BOOL ret = TRUE; + 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) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + if(uiMessage >= WM_USER && uiMessage < 0xC000) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + if (!lpdwRecipients) + lpdwRecipients = &recips; + + if ( pBSMInfo && dwflags & BSF_QUERY ) + { + if (pBSMInfo->cbSize != sizeof(BSMINFO)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + FIXME("Not returning PBSMINFO information yet\n"); + } + + parm.flags = dwflags; + parm.recipients = lpdwRecipients; + + if (*lpdwRecipients & BSM_APPLICATIONS) + { + return NtUserMessageCall(GetDesktopWindow(), + uiMessage, + wParam, + lParam, + (ULONG_PTR)&parm, + NUMC_BROADCASTSYSTEMMESSAGE, + Ansi); + } + else + { + FIXME("Recipients %08x not supported!\n", *lpdwRecipients); + } + + return ret; +} + +/* + * @implemented + */ +LONG +STDCALL +BroadcastSystemMessageA( + DWORD dwFlags, + LPDWORD lpdwRecipients, + UINT uiMessage, + WPARAM wParam, + LPARAM lParam) +{ + return IntBroadcastSystemMessage( dwFlags, lpdwRecipients, uiMessage, wParam, lParam, NULL, TRUE ); +} + +/* + * @implemented + */ +LONG +STDCALL +BroadcastSystemMessageW( + DWORD dwFlags, + LPDWORD lpdwRecipients, + UINT uiMessage, + WPARAM wParam, + LPARAM lParam) +{ + return IntBroadcastSystemMessage( dwFlags, lpdwRecipients, uiMessage, wParam, lParam, NULL, FALSE ); +} + +/* + * @implemented + */ +LONG +STDCALL +BroadcastSystemMessageExA( + DWORD dwflags, + LPDWORD lpdwRecipients, + UINT uiMessage, + WPARAM wParam, + LPARAM lParam, + PBSMINFO pBSMInfo) +{ + return IntBroadcastSystemMessage( dwflags, lpdwRecipients, uiMessage, wParam, lParam , pBSMInfo, TRUE ); +} + +/* + * @implemented + */ +LONG +STDCALL +BroadcastSystemMessageExW( + DWORD dwflags, + LPDWORD lpdwRecipients, + UINT uiMessage, + WPARAM wParam, + LPARAM lParam, + PBSMINFO pBSMInfo) +{ + return IntBroadcastSystemMessage( dwflags, lpdwRecipients, uiMessage, wParam, lParam , pBSMInfo, FALSE ); +} +