https://bugs.winehq.org/show_bug.cgi?id=26560
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |focht@gmx.net Component|-unknown |user32 Summary|Amazon MP3 Downloader: |Amazon MP3 Downloader: left |Menus don't work. |mouse click on menus | |doesn't work (WM_MENUSELECT | |message not seen by app | |hook during popup menu | |tracking) Ever confirmed|0 |1
--- Comment #5 from Anastasius Focht focht@gmx.net --- Hello folks,
confirming.
The app installs a WH_MSGFILTER type hook with SetWindowsHookExW() and calls TrackPopupMenuEx() with flags (TPM_RIGHTBUTTON|TPM_LEFTALIGN|TPM_TOPALIGN|TPM_VERTICAL|TPM_VERPOSANIMATION), meaning that both, right and left mouse button click should have the same effect.
Right mouse click works:
--- snip --- $ pwd /home/focht/.wine/drive_c/Program Files/Amazon/MP3 Downloader
$ WINEDEBUG=+tid,+seh,+relay,+msg,+win,+menu wine ./AmazonMP3Downloader.exe
log.txt 2>&1
... 0025:Call user32.SetWindowsHookExW(ffffffff,004baa70,00000000,00000025) ret=004badae 0025:Ret user32.SetWindowsHookExW() retval=000100ec ret=004badae 0025:Call user32.TrackPopupMenuEx(00010084,00001042,00000153,000000f2,00020076,0032f83c) ret=004bade1 0025:trace:menu:TrackPopupMenuEx hmenu 0x10084 flags 1042 (339,242) hwnd 0x20076 lpTpm 0x32f83c rect (339,223)-(379,242) 0025:trace:menu:MENU_InitTracking hwnd=0x20076 hmenu=0x10084 0025:Call window proc 0x4cc4db (hwnd=0x20076,msg=WM_ENTERMENULOOP,wp=00000001,lp=00000000) 0025:Call user32.CallWindowProcW(7159389f,00020076,00000211,00000001,00000000) ret=004ca5ff 0025:Call window proc 0x7159389f (hwnd=0x20076,msg=WM_ENTERMENULOOP,wp=00000001,lp=00000000) ... 0025:trace:msg:peek_message got type 7 msg 205 (WM_RBUTTONUP) hwnd 0x100ee wp 0 lp 0 0025:Call hook proc 0x4baa70 (id=WH_MSGFILTER,code=2,wp=00000000,lp=0032f6c8) 0025:Call user32.CallNextHookEx(000100ec,00000002,00000000,0032f6c8) ret=004baab1 0025:Call hook proc 0x4d0438 (id=WH_MSGFILTER,code=2,wp=00000000,lp=0032f6c8) 0025:Call user32.GetParent(000100ee) ret=004ce1e4 0025:Ret user32.GetParent() retval=0001007c ret=004ce1e4 0025:Call user32.GetParent(000100ee) ret=004cc671 0025:Ret user32.GetParent() retval=0001007c ret=004cc671 0025:Call user32.GetParent(0001007c) ret=004ce1e4 0025:Ret user32.GetParent() retval=00000000 ret=004ce1e4 0025:Call user32.GetParent(0001007c) ret=004cc671 0025:Ret user32.GetParent() retval=00000000 ret=004cc671 0025:Ret hook proc 0x4d0438 (id=WH_MSGFILTER,code=2,wp=00000000,lp=0032f6c8) retval=00000000 0025:Ret user32.CallNextHookEx() retval=00000000 ret=004baab1 0025:Ret hook proc 0x4baa70 (id=WH_MSGFILTER,code=2,wp=00000000,lp=0032f6c8) retval=00000000 0025:trace:menu:MENU_ButtonUp 0x32f6b0 hmenu=0x10084 0025:trace:win:GetWindowRect hwnd 0x100ee (339,242)-(501,334) 0025:trace:menu:do_debug_print_menuitem FocusedItem: { ID=0xe140, State=hi, Text=L"&About..." } 0025:trace:menu:MENU_ExecFocusedItem 0x32f6b0 hmenu=0x10084 0025:trace:menu:MENU_ExecFocusedItem hMenu 0x10084 wID 0000e140 hSubMenu (nil) fType 0000 0025:trace:msg:PostMessageW hwnd 0x20076 msg 111 (WM_COMMAND) wp e140 lp 0 0025:trace:menu:MENU_TrackMenu executedMenuId 57664 ... 0025:trace:menu:MENU_ExitTracking hwnd=0x20076 0025:Call window proc 0x4cc4db (hwnd=0x20076,msg=WM_EXITMENULOOP,wp=00000001,lp=00000000) 0025:Call user32.CallWindowProcW(7159389f,00020076,00000212,00000001,00000000) ret=004ca5ff 0025:Call window proc 0x7159389f (hwnd=0x20076,msg=WM_EXITMENULOOP,wp=00000001,lp=00000000) 0025:Call user32.GetWindowLongA(00020076,00000000) ret=715938b4 0025:Ret user32.GetWindowLongA() retval=00148440 ret=715938b4 0025:Call user32.DefWindowProcW(00020076,00000212,00000001,00000000) ret=71593c5b 0025:Ret user32.DefWindowProcW() retval=00000000 ret=71593c5b 0025:Ret window proc 0x7159389f (hwnd=0x20076,msg=WM_EXITMENULOOP,wp=00000001,lp=00000000) retval=00000000 0025:Ret user32.CallWindowProcW() retval=00000000 ret=004ca5ff 0025:Ret window proc 0x4cc4db (hwnd=0x20076,msg=WM_EXITMENULOOP,wp=00000001,lp=00000000) retval=00000000 0025:Ret user32.TrackPopupMenuEx() retval=00000001 ret=004bade1 0025:Call user32.UnhookWindowsHookEx(000100ec) ret=004baded 0025:Ret user32.UnhookWindowsHookEx() retval=00000001 ret=004baded ... --- snip ---
Left mouse click (doesn't work):
--- snip --- 0025:trace:msg:peek_message got type 7 msg 202 (WM_LBUTTONUP) hwnd 0x100ee wp 0 lp 0 0025:Call hook proc 0x4baa70 (id=WH_MSGFILTER,code=2,wp=00000000,lp=0032f6c8) 0025:Ret hook proc 0x4baa70 (id=WH_MSGFILTER,code=2,wp=00000000,lp=0032f6c8) retval=00000001 0025:trace:msg:peek_message got type 7 msg 202 (WM_LBUTTONUP) hwnd 0x100ee wp 0 lp 0 0025:Call winex11.drv.MsgWaitForMultipleObjectsEx(00000000,00000000,00000000,000004ff,00000000) ret=7ec19c4b 0025:Ret winex11.drv.MsgWaitForMultipleObjectsEx() retval=00000102 ret=7ec19c4b 0025:Call winex11.drv.MsgWaitForMultipleObjectsEx(00000001,0032f450,ffffffff,000004ff,00000000) ret=7ec19c4b 0025:Ret winex11.drv.MsgWaitForMultipleObjectsEx() retval=00000000 ret=7ec19c4b --- snip ---
The hook eats WM_LBUTTONUP messages during tracking (retval 0x1).
Looking at the app's hook code it seems that WM_MENUSELECT message needs to be seen by the hook (= stores menu item id) before WM_LBUTTONUP is properly processed.
--- snip --- 004BA120 8B4424 04 MOV EAX,DWORD PTR SS:[ESP+4] 004BA124 83EC 08 SUB ESP,8 004BA127 53 PUSH EBX 004BA128 55 PUSH EBP 004BA129 56 PUSH ESI 004BA12A 8BF1 MOV ESI,ECX 004BA12C 8B48 04 MOV ECX,DWORD PTR DS:[EAX+4] ; msg.message 004BA12F 81F9 00020000 CMP ECX,200 ; WM_MOUSEFIRST 004BA135 57 PUSH EDI 004BA136 0F87 42020000 JA 004BA37E 004BA13C 0F84 7E010000 JE 004BA2C0 ; WM_MOUSEMOVE 004BA142 81E9 00010000 SUB ECX,100 ; WM_KEYFIRST 004BA148 74 68 JZ SHORT 004BA1B2 004BA14A 83E9 1F SUB ECX,1F ; WM_MENUSELECT 004BA14D 0F85 06030000 JNZ 004BA459 004BA153 8B48 0C MOV ECX,DWORD PTR DS:[EAX+0C] ; msg.lParam 004BA156 898E 8C000000 MOV DWORD PTR DS:[ESI+8C],ECX 004BA15C 0FB750 08 MOVZX EDX,WORD PTR DS:[EAX+8] ; msg.wParam (id) 004BA160 33C9 XOR ECX,ECX 004BA162 8A48 0A MOV CL,BYTE PTR DS:[EAX+0A] 004BA165 BB 01000000 MOV EBX,1 004BA16A 8915 D0805300 MOV DWORD PTR DS:[5380D0],EDX ; (id) ... 004BA37E 81E9 01020000 SUB ECX,201 ; WM_LBUTTONDOWN 004BA384 74 6E JZ SHORT 004BA3F4 004BA386 49 DEC ECX ; WM_LBUTTONUP 004BA387 0F85 CC000000 JNZ 004BA459 004BA38D A1 D0805300 MOV EAX,DWORD PTR DS:[5380D0] ; msg.wParam (id) 004BA392 85C0 TEST EAX,EAX 004BA394 8BF8 MOV EDI,EAX 004BA396 74 4D JZ SHORT 004BA3E5 004BA398 6A 00 PUSH 0 004BA39A 50 PUSH EAX 004BA39B A1 C8805300 MOV EAX,DWORD PTR DS:[5380C8] 004BA3A0 8B88 8C000000 MOV ECX,DWORD PTR DS:[EAX+8C] 004BA3A6 51 PUSH ECX 004BA3A7 FF15 2C854E00 CALL DWORD PTR DS:[<&USER32.GetMenuState>] ... 004BA3E5 5F POP EDI 004BA3E6 5E POP ESI 004BA3E7 5D POP EBP 004BA3E8 B8 01000000 MOV EAX,1 004BA3ED 5B POP EBX 004BA3EE 83C4 08 ADD ESP,8 004BA3F1 C2 0400 RETN 4 ... --- snip ---
Source: http://source.winehq.org/git/wine.git/blob/77ee42fd330130c55b6b74ab8662a2377...
--- snip --- 2978 static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y, 2979 HWND hwnd, const RECT *lprect ) 2980 { ... 3020 __TRY while (!fEndMenu) 3021 { 3022 menu = MENU_GetMenu( mt.hCurrentMenu ); 3023 if (!menu) /* sometimes happens if I do a window manager close */ 3024 break; 3025 3026 /* we have to keep the message in the queue until it's 3027 * clear that menu loop is not over yet. */ 3028 3029 for (;;) 3030 { 3031 if (PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE )) 3032 { 3033 if (!CallMsgFilterW( &msg, MSGF_MENU )) break; 3034 /* remove the message from the queue */ 3035 PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE ); 3036 } 3037 else 3038 { 3039 if (!enterIdleSent) 3040 { 3041 HWND win = menu->wFlags & MF_POPUP ? menu->hWnd : 0; 3042 enterIdleSent = TRUE; 3043 SendMessageW( mt.hOwnerWnd, WM_ENTERIDLE, MSGF_MENU, (LPARAM)win ); 3044 } 3045 WaitMessage(); 3046 } 3047 } ... 3068 fRemove = FALSE; 3069 if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST)) 3070 { ... 3082 switch(msg.message) 3083 { ... 3120 case WM_MOUSEMOVE: 3121 /* the selected menu item must be changed every time */ 3122 /* the mouse moves. */ 3123 3124 if (hmenu) 3125 fEndMenu |= !MENU_MouseMove( &mt, hmenu, wFlags ); 3126 3127 } /* switch(msg.message) - mouse */ 3128 } ... --- snip ---
$ sha1sum AmazonMP3Installer.exe 011887aaffdfe0773b8d9ca9ba0317b3ba883a6e AmazonMP3Installer.exe
$ du -sh AmazonMP3Installer.exe 592K AmazonMP3Installer.exe
$ wine --version wine-1.7.11-159-gee33839
Regards