2001-08-07 21:19:08 +02:00
|
|
|
/*
|
|
|
|
* Window messaging support
|
|
|
|
*
|
|
|
|
* Copyright 2001 Alexandre Julliard
|
2008-04-01 21:15:55 +02:00
|
|
|
* Copyright 2008 Maarten Lankhorst
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2001-08-07 21:19:08 +02:00
|
|
|
*/
|
|
|
|
|
2003-07-11 23:55:58 +02:00
|
|
|
#include <assert.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2003-07-11 23:55:58 +02:00
|
|
|
|
2011-03-02 19:43:53 +01:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "ntstatus.h"
|
2005-11-28 17:32:54 +01:00
|
|
|
#define WIN32_NO_STATUS
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
2001-08-07 21:19:08 +02:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "winnls.h"
|
2006-03-09 22:48:37 +01:00
|
|
|
#include "dbt.h"
|
2001-08-13 22:33:21 +02:00
|
|
|
#include "dde.h"
|
2008-04-14 19:39:28 +02:00
|
|
|
#include "imm.h"
|
2021-05-06 12:57:33 +02:00
|
|
|
#include "hidusage.h"
|
2008-04-25 17:19:22 +02:00
|
|
|
#include "ddk/imm.h"
|
2001-08-07 21:19:08 +02:00
|
|
|
#include "wine/server.h"
|
2004-12-08 19:06:14 +01:00
|
|
|
#include "user_private.h"
|
2001-08-07 21:19:08 +02:00
|
|
|
#include "win.h"
|
2005-03-10 16:47:53 +01:00
|
|
|
#include "controls.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2009-09-30 01:39:25 +02:00
|
|
|
#include "wine/exception.h"
|
2001-08-07 21:19:08 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msg);
|
2001-08-07 21:19:08 +02:00
|
|
|
|
|
|
|
|
2008-06-25 14:19:34 +02:00
|
|
|
/* Message class descriptor */
|
|
|
|
const struct builtin_class_descr MESSAGE_builtin_class =
|
|
|
|
{
|
2020-09-21 16:31:11 +02:00
|
|
|
L"Message", /* name */
|
2008-06-25 14:19:34 +02:00
|
|
|
0, /* style */
|
2009-12-18 12:39:13 +01:00
|
|
|
WINPROC_MESSAGE, /* proc */
|
2008-06-25 14:19:34 +02:00
|
|
|
0, /* extra */
|
2013-10-24 17:40:37 +02:00
|
|
|
0, /* cursor */
|
2008-06-25 14:19:34 +02:00
|
|
|
0 /* brush */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-03-30 20:26:10 +02:00
|
|
|
/* pack a pointer into a 32/64 portable format */
|
|
|
|
static inline ULONGLONG pack_ptr( const void *ptr )
|
|
|
|
{
|
|
|
|
return (ULONG_PTR)ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* unpack a potentially 64-bit pointer, returning 0 when truncated */
|
|
|
|
static inline void *unpack_ptr( ULONGLONG ptr64 )
|
|
|
|
{
|
|
|
|
if ((ULONG_PTR)ptr64 != ptr64) return 0;
|
|
|
|
return (void *)(ULONG_PTR)ptr64;
|
|
|
|
}
|
|
|
|
|
2007-08-08 20:35:24 +02:00
|
|
|
/* check for pending WM_CHAR message with DBCS trailing byte */
|
|
|
|
static inline BOOL get_pending_wmchar( MSG *msg, UINT first, UINT last, BOOL remove )
|
|
|
|
{
|
|
|
|
struct wm_char_mapping_data *data = get_user_thread_info()->wmchar_data;
|
|
|
|
|
|
|
|
if (!data || !data->get_msg.message) return FALSE;
|
|
|
|
if ((first || last) && (first > WM_CHAR || last < WM_CHAR)) return FALSE;
|
|
|
|
if (!msg) return FALSE;
|
|
|
|
*msg = data->get_msg;
|
|
|
|
if (remove) data->get_msg.message = 0;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2001-08-07 21:19:08 +02:00
|
|
|
|
2008-06-25 14:19:34 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2009-12-18 12:38:22 +01:00
|
|
|
* MessageWndProc
|
2008-06-25 14:19:34 +02:00
|
|
|
*
|
|
|
|
* Window procedure for "Message" windows (HWND_MESSAGE parent).
|
|
|
|
*/
|
2009-12-18 12:38:22 +01:00
|
|
|
LRESULT WINAPI MessageWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
|
2008-06-25 14:19:34 +02:00
|
|
|
{
|
|
|
|
if (message == WM_NCCREATE) return TRUE;
|
|
|
|
return 0; /* all other messages are ignored */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-21 13:51:21 +02:00
|
|
|
DWORD get_input_codepage( void )
|
|
|
|
{
|
2013-05-21 13:51:22 +02:00
|
|
|
DWORD cp;
|
|
|
|
int ret;
|
2021-11-16 12:35:43 +01:00
|
|
|
HKL hkl = NtUserGetKeyboardLayout( 0 );
|
2013-05-21 13:51:22 +02:00
|
|
|
|
|
|
|
ret = GetLocaleInfoW( LOWORD(hkl), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
|
|
|
|
(WCHAR *)&cp, sizeof(cp) / sizeof(WCHAR) );
|
|
|
|
if (!ret) cp = CP_ACP;
|
|
|
|
return cp;
|
2013-05-21 13:51:21 +02:00
|
|
|
}
|
2001-08-07 21:19:08 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* map_wparam_AtoW
|
|
|
|
*
|
|
|
|
* Convert the wparam of an ASCII message to Unicode.
|
|
|
|
*/
|
2007-08-08 18:25:38 +02:00
|
|
|
BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping )
|
2001-08-07 21:19:08 +02:00
|
|
|
{
|
2007-08-08 18:25:38 +02:00
|
|
|
char ch[2];
|
|
|
|
WCHAR wch[2];
|
2021-03-04 09:42:27 +01:00
|
|
|
DWORD cp;
|
2007-08-08 18:25:38 +02:00
|
|
|
|
|
|
|
wch[0] = wch[1] = 0;
|
2003-05-11 04:58:19 +02:00
|
|
|
switch(message)
|
2001-08-07 21:19:08 +02:00
|
|
|
{
|
2007-08-08 18:25:38 +02:00
|
|
|
case WM_CHAR:
|
|
|
|
/* WM_CHAR is magic: a DBCS char can be sent/posted as two consecutive WM_CHAR
|
|
|
|
* messages, in which case the first char is stored, and the conversion
|
|
|
|
* to Unicode only takes place once the second char is sent/posted.
|
|
|
|
*/
|
|
|
|
if (mapping != WMCHAR_MAP_NOMAPPING)
|
|
|
|
{
|
|
|
|
struct wm_char_mapping_data *data = get_user_thread_info()->wmchar_data;
|
|
|
|
BYTE low = LOBYTE(*wparam);
|
2021-03-04 09:42:27 +01:00
|
|
|
cp = get_input_codepage();
|
2007-08-08 18:25:38 +02:00
|
|
|
|
|
|
|
if (HIBYTE(*wparam))
|
|
|
|
{
|
|
|
|
ch[0] = low;
|
|
|
|
ch[1] = HIBYTE(*wparam);
|
2013-05-21 13:51:21 +02:00
|
|
|
MultiByteToWideChar( cp, 0, ch, 2, wch, 2 );
|
2007-08-08 18:25:38 +02:00
|
|
|
TRACE( "map %02x,%02x -> %04x mapping %u\n", (BYTE)ch[0], (BYTE)ch[1], wch[0], mapping );
|
|
|
|
if (data) data->lead_byte[mapping] = 0;
|
|
|
|
}
|
|
|
|
else if (data && data->lead_byte[mapping])
|
|
|
|
{
|
|
|
|
ch[0] = data->lead_byte[mapping];
|
|
|
|
ch[1] = low;
|
2013-05-21 13:51:21 +02:00
|
|
|
MultiByteToWideChar( cp, 0, ch, 2, wch, 2 );
|
2007-08-08 18:25:38 +02:00
|
|
|
TRACE( "map stored %02x,%02x -> %04x mapping %u\n", (BYTE)ch[0], (BYTE)ch[1], wch[0], mapping );
|
|
|
|
data->lead_byte[mapping] = 0;
|
|
|
|
}
|
|
|
|
else if (!IsDBCSLeadByte( low ))
|
|
|
|
{
|
|
|
|
ch[0] = low;
|
2013-05-21 13:51:21 +02:00
|
|
|
MultiByteToWideChar( cp, 0, ch, 1, wch, 2 );
|
2007-08-08 18:25:38 +02:00
|
|
|
TRACE( "map %02x -> %04x\n", (BYTE)ch[0], wch[0] );
|
|
|
|
if (data) data->lead_byte[mapping] = 0;
|
|
|
|
}
|
|
|
|
else /* store it and wait for trail byte */
|
|
|
|
{
|
|
|
|
if (!data)
|
|
|
|
{
|
|
|
|
if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) )))
|
|
|
|
return FALSE;
|
|
|
|
get_user_thread_info()->wmchar_data = data;
|
|
|
|
}
|
|
|
|
TRACE( "storing lead byte %02x mapping %u\n", low, mapping );
|
|
|
|
data->lead_byte[mapping] = low;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
*wparam = MAKEWPARAM(wch[0], wch[1]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* else fall through */
|
2003-05-11 04:58:19 +02:00
|
|
|
case WM_CHARTOITEM:
|
|
|
|
case EM_SETPASSWORDCHAR:
|
|
|
|
case WM_DEADCHAR:
|
|
|
|
case WM_SYSCHAR:
|
|
|
|
case WM_SYSDEADCHAR:
|
|
|
|
case WM_MENUCHAR:
|
2021-03-04 09:42:27 +01:00
|
|
|
cp = get_input_codepage();
|
2007-08-08 18:25:38 +02:00
|
|
|
ch[0] = LOBYTE(*wparam);
|
|
|
|
ch[1] = HIBYTE(*wparam);
|
2013-05-21 13:51:21 +02:00
|
|
|
MultiByteToWideChar( cp, 0, ch, 2, wch, 2 );
|
2007-08-08 18:25:38 +02:00
|
|
|
*wparam = MAKEWPARAM(wch[0], wch[1]);
|
2003-05-11 04:58:19 +02:00
|
|
|
break;
|
|
|
|
case WM_IME_CHAR:
|
2021-03-04 09:42:27 +01:00
|
|
|
cp = get_input_codepage();
|
2007-08-08 18:25:38 +02:00
|
|
|
ch[0] = HIBYTE(*wparam);
|
|
|
|
ch[1] = LOBYTE(*wparam);
|
2013-05-21 13:51:21 +02:00
|
|
|
if (ch[0]) MultiByteToWideChar( cp, 0, ch, 2, wch, 2 );
|
|
|
|
else MultiByteToWideChar( cp, 0, ch + 1, 1, wch, 1 );
|
2007-08-08 18:25:38 +02:00
|
|
|
*wparam = MAKEWPARAM(wch[0], HIWORD(*wparam));
|
2003-05-11 04:58:19 +02:00
|
|
|
break;
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
2007-08-08 18:25:38 +02:00
|
|
|
return TRUE;
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* map_wparam_WtoA
|
|
|
|
*
|
|
|
|
* Convert the wparam of a Unicode message to ASCII.
|
|
|
|
*/
|
2007-08-08 20:35:24 +02:00
|
|
|
static void map_wparam_WtoA( MSG *msg, BOOL remove )
|
2001-08-07 21:19:08 +02:00
|
|
|
{
|
2013-05-21 13:51:21 +02:00
|
|
|
BYTE ch[4];
|
2007-08-08 20:35:24 +02:00
|
|
|
WCHAR wch[2];
|
|
|
|
DWORD len;
|
2021-03-04 09:42:27 +01:00
|
|
|
DWORD cp;
|
2007-08-08 20:35:24 +02:00
|
|
|
|
|
|
|
switch(msg->message)
|
2001-08-07 21:19:08 +02:00
|
|
|
{
|
2007-08-08 20:35:24 +02:00
|
|
|
case WM_CHAR:
|
|
|
|
if (!HIWORD(msg->wParam))
|
|
|
|
{
|
2021-03-04 09:42:27 +01:00
|
|
|
cp = get_input_codepage();
|
2007-08-08 20:35:24 +02:00
|
|
|
wch[0] = LOWORD(msg->wParam);
|
|
|
|
ch[0] = ch[1] = 0;
|
2013-05-21 13:51:21 +02:00
|
|
|
len = WideCharToMultiByte( cp, 0, wch, 1, (LPSTR)ch, 2, NULL, NULL );
|
2007-08-08 20:35:24 +02:00
|
|
|
if (len == 2) /* DBCS char */
|
|
|
|
{
|
|
|
|
struct wm_char_mapping_data *data = get_user_thread_info()->wmchar_data;
|
|
|
|
if (!data)
|
|
|
|
{
|
|
|
|
if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) ))) return;
|
|
|
|
get_user_thread_info()->wmchar_data = data;
|
|
|
|
}
|
|
|
|
if (remove)
|
|
|
|
{
|
|
|
|
data->get_msg = *msg;
|
|
|
|
data->get_msg.wParam = ch[1];
|
|
|
|
}
|
|
|
|
msg->wParam = ch[0];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* else fall through */
|
2003-05-11 04:58:19 +02:00
|
|
|
case WM_CHARTOITEM:
|
|
|
|
case EM_SETPASSWORDCHAR:
|
|
|
|
case WM_DEADCHAR:
|
|
|
|
case WM_SYSCHAR:
|
|
|
|
case WM_SYSDEADCHAR:
|
|
|
|
case WM_MENUCHAR:
|
2021-03-04 09:42:27 +01:00
|
|
|
cp = get_input_codepage();
|
2007-08-08 20:35:24 +02:00
|
|
|
wch[0] = LOWORD(msg->wParam);
|
|
|
|
wch[1] = HIWORD(msg->wParam);
|
|
|
|
ch[0] = ch[1] = 0;
|
2013-05-21 13:51:21 +02:00
|
|
|
WideCharToMultiByte( cp, 0, wch, 2, (LPSTR)ch, 4, NULL, NULL );
|
2007-08-08 20:35:24 +02:00
|
|
|
msg->wParam = MAKEWPARAM( ch[0] | (ch[1] << 8), 0 );
|
2003-05-11 04:58:19 +02:00
|
|
|
break;
|
|
|
|
case WM_IME_CHAR:
|
2021-03-04 09:42:27 +01:00
|
|
|
cp = get_input_codepage();
|
2007-08-08 20:35:24 +02:00
|
|
|
wch[0] = LOWORD(msg->wParam);
|
|
|
|
ch[0] = ch[1] = 0;
|
2013-05-21 13:51:21 +02:00
|
|
|
len = WideCharToMultiByte( cp, 0, wch, 1, (LPSTR)ch, 2, NULL, NULL );
|
2007-08-08 20:35:24 +02:00
|
|
|
if (len == 2)
|
|
|
|
msg->wParam = MAKEWPARAM( (ch[0] << 8) | ch[1], HIWORD(msg->wParam) );
|
|
|
|
else
|
|
|
|
msg->wParam = MAKEWPARAM( ch[0], HIWORD(msg->wParam) );
|
2003-05-11 04:58:19 +02:00
|
|
|
break;
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-18 20:22:55 +01:00
|
|
|
/* since the WM_DDE_ACK response to a WM_DDE_EXECUTE message should contain the handle
|
|
|
|
* to the memory handle, we keep track (in the server side) of all pairs of handle
|
|
|
|
* used (the client passes its value and the content of the memory handle), and
|
|
|
|
* the server stored both values (the client, and the local one, created after the
|
2002-06-01 01:06:46 +02:00
|
|
|
* content). When a ACK message is generated, the list of pair is searched for a
|
2002-01-18 20:22:55 +01:00
|
|
|
* matching pair, so that the client memory handle can be returned.
|
|
|
|
*/
|
|
|
|
struct DDE_pair {
|
|
|
|
HGLOBAL client_hMem;
|
|
|
|
HGLOBAL server_hMem;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct DDE_pair* dde_pairs;
|
|
|
|
static int dde_num_alloc;
|
|
|
|
static int dde_num_used;
|
2003-08-13 01:50:54 +02:00
|
|
|
|
|
|
|
static CRITICAL_SECTION dde_crst;
|
|
|
|
static CRITICAL_SECTION_DEBUG critsect_debug =
|
|
|
|
{
|
|
|
|
0, 0, &dde_crst,
|
|
|
|
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
|
2005-09-09 12:19:44 +02:00
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": dde_crst") }
|
2003-08-13 01:50:54 +02:00
|
|
|
};
|
|
|
|
static CRITICAL_SECTION dde_crst = { &critsect_debug, -1, 0, 0, 0, 0 };
|
2002-01-18 20:22:55 +01:00
|
|
|
|
|
|
|
static BOOL dde_add_pair(HGLOBAL chm, HGLOBAL shm)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
#define GROWBY 4
|
|
|
|
|
|
|
|
EnterCriticalSection(&dde_crst);
|
|
|
|
|
|
|
|
/* now remember the pair of hMem on both sides */
|
|
|
|
if (dde_num_used == dde_num_alloc)
|
|
|
|
{
|
2003-10-14 07:24:20 +02:00
|
|
|
struct DDE_pair* tmp;
|
|
|
|
if (dde_pairs)
|
|
|
|
tmp = HeapReAlloc( GetProcessHeap(), 0, dde_pairs,
|
2002-01-18 20:22:55 +01:00
|
|
|
(dde_num_alloc + GROWBY) * sizeof(struct DDE_pair));
|
2003-10-14 07:24:20 +02:00
|
|
|
else
|
|
|
|
tmp = HeapAlloc( GetProcessHeap(), 0,
|
|
|
|
(dde_num_alloc + GROWBY) * sizeof(struct DDE_pair));
|
|
|
|
|
2002-01-18 20:22:55 +01:00
|
|
|
if (!tmp)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&dde_crst);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
dde_pairs = tmp;
|
|
|
|
/* zero out newly allocated part */
|
|
|
|
memset(&dde_pairs[dde_num_alloc], 0, GROWBY * sizeof(struct DDE_pair));
|
|
|
|
dde_num_alloc += GROWBY;
|
|
|
|
}
|
|
|
|
#undef GROWBY
|
|
|
|
for (i = 0; i < dde_num_alloc; i++)
|
|
|
|
{
|
|
|
|
if (dde_pairs[i].server_hMem == 0)
|
|
|
|
{
|
|
|
|
dde_pairs[i].client_hMem = chm;
|
|
|
|
dde_pairs[i].server_hMem = shm;
|
|
|
|
dde_num_used++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&dde_crst);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HGLOBAL dde_get_pair(HGLOBAL shm)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
HGLOBAL ret = 0;
|
|
|
|
|
|
|
|
EnterCriticalSection(&dde_crst);
|
|
|
|
for (i = 0; i < dde_num_alloc; i++)
|
|
|
|
{
|
|
|
|
if (dde_pairs[i].server_hMem == shm)
|
|
|
|
{
|
|
|
|
/* free this pair */
|
|
|
|
dde_pairs[i].server_hMem = 0;
|
|
|
|
dde_num_used--;
|
|
|
|
ret = dde_pairs[i].client_hMem;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&dde_crst);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* post_dde_message
|
|
|
|
*
|
2003-05-20 01:27:16 +02:00
|
|
|
* Post a DDE message
|
2002-01-18 20:22:55 +01:00
|
|
|
*/
|
2022-04-01 14:46:51 +02:00
|
|
|
BOOL post_dde_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD dest_tid, DWORD type )
|
2002-01-18 20:22:55 +01:00
|
|
|
{
|
|
|
|
void* ptr = NULL;
|
|
|
|
int size = 0;
|
2005-09-12 23:22:32 +02:00
|
|
|
UINT_PTR uiLo, uiHi;
|
2015-11-06 05:00:42 +01:00
|
|
|
LPARAM lp;
|
2002-01-18 20:22:55 +01:00
|
|
|
HGLOBAL hunlock = 0;
|
|
|
|
DWORD res;
|
2013-10-21 14:48:20 +02:00
|
|
|
ULONGLONG hpack;
|
2002-01-18 20:22:55 +01:00
|
|
|
|
2022-04-01 14:46:11 +02:00
|
|
|
if (!UnpackDDElParam( msg, lparam, &uiLo, &uiHi ))
|
2002-01-18 20:22:55 +01:00
|
|
|
return FALSE;
|
|
|
|
|
2022-04-01 14:46:11 +02:00
|
|
|
lp = lparam;
|
|
|
|
switch (msg)
|
2002-01-18 20:22:55 +01:00
|
|
|
{
|
|
|
|
/* DDE messages which don't require packing are:
|
|
|
|
* WM_DDE_INITIATE
|
|
|
|
* WM_DDE_TERMINATE
|
|
|
|
* WM_DDE_REQUEST
|
|
|
|
* WM_DDE_UNADVISE
|
|
|
|
*/
|
|
|
|
case WM_DDE_ACK:
|
|
|
|
if (HIWORD(uiHi))
|
|
|
|
{
|
|
|
|
/* uiHi should contain a hMem from WM_DDE_EXECUTE */
|
2002-11-22 21:43:01 +01:00
|
|
|
HGLOBAL h = dde_get_pair( (HANDLE)uiHi );
|
2002-01-18 20:22:55 +01:00
|
|
|
if (h)
|
|
|
|
{
|
2013-10-21 14:48:20 +02:00
|
|
|
hpack = pack_ptr( h );
|
2002-01-18 20:22:55 +01:00
|
|
|
/* send back the value of h on the other side */
|
2022-04-01 14:46:11 +02:00
|
|
|
ptr = &hpack;
|
|
|
|
size = sizeof(hpack);
|
2002-01-18 20:22:55 +01:00
|
|
|
lp = uiLo;
|
2007-05-24 16:41:17 +02:00
|
|
|
TRACE( "send dde-ack %lx %08lx => %p\n", uiLo, uiHi, h );
|
2002-01-18 20:22:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* uiHi should contain either an atom or 0 */
|
2007-05-24 16:41:17 +02:00
|
|
|
TRACE( "send dde-ack %lx atom=%lx\n", uiLo, uiHi );
|
2002-01-18 20:22:55 +01:00
|
|
|
lp = MAKELONG( uiLo, uiHi );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_DDE_ADVISE:
|
|
|
|
case WM_DDE_DATA:
|
|
|
|
case WM_DDE_POKE:
|
|
|
|
if (uiLo)
|
|
|
|
{
|
|
|
|
size = GlobalSize( (HGLOBAL)uiLo ) ;
|
2022-04-01 14:46:11 +02:00
|
|
|
if ((msg == WM_DDE_ADVISE && size < sizeof(DDEADVISE)) ||
|
|
|
|
(msg == WM_DDE_DATA && size < FIELD_OFFSET(DDEDATA, Value)) ||
|
|
|
|
(msg == WM_DDE_POKE && size < FIELD_OFFSET(DDEPOKE, Value)))
|
|
|
|
return FALSE;
|
2002-01-18 20:22:55 +01:00
|
|
|
}
|
2022-04-01 14:46:11 +02:00
|
|
|
else if (msg != WM_DDE_DATA) return FALSE;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-01-18 20:22:55 +01:00
|
|
|
lp = uiHi;
|
|
|
|
if (uiLo)
|
|
|
|
{
|
|
|
|
if ((ptr = GlobalLock( (HGLOBAL)uiLo) ))
|
|
|
|
{
|
2009-03-02 10:24:30 +01:00
|
|
|
DDEDATA *dde_data = ptr;
|
2003-05-20 01:27:16 +02:00
|
|
|
TRACE("unused %d, fResponse %d, fRelease %d, fDeferUpd %d, fAckReq %d, cfFormat %d\n",
|
|
|
|
dde_data->unused, dde_data->fResponse, dde_data->fRelease,
|
|
|
|
dde_data->reserved, dde_data->fAckReq, dde_data->cfFormat);
|
2002-01-18 20:22:55 +01:00
|
|
|
hunlock = (HGLOBAL)uiLo;
|
|
|
|
}
|
|
|
|
}
|
2007-05-24 16:41:17 +02:00
|
|
|
TRACE( "send ddepack %u %lx\n", size, uiHi );
|
2002-01-18 20:22:55 +01:00
|
|
|
break;
|
|
|
|
case WM_DDE_EXECUTE:
|
2022-04-01 14:46:11 +02:00
|
|
|
if (lparam)
|
2002-01-18 20:22:55 +01:00
|
|
|
{
|
2022-04-01 14:46:11 +02:00
|
|
|
if ((ptr = GlobalLock( (HGLOBAL)lparam) ))
|
2002-01-18 20:22:55 +01:00
|
|
|
{
|
2022-04-01 14:46:11 +02:00
|
|
|
size = GlobalSize( (HGLOBAL)lparam );
|
2002-01-18 20:22:55 +01:00
|
|
|
/* so that the other side can send it back on ACK */
|
2022-04-01 14:46:11 +02:00
|
|
|
lp = lparam;
|
|
|
|
hunlock = (HGLOBAL)lparam;
|
2002-01-18 20:22:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
SERVER_START_REQ( send_message )
|
|
|
|
{
|
2022-04-01 14:46:11 +02:00
|
|
|
req->id = dest_tid;
|
|
|
|
req->type = type;
|
2003-07-11 23:55:58 +02:00
|
|
|
req->flags = 0;
|
2022-04-01 14:46:11 +02:00
|
|
|
req->win = wine_server_user_handle( hwnd );
|
|
|
|
req->msg = msg;
|
|
|
|
req->wparam = wparam;
|
2002-01-18 20:22:55 +01:00
|
|
|
req->lparam = lp;
|
2007-04-17 20:08:59 +02:00
|
|
|
req->timeout = TIMEOUT_INFINITE;
|
2022-04-01 14:46:11 +02:00
|
|
|
if (size) wine_server_add_data( req, ptr, size );
|
2002-01-18 20:22:55 +01:00
|
|
|
if ((res = wine_server_call( req )))
|
|
|
|
{
|
|
|
|
if (res == STATUS_INVALID_PARAMETER)
|
|
|
|
/* FIXME: find a STATUS_ value for this one */
|
|
|
|
SetLastError( ERROR_INVALID_THREAD_ID );
|
|
|
|
else
|
|
|
|
SetLastError( RtlNtStatusToDosError(res) );
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
|
|
|
else
|
2022-04-01 14:46:11 +02:00
|
|
|
FreeDDElParam( msg, lparam );
|
2002-01-18 20:22:55 +01:00
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
if (hunlock) GlobalUnlock(hunlock);
|
|
|
|
|
|
|
|
return !res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* unpack_dde_message
|
|
|
|
*
|
|
|
|
* Unpack a posted DDE message received from another process.
|
|
|
|
*/
|
2022-03-31 15:36:39 +02:00
|
|
|
BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam,
|
|
|
|
void **buffer, size_t size )
|
2002-01-18 20:22:55 +01:00
|
|
|
{
|
2005-09-12 23:22:32 +02:00
|
|
|
UINT_PTR uiLo, uiHi;
|
2002-01-18 20:22:55 +01:00
|
|
|
HGLOBAL hMem = 0;
|
|
|
|
void* ptr;
|
|
|
|
|
|
|
|
switch (message)
|
|
|
|
{
|
|
|
|
case WM_DDE_ACK:
|
|
|
|
if (size)
|
|
|
|
{
|
2010-03-30 20:42:09 +02:00
|
|
|
ULONGLONG hpack;
|
2002-01-18 20:22:55 +01:00
|
|
|
/* hMem is being passed */
|
2010-03-30 20:42:09 +02:00
|
|
|
if (size != sizeof(hpack)) return FALSE;
|
2002-01-18 20:22:55 +01:00
|
|
|
if (!buffer || !*buffer) return FALSE;
|
|
|
|
uiLo = *lparam;
|
2010-03-30 20:42:09 +02:00
|
|
|
memcpy( &hpack, *buffer, size );
|
|
|
|
hMem = unpack_ptr( hpack );
|
2005-09-12 23:22:32 +02:00
|
|
|
uiHi = (UINT_PTR)hMem;
|
2007-05-24 16:41:17 +02:00
|
|
|
TRACE("recv dde-ack %lx mem=%lx[%lx]\n", uiLo, uiHi, GlobalSize( hMem ));
|
2002-01-18 20:22:55 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
uiLo = LOWORD( *lparam );
|
|
|
|
uiHi = HIWORD( *lparam );
|
2007-05-24 16:41:17 +02:00
|
|
|
TRACE("recv dde-ack %lx atom=%lx\n", uiLo, uiHi);
|
2002-01-18 20:22:55 +01:00
|
|
|
}
|
|
|
|
*lparam = PackDDElParam( WM_DDE_ACK, uiLo, uiHi );
|
|
|
|
break;
|
|
|
|
case WM_DDE_ADVISE:
|
|
|
|
case WM_DDE_DATA:
|
|
|
|
case WM_DDE_POKE:
|
|
|
|
if ((!buffer || !*buffer) && message != WM_DDE_DATA) return FALSE;
|
|
|
|
uiHi = *lparam;
|
|
|
|
if (size)
|
|
|
|
{
|
2005-03-14 18:13:44 +01:00
|
|
|
if (!(hMem = GlobalAlloc( GMEM_MOVEABLE|GMEM_DDESHARE, size )))
|
|
|
|
return FALSE;
|
|
|
|
if ((ptr = GlobalLock( hMem )))
|
2002-01-18 20:22:55 +01:00
|
|
|
{
|
|
|
|
memcpy( ptr, *buffer, size );
|
|
|
|
GlobalUnlock( hMem );
|
|
|
|
}
|
2005-03-14 18:13:44 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
GlobalFree( hMem );
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-01-18 20:22:55 +01:00
|
|
|
}
|
2005-09-12 23:22:32 +02:00
|
|
|
uiLo = (UINT_PTR)hMem;
|
2002-01-18 20:22:55 +01:00
|
|
|
|
|
|
|
*lparam = PackDDElParam( message, uiLo, uiHi );
|
|
|
|
break;
|
|
|
|
case WM_DDE_EXECUTE:
|
|
|
|
if (size)
|
|
|
|
{
|
|
|
|
if (!buffer || !*buffer) return FALSE;
|
2005-03-14 18:13:44 +01:00
|
|
|
if (!(hMem = GlobalAlloc( GMEM_MOVEABLE|GMEM_DDESHARE, size ))) return FALSE;
|
|
|
|
if ((ptr = GlobalLock( hMem )))
|
2002-01-18 20:22:55 +01:00
|
|
|
{
|
|
|
|
memcpy( ptr, *buffer, size );
|
|
|
|
GlobalUnlock( hMem );
|
2007-05-30 12:32:24 +02:00
|
|
|
TRACE( "exec: pairing c=%08lx s=%p\n", *lparam, hMem );
|
2002-11-22 21:43:01 +01:00
|
|
|
if (!dde_add_pair( (HGLOBAL)*lparam, hMem ))
|
2002-01-18 20:22:55 +01:00
|
|
|
{
|
|
|
|
GlobalFree( hMem );
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-03-14 18:13:44 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GlobalFree( hMem );
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-01-18 20:22:55 +01:00
|
|
|
} else return FALSE;
|
2002-11-22 21:43:01 +01:00
|
|
|
*lparam = (LPARAM)hMem;
|
2002-01-18 20:22:55 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
2001-10-16 23:58:58 +02:00
|
|
|
|
2022-04-06 11:10:45 +02:00
|
|
|
BOOL process_rawinput_message( MSG *msg, UINT hw_id, const struct hardware_msg_data *msg_data )
|
2012-09-11 00:27:04 +02:00
|
|
|
{
|
2020-07-06 12:04:50 +02:00
|
|
|
struct rawinput_thread_data *thread_data = rawinput_thread_data();
|
2012-09-11 00:27:04 +02:00
|
|
|
|
2021-12-14 21:24:22 +01:00
|
|
|
if (msg->message == WM_INPUT_DEVICE_CHANGE)
|
|
|
|
rawinput_update_device_list();
|
|
|
|
else
|
2021-05-11 10:17:21 +02:00
|
|
|
{
|
2021-05-28 16:12:18 +02:00
|
|
|
thread_data->buffer->header.dwSize = RAWINPUT_BUFFER_SIZE;
|
2021-05-11 10:17:21 +02:00
|
|
|
if (!rawinput_from_hardware_message( thread_data->buffer, msg_data )) return FALSE;
|
|
|
|
thread_data->hw_id = hw_id;
|
|
|
|
msg->lParam = (LPARAM)hw_id;
|
|
|
|
}
|
|
|
|
|
2018-08-27 14:02:43 +02:00
|
|
|
msg->pt = point_phys_to_win_dpi( msg->hwnd, msg->pt );
|
2012-09-11 00:27:04 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-01-08 01:27:58 +01:00
|
|
|
|
2001-08-07 21:19:08 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* SendMessageTimeoutW (USER32.@)
|
|
|
|
*/
|
|
|
|
LRESULT WINAPI SendMessageTimeoutW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
|
2002-10-31 02:04:39 +01:00
|
|
|
UINT flags, UINT timeout, PDWORD_PTR res_ptr )
|
2001-08-07 21:19:08 +02:00
|
|
|
{
|
2022-04-04 16:57:43 +02:00
|
|
|
struct send_message_timeout_params params = { .flags = flags, .timeout = timeout };
|
|
|
|
LRESULT res;
|
2001-08-07 21:19:08 +02:00
|
|
|
|
2022-04-08 13:30:22 +02:00
|
|
|
res = NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms, NtUserSendMessageTimeout, FALSE );
|
2022-04-04 16:57:43 +02:00
|
|
|
if (res_ptr) *res_ptr = res;
|
|
|
|
return params.result;
|
2006-05-18 19:47:40 +02:00
|
|
|
}
|
2001-08-07 21:19:08 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SendMessageTimeoutA (USER32.@)
|
|
|
|
*/
|
|
|
|
LRESULT WINAPI SendMessageTimeoutA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
|
2002-10-31 02:04:39 +01:00
|
|
|
UINT flags, UINT timeout, PDWORD_PTR res_ptr )
|
2001-08-07 21:19:08 +02:00
|
|
|
{
|
2022-04-04 16:58:00 +02:00
|
|
|
struct send_message_timeout_params params = { .flags = flags, .timeout = timeout };
|
|
|
|
LRESULT res = 0;
|
2001-08-07 21:19:08 +02:00
|
|
|
|
2022-04-04 16:58:00 +02:00
|
|
|
if (msg != WM_CHAR || WIN_IsCurrentThread( hwnd ))
|
|
|
|
{
|
|
|
|
res = NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms,
|
2022-04-08 13:30:22 +02:00
|
|
|
NtUserSendMessageTimeout, TRUE );
|
2022-04-04 16:58:00 +02:00
|
|
|
}
|
|
|
|
else if (map_wparam_AtoW( msg, &wparam, WMCHAR_MAP_SENDMESSAGE ))
|
|
|
|
{
|
|
|
|
res = NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms,
|
2022-04-08 13:30:22 +02:00
|
|
|
NtUserSendMessageTimeout, FALSE );
|
2022-04-04 16:58:00 +02:00
|
|
|
}
|
2001-08-07 21:19:08 +02:00
|
|
|
|
2022-04-04 16:58:00 +02:00
|
|
|
if (res_ptr) *res_ptr = res;
|
|
|
|
return params.result;
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SendMessageW (USER32.@)
|
|
|
|
*/
|
|
|
|
LRESULT WINAPI SendMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
|
|
|
{
|
2022-04-08 13:30:22 +02:00
|
|
|
return NtUserMessageCall( hwnd, msg, wparam, lparam, NULL, NtUserSendMessage, FALSE );
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SendMessageA (USER32.@)
|
|
|
|
*/
|
|
|
|
LRESULT WINAPI SendMessageA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
|
|
|
{
|
2022-04-04 16:58:21 +02:00
|
|
|
if (msg == WM_CHAR && !WIN_IsCurrentThread( hwnd ))
|
|
|
|
{
|
|
|
|
if (!map_wparam_AtoW( msg, &wparam, WMCHAR_MAP_SENDMESSAGE ))
|
|
|
|
return 0;
|
2022-04-08 13:30:22 +02:00
|
|
|
return NtUserMessageCall( hwnd, msg, wparam, lparam, NULL, NtUserSendMessage, FALSE );
|
2022-04-04 16:58:21 +02:00
|
|
|
}
|
2007-08-08 16:23:23 +02:00
|
|
|
|
2022-04-08 13:30:22 +02:00
|
|
|
return NtUserMessageCall( hwnd, msg, wparam, lparam, NULL, NtUserSendMessage, TRUE );
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SendNotifyMessageA (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SendNotifyMessageA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
|
|
|
{
|
2022-04-04 16:58:49 +02:00
|
|
|
if (!WIN_IsCurrentThread( hwnd ) && !map_wparam_AtoW( msg, &wparam, WMCHAR_MAP_SENDMESSAGE ))
|
2007-08-08 16:23:23 +02:00
|
|
|
return FALSE;
|
|
|
|
|
2022-04-08 13:30:22 +02:00
|
|
|
return NtUserMessageCall( hwnd, msg, wparam, lparam, 0, NtUserSendNotifyMessage, TRUE );
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SendNotifyMessageW (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SendNotifyMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
|
|
|
{
|
2022-04-08 13:30:22 +02:00
|
|
|
return NtUserMessageCall( hwnd, msg, wparam, lparam, 0, NtUserSendNotifyMessage, FALSE );
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SendMessageCallbackA (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SendMessageCallbackA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
|
|
|
|
SENDASYNCPROC callback, ULONG_PTR data )
|
|
|
|
{
|
2022-04-04 16:59:28 +02:00
|
|
|
struct send_message_callback_params params = { .callback = callback, .data = data };
|
2007-08-08 16:23:23 +02:00
|
|
|
|
2022-04-04 16:59:28 +02:00
|
|
|
if (!WIN_IsCurrentThread( hwnd ) && !map_wparam_AtoW( msg, &wparam, WMCHAR_MAP_SENDMESSAGE ))
|
2007-08-08 16:23:23 +02:00
|
|
|
return FALSE;
|
|
|
|
|
2022-04-08 13:30:22 +02:00
|
|
|
return NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms, NtUserSendMessageCallback, TRUE );
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SendMessageCallbackW (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SendMessageCallbackW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
|
|
|
|
SENDASYNCPROC callback, ULONG_PTR data )
|
|
|
|
{
|
2022-04-04 16:59:02 +02:00
|
|
|
struct send_message_callback_params params = { .callback = callback, .data = data };
|
2022-04-08 13:30:22 +02:00
|
|
|
return NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms, NtUserSendMessageCallback, FALSE );
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* ReplyMessage (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI ReplyMessage( LRESULT result )
|
|
|
|
{
|
2022-04-13 15:07:48 +02:00
|
|
|
return NtUserReplyMessage( result, NULL );
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InSendMessage (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InSendMessage(void)
|
|
|
|
{
|
2016-08-30 07:38:15 +02:00
|
|
|
return (InSendMessageEx( NULL ) & (ISMEX_SEND | ISMEX_NOTIFY | ISMEX_CALLBACK)) != 0;
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InSendMessageEx (USER32.@)
|
|
|
|
*/
|
|
|
|
DWORD WINAPI InSendMessageEx( LPVOID reserved )
|
|
|
|
{
|
2005-04-27 10:18:20 +02:00
|
|
|
struct received_message_info *info = get_user_thread_info()->receive_info;
|
2001-08-07 21:19:08 +02:00
|
|
|
|
|
|
|
if (info) return info->flags;
|
|
|
|
return ISMEX_NOSEND;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PostMessageA (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI PostMessageA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
|
|
|
{
|
2007-08-08 18:25:38 +02:00
|
|
|
if (!map_wparam_AtoW( msg, &wparam, WMCHAR_MAP_POSTMESSAGE )) return TRUE;
|
|
|
|
return PostMessageW( hwnd, msg, wparam, lparam );
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PostMessageW (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI PostMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
|
|
|
{
|
2022-04-06 11:05:31 +02:00
|
|
|
return NtUserPostMessage( hwnd, msg, wparam, lparam );
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* PostThreadMessageA (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI PostThreadMessageA( DWORD thread, UINT msg, WPARAM wparam, LPARAM lparam )
|
|
|
|
{
|
2007-08-08 18:25:38 +02:00
|
|
|
if (!map_wparam_AtoW( msg, &wparam, WMCHAR_MAP_POSTMESSAGE )) return TRUE;
|
2022-04-06 11:05:19 +02:00
|
|
|
return NtUserPostThreadMessage( thread, msg, wparam, lparam );
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PostQuitMessage (USER32.@)
|
2006-01-17 13:14:31 +01:00
|
|
|
*
|
|
|
|
* Posts a quit message to the current thread's message queue.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* exit_code [I] Exit code to return from message loop.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Nothing.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* This function is not the same as calling:
|
|
|
|
*|PostThreadMessage(GetCurrentThreadId(), WM_QUIT, exit_code, 0);
|
|
|
|
* It instead sets a flag in the message queue that signals it to generate
|
|
|
|
* a WM_QUIT message when there are no other pending sent or posted messages
|
|
|
|
* in the queue.
|
2001-08-07 21:19:08 +02:00
|
|
|
*/
|
2006-01-17 13:14:31 +01:00
|
|
|
void WINAPI PostQuitMessage( INT exit_code )
|
2001-08-07 21:19:08 +02:00
|
|
|
{
|
2006-01-17 13:14:31 +01:00
|
|
|
SERVER_START_REQ( post_quit_message )
|
|
|
|
{
|
|
|
|
req->exit_code = exit_code;
|
|
|
|
wine_server_call( req );
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PeekMessageW (USER32.@)
|
|
|
|
*/
|
2010-08-25 13:46:03 +02:00
|
|
|
BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageW( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT flags )
|
2001-08-07 21:19:08 +02:00
|
|
|
{
|
2022-03-31 15:36:51 +02:00
|
|
|
return NtUserPeekMessage( msg_out, hwnd, first, last, flags );
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PeekMessageA (USER32.@)
|
|
|
|
*/
|
2010-08-25 13:46:03 +02:00
|
|
|
BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageA( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags )
|
2001-08-07 21:19:08 +02:00
|
|
|
{
|
2007-08-08 20:35:24 +02:00
|
|
|
if (get_pending_wmchar( msg, first, last, (flags & PM_REMOVE) )) return TRUE;
|
|
|
|
if (!PeekMessageW( msg, hwnd, first, last, flags )) return FALSE;
|
|
|
|
map_wparam_WtoA( msg, (flags & PM_REMOVE) );
|
|
|
|
return TRUE;
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetMessageW (USER32.@)
|
|
|
|
*/
|
2010-08-25 13:46:03 +02:00
|
|
|
BOOL WINAPI DECLSPEC_HOTPATCH GetMessageW( MSG *msg, HWND hwnd, UINT first, UINT last )
|
2001-08-07 21:19:08 +02:00
|
|
|
{
|
2022-03-31 15:37:04 +02:00
|
|
|
return NtUserGetMessage( msg, hwnd, first, last );
|
2001-08-07 21:19:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetMessageA (USER32.@)
|
|
|
|
*/
|
2010-08-25 13:46:03 +02:00
|
|
|
BOOL WINAPI DECLSPEC_HOTPATCH GetMessageA( MSG *msg, HWND hwnd, UINT first, UINT last )
|
2001-08-07 21:19:08 +02:00
|
|
|
{
|
2007-08-08 20:35:24 +02:00
|
|
|
if (get_pending_wmchar( msg, first, last, TRUE )) return TRUE;
|
2019-09-14 19:35:40 +02:00
|
|
|
if (GetMessageW( msg, hwnd, first, last ) < 0) return -1;
|
2007-08-08 20:35:24 +02:00
|
|
|
map_wparam_WtoA( msg, TRUE );
|
2001-08-07 21:19:08 +02:00
|
|
|
return (msg->message != WM_QUIT);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-05 02:23:02 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* IsDialogMessageA (USER32.@)
|
2005-11-09 11:33:40 +01:00
|
|
|
* IsDialogMessage (USER32.@)
|
2002-07-05 02:23:02 +02:00
|
|
|
*/
|
|
|
|
BOOL WINAPI IsDialogMessageA( HWND hwndDlg, LPMSG pmsg )
|
|
|
|
{
|
|
|
|
MSG msg = *pmsg;
|
2007-08-08 18:25:38 +02:00
|
|
|
map_wparam_AtoW( msg.message, &msg.wParam, WMCHAR_MAP_NOMAPPING );
|
2002-07-05 02:23:02 +02:00
|
|
|
return IsDialogMessageW( hwndDlg, &msg );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-07 18:19:24 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* TranslateMessage (USER32.@)
|
|
|
|
*
|
|
|
|
* Implementation of TranslateMessage.
|
|
|
|
*
|
|
|
|
* TranslateMessage translates virtual-key messages into character-messages,
|
|
|
|
* as follows :
|
|
|
|
* WM_KEYDOWN/WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message.
|
|
|
|
* ditto replacing WM_* with WM_SYS*
|
|
|
|
* This produces WM_CHAR messages only for keys mapped to ASCII characters
|
|
|
|
* by the keyboard driver.
|
|
|
|
*
|
|
|
|
* If the message is WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, or WM_SYSKEYUP, the
|
|
|
|
* return value is nonzero, regardless of the translation.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI TranslateMessage( const MSG *msg )
|
|
|
|
{
|
2022-04-15 14:52:36 +02:00
|
|
|
return NtUserTranslateMessage( msg, 0 );
|
2005-03-07 18:19:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DispatchMessageA (USER32.@)
|
2005-11-09 11:33:40 +01:00
|
|
|
*
|
|
|
|
* See DispatchMessageW.
|
2005-03-07 18:19:24 +01:00
|
|
|
*/
|
2009-09-12 14:10:56 +02:00
|
|
|
LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageA( const MSG* msg )
|
2005-03-07 18:19:24 +01:00
|
|
|
{
|
2007-08-07 17:45:10 +02:00
|
|
|
LRESULT retval;
|
2005-03-07 18:19:24 +01:00
|
|
|
|
|
|
|
/* Process timer messages */
|
2022-04-21 02:15:33 +02:00
|
|
|
if (msg->lParam && msg->message == WM_TIMER)
|
2005-03-07 18:19:24 +01:00
|
|
|
{
|
2022-04-21 02:15:33 +02:00
|
|
|
__TRY
|
2009-09-30 01:39:25 +02:00
|
|
|
{
|
2022-04-21 02:15:33 +02:00
|
|
|
retval = CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd,
|
|
|
|
msg->message, msg->wParam, GetTickCount() );
|
|
|
|
}
|
|
|
|
__EXCEPT_ALL
|
|
|
|
{
|
|
|
|
retval = 0;
|
2009-09-30 01:39:25 +02:00
|
|
|
}
|
2022-04-21 02:15:33 +02:00
|
|
|
__ENDTRY
|
|
|
|
return retval;
|
2005-03-07 18:19:24 +01:00
|
|
|
}
|
2022-04-13 15:07:13 +02:00
|
|
|
return NtUserDispatchMessageA( msg );
|
2005-03-07 18:19:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DispatchMessageW (USER32.@) Process a message
|
|
|
|
*
|
|
|
|
* Process the message specified in the structure *_msg_.
|
|
|
|
*
|
|
|
|
* If the lpMsg parameter points to a WM_TIMER message and the
|
|
|
|
* parameter of the WM_TIMER message is not NULL, the lParam parameter
|
|
|
|
* points to the function that is called instead of the window
|
2009-09-30 01:39:25 +02:00
|
|
|
* procedure. The function stored in lParam (timer callback) is protected
|
|
|
|
* from causing page-faults.
|
2005-03-07 18:19:24 +01:00
|
|
|
*
|
|
|
|
* The message must be valid.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
* DispatchMessage() returns the result of the window procedure invoked.
|
|
|
|
*
|
|
|
|
* CONFORMANCE
|
|
|
|
*
|
|
|
|
* ECMA-234, Win32
|
|
|
|
*
|
|
|
|
*/
|
2009-09-12 14:10:56 +02:00
|
|
|
LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageW( const MSG* msg )
|
2005-03-07 18:19:24 +01:00
|
|
|
{
|
2007-08-07 17:45:10 +02:00
|
|
|
LRESULT retval;
|
2005-03-07 18:19:24 +01:00
|
|
|
|
|
|
|
/* Process timer messages */
|
|
|
|
if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER))
|
|
|
|
{
|
2009-09-30 01:39:25 +02:00
|
|
|
if (msg->lParam)
|
|
|
|
{
|
|
|
|
__TRY
|
|
|
|
{
|
|
|
|
retval = CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd,
|
|
|
|
msg->message, msg->wParam, GetTickCount() );
|
|
|
|
}
|
2014-11-10 09:27:54 +01:00
|
|
|
__EXCEPT_ALL
|
2009-09-30 01:39:25 +02:00
|
|
|
{
|
|
|
|
retval = 0;
|
|
|
|
}
|
|
|
|
__ENDTRY
|
|
|
|
return retval;
|
|
|
|
}
|
2005-03-07 18:19:24 +01:00
|
|
|
}
|
2022-03-23 14:01:18 +01:00
|
|
|
return NtUserDispatchMessage( msg );
|
2005-03-07 18:19:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-26 10:18:47 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* GetMessagePos (USER.119)
|
|
|
|
* GetMessagePos (USER32.@)
|
|
|
|
*
|
|
|
|
* The GetMessagePos() function returns a long value representing a
|
|
|
|
* cursor position, in screen coordinates, when the last message
|
|
|
|
* retrieved by the GetMessage() function occurs. The x-coordinate is
|
|
|
|
* in the low-order word of the return value, the y-coordinate is in
|
|
|
|
* the high-order word. The application can use the MAKEPOINT()
|
|
|
|
* macro to obtain a POINT structure from the return value.
|
|
|
|
*
|
|
|
|
* For the current cursor position, use GetCursorPos().
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
* Cursor position of last message on success, zero on failure.
|
|
|
|
*
|
|
|
|
* CONFORMANCE
|
|
|
|
*
|
|
|
|
* ECMA-234, Win32
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
DWORD WINAPI GetMessagePos(void)
|
|
|
|
{
|
2022-04-19 15:31:01 +02:00
|
|
|
return NtUserGetThreadInfo()->message_pos;
|
2005-04-26 10:18:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetMessageTime (USER.120)
|
|
|
|
* GetMessageTime (USER32.@)
|
|
|
|
*
|
|
|
|
* GetMessageTime() returns the message time for the last message
|
|
|
|
* retrieved by the function. The time is measured in milliseconds with
|
|
|
|
* the same offset as GetTickCount().
|
|
|
|
*
|
|
|
|
* Since the tick count wraps, this is only useful for moderately short
|
|
|
|
* relative time comparisons.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
* Time of last message on success, zero on failure.
|
|
|
|
*/
|
|
|
|
LONG WINAPI GetMessageTime(void)
|
|
|
|
{
|
2022-04-19 15:31:01 +02:00
|
|
|
return NtUserGetThreadInfo()->message_time;
|
2005-04-26 10:18:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetMessageExtraInfo (USER.288)
|
|
|
|
* GetMessageExtraInfo (USER32.@)
|
|
|
|
*/
|
|
|
|
LPARAM WINAPI GetMessageExtraInfo(void)
|
|
|
|
{
|
2022-04-19 15:31:01 +02:00
|
|
|
return NtUserGetThreadInfo()->message_extra;
|
2005-04-26 10:18:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SetMessageExtraInfo (USER32.@)
|
|
|
|
*/
|
|
|
|
LPARAM WINAPI SetMessageExtraInfo(LPARAM lParam)
|
|
|
|
{
|
2022-04-19 15:31:01 +02:00
|
|
|
struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
|
|
|
|
LONG old_value = thread_info->message_extra;
|
|
|
|
thread_info->message_extra = lParam;
|
2005-04-26 10:18:47 +02:00
|
|
|
return old_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-05 12:58:33 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* GetCurrentInputMessageSource (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI GetCurrentInputMessageSource( INPUT_MESSAGE_SOURCE *source )
|
|
|
|
{
|
2018-11-05 13:01:08 +01:00
|
|
|
*source = get_user_thread_info()->msg_source;
|
|
|
|
return TRUE;
|
2018-11-05 12:58:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-10 16:47:53 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* WaitMessage (USER.112) Suspend thread pending messages
|
|
|
|
* WaitMessage (USER32.@) Suspend thread pending messages
|
|
|
|
*
|
|
|
|
* WaitMessage() suspends a thread until events appear in the thread's
|
|
|
|
* queue.
|
|
|
|
*/
|
|
|
|
BOOL WINAPI WaitMessage(void)
|
|
|
|
{
|
2022-04-01 14:45:57 +02:00
|
|
|
return NtUserMsgWaitForMultipleObjectsEx( 0, NULL, INFINITE, QS_ALLINPUT, 0 ) != WAIT_FAILED;
|
2005-03-10 16:47:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MsgWaitForMultipleObjects (USER32.@)
|
|
|
|
*/
|
2013-09-24 12:25:02 +02:00
|
|
|
DWORD WINAPI MsgWaitForMultipleObjects( DWORD count, const HANDLE *handles,
|
2005-03-10 16:47:53 +01:00
|
|
|
BOOL wait_all, DWORD timeout, DWORD mask )
|
|
|
|
{
|
2022-04-01 14:45:57 +02:00
|
|
|
return NtUserMsgWaitForMultipleObjectsEx( count, handles, timeout, mask,
|
|
|
|
wait_all ? MWMO_WAITALL : 0 );
|
2005-03-10 16:47:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* WaitForInputIdle (USER32.@)
|
|
|
|
*/
|
2022-04-01 14:46:04 +02:00
|
|
|
DWORD WINAPI WaitForInputIdle( HANDLE process, DWORD timeout )
|
2005-03-10 16:47:53 +01:00
|
|
|
{
|
2022-04-01 14:46:04 +02:00
|
|
|
return NtUserWaitForInputIdle( process, timeout, FALSE );
|
2005-03-10 16:47:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RegisterWindowMessageA (USER32.@)
|
2005-11-09 11:33:40 +01:00
|
|
|
* RegisterWindowMessage (USER.118)
|
2005-03-10 16:47:53 +01:00
|
|
|
*/
|
2005-08-22 11:15:55 +02:00
|
|
|
UINT WINAPI RegisterWindowMessageA( LPCSTR str )
|
2005-03-10 16:47:53 +01:00
|
|
|
{
|
2005-08-22 11:15:55 +02:00
|
|
|
UINT ret = GlobalAddAtomA(str);
|
|
|
|
TRACE("%s, ret=%x\n", str, ret);
|
|
|
|
return ret;
|
2005-03-10 16:47:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RegisterWindowMessageW (USER32.@)
|
|
|
|
*/
|
2005-08-22 11:15:55 +02:00
|
|
|
UINT WINAPI RegisterWindowMessageW( LPCWSTR str )
|
2005-03-10 16:47:53 +01:00
|
|
|
{
|
2005-08-22 11:15:55 +02:00
|
|
|
UINT ret = GlobalAddAtomW(str);
|
|
|
|
TRACE("%s ret=%x\n", debugstr_w(str), ret);
|
|
|
|
return ret;
|
2005-03-10 16:47:53 +01:00
|
|
|
}
|
|
|
|
|
2008-04-01 21:15:55 +02:00
|
|
|
typedef struct BroadcastParm
|
|
|
|
{
|
|
|
|
DWORD flags;
|
|
|
|
LPDWORD recipients;
|
|
|
|
UINT msg;
|
|
|
|
WPARAM wp;
|
|
|
|
LPARAM lp;
|
2013-11-20 01:26:25 +01:00
|
|
|
BOOL success;
|
2008-04-01 21:15:55 +02:00
|
|
|
HWINSTA winsta;
|
|
|
|
} BroadcastParm;
|
2005-03-10 16:47:53 +01:00
|
|
|
|
2008-04-01 21:15:55 +02:00
|
|
|
static BOOL CALLBACK bcast_childwindow( HWND hw, LPARAM lp )
|
2005-03-10 16:47:53 +01:00
|
|
|
{
|
2008-04-01 21:15:55 +02:00
|
|
|
BroadcastParm *parm = (BroadcastParm*)lp;
|
|
|
|
DWORD_PTR retval = 0;
|
2008-04-11 14:20:51 +02:00
|
|
|
LRESULT lresult;
|
2008-04-01 21:15:55 +02:00
|
|
|
|
|
|
|
if (parm->flags & BSF_IGNORECURRENTTASK && WIN_IsCurrentProcess(hw))
|
|
|
|
{
|
|
|
|
TRACE("Not telling myself %p\n", hw);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* I don't know 100% for sure if this is what Windows does, but it fits the tests */
|
|
|
|
if (parm->flags & BSF_QUERY)
|
|
|
|
{
|
|
|
|
TRACE("Telling window %p using SendMessageTimeout\n", hw);
|
|
|
|
|
|
|
|
/* Not tested for conflicting flags */
|
|
|
|
if (parm->flags & BSF_FORCEIFHUNG || parm->flags & BSF_NOHANG)
|
|
|
|
lresult = SendMessageTimeoutW( hw, parm->msg, parm->wp, parm->lp, SMTO_ABORTIFHUNG, 2000, &retval );
|
|
|
|
else if (parm->flags & BSF_NOTIMEOUTIFNOTHUNG)
|
|
|
|
lresult = SendMessageTimeoutW( hw, parm->msg, parm->wp, parm->lp, SMTO_NOTIMEOUTIFNOTHUNG, 2000, &retval );
|
|
|
|
else
|
|
|
|
lresult = SendMessageTimeoutW( hw, parm->msg, parm->wp, parm->lp, SMTO_NORMAL, 2000, &retval );
|
|
|
|
|
|
|
|
if (!lresult && GetLastError() == ERROR_TIMEOUT)
|
|
|
|
{
|
|
|
|
WARN("Timed out!\n");
|
|
|
|
if (!(parm->flags & BSF_FORCEIFHUNG))
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
if (retval == BROADCAST_QUERY_DENY)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
fail:
|
2013-11-20 01:26:25 +01:00
|
|
|
parm->success = FALSE;
|
2008-04-01 21:15:55 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (parm->flags & BSF_POSTMESSAGE)
|
2005-03-10 16:47:53 +01:00
|
|
|
{
|
2008-04-01 21:15:55 +02:00
|
|
|
TRACE("Telling window %p using PostMessage\n", hw);
|
|
|
|
PostMessageW( hw, parm->msg, parm->wp, parm->lp );
|
2005-03-10 16:47:53 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-04-01 21:15:55 +02:00
|
|
|
TRACE("Telling window %p using SendNotifyMessage\n", hw);
|
|
|
|
SendNotifyMessageW( hw, parm->msg, parm->wp, parm->lp );
|
2005-03-10 16:47:53 +01:00
|
|
|
}
|
2008-04-01 21:15:55 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CALLBACK bcast_desktop( LPWSTR desktop, LPARAM lp )
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
HDESK hdesktop;
|
|
|
|
BroadcastParm *parm = (BroadcastParm*)lp;
|
|
|
|
|
|
|
|
TRACE("desktop: %s\n", debugstr_w( desktop ));
|
|
|
|
|
|
|
|
hdesktop = open_winstation_desktop( parm->winsta, desktop, 0, FALSE, DESKTOP_ENUMERATE|DESKTOP_WRITEOBJECTS|STANDARD_RIGHTS_WRITE );
|
|
|
|
if (!hdesktop)
|
|
|
|
{
|
|
|
|
FIXME("Could not open desktop %s\n", debugstr_w(desktop));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = EnumDesktopWindows( hdesktop, bcast_childwindow, lp );
|
2021-10-13 14:53:36 +02:00
|
|
|
NtUserCloseDesktop( hdesktop );
|
2008-04-01 21:15:55 +02:00
|
|
|
TRACE("-->%d\n", ret);
|
|
|
|
return parm->success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CALLBACK bcast_winsta( LPWSTR winsta, LPARAM lp )
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
HWINSTA hwinsta = OpenWindowStationW( winsta, FALSE, WINSTA_ENUMDESKTOPS );
|
|
|
|
TRACE("hwinsta: %p/%s/%08x\n", hwinsta, debugstr_w( winsta ), GetLastError());
|
|
|
|
if (!hwinsta)
|
|
|
|
return TRUE;
|
|
|
|
((BroadcastParm *)lp)->winsta = hwinsta;
|
|
|
|
ret = EnumDesktopsW( hwinsta, bcast_desktop, lp );
|
2021-10-12 16:42:35 +02:00
|
|
|
NtUserCloseWindowStation( hwinsta );
|
2008-04-01 21:15:55 +02:00
|
|
|
TRACE("-->%d\n", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* BroadcastSystemMessageA (USER32.@)
|
|
|
|
* BroadcastSystemMessage (USER32.@)
|
|
|
|
*/
|
|
|
|
LONG WINAPI BroadcastSystemMessageA( DWORD flags, LPDWORD recipients, UINT msg, WPARAM wp, LPARAM lp )
|
|
|
|
{
|
|
|
|
return BroadcastSystemMessageExA( flags, recipients, msg, wp, lp, NULL );
|
2005-03-10 16:47:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* BroadcastSystemMessageW (USER32.@)
|
|
|
|
*/
|
|
|
|
LONG WINAPI BroadcastSystemMessageW( DWORD flags, LPDWORD recipients, UINT msg, WPARAM wp, LPARAM lp )
|
|
|
|
{
|
2008-04-01 21:15:55 +02:00
|
|
|
return BroadcastSystemMessageExW( flags, recipients, msg, wp, lp, NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* BroadcastSystemMessageExA (USER32.@)
|
|
|
|
*/
|
|
|
|
LONG WINAPI BroadcastSystemMessageExA( DWORD flags, LPDWORD recipients, UINT msg, WPARAM wp, LPARAM lp, PBSMINFO pinfo )
|
|
|
|
{
|
|
|
|
map_wparam_AtoW( msg, &wp, WMCHAR_MAP_NOMAPPING );
|
|
|
|
return BroadcastSystemMessageExW( flags, recipients, msg, wp, lp, NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* BroadcastSystemMessageExW (USER32.@)
|
|
|
|
*/
|
|
|
|
LONG WINAPI BroadcastSystemMessageExW( DWORD flags, LPDWORD recipients, UINT msg, WPARAM wp, LPARAM lp, PBSMINFO pinfo )
|
|
|
|
{
|
|
|
|
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 );
|
|
|
|
|
|
|
|
TRACE("Flags: %08x, recipients: %p(0x%x), msg: %04x, wparam: %08lx, lparam: %08lx\n", flags, recipients,
|
|
|
|
(recipients ? *recipients : recips), msg, wp, lp);
|
|
|
|
|
|
|
|
if (flags & ~all_flags)
|
2005-03-10 16:47:53 +01:00
|
|
|
{
|
2008-04-01 21:15:55 +02:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return 0;
|
2005-03-10 16:47:53 +01:00
|
|
|
}
|
2008-04-01 21:15:55 +02:00
|
|
|
|
|
|
|
if (!recipients)
|
|
|
|
recipients = &recips;
|
|
|
|
|
|
|
|
if ( pinfo && flags & BSF_QUERY )
|
|
|
|
FIXME("Not returning PBSMINFO information yet\n");
|
|
|
|
|
|
|
|
parm.flags = flags;
|
|
|
|
parm.recipients = recipients;
|
|
|
|
parm.msg = msg;
|
|
|
|
parm.wp = wp;
|
|
|
|
parm.lp = lp;
|
|
|
|
parm.success = TRUE;
|
|
|
|
|
|
|
|
if (*recipients & BSM_ALLDESKTOPS || *recipients == BSM_ALLCOMPONENTS)
|
|
|
|
ret = EnumWindowStationsW(bcast_winsta, (LONG_PTR)&parm);
|
|
|
|
else if (*recipients & BSM_APPLICATIONS)
|
2005-03-10 16:47:53 +01:00
|
|
|
{
|
2008-04-01 21:15:55 +02:00
|
|
|
EnumWindows(bcast_childwindow, (LONG_PTR)&parm);
|
|
|
|
ret = parm.success;
|
2005-03-10 16:47:53 +01:00
|
|
|
}
|
2008-04-01 21:15:55 +02:00
|
|
|
else
|
|
|
|
FIXME("Recipients %08x not supported!\n", *recipients);
|
2005-03-10 16:47:53 +01:00
|
|
|
|
2008-04-01 21:15:55 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2005-03-10 16:47:53 +01:00
|
|
|
|
2001-08-07 21:19:08 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* SetMessageQueue (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SetMessageQueue( INT size )
|
|
|
|
{
|
|
|
|
/* now obsolete the message queue will be expanded dynamically as necessary */
|
|
|
|
return TRUE;
|
|
|
|
}
|
2002-10-11 20:50:15 +02:00
|
|
|
|
|
|
|
|
2004-09-02 00:47:48 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MessageBeep (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI MessageBeep( UINT i )
|
|
|
|
{
|
2022-04-13 15:07:13 +02:00
|
|
|
return NtUserMessageBeep( i );
|
2004-09-02 00:47:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-04-29 12:34:53 +02:00
|
|
|
/******************************************************************
|
|
|
|
* SetTimer (USER32.@)
|
|
|
|
*/
|
|
|
|
UINT_PTR WINAPI SetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc )
|
|
|
|
{
|
2022-03-16 15:35:55 +01:00
|
|
|
return NtUserSetTimer( hwnd, id, timeout, proc, TIMERV_DEFAULT_COALESCING );
|
2016-04-29 12:34:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-04-21 02:15:31 +02:00
|
|
|
/******************************************************************
|
|
|
|
* SetSystemTimer (USER32.@)
|
|
|
|
*/
|
|
|
|
UINT_PTR WINAPI SetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, void *unknown )
|
|
|
|
{
|
|
|
|
if (unknown) FIXME( "ignoring unknown parameter %p\n", unknown );
|
|
|
|
|
|
|
|
return NtUserSetSystemTimer( hwnd, id, timeout );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-29 19:18:02 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* KillSystemTimer (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI KillSystemTimer( HWND hwnd, UINT_PTR id )
|
|
|
|
{
|
2022-04-13 15:08:21 +02:00
|
|
|
return NtUserKillSystemTimer( hwnd, id );
|
2004-11-29 19:18:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-16 21:01:08 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* IsGUIThread (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI IsGUIThread( BOOL convert )
|
|
|
|
{
|
|
|
|
FIXME( "%u: stub\n", convert );
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-09-15 21:58:05 +02:00
|
|
|
/******************************************************************
|
|
|
|
* IsHungAppWindow (USER32.@)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI IsHungAppWindow( HWND hWnd )
|
|
|
|
{
|
2007-12-28 03:59:13 +01:00
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
SERVER_START_REQ( is_window_hung )
|
|
|
|
{
|
2008-12-08 16:58:20 +01:00
|
|
|
req->win = wine_server_user_handle( hWnd );
|
2007-12-28 03:59:13 +01:00
|
|
|
ret = !wine_server_call_err( req ) && reply->is_hung;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
2003-09-15 21:58:05 +02:00
|
|
|
}
|
2008-11-11 10:18:11 +01:00
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* ChangeWindowMessageFilter (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI ChangeWindowMessageFilter( UINT message, DWORD flag )
|
|
|
|
{
|
|
|
|
FIXME( "%x %08x\n", message, flag );
|
|
|
|
return TRUE;
|
|
|
|
}
|
2014-03-20 17:24:58 +01:00
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* ChangeWindowMessageFilterEx (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI ChangeWindowMessageFilterEx( HWND hwnd, UINT message, DWORD action, CHANGEFILTERSTRUCT *changefilter )
|
|
|
|
{
|
|
|
|
FIXME( "%p %x %d %p\n", hwnd, message, action, changefilter );
|
|
|
|
return TRUE;
|
|
|
|
}
|