https://bugs.winehq.org/show_bug.cgi?id=28933
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net Summary|Screamer radio, mainmenu |Screamer Radio 0.4.4 no |doesn't work |interaction with main menu | |possible (popup menus/items | |bound to parent window/menu | |destroyed before use) Component|-unknown |user32 Keywords|regression |
--- Comment #22 from Anastasius Focht focht@gmx.net --- Hello folks,
confirming.
I doubt there was a regression at all, this can never have worked unless the app code was different at that time.
--- quote --- Using overrides for mfc42.dll & mfc42u.dll (native,builtin or native) makes no difference. --- quote ---
The app is linked statically against MFC, there is no point in providing 'mfc42.dll'.
Anyway, it seems the app has an interesting way of managing popup/sub-menus. I'm still undecided if it relies on undocumented behaviour or is just sloppy coding/brain damage.
--- snip --- $ pwd /home/focht/.wine/drive_c/users/focht/Local Settings/Application Data/Screamer Radio
$ WINEDEBUG=+seh,+relay,+win,+menu wine ./screamer.exe >>log2.txt 2>&1 ... 002e:Call user32.CreateMenu() ret=0040c396 002e:trace:menu:CreateMenu return 0x200c2 002e:Ret user32.CreateMenu() retval=000200c2 ret=0040c396 002e:Call user32.CreatePopupMenu() ret=00412b27 002e:trace:menu:CreateMenu return 0x700c4 002e:Ret user32.CreatePopupMenu() retval=000700c4 ret=00412b27 002e:Call user32.CreatePopupMenu() ret=0041286b 002e:trace:menu:CreateMenu return 0x3600c8 002e:Ret user32.CreatePopupMenu() retval=003600c8 ret=0041286b ... 002e:Call user32.AppendMenuW(003600c8,00000003,00000000,00816fb0) ret=00412a5f 002e:trace:menu:InsertMenuW hMenu 0x3600c8, pos -1, flags 00000403, id 0000, str L"No History" 002e:trace:menu:MENU_InsertItem inserting at 0 flags 403 002e:trace:menu:do_debug_print_menuitem SetMenuItemInfo_common from: { ID=0x0 } 002e:trace:menu:do_debug_print_menuitem SetMenuItemInfo_common to : { ID=0x0, State=grey, Text=L"No History" } 002e:Ret user32.AppendMenuW() retval=00000001 ret=00412a5f ... 002e:Call user32.AppendMenuW(000700c4,00000010,003600c8,008c3850) ret=00412aa6 002e:trace:menu:InsertMenuW hMenu 0x700c4, pos -1, flags 00000410, id 3600c8, str L"&History" 002e:trace:menu:MENU_InsertItem inserting at 0 flags 410 002e:trace:menu:do_debug_print_menuitem SetMenuItemInfo_common from: { ID=0x0 } 002e:trace:menu:do_debug_print_menuitem SetMenuItemInfo_common to : { ID=0x3600c8, Sub=0x3600c8, fType=pop, Text=L"&History" } 002e:Ret user32.AppendMenuW() retval=00000001 ret=00412aa6 002e:Call ntdll.RtlFreeHeap(00800000,00000000,008c3850) ret=005296d3 002e:Ret ntdll.RtlFreeHeap() retval=00000001 ret=005296d3 002e:Call user32.DestroyMenu(003600c8) ret=00412ab8 002e:trace:menu:DestroyMenu (0x3600c8) 002e:Ret user32.DestroyMenu() retval=00000001 ret=00412ab8 ... 002e:Call user32.AppendMenuW(003b00c8,00000000,00001425,008c3850) ret=00411cce 002e:trace:menu:InsertMenuW hMenu 0x3b00c8, pos -1, flags 00000400, id 1425, str L"&About Screamer Radio" 002e:trace:menu:MENU_InsertItem inserting at 4 flags 400 002e:trace:menu:do_debug_print_menuitem SetMenuItemInfo_common from: { ID=0x0 } 002e:trace:menu:do_debug_print_menuitem SetMenuItemInfo_common to : { ID=0x1425, Text=L"&About Screamer Radio" } 002e:Ret user32.AppendMenuW() retval=00000001 ret=00411cce ... 002e:Call user32.AppendMenuW(000200c2,00000010,000700c4,0032f040) ret=00412d24 002e:trace:menu:InsertMenuW hMenu 0x200c2, pos -1, flags 00000410, id 700c4, str L"&File" 002e:trace:menu:MENU_InsertItem inserting at 0 flags 410 002e:trace:menu:do_debug_print_menuitem SetMenuItemInfo_common from: { ID=0x0 } 002e:warn:menu:MENU_GetMenu other process menu 0x3600c8? 002e:trace:menu:do_debug_print_menuitem SetMenuItemInfo_common to : { ID=0x700c4, Sub=0x700c4, fType=pop, Text=L"&File" } 002e:Ret user32.AppendMenuW() retval=00000001 ret=00412d24 002e:Call user32.DestroyMenu(000700c4) ret=00412d33 002e:trace:menu:DestroyMenu (0x700c4) 002e:trace:menu:DestroyMenu (0x3600c8) 002e:Ret user32.DestroyMenu() retval=00000001 ret=00412d33 002e:Call user32.CreatePopupMenu() ret=00412469 002e:trace:menu:CreateMenu return 0x800c4 002e:Ret user32.CreatePopupMenu() retval=000800c4 ret=00412469 002e:Call user32.CreatePopupMenu() ret=0041246d 002e:trace:menu:CreateMenu return 0x3700c8 002e:Ret user32.CreatePopupMenu() retval=003700c8 ret=0041246d 002e:Call user32.CreatePopupMenu() ret=0041149f 002e:trace:menu:CreateMenu return 0x3800ca 002e:Ret user32.CreatePopupMenu() retval=003800ca ret=0041149f ... --- snip ---
--- snip --- ... 002e:Call user32.AppendMenuW(000200c2,00000010,003b00c8,0032efe0) ret=00411d0e 002e:trace:menu:InsertMenuW hMenu 0x200c2, pos -1, flags 00000410, id 3b00c8, str L"&Help" 002e:trace:menu:MENU_InsertItem inserting at 5 flags 410 002e:trace:menu:do_debug_print_menuitem SetMenuItemInfo_common from: { ID=0x0 } 002e:trace:menu:do_debug_print_menuitem SetMenuItemInfo_common to : { ID=0x3b00c8, Sub=0x3b00c8, fType=pop, Text=L"&Help" } 002e:Ret user32.AppendMenuW() retval=00000001 ret=00411d0e 002e:Call user32.DestroyMenu(003b00c8) ret=00411d20 002e:trace:menu:DestroyMenu (0x3b00c8) 002e:Ret user32.DestroyMenu() retval=00000001 ret=00411d20 --- snip ---
--- snip --- 002e:Call user32.SetMenu(00010080,000200c2) ret=0040c3f7 002e:trace:menu:MENU_SetMenu (0x10080, 0x200c2); ... 002e:Ret user32.SetMenu() retval=00000001 ret=0040c3f7 --- snip ---
It unconditionally calls 'DestroyMenu()' on each item after creation/insertion of popup and sub-menu items.
When clicking the main menu items, the popup/sub-menus can't be looked up any more because the handles are no longer valid. Trace messages with 'other process menu 0xXXX?' are an indication of this.
Clicking main menu items:
--- snip --- ... 002e:Call window proc 0x7eb18d92 (hwnd=0x10080,msg=WM_INITMENU,wp=000200c2,lp=00000000) 002e:trace:win:WIN_SetWindowLong 0x10080 0 0 W 002e:Call dialog proc 0x40e2f0 (hwnd=0x10080,msg=WM_INITMENU,wp=000200c2,lp=00000000) 002e:Ret dialog proc 0x40e2f0 (hwnd=0x10080,msg=WM_INITMENU,wp=000200c2,lp=00000000) retval=00000000 result=00000000 002e:Ret window proc 0x7eb18d92 (hwnd=0x10080,msg=WM_INITMENU,wp=000200c2,lp=00000000) retval=00000000 002e:trace:menu:GetMenu for 0x10080 returning 0x200c2 002e:trace:menu:MENU_TrackMenu hmenu=0x200c2 flags=0x40000000 (247,483) hwnd=0x10080 (null) 002e:trace:menu:MENU_ButtonDown 0x32f36c hPtMenu=0x200c2 002e:trace:win:GetWindowRect hwnd 0x10080 (233,450)-(611,667) 002e:trace:menu:MENU_SwitchTracking 0x32f36c hmenu=0x200c2 0x0000 002e:trace:menu:MENU_HideSubPopups owner=0x10080 hmenu=0x200c2 0x0000 002e:trace:menu:MENU_SelectItem owner=0x10080 menu=0x200c2 index=0x0000 select=0x0001 002e:trace:win:GetDCEx hwnd 0x10080, hrgnClip (nil), flags 00000003 002e:Call winex11.drv.GetDC(0001006e,00010080,00010080,0032f0e8,0032f0d8,00000013) ret=7eb5fc7e 002e:Ret winex11.drv.GetDC() retval=00000001 ret=7eb5fc7e 002e:trace:win:GetDCEx (0x10080,(nil),0x13): returning 0x1006e (updated) 002e:trace:menu:do_debug_print_menuitem MENU_DrawMenuItem: { ID=0x700c4, Sub=0x700c4, fType=pop, State=hi, Text=L"&File" } 002e:trace:menu:MENU_DrawMenuItem rect=(0,1)-(28,19) ... 002e:Call dialog proc 0x40e2f0 (hwnd=0x10080,msg=WM_INITMENUPOPUP,wp=000700c4,lp=00000000) 002e:Ret dialog proc 0x40e2f0 (hwnd=0x10080,msg=WM_INITMENUPOPUP,wp=000700c4,lp=00000000) retval=00000000 result=00000000 002e:Ret window proc 0x7eb18d92 (hwnd=0x10080,msg=WM_INITMENUPOPUP,wp=000700c4,lp=00000000) retval=00000000 002e:trace:win:GetWindowRect hwnd 0x10080 (233,450)-(611,667) 002e:trace:menu:MENU_InitPopup owner=0x10080 hmenu=0x700c4 002e:warn:menu:MENU_GetMenu other process menu 0x700c4? 002e:trace:menu:MENU_ShowPopup owner=0x10080 hmenu=0x700c4 id=0x0000 x=0x00ec y=0x01eb xa=0x001c ya=0x0012 002e:warn:menu:MENU_GetMenu other process menu 0x700c4? 002e:Call winex11.drv.SetCapture(00010080,00000004) ret=7eb31f58 002e:Ret winex11.drv.SetCapture() retval=00000000 ret=7eb31f58 002e:warn:menu:MENU_GetMenu other process menu 0x700c4? ... --- snip ---
Interestingly, I found a patch on wine-devel mailing list sent some years ago:
https://www.winehq.org/pipermail/wine-patches/2014-May/132644.html
--- quote --- [PATCH 2/3] user32: Add internal reference counting to menu structs Andrew Eikum aeikum at codeweavers.com Fri May 16 10:52:59 CDT 2014 ... This is needed so the client can release the HMENU handle, but we can still reference the menu structure internally. The HMENU is still used all over the place internally, and those have to be fixed to point to the raw struct so things don't fail if the HMENU has been released. --- quote ---
Unfortunately there is no explanation "cover letter" and also no Bugzilla reference which app ought to be fixed by this. It helps here, although the goal of the patch was different. I took the essence of that patch and modified 'user32.DestroyWindow()' further to free the underlying window handle only if the (sub)menu was really destroyed.
It made the app fully functional. All main menu items including sub-menus (popup) can be accessed.
ProtectionID scan:
--- snip --- -=[ ProtectionID v0.6.9.0 DECEMBER]=- (c) 2003-2017 CDKiLLER & TippeX Build 24/12/17-21:05:42 Ready... Scanning -> C:\users\focht\Local Settings\Application Data\Screamer Radio\screamer.exe File Type : 32-Bit Exe (Subsystem : Win GUI / 2), Size : 1894912 (01CEA00h) Byte(s) | Machine: 0x14C (I386) Compilation TimeStamp : 0x4CE7E200 -> Sat 20th Nov 2010 14:58:08 (GMT) [TimeStamp] 0x4CE7E200 -> Sat 20th Nov 2010 14:58:08 (GMT) | PE Header | - | Offset: 0x00000100 | VA: 0x00400100 | - [TimeStamp] 0x4CE7E200 -> Sat 20th Nov 2010 14:58:08 (GMT) | DebugDirectory | - | Offset: 0x001697A4 | VA: 0x0056ADA4 | - [LoadConfig] Struct determined as v8 (Expected size 140 | Actual size 64) [!] Executable uses SEH Tables (/SAFESEH) (1045 calculated 1045 recorded... 0 invalid addresses) [LoadConfig] CodeIntegrity -> Flags 0x10 | Catalog 0x0 (0) | Catalog Offset 0x635C3A43 | Reserved 0x5C65646F [LoadConfig] GuardAddressTakenIatEntryTable 0x65726353 | Count 0x72656D61 (1919249761) [LoadConfig] GuardLongJumpTargetTable 0x6E69572E | Count 0x735C3233 (1935422003) [LoadConfig] HybridMetadataPointer 0x6372756F | DynamicValueRelocTable 0x63735C65 [LoadConfig] FailFastIndirectProc 0x6D616572 | FailFastPointer 0x622E7265 [LoadConfig] UnknownZero1 0x752E6E69 [File Heuristics] -> Flag #1 : 00000100000001001100000000000000 (0x0404C000) [Entrypoint Section Entropy] : 6.57 (section #0) ".text " | Size : 0x1685E5 (1476069) byte(s) [DllCharacteristics] -> Flag : (0x8100) -> DEP | TSA [SectionCount] 4 (0x4) | ImageSize 0x1D9000 (1937408) byte(s) [VersionInfo] Company Name : Steamcore.se [VersionInfo] Product Name : Screamer Radio [VersionInfo] Product Version : 0.4.4.0 [VersionInfo] File Description : Screamer Radio [VersionInfo] File Version : 0.4.4.0 [VersionInfo] Original FileName : screamer.exe [VersionInfo] Internal Name : Screamer Radio [VersionInfo] Version Comments : http://www.screamer-radio.com/ [VersionInfo] Legal Copyrights : Copyright (C) 2003-2010. Steamcore.se [ModuleReport] [IAT] Modules -> KERNEL32.dll | USER32.dll | GDI32.dll | MSIMG32.dll | COMDLG32.dll | WINSPOOL.DRV | ADVAPI32.dll | SHELL32.dll | COMCTL32.dll | SHLWAPI.dll | ole32.dll | OLEAUT32.dll | WS2_32.dll | OLEACC.dll | gdiplus.dll | IMM32.dll | WINMM.dll | iconv.dll [Debug Info] (record 1 of 1) (file offset 0x1697A0) Characteristics : 0x0 | TimeDateStamp : 0x4CE7E200 (Sat 20th Nov 2010 14:58:08 (GMT)) | MajorVer : 0 / MinorVer : 0 -> (0.0) Type : 2 (0x2) -> CodeView | Size : 0x58 (88) AddressOfRawData : 0x19F690 | PointerToRawData : 0x19E090 CvSig : 0x53445352 | SigGuid 09A5D969-24BF-4C71-883D5E8D3FCE8624 Age : 0x10 (16) | Pdb : C:\code\Screamer.Win32\source\screamer.bin.unicode\screamer.pdb [CdKeySerial] found "Invalid code" @ VA: 0x00193768 / Offset: 0x00192168 [CompilerDetect] -> Visual C++ 10.0 (Visual Studio 2010) [!] File appears to have no protection or is using an unknown protection - Scan Took : 0.595 Second(s) [000000253h (595) tick(s)] [506 of 580 scan(s) done] --- snip ---
$ sha1sum screamer044.exe 46d7547f4510cdb9413f665e615c77de56f24a1c screamer044.exe
$ du -sh screamer044.exe 2.7M screamer044.exe
$ wine --version wine-3.6
Regards