This is a resend of a patch that seemingly fell through the cracks. ChangeLog: - Fix SendMessageCallback so that it works in all cases now Rob
Index: wine/dlls/user/message.c =================================================================== RCS file: /home/wine/wine/dlls/user/message.c,v retrieving revision 1.33 diff -u -r1.33 message.c --- wine/dlls/user/message.c 8 Jan 2003 19:56:31 -0000 1.33 +++ wine/dlls/user/message.c 11 Jan 2003 21:07:26 -0000 @@ -1900,6 +1900,32 @@ return send_inter_thread_message( dest_tid, &info, &result ); } +static DWORD WINAPI threadproc_sendmessagecallback(LPVOID lpParameter) +{ + struct send_message_info * lpInfo = (struct send_message_info *) lpParameter; + LRESULT result; + DWORD dest_tid; + if (!(dest_tid = GetWindowThreadProcessId( lpInfo->hwnd, NULL ))) + { + HeapFree( GetProcessHeap(), 0, lpInfo ); + return 1; + } + + if (USER_IsExitingThread( dest_tid )) + { + HeapFree( GetProcessHeap(), 0, lpInfo ); + return 0; + } + + if (send_inter_thread_message( dest_tid, lpInfo, &result )) + { + lpInfo->callback( lpInfo->hwnd, lpInfo->msg, lpInfo->data, result ); + HeapFree( GetProcessHeap(), 0, lpInfo ); + return 0; + } + HeapFree( GetProcessHeap(), 0, lpInfo ); + return 1; +} /*********************************************************************** * SendMessageCallbackA (USER32.@) @@ -1919,8 +1945,10 @@ SENDASYNCPROC callback, ULONG_PTR data ) { struct send_message_info info; + struct send_message_info * lpInfo; LRESULT result; DWORD dest_tid; + TRACE("\n"); if (is_pointer_message(msg)) { @@ -1952,11 +1980,11 @@ callback( hwnd, msg, data, result ); return TRUE; } - FIXME( "callback will not be called\n" ); - return send_inter_thread_message( dest_tid, &info, &result ); + lpInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(struct send_message_info) ); + CopyMemory( lpInfo, &info, sizeof(struct send_message_info) ); + return (CreateThread(NULL, 0, threadproc_sendmessagecallback, (LPVOID)lpInfo, 0, NULL) != NULL); } - /*********************************************************************** * ReplyMessage (USER32.@) */