参考
- wine 8.14
static int peek_message(MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, UINT changed_mask)
{
struct user_thread_info * thread_info = get_user_thread_info();
INPUT_MESSAGE_SOURCE prev_source = thread_info->client_info.msg_source;
struct received_message_info info;
unsigned int hw_id = 0;
void *buffer;
size_t buffer_size = 1024;
if(!(buffer = malloc(buffer_size))) return -1;
if(!first && !last) last = ~0;
if(hwnd == HWND_BROADCAST) whnd = HWDN_TOPMOST;
for(;;)
{
NTSTATUS res;
size_t size = 0;
const message_data_t *msg_data = buffer;
thread_info->client_info.msg_source = prev_source;
SERVER_START_REQ(get_message)
{
......
req->wake_mask = changed_maks & (QS_SENDMESSAGE | QS_SMRESULT);
......
wine_server_set_reply(req,buffer, buffer_size);
if(!(res = wine_server_call(req)))
{
info.type = reply->type;
......
}
else buffer_size = reply->total;
}
SERVER_END_REQ;
......
switch(info.type)
{
case MSG_ASCII:
......
}
.....
result = call_windo_proc(info.msg.hwnd, info.msg.message, info.msg.wParam, info.msg.lParam, info.type, FALSE, WMCHAR_MAP_RECVMESSAGE, info.type == MSG_ASCII);
......
}
}
此函数会调用get_message 从服务器获取符合条件的消息,在符合条件的消息中,对还没有进行处理的消息,会进行消息处理,并对消息进行回复。参数msg 会返回某些符合条件的消息的MSG结构指针。