|
|
|
@ -50,74 +50,6 @@ WINE_DECLARE_DEBUG_CHANNEL(key);
|
|
|
|
|
#define WM_NCMOUSEFIRST WM_NCMOUSEMOVE
|
|
|
|
|
#define WM_NCMOUSELAST (WM_NCMOUSEFIRST+(WM_MOUSELAST-WM_MOUSEFIRST))
|
|
|
|
|
|
|
|
|
|
#define MAX_PACK_COUNT 4
|
|
|
|
|
|
|
|
|
|
#define MAX_WINPROC_RECURSION 64
|
|
|
|
|
|
|
|
|
|
struct packed_hook_extra_info
|
|
|
|
|
{
|
|
|
|
|
user_handle_t handle;
|
|
|
|
|
DWORD __pad;
|
|
|
|
|
ULONGLONG lparam;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* the structures are unpacked on top of the packed ones, so make sure they fit */
|
|
|
|
|
C_ASSERT( sizeof(struct packed_CREATESTRUCTW) >= sizeof(CREATESTRUCTW) );
|
|
|
|
|
C_ASSERT( sizeof(struct packed_DRAWITEMSTRUCT) >= sizeof(DRAWITEMSTRUCT) );
|
|
|
|
|
C_ASSERT( sizeof(struct packed_MEASUREITEMSTRUCT) >= sizeof(MEASUREITEMSTRUCT) );
|
|
|
|
|
C_ASSERT( sizeof(struct packed_DELETEITEMSTRUCT) >= sizeof(DELETEITEMSTRUCT) );
|
|
|
|
|
C_ASSERT( sizeof(struct packed_COMPAREITEMSTRUCT) >= sizeof(COMPAREITEMSTRUCT) );
|
|
|
|
|
C_ASSERT( sizeof(struct packed_WINDOWPOS) >= sizeof(WINDOWPOS) );
|
|
|
|
|
C_ASSERT( sizeof(struct packed_COPYDATASTRUCT) >= sizeof(COPYDATASTRUCT) );
|
|
|
|
|
C_ASSERT( sizeof(struct packed_HELPINFO) >= sizeof(HELPINFO) );
|
|
|
|
|
C_ASSERT( sizeof(struct packed_NCCALCSIZE_PARAMS) >= sizeof(NCCALCSIZE_PARAMS) + sizeof(WINDOWPOS) );
|
|
|
|
|
C_ASSERT( sizeof(struct packed_MSG) >= sizeof(MSG) );
|
|
|
|
|
C_ASSERT( sizeof(struct packed_MDINEXTMENU) >= sizeof(MDINEXTMENU) );
|
|
|
|
|
C_ASSERT( sizeof(struct packed_MDICREATESTRUCTW) >= sizeof(MDICREATESTRUCTW) );
|
|
|
|
|
C_ASSERT( sizeof(struct packed_hook_extra_info) >= sizeof(struct hook_extra_info) );
|
|
|
|
|
|
|
|
|
|
union packed_structs
|
|
|
|
|
{
|
|
|
|
|
struct packed_CREATESTRUCTW cs;
|
|
|
|
|
struct packed_DRAWITEMSTRUCT dis;
|
|
|
|
|
struct packed_MEASUREITEMSTRUCT mis;
|
|
|
|
|
struct packed_DELETEITEMSTRUCT dls;
|
|
|
|
|
struct packed_COMPAREITEMSTRUCT cis;
|
|
|
|
|
struct packed_WINDOWPOS wp;
|
|
|
|
|
struct packed_COPYDATASTRUCT cds;
|
|
|
|
|
struct packed_HELPINFO hi;
|
|
|
|
|
struct packed_NCCALCSIZE_PARAMS ncp;
|
|
|
|
|
struct packed_MSG msg;
|
|
|
|
|
struct packed_MDINEXTMENU mnm;
|
|
|
|
|
struct packed_MDICREATESTRUCTW mcs;
|
|
|
|
|
struct packed_hook_extra_info hook;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* description of the data fields that need to be packed along with a sent message */
|
|
|
|
|
struct packed_message
|
|
|
|
|
{
|
|
|
|
|
union packed_structs ps;
|
|
|
|
|
int count;
|
|
|
|
|
const void *data[MAX_PACK_COUNT];
|
|
|
|
|
size_t size[MAX_PACK_COUNT];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* structure to group all parameters for sent messages of the various kinds */
|
|
|
|
|
struct send_message_info
|
|
|
|
|
{
|
|
|
|
|
enum message_type type;
|
|
|
|
|
DWORD dest_tid;
|
|
|
|
|
HWND hwnd;
|
|
|
|
|
UINT msg;
|
|
|
|
|
WPARAM wparam;
|
|
|
|
|
LPARAM lparam;
|
|
|
|
|
UINT flags; /* flags for SendMessageTimeout */
|
|
|
|
|
UINT timeout; /* timeout for SendMessageTimeout */
|
|
|
|
|
SENDASYNCPROC callback; /* callback function for SendMessageCallback */
|
|
|
|
|
ULONG_PTR data; /* callback data */
|
|
|
|
|
enum wm_char_mapping wm_char;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Message class descriptor */
|
|
|
|
|
const struct builtin_class_descr MESSAGE_builtin_class =
|
|
|
|
|
{
|
|
|
|
@ -130,97 +62,6 @@ const struct builtin_class_descr MESSAGE_builtin_class =
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* flag for messages that contain pointers */
|
|
|
|
|
/* 32 messages per entry, messages 0..31 map to bits 0..31 */
|
|
|
|
|
|
|
|
|
|
#define SET(msg) (1 << ((msg) & 31))
|
|
|
|
|
|
|
|
|
|
static const unsigned int message_pointer_flags[] =
|
|
|
|
|
{
|
|
|
|
|
/* 0x00 - 0x1f */
|
|
|
|
|
SET(WM_CREATE) | SET(WM_SETTEXT) | SET(WM_GETTEXT) |
|
|
|
|
|
SET(WM_WININICHANGE) | SET(WM_DEVMODECHANGE),
|
|
|
|
|
/* 0x20 - 0x3f */
|
|
|
|
|
SET(WM_GETMINMAXINFO) | SET(WM_DRAWITEM) | SET(WM_MEASUREITEM) | SET(WM_DELETEITEM) |
|
|
|
|
|
SET(WM_COMPAREITEM),
|
|
|
|
|
/* 0x40 - 0x5f */
|
|
|
|
|
SET(WM_WINDOWPOSCHANGING) | SET(WM_WINDOWPOSCHANGED) | SET(WM_COPYDATA) | SET(WM_HELP),
|
|
|
|
|
/* 0x60 - 0x7f */
|
|
|
|
|
SET(WM_STYLECHANGING) | SET(WM_STYLECHANGED),
|
|
|
|
|
/* 0x80 - 0x9f */
|
|
|
|
|
SET(WM_NCCREATE) | SET(WM_NCCALCSIZE) | SET(WM_GETDLGCODE),
|
|
|
|
|
/* 0xa0 - 0xbf */
|
|
|
|
|
SET(EM_GETSEL) | SET(EM_GETRECT) | SET(EM_SETRECT) | SET(EM_SETRECTNP),
|
|
|
|
|
/* 0xc0 - 0xdf */
|
|
|
|
|
SET(EM_REPLACESEL) | SET(EM_GETLINE) | SET(EM_SETTABSTOPS),
|
|
|
|
|
/* 0xe0 - 0xff */
|
|
|
|
|
SET(SBM_GETRANGE) | SET(SBM_SETSCROLLINFO) | SET(SBM_GETSCROLLINFO) | SET(SBM_GETSCROLLBARINFO),
|
|
|
|
|
/* 0x100 - 0x11f */
|
|
|
|
|
0,
|
|
|
|
|
/* 0x120 - 0x13f */
|
|
|
|
|
0,
|
|
|
|
|
/* 0x140 - 0x15f */
|
|
|
|
|
SET(CB_GETEDITSEL) | SET(CB_ADDSTRING) | SET(CB_DIR) | SET(CB_GETLBTEXT) |
|
|
|
|
|
SET(CB_INSERTSTRING) | SET(CB_FINDSTRING) | SET(CB_SELECTSTRING) |
|
|
|
|
|
SET(CB_GETDROPPEDCONTROLRECT) | SET(CB_FINDSTRINGEXACT),
|
|
|
|
|
/* 0x160 - 0x17f */
|
|
|
|
|
0,
|
|
|
|
|
/* 0x180 - 0x19f */
|
|
|
|
|
SET(LB_ADDSTRING) | SET(LB_INSERTSTRING) | SET(LB_GETTEXT) | SET(LB_SELECTSTRING) |
|
|
|
|
|
SET(LB_DIR) | SET(LB_FINDSTRING) |
|
|
|
|
|
SET(LB_GETSELITEMS) | SET(LB_SETTABSTOPS) | SET(LB_ADDFILE) | SET(LB_GETITEMRECT),
|
|
|
|
|
/* 0x1a0 - 0x1bf */
|
|
|
|
|
SET(LB_FINDSTRINGEXACT),
|
|
|
|
|
/* 0x1c0 - 0x1df */
|
|
|
|
|
0,
|
|
|
|
|
/* 0x1e0 - 0x1ff */
|
|
|
|
|
0,
|
|
|
|
|
/* 0x200 - 0x21f */
|
|
|
|
|
SET(WM_NEXTMENU) | SET(WM_SIZING) | SET(WM_MOVING) | SET(WM_DEVICECHANGE),
|
|
|
|
|
/* 0x220 - 0x23f */
|
|
|
|
|
SET(WM_MDICREATE) | SET(WM_MDIGETACTIVE) | SET(WM_DROPOBJECT) |
|
|
|
|
|
SET(WM_QUERYDROPOBJECT) | SET(WM_DRAGLOOP) | SET(WM_DRAGSELECT) | SET(WM_DRAGMOVE),
|
|
|
|
|
/* 0x240 - 0x25f */
|
|
|
|
|
0,
|
|
|
|
|
/* 0x260 - 0x27f */
|
|
|
|
|
0,
|
|
|
|
|
/* 0x280 - 0x29f */
|
|
|
|
|
0,
|
|
|
|
|
/* 0x2a0 - 0x2bf */
|
|
|
|
|
0,
|
|
|
|
|
/* 0x2c0 - 0x2df */
|
|
|
|
|
0,
|
|
|
|
|
/* 0x2e0 - 0x2ff */
|
|
|
|
|
0,
|
|
|
|
|
/* 0x300 - 0x31f */
|
|
|
|
|
SET(WM_ASKCBFORMATNAME)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* check whether a given message type includes pointers */
|
|
|
|
|
static inline BOOL is_pointer_message( UINT message, WPARAM wparam )
|
|
|
|
|
{
|
|
|
|
|
if (message >= 8*sizeof(message_pointer_flags)) return FALSE;
|
|
|
|
|
if (message == WM_DEVICECHANGE && !(wparam & 0x8000)) return FALSE;
|
|
|
|
|
return (message_pointer_flags[message / 32] & SET(message)) != 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#undef SET
|
|
|
|
|
|
|
|
|
|
/* add a data field to a packed message */
|
|
|
|
|
static inline void push_data( struct packed_message *data, const void *ptr, size_t size )
|
|
|
|
|
{
|
|
|
|
|
data->data[data->count] = ptr;
|
|
|
|
|
data->size[data->count] = size;
|
|
|
|
|
data->count++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* add a string to a packed message */
|
|
|
|
|
static inline void push_string( struct packed_message *data, LPCWSTR str )
|
|
|
|
|
{
|
|
|
|
|
push_data( data, str, (lstrlenW(str) + 1) * sizeof(WCHAR) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* pack a pointer into a 32/64 portable format */
|
|
|
|
|
static inline ULONGLONG pack_ptr( const void *ptr )
|
|
|
|
|
{
|
|
|
|
@ -234,20 +75,6 @@ static inline void *unpack_ptr( ULONGLONG ptr64 )
|
|
|
|
|
return (void *)(ULONG_PTR)ptr64;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* check whether a combobox expects strings or ids in CB_ADDSTRING/CB_INSERTSTRING */
|
|
|
|
|
static inline BOOL combobox_has_strings( HWND hwnd )
|
|
|
|
|
{
|
|
|
|
|
DWORD style = GetWindowLongA( hwnd, GWL_STYLE );
|
|
|
|
|
return (!(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) || (style & CBS_HASSTRINGS));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* check whether a listbox expects strings or ids in LB_ADDSTRING/LB_INSERTSTRING */
|
|
|
|
|
static inline BOOL listbox_has_strings( HWND hwnd )
|
|
|
|
|
{
|
|
|
|
|
DWORD style = GetWindowLongA( hwnd, GWL_STYLE );
|
|
|
|
|
return (!(style & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)) || (style & LBS_HASSTRINGS));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* check whether message is in the range of keyboard messages */
|
|
|
|
|
static inline BOOL is_keyboard_message( UINT message )
|
|
|
|
|
{
|
|
|
|
@ -294,43 +121,6 @@ LRESULT WINAPI MessageWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lP
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* broadcast_message_callback
|
|
|
|
|
*
|
|
|
|
|
* Helper callback for broadcasting messages.
|
|
|
|
|
*/
|
|
|
|
|
static BOOL CALLBACK broadcast_message_callback( HWND hwnd, LPARAM lparam )
|
|
|
|
|
{
|
|
|
|
|
struct send_message_info *info = (struct send_message_info *)lparam;
|
|
|
|
|
if ((GetWindowLongW( hwnd, GWL_STYLE ) & (WS_POPUP|WS_CHILD)) == WS_CHILD)
|
|
|
|
|
return TRUE;
|
|
|
|
|
switch(info->type)
|
|
|
|
|
{
|
|
|
|
|
case MSG_UNICODE:
|
|
|
|
|
SendMessageTimeoutW( hwnd, info->msg, info->wparam, info->lparam,
|
|
|
|
|
info->flags, info->timeout, NULL );
|
|
|
|
|
break;
|
|
|
|
|
case MSG_ASCII:
|
|
|
|
|
SendMessageTimeoutA( hwnd, info->msg, info->wparam, info->lparam,
|
|
|
|
|
info->flags, info->timeout, NULL );
|
|
|
|
|
break;
|
|
|
|
|
case MSG_NOTIFY:
|
|
|
|
|
SendNotifyMessageW( hwnd, info->msg, info->wparam, info->lparam );
|
|
|
|
|
break;
|
|
|
|
|
case MSG_CALLBACK:
|
|
|
|
|
SendMessageCallbackW( hwnd, info->msg, info->wparam, info->lparam,
|
|
|
|
|
info->callback, info->data );
|
|
|
|
|
break;
|
|
|
|
|
case MSG_POSTED:
|
|
|
|
|
PostMessageW( hwnd, info->msg, info->wparam, info->lparam );
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ERR( "bad type %d\n", info->type );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DWORD get_input_codepage( void )
|
|
|
|
|
{
|
|
|
|
|
DWORD cp;
|
|
|
|
@ -498,352 +288,6 @@ static void map_wparam_WtoA( MSG *msg, BOOL remove )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* pack_message
|
|
|
|
|
*
|
|
|
|
|
* Pack a message for sending to another process.
|
|
|
|
|
* Return the size of the data we expect in the message reply.
|
|
|
|
|
* Set data->count to -1 if there is an error.
|
|
|
|
|
*/
|
|
|
|
|
static size_t pack_message( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam,
|
|
|
|
|
struct packed_message *data )
|
|
|
|
|
{
|
|
|
|
|
data->count = 0;
|
|
|
|
|
switch(message)
|
|
|
|
|
{
|
|
|
|
|
case WM_NCCREATE:
|
|
|
|
|
case WM_CREATE:
|
|
|
|
|
{
|
|
|
|
|
CREATESTRUCTW *cs = (CREATESTRUCTW *)lparam;
|
|
|
|
|
data->ps.cs.lpCreateParams = pack_ptr( cs->lpCreateParams );
|
|
|
|
|
data->ps.cs.hInstance = pack_ptr( cs->hInstance );
|
|
|
|
|
data->ps.cs.hMenu = wine_server_user_handle( cs->hMenu );
|
|
|
|
|
data->ps.cs.hwndParent = wine_server_user_handle( cs->hwndParent );
|
|
|
|
|
data->ps.cs.cy = cs->cy;
|
|
|
|
|
data->ps.cs.cx = cs->cx;
|
|
|
|
|
data->ps.cs.y = cs->y;
|
|
|
|
|
data->ps.cs.x = cs->x;
|
|
|
|
|
data->ps.cs.style = cs->style;
|
|
|
|
|
data->ps.cs.dwExStyle = cs->dwExStyle;
|
|
|
|
|
data->ps.cs.lpszName = pack_ptr( cs->lpszName );
|
|
|
|
|
data->ps.cs.lpszClass = pack_ptr( cs->lpszClass );
|
|
|
|
|
push_data( data, &data->ps.cs, sizeof(data->ps.cs) );
|
|
|
|
|
if (!IS_INTRESOURCE(cs->lpszName)) push_string( data, cs->lpszName );
|
|
|
|
|
if (!IS_INTRESOURCE(cs->lpszClass)) push_string( data, cs->lpszClass );
|
|
|
|
|
return sizeof(data->ps.cs);
|
|
|
|
|
}
|
|
|
|
|
case WM_GETTEXT:
|
|
|
|
|
case WM_ASKCBFORMATNAME:
|
|
|
|
|
return wparam * sizeof(WCHAR);
|
|
|
|
|
case WM_WININICHANGE:
|
|
|
|
|
if (lparam) push_string(data, (LPWSTR)lparam );
|
|
|
|
|
return 0;
|
|
|
|
|
case WM_SETTEXT:
|
|
|
|
|
case WM_DEVMODECHANGE:
|
|
|
|
|
case CB_DIR:
|
|
|
|
|
case LB_DIR:
|
|
|
|
|
case LB_ADDFILE:
|
|
|
|
|
case EM_REPLACESEL:
|
|
|
|
|
push_string( data, (LPWSTR)lparam );
|
|
|
|
|
return 0;
|
|
|
|
|
case WM_GETMINMAXINFO:
|
|
|
|
|
push_data( data, (MINMAXINFO *)lparam, sizeof(MINMAXINFO) );
|
|
|
|
|
return sizeof(MINMAXINFO);
|
|
|
|
|
case WM_DRAWITEM:
|
|
|
|
|
{
|
|
|
|
|
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lparam;
|
|
|
|
|
data->ps.dis.CtlType = dis->CtlType;
|
|
|
|
|
data->ps.dis.CtlID = dis->CtlID;
|
|
|
|
|
data->ps.dis.itemID = dis->itemID;
|
|
|
|
|
data->ps.dis.itemAction = dis->itemAction;
|
|
|
|
|
data->ps.dis.itemState = dis->itemState;
|
|
|
|
|
data->ps.dis.hwndItem = wine_server_user_handle( dis->hwndItem );
|
|
|
|
|
data->ps.dis.hDC = wine_server_user_handle( dis->hDC ); /* FIXME */
|
|
|
|
|
data->ps.dis.rcItem = dis->rcItem;
|
|
|
|
|
data->ps.dis.itemData = dis->itemData;
|
|
|
|
|
push_data( data, &data->ps.dis, sizeof(data->ps.dis) );
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case WM_MEASUREITEM:
|
|
|
|
|
{
|
|
|
|
|
MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lparam;
|
|
|
|
|
data->ps.mis.CtlType = mis->CtlType;
|
|
|
|
|
data->ps.mis.CtlID = mis->CtlID;
|
|
|
|
|
data->ps.mis.itemID = mis->itemID;
|
|
|
|
|
data->ps.mis.itemWidth = mis->itemWidth;
|
|
|
|
|
data->ps.mis.itemHeight = mis->itemHeight;
|
|
|
|
|
data->ps.mis.itemData = mis->itemData;
|
|
|
|
|
push_data( data, &data->ps.mis, sizeof(data->ps.mis) );
|
|
|
|
|
return sizeof(data->ps.mis);
|
|
|
|
|
}
|
|
|
|
|
case WM_DELETEITEM:
|
|
|
|
|
{
|
|
|
|
|
DELETEITEMSTRUCT *dls = (DELETEITEMSTRUCT *)lparam;
|
|
|
|
|
data->ps.dls.CtlType = dls->CtlType;
|
|
|
|
|
data->ps.dls.CtlID = dls->CtlID;
|
|
|
|
|
data->ps.dls.itemID = dls->itemID;
|
|
|
|
|
data->ps.dls.hwndItem = wine_server_user_handle( dls->hwndItem );
|
|
|
|
|
data->ps.dls.itemData = dls->itemData;
|
|
|
|
|
push_data( data, &data->ps.dls, sizeof(data->ps.dls) );
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case WM_COMPAREITEM:
|
|
|
|
|
{
|
|
|
|
|
COMPAREITEMSTRUCT *cis = (COMPAREITEMSTRUCT *)lparam;
|
|
|
|
|
data->ps.cis.CtlType = cis->CtlType;
|
|
|
|
|
data->ps.cis.CtlID = cis->CtlID;
|
|
|
|
|
data->ps.cis.hwndItem = wine_server_user_handle( cis->hwndItem );
|
|
|
|
|
data->ps.cis.itemID1 = cis->itemID1;
|
|
|
|
|
data->ps.cis.itemData1 = cis->itemData1;
|
|
|
|
|
data->ps.cis.itemID2 = cis->itemID2;
|
|
|
|
|
data->ps.cis.itemData2 = cis->itemData2;
|
|
|
|
|
data->ps.cis.dwLocaleId = cis->dwLocaleId;
|
|
|
|
|
push_data( data, &data->ps.cis, sizeof(data->ps.cis) );
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case WM_WINE_SETWINDOWPOS:
|
|
|
|
|
case WM_WINDOWPOSCHANGING:
|
|
|
|
|
case WM_WINDOWPOSCHANGED:
|
|
|
|
|
{
|
|
|
|
|
WINDOWPOS *wp = (WINDOWPOS *)lparam;
|
|
|
|
|
data->ps.wp.hwnd = wine_server_user_handle( wp->hwnd );
|
|
|
|
|
data->ps.wp.hwndInsertAfter = wine_server_user_handle( wp->hwndInsertAfter );
|
|
|
|
|
data->ps.wp.x = wp->x;
|
|
|
|
|
data->ps.wp.y = wp->y;
|
|
|
|
|
data->ps.wp.cx = wp->cx;
|
|
|
|
|
data->ps.wp.cy = wp->cy;
|
|
|
|
|
data->ps.wp.flags = wp->flags;
|
|
|
|
|
push_data( data, &data->ps.wp, sizeof(data->ps.wp) );
|
|
|
|
|
return sizeof(data->ps.wp);
|
|
|
|
|
}
|
|
|
|
|
case WM_COPYDATA:
|
|
|
|
|
{
|
|
|
|
|
COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lparam;
|
|
|
|
|
data->ps.cds.cbData = cds->cbData;
|
|
|
|
|
data->ps.cds.dwData = cds->dwData;
|
|
|
|
|
data->ps.cds.lpData = pack_ptr( cds->lpData );
|
|
|
|
|
push_data( data, &data->ps.cds, sizeof(data->ps.cds) );
|
|
|
|
|
if (cds->lpData) push_data( data, cds->lpData, cds->cbData );
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
|
/* WM_NOTIFY cannot be sent across processes (MSDN) */
|
|
|
|
|
data->count = -1;
|
|
|
|
|
return 0;
|
|
|
|
|
case WM_HELP:
|
|
|
|
|
{
|
|
|
|
|
HELPINFO *hi = (HELPINFO *)lparam;
|
|
|
|
|
data->ps.hi.iContextType = hi->iContextType;
|
|
|
|
|
data->ps.hi.iCtrlId = hi->iCtrlId;
|
|
|
|
|
data->ps.hi.hItemHandle = wine_server_user_handle( hi->hItemHandle );
|
|
|
|
|
data->ps.hi.dwContextId = hi->dwContextId;
|
|
|
|
|
data->ps.hi.MousePos = hi->MousePos;
|
|
|
|
|
push_data( data, &data->ps.hi, sizeof(data->ps.hi) );
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case WM_STYLECHANGING:
|
|
|
|
|
case WM_STYLECHANGED:
|
|
|
|
|
push_data( data, (STYLESTRUCT *)lparam, sizeof(STYLESTRUCT) );
|
|
|
|
|
return 0;
|
|
|
|
|
case WM_NCCALCSIZE:
|
|
|
|
|
if (!wparam)
|
|
|
|
|
{
|
|
|
|
|
push_data( data, (RECT *)lparam, sizeof(RECT) );
|
|
|
|
|
return sizeof(RECT);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NCCALCSIZE_PARAMS *ncp = (NCCALCSIZE_PARAMS *)lparam;
|
|
|
|
|
data->ps.ncp.rgrc[0] = ncp->rgrc[0];
|
|
|
|
|
data->ps.ncp.rgrc[1] = ncp->rgrc[1];
|
|
|
|
|
data->ps.ncp.rgrc[2] = ncp->rgrc[2];
|
|
|
|
|
data->ps.ncp.hwnd = wine_server_user_handle( ncp->lppos->hwnd );
|
|
|
|
|
data->ps.ncp.hwndInsertAfter = wine_server_user_handle( ncp->lppos->hwndInsertAfter );
|
|
|
|
|
data->ps.ncp.x = ncp->lppos->x;
|
|
|
|
|
data->ps.ncp.y = ncp->lppos->y;
|
|
|
|
|
data->ps.ncp.cx = ncp->lppos->cx;
|
|
|
|
|
data->ps.ncp.cy = ncp->lppos->cy;
|
|
|
|
|
data->ps.ncp.flags = ncp->lppos->flags;
|
|
|
|
|
push_data( data, &data->ps.ncp, sizeof(data->ps.ncp) );
|
|
|
|
|
return sizeof(data->ps.ncp);
|
|
|
|
|
}
|
|
|
|
|
case WM_GETDLGCODE:
|
|
|
|
|
if (lparam)
|
|
|
|
|
{
|
|
|
|
|
MSG *msg = (MSG *)lparam;
|
|
|
|
|
data->ps.msg.hwnd = wine_server_user_handle( msg->hwnd );
|
|
|
|
|
data->ps.msg.message = msg->message;
|
|
|
|
|
data->ps.msg.wParam = msg->wParam;
|
|
|
|
|
data->ps.msg.lParam = msg->lParam;
|
|
|
|
|
data->ps.msg.time = msg->time;
|
|
|
|
|
data->ps.msg.pt = msg->pt;
|
|
|
|
|
push_data( data, &data->ps.msg, sizeof(data->ps.msg) );
|
|
|
|
|
return sizeof(data->ps.msg);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
case SBM_SETSCROLLINFO:
|
|
|
|
|
push_data( data, (SCROLLINFO *)lparam, sizeof(SCROLLINFO) );
|
|
|
|
|
return 0;
|
|
|
|
|
case SBM_GETSCROLLINFO:
|
|
|
|
|
push_data( data, (SCROLLINFO *)lparam, sizeof(SCROLLINFO) );
|
|
|
|
|
return sizeof(SCROLLINFO);
|
|
|
|
|
case SBM_GETSCROLLBARINFO:
|
|
|
|
|
{
|
|
|
|
|
const SCROLLBARINFO *info = (const SCROLLBARINFO *)lparam;
|
|
|
|
|
size_t size = min( info->cbSize, sizeof(SCROLLBARINFO) );
|
|
|
|
|
push_data( data, info, size );
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
case EM_GETSEL:
|
|
|
|
|
case SBM_GETRANGE:
|
|
|
|
|
case CB_GETEDITSEL:
|
|
|
|
|
{
|
|
|
|
|
size_t size = 0;
|
|
|
|
|
if (wparam) size += sizeof(DWORD);
|
|
|
|
|
if (lparam) size += sizeof(DWORD);
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
case EM_GETRECT:
|
|
|
|
|
case LB_GETITEMRECT:
|
|
|
|
|
case CB_GETDROPPEDCONTROLRECT:
|
|
|
|
|
return sizeof(RECT);
|
|
|
|
|
case EM_SETRECT:
|
|
|
|
|
case EM_SETRECTNP:
|
|
|
|
|
push_data( data, (RECT *)lparam, sizeof(RECT) );
|
|
|
|
|
return 0;
|
|
|
|
|
case EM_GETLINE:
|
|
|
|
|
{
|
|
|
|
|
WORD *pw = (WORD *)lparam;
|
|
|
|
|
push_data( data, pw, sizeof(*pw) );
|
|
|
|
|
return *pw * sizeof(WCHAR);
|
|
|
|
|
}
|
|
|
|
|
case EM_SETTABSTOPS:
|
|
|
|
|
case LB_SETTABSTOPS:
|
|
|
|
|
if (wparam) push_data( data, (UINT *)lparam, sizeof(UINT) * wparam );
|
|
|
|
|
return 0;
|
|
|
|
|
case CB_ADDSTRING:
|
|
|
|
|
case CB_INSERTSTRING:
|
|
|
|
|
case CB_FINDSTRING:
|
|
|
|
|
case CB_FINDSTRINGEXACT:
|
|
|
|
|
case CB_SELECTSTRING:
|
|
|
|
|
if (combobox_has_strings( hwnd )) push_string( data, (LPWSTR)lparam );
|
|
|
|
|
return 0;
|
|
|
|
|
case CB_GETLBTEXT:
|
|
|
|
|
if (!combobox_has_strings( hwnd )) return sizeof(ULONG_PTR);
|
|
|
|
|
return (SendMessageW( hwnd, CB_GETLBTEXTLEN, wparam, 0 ) + 1) * sizeof(WCHAR);
|
|
|
|
|
case LB_ADDSTRING:
|
|
|
|
|
case LB_INSERTSTRING:
|
|
|
|
|
case LB_FINDSTRING:
|
|
|
|
|
case LB_FINDSTRINGEXACT:
|
|
|
|
|
case LB_SELECTSTRING:
|
|
|
|
|
if (listbox_has_strings( hwnd )) push_string( data, (LPWSTR)lparam );
|
|
|
|
|
return 0;
|
|
|
|
|
case LB_GETTEXT:
|
|
|
|
|
if (!listbox_has_strings( hwnd )) return sizeof(ULONG_PTR);
|
|
|
|
|
return (SendMessageW( hwnd, LB_GETTEXTLEN, wparam, 0 ) + 1) * sizeof(WCHAR);
|
|
|
|
|
case LB_GETSELITEMS:
|
|
|
|
|
return wparam * sizeof(UINT);
|
|
|
|
|
case WM_NEXTMENU:
|
|
|
|
|
{
|
|
|
|
|
MDINEXTMENU *mnm = (MDINEXTMENU *)lparam;
|
|
|
|
|
data->ps.mnm.hmenuIn = wine_server_user_handle( mnm->hmenuIn );
|
|
|
|
|
data->ps.mnm.hmenuNext = wine_server_user_handle( mnm->hmenuNext );
|
|
|
|
|
data->ps.mnm.hwndNext = wine_server_user_handle( mnm->hwndNext );
|
|
|
|
|
push_data( data, &data->ps.mnm, sizeof(data->ps.mnm) );
|
|
|
|
|
return sizeof(data->ps.mnm);
|
|
|
|
|
}
|
|
|
|
|
case WM_SIZING:
|
|
|
|
|
case WM_MOVING:
|
|
|
|
|
push_data( data, (RECT *)lparam, sizeof(RECT) );
|
|
|
|
|
return sizeof(RECT);
|
|
|
|
|
case WM_MDICREATE:
|
|
|
|
|
{
|
|
|
|
|
MDICREATESTRUCTW *mcs = (MDICREATESTRUCTW *)lparam;
|
|
|
|
|
data->ps.mcs.szClass = pack_ptr( mcs->szClass );
|
|
|
|
|
data->ps.mcs.szTitle = pack_ptr( mcs->szTitle );
|
|
|
|
|
data->ps.mcs.hOwner = pack_ptr( mcs->hOwner );
|
|
|
|
|
data->ps.mcs.x = mcs->x;
|
|
|
|
|
data->ps.mcs.y = mcs->y;
|
|
|
|
|
data->ps.mcs.cx = mcs->cx;
|
|
|
|
|
data->ps.mcs.cy = mcs->cy;
|
|
|
|
|
data->ps.mcs.style = mcs->style;
|
|
|
|
|
data->ps.mcs.lParam = mcs->lParam;
|
|
|
|
|
push_data( data, &data->ps.mcs, sizeof(data->ps.mcs) );
|
|
|
|
|
if (!IS_INTRESOURCE(mcs->szClass)) push_string( data, mcs->szClass );
|
|
|
|
|
if (!IS_INTRESOURCE(mcs->szTitle)) push_string( data, mcs->szTitle );
|
|
|
|
|
return sizeof(data->ps.mcs);
|
|
|
|
|
}
|
|
|
|
|
case WM_MDIGETACTIVE:
|
|
|
|
|
if (lparam) return sizeof(BOOL);
|
|
|
|
|
return 0;
|
|
|
|
|
case WM_DEVICECHANGE:
|
|
|
|
|
{
|
|
|
|
|
DEV_BROADCAST_HDR *header = (DEV_BROADCAST_HDR *)lparam;
|
|
|
|
|
if ((wparam & 0x8000) && header) push_data( data, header, header->dbch_size );
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case WM_WINE_KEYBOARD_LL_HOOK:
|
|
|
|
|
{
|
|
|
|
|
struct hook_extra_info *h_extra = (struct hook_extra_info *)lparam;
|
|
|
|
|
data->ps.hook.handle = wine_server_user_handle( h_extra->handle );
|
|
|
|
|
push_data( data, &data->ps.hook, sizeof(data->ps.hook) );
|
|
|
|
|
push_data( data, (LPVOID)h_extra->lparam, sizeof(KBDLLHOOKSTRUCT) );
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case WM_WINE_MOUSE_LL_HOOK:
|
|
|
|
|
{
|
|
|
|
|
struct hook_extra_info *h_extra = (struct hook_extra_info *)lparam;
|
|
|
|
|
data->ps.hook.handle = wine_server_user_handle( h_extra->handle );
|
|
|
|
|
push_data( data, &data->ps.hook, sizeof(data->ps.hook) );
|
|
|
|
|
push_data( data, (LPVOID)h_extra->lparam, sizeof(MSLLHOOKSTRUCT) );
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case WM_NCPAINT:
|
|
|
|
|
if (wparam <= 1) return 0;
|
|
|
|
|
FIXME( "WM_NCPAINT hdc packing not supported yet\n" );
|
|
|
|
|
data->count = -1;
|
|
|
|
|
return 0;
|
|
|
|
|
case WM_PAINT:
|
|
|
|
|
if (!wparam) return 0;
|
|
|
|
|
/* fall through */
|
|
|
|
|
|
|
|
|
|
/* these contain an HFONT */
|
|
|
|
|
case WM_SETFONT:
|
|
|
|
|
case WM_GETFONT:
|
|
|
|
|
/* these contain an HDC */
|
|
|
|
|
case WM_ERASEBKGND:
|
|
|
|
|
case WM_ICONERASEBKGND:
|
|
|
|
|
case WM_CTLCOLORMSGBOX:
|
|
|
|
|
case WM_CTLCOLOREDIT:
|
|
|
|
|
case WM_CTLCOLORLISTBOX:
|
|
|
|
|
case WM_CTLCOLORBTN:
|
|
|
|
|
case WM_CTLCOLORDLG:
|
|
|
|
|
case WM_CTLCOLORSCROLLBAR:
|
|
|
|
|
case WM_CTLCOLORSTATIC:
|
|
|
|
|
case WM_PRINT:
|
|
|
|
|
case WM_PRINTCLIENT:
|
|
|
|
|
/* these contain an HGLOBAL */
|
|
|
|
|
case WM_PAINTCLIPBOARD:
|
|
|
|
|
case WM_SIZECLIPBOARD:
|
|
|
|
|
/* these contain HICON */
|
|
|
|
|
case WM_GETICON:
|
|
|
|
|
case WM_SETICON:
|
|
|
|
|
case WM_QUERYDRAGICON:
|
|
|
|
|
case WM_QUERYPARKICON:
|
|
|
|
|
/* these contain pointers */
|
|
|
|
|
case WM_DROPOBJECT:
|
|
|
|
|
case WM_QUERYDROPOBJECT:
|
|
|
|
|
case WM_DRAGLOOP:
|
|
|
|
|
case WM_DRAGSELECT:
|
|
|
|
|
case WM_DRAGMOVE:
|
|
|
|
|
FIXME( "msg %x (%s) not supported yet\n", message, SPY_GetMsgName(message, hwnd) );
|
|
|
|
|
data->count = -1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* handle_internal_message
|
|
|
|
|
*
|
|
|
|
@ -1542,90 +986,6 @@ BOOL process_hardware_message( MSG *msg, UINT hw_id, const struct hardware_msg_d
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* put_message_in_queue
|
|
|
|
|
*
|
|
|
|
|
* Put a sent message into the destination queue.
|
|
|
|
|
* For inter-process message, reply_size is set to expected size of reply data.
|
|
|
|
|
*/
|
|
|
|
|
static BOOL put_message_in_queue( const struct send_message_info *info, size_t *reply_size )
|
|
|
|
|
{
|
|
|
|
|
struct packed_message data;
|
|
|
|
|
message_data_t msg_data;
|
|
|
|
|
unsigned int res;
|
|
|
|
|
int i;
|
|
|
|
|
timeout_t timeout = TIMEOUT_INFINITE;
|
|
|
|
|
|
|
|
|
|
/* Check for INFINITE timeout for compatibility with Win9x,
|
|
|
|
|
* although Windows >= NT does not do so
|
|
|
|
|
*/
|
|
|
|
|
if (info->type != MSG_NOTIFY &&
|
|
|
|
|
info->type != MSG_CALLBACK &&
|
|
|
|
|
info->type != MSG_POSTED &&
|
|
|
|
|
info->timeout &&
|
|
|
|
|
info->timeout != INFINITE)
|
|
|
|
|
{
|
|
|
|
|
/* timeout is signed despite the prototype */
|
|
|
|
|
timeout = (timeout_t)max( 0, (int)info->timeout ) * -10000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memset( &data, 0, sizeof(data) );
|
|
|
|
|
if (info->type == MSG_OTHER_PROCESS || info->type == MSG_NOTIFY)
|
|
|
|
|
{
|
|
|
|
|
*reply_size = pack_message( info->hwnd, info->msg, info->wparam, info->lparam, &data );
|
|
|
|
|
if (data.count == -1)
|
|
|
|
|
{
|
|
|
|
|
WARN( "cannot pack message %x\n", info->msg );
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (info->type == MSG_CALLBACK)
|
|
|
|
|
{
|
|
|
|
|
msg_data.callback.callback = wine_server_client_ptr( info->callback );
|
|
|
|
|
msg_data.callback.data = info->data;
|
|
|
|
|
msg_data.callback.result = 0;
|
|
|
|
|
data.data[0] = &msg_data;
|
|
|
|
|
data.size[0] = sizeof(msg_data.callback);
|
|
|
|
|
data.count = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (info->type == MSG_POSTED && info->msg >= WM_DDE_FIRST && info->msg <= WM_DDE_LAST)
|
|
|
|
|
{
|
|
|
|
|
return post_dde_message( info->hwnd, info->msg, info->wparam, info->lparam,
|
|
|
|
|
info->dest_tid, info->type );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SERVER_START_REQ( send_message )
|
|
|
|
|
{
|
|
|
|
|
req->id = info->dest_tid;
|
|
|
|
|
req->type = info->type;
|
|
|
|
|
req->flags = 0;
|
|
|
|
|
req->win = wine_server_user_handle( info->hwnd );
|
|
|
|
|
req->msg = info->msg;
|
|
|
|
|
req->wparam = info->wparam;
|
|
|
|
|
req->lparam = info->lparam;
|
|
|
|
|
req->timeout = timeout;
|
|
|
|
|
|
|
|
|
|
if (info->flags & SMTO_ABORTIFHUNG) req->flags |= SEND_MSG_ABORT_IF_HUNG;
|
|
|
|
|
for (i = 0; i < data.count; i++) wine_server_add_data( req, data.data[i], data.size[i] );
|
|
|
|
|
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) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
SERVER_END_REQ;
|
|
|
|
|
return !res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static BOOL is_message_broadcastable(UINT msg)
|
|
|
|
|
{
|
|
|
|
|
return msg < WM_USER || msg >= 0xc000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* SendMessageTimeoutW (USER32.@)
|
|
|
|
|
*/
|
|
|
|
@ -1782,38 +1142,7 @@ BOOL WINAPI PostMessageA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
|
|
|
|
*/
|
|
|
|
|
BOOL WINAPI PostMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
|
|
|
|
{
|
|
|
|
|
struct send_message_info info;
|
|
|
|
|
|
|
|
|
|
if (is_pointer_message( msg, wparam ))
|
|
|
|
|
{
|
|
|
|
|
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TRACE( "hwnd %p msg %x (%s) wp %lx lp %lx\n",
|
|
|
|
|
hwnd, msg, SPY_GetMsgName(msg, hwnd), wparam, lparam );
|
|
|
|
|
|
|
|
|
|
info.type = MSG_POSTED;
|
|
|
|
|
info.hwnd = hwnd;
|
|
|
|
|
info.msg = msg;
|
|
|
|
|
info.wparam = wparam;
|
|
|
|
|
info.lparam = lparam;
|
|
|
|
|
info.flags = 0;
|
|
|
|
|
|
|
|
|
|
if (is_broadcast(hwnd))
|
|
|
|
|
{
|
|
|
|
|
if (is_message_broadcastable( info.msg ))
|
|
|
|
|
EnumWindows( broadcast_message_callback, (LPARAM)&info );
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!hwnd) return NtUserPostThreadMessage( GetCurrentThreadId(), msg, wparam, lparam );
|
|
|
|
|
|
|
|
|
|
if (!(info.dest_tid = GetWindowThreadProcessId( hwnd, NULL ))) return FALSE;
|
|
|
|
|
|
|
|
|
|
if (USER_IsExitingThread( info.dest_tid )) return TRUE;
|
|
|
|
|
|
|
|
|
|
return put_message_in_queue( &info, NULL );
|
|
|
|
|
return NtUserPostMessage( hwnd, msg, wparam, lparam );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|