[PATCH] shell32 - handle WM_CLOSE in the Control Panel window (fixed)

Vincent Povirk madewokherd+8cd9 at gmail.com
Thu Aug 21 21:55:42 CDT 2008


Commenting out FreeLibrary(applet->hModule); in Control_UnloadApplet
avoids the crash. The problem is that the applet's dialog still exists
when FreeLibrary is called. Since its dialog procedure was in the
freed library, the program crashes when that dialog gets a message.

I don't know what the proper fix is.

Vincent Povirk



On Thu, Aug 21, 2008 at 9:26 PM, Steven Edwards <winehacker at gmail.com> wrote:
> On Thu, Aug 21, 2008 at 9:00 PM, Vincent Povirk
> <madewokherd+8cd9 at gmail.com> wrote:
>> Why doesn't the WM_DESTROY case handle this properly? At first glance,
>> it appears to have code for stopping the running applets and quitting
>> from the main loop.
>>
>> Calling ExitProcess from WM_CLOSE is anything but graceful.
>
> I am not sure what the right answer is as I've never really tried to
> fix this type of problem before, WM_DESTROY does not seem to do
> something right, as even making WM_CLOSE fall through to it produces
> the same crash. I spent some time trying to debug the problem but got
> no where so I started just blindly adding PostQuitMessages and
> ExitProcess calls around the areas in the backtrace until I found
> something that got rid of the crash. Its easy to replicate, just run
> control, open the appwiz.cpl and then close the control panel window
> with the cpl applet still open.
>
> Here is the backtrace
>
> wine: Unhandled page fault on execute access to 0x7e50da00 at address
> 0x7e50da00 (thread 0009), starting debugger...
> Unhandled exception: page fault on execute access to 0x7e50da00 in
> 32-bit code (0x7e50da00).
> Register dump:
>  CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
>  EIP:7e50da00 ESP:0033b57c EBP:0033b5a8 EFLAGS:00010206(   - 00      - RIP1)
>  EAX:7e50da00 EBX:7eba0574 ECX:00000000 EDX:7e50da00
>  ESI:00000000 EDI:0001003a
> Stack dump:
> 0x0033b57c:  7eb7d8da 0001003a 00000018 00000000
> 0x0033b58c:  00000000 7ebbfe80 7eba0574 0033b5a8
> 0x0033b59c:  7eba0574 00000000 0001003a 0033b5e8
> 0x0033b5ac:  7eb7f738 7e50da00 0001003a 00000018
> 0x0033b5bc:  00000000 00000000 00000000 0033b5d8
> 0x0033b5cc:  7eb6f120 7ebbfe80 7eba0574 7eb7f6db
> Backtrace:
> =>1 0x7e50da00 (0x0033b5a8)
>  2 0x7eb7f738 call_dialog_proc+0x68(hwnd=<register EDI not in topmost
> frame>, msg=0x18, wp=0x0, lp=0x0, result=0x33b618, arg=0x7e50da00)
> [/home/sedwards/source/wine-git/dlls/user32/winproc.c:479] in user32
> (0x0033b5e8)
>  3 0x7eb82f5a WINPROC_CallDlgProcW+0x5a(func=0xffff0026,
> hwnd=0x1003a, msg=0x18, wParam=<register EDI not in topmost frame>,
> lParam=0x0) [/home/sedwards/source/wine-git/dlls/user32/winproc.c:2394]
> in user32 (0x0033b628)
>  4 0x7eb0a2d5 DefDlgProcW+0x85(hwnd=<register ESI not in topmost
> frame>, msg=0x18, wParam=0x0, lParam=0x0)
> [/home/sedwards/source/wine-git/dlls/user32/defdlg.c:488] in user32
> (0x0033b658)
>  5 0x7eb7d8da WINPROC_wrapper+0x1a() in user32 (0x0033b688)
>  6 0x7eb7dfce call_window_proc+0x6e(hwnd=<register EDI not in topmost
> frame>, msg=0x18, wp=0x0, lp=0x0, result=0x33b76c, arg=0x7eb0a250)
> [/home/sedwards/source/wine-git/dlls/user32/winproc.c:457] in user32
> (0x0033b6c8)
>  7 0x7eb842f1 WINPROC_call_window+0xd1(hwnd=<register ESI not in
> topmost frame>, msg=0x18, wParam=0x0, lParam=0x0, result=0x33b76c,
> unicode=0x1, mapping=0x1)
> [/home/sedwards/source/wine-git/dlls/user32/winproc.c:2207] in user32
> (0x0033b708)
>  8 0x7eb458ca call_window_proc+0xca(hwnd=<register ESI not in topmost
> frame>, msg=0x18, wparam=0x0, lparam=0x0, unicode=0x1,
> same_thread=0x1, mapping=0x1)
> [/home/sedwards/source/wine-git/dlls/user32/message.c:1639] in user32
> (0x0033b778)
>  9 0x7eb48862 send_message+0x222(info=<register EDI not in topmost
> frame>, res_ptr=0x33b814, unicode=<register ESI not in topmost frame>)
> [/home/sedwards/source/wine-git/dlls/user32/message.c:2463] in user32
> (0x0033b7d8)
>  10 0x7eb48cda SendMessageW+0x4a(hwnd=0x1003a, msg=0x18, wparam=0x0,
> lparam=0x0) [/home/sedwards/source/wine-git/dlls/user32/message.c:2586]
> in user32 (0x0033b818)
>  11 0x7eb7cd06 show_window+0x4d6(hwnd=0x1003a, cmd=<register ESI not
> in topmost frame>)
> [/home/sedwards/source/wine-git/dlls/user32/winpos.c:1046] in user32
> (0x0033b888)
>  12 0x7eb7ce4b ShowWindow+0x3b(hwnd=<register ESI not in topmost
> frame>, cmd=0x0)
> [/home/sedwards/source/wine-git/dlls/user32/winpos.c:1154] in user32
> (0x0033b8a8)
>  13 0x7eb724fc DestroyWindow+0x1bc(hwnd=0x1003a)
> [/home/sedwards/source/wine-git/dlls/user32/win.c:1502] in user32
> (0x0033b8e8)
>  14 0x7ea4e49b PROPSHEET_CleanUp+0xcb(hwndDlg=<is not available>)
> [/home/sedwards/source/wine-git/dlls/comctl32/propsheet.c:2720] in
> comctl32 (0x0033b918)
>  15 0x7ea51ef5 PROPSHEET_DialogProc+0x595(hwnd=0x1002e,
> uMsg=<register ESI not in topmost frame>, wParam=0x0, lParam=0x0)
> [/home/sedwards/source/wine-git/dlls/comctl32/propsheet.c:3534] in
> comctl32 (0x0033bc48)
>  16 0x7eb7d8da WINPROC_wrapper+0x1a() in user32 (0x0033bc78)
>  17 0x7eb7f738 call_dialog_proc+0x68(hwnd=<register EDI not in
> topmost frame>, msg=0x2, wp=0x0, lp=0x0, result=0x33bce8,
> arg=0x7ea51960)
> [/home/sedwards/source/wine-git/dlls/user32/winproc.c:479] in user32
> (0x0033bcb8)
>  18 0x7eb82f5a WINPROC_CallDlgProcW+0x5a(func=0xffff0025,
> hwnd=0x1002e, msg=0x2, wParam=<register EDI not in topmost frame>,
> lParam=0x0) [/home/sedwards/source/wine-git/dlls/user32/winproc.c:2394]
> in user32 (0x0033bcf8)
>  19 0x7eb0a2d5 DefDlgProcW+0x85(hwnd=<register ESI not in topmost
> frame>, msg=0x2, wParam=0x0, lParam=0x0)
> [/home/sedwards/source/wine-git/dlls/user32/defdlg.c:488] in user32
> (0x0033bd28)
>  20 0x7eb7d8da WINPROC_wrapper+0x1a() in user32 (0x0033bd58)
>  21 0x7eb7dfce call_window_proc+0x6e(hwnd=<register EDI not in
> topmost frame>, msg=0x2, wp=0x0, lp=0x0, result=0x33be3c,
> arg=0x7eb0a250)
> [/home/sedwards/source/wine-git/dlls/user32/winproc.c:457] in user32
> (0x0033bd98)
>  22 0x7eb842f1 WINPROC_call_window+0xd1(hwnd=<register ESI not in
> topmost frame>, msg=0x2, wParam=0x0, lParam=0x0, result=0x33be3c,
> unicode=0x1, mapping=0x1002e)
> [/home/sedwards/source/wine-git/dlls/user32/winproc.c:2207] in user32
> (0x0033bdd8)
>  23 0x7eb458ca call_window_proc+0xca(hwnd=<register ESI not in
> topmost frame>, msg=0x2, wparam=0x0, lparam=0x0, unicode=0x1,
> same_thread=0x1, mapping=0x1002e)
> [/home/sedwards/source/wine-git/dlls/user32/message.c:1639] in user32
> (0x0033be48)
>  24 0x7eb48862 send_message+0x222(info=<register EDI not in topmost
> frame>, res_ptr=0x33bee4, unicode=<register ESI not in topmost frame>)
> [/home/sedwards/source/wine-git/dlls/user32/message.c:2463] in user32
> (0x0033bea8)
>  25 0x7eb48cda SendMessageW+0x4a(hwnd=0x1002e, msg=0x2, wparam=0x0,
> lparam=0x0) [/home/sedwards/source/wine-git/dlls/user32/message.c:2586]
> in user32 (0x0033bee8)
>  26 0x7eb71186 WIN_SendDestroyMsg+0x66(hwnd=<register ESI not in
> topmost frame>)
> [/home/sedwards/source/wine-git/dlls/user32/win.c:1436] in user32
> (0x0033bf48)
>  27 0x7eb72521 DestroyWindow+0x1e1(hwnd=0x1002e)
> [/home/sedwards/source/wine-git/dlls/user32/win.c:1540] in user32
> (0x0033bf88)
>  28 0x7ea4f8a0 PROPSHEET_PropertySheet+0x2c0(psInfo=0x1381c0,
> unicode=<is not available>)
> [/home/sedwards/source/wine-git/dlls/comctl32/propsheet.c:2803] in
> comctl32 (0x0033bfe8)
>  29 0x7ea500cf PropertySheetW+0x1cf(lppsh=0x33d080)
> [/home/sedwards/source/wine-git/dlls/comctl32/propsheet.c:2900] in
> comctl32 (0x0033c058)
>  30 0x7e50c930 (0x0033d0f8)
>  31 0x7ed7e3cd Control_WndProc+0xa3d(hWnd=0x10026, wMsg=0x4e,
> lParam1=0x3e8, lParam2=0x33e4a0)
> [/home/sedwards/source/wine-git/dlls/shell32/control.c:501] in shell32
> (0x0033e238)
>  32 0x7eb7d8da WINPROC_wrapper+0x1a() in user32 (0x0033e268)
>  33 0x7eb7dfce call_window_proc+0x6e(hwnd=<register EDI not in
> topmost frame>, msg=0x4e, wp=0x3e8, lp=0x33e4a0, result=0x33e34c,
> arg=0x7ed7d990)
> [/home/sedwards/source/wine-git/dlls/user32/winproc.c:457] in user32
> (0x0033e2a8)
>  34 0x7eb842f1 WINPROC_call_window+0xd1(hwnd=<register ESI not in
> topmost frame>, msg=0x4e, wParam=0x3e8, lParam=0x33e4a0,
> result=0x33e34c, unicode=0x1, mapping=0x1)
> [/home/sedwards/source/wine-git/dlls/user32/winproc.c:2207] in user32
> (0x0033e2e8)
>  35 0x7eb458ca call_window_proc+0xca(hwnd=<register ESI not in
> topmost frame>, msg=0x4e, wparam=0x3e8, lparam=0x33e4a0, unicode=0x1,
> same_thread=0x1, mapping=0x1)
> [/home/sedwards/source/wine-git/dlls/user32/message.c:1639] in user32
> (0x0033e358)
>  36 0x7eb48862 send_message+0x222(info=<register EDI not in topmost
> frame>, res_ptr=0x33e3f4, unicode=<register ESI not in topmost frame>)
> [/home/sedwards/source/wine-git/dlls/user32/message.c:2463] in user32
> (0x0033e3b8)
>  37 0x7eb48cda SendMessageW+0x4a(hwnd=0x10026, msg=0x4e,
> wparam=0x3e8, lparam=0x33e4a0)
> [/home/sedwards/source/wine-git/dlls/user32/message.c:2586] in user32
> (0x0033e3f8)
>  38 0x7ea2b89b notify_hdr+0x6b(infoPtr=<register EDI not in topmost
> frame>, code=0xfffffffd, pnmh=<register ESI not in topmost frame>)
> [/home/sedwards/source/wine-git/dlls/comctl32/listview.c:737] in
> comctl32 (0x0033e428)
>  39 0x7ea3364f notify_click+0x16f(infoPtr=0x1337e8, code=0xfffffffd,
> lvht=0x33e578) [/home/sedwards/source/wine-git/dlls/comctl32/listview.c:806]
> in comctl32 (0x0033e4d8)
>  40 0x7ea33955 LISTVIEW_LButtonDblClk+0xa5(infoPtr=<register EDI not
> in topmost frame>, wKey=<is not available>, x=0x28, y=0x15)
> [/home/sedwards/source/wine-git/dlls/comctl32/listview.c:8557] in
> comctl32 (0x0033e598)
>  41 0x7ea3ecbe LISTVIEW_WindowProc+0x3de(hwnd=0x1002a, uMsg=0x203,
> wParam=0x1, lParam=0x15)
> [/home/sedwards/source/wine-git/dlls/comctl32/listview.c:9926] in
> comctl32 (0x0033ee98)
>  42 0x7eb7d8da WINPROC_wrapper+0x1a() in user32 (0x0033eec8)
>  43 0x7eb7dfce call_window_proc+0x6e(hwnd=<register EDI not in
> topmost frame>, msg=0x203, wp=0x1, lp=0x150028, result=0x33ef78,
> arg=0x7ea3e8e0)
> [/home/sedwards/source/wine-git/dlls/user32/winproc.c:457] in user32
> (0x0033ef08)
>  44 0x7eb842f1 WINPROC_call_window+0xd1(hwnd=<register ESI not in
> topmost frame>, msg=0x203, wParam=0x1, lParam=0x150028,
> result=0x33ef78, unicode=0x1, mapping=0x4)
> [/home/sedwards/source/wine-git/dlls/user32/winproc.c:2207] in user32
> (0x0033ef48)
>  45 0x7eb45186 DispatchMessageW+0x96(msg=<register EDI not in topmost
> frame>) [/home/sedwards/source/wine-git/dlls/user32/message.c:3125] in
> user32 (0x0033ef88)
>  46 0x7ed7f177 Control_RunDLLW+0x3f7(hWnd=0x10020, hInst=0x0,
> cmd=0x1326f0, nCmdShow=0x5)
> [/home/sedwards/source/wine-git/dlls/shell32/control.c:620] in shell32
> (0x0033fcc8)
>  47 0x7ed7f76d Control_RunDLLA+0xfd(hWnd=0x10020, hInst=0x0,
> cmd=0x7ee7eb43, nCmdShow=0x5)
> [/home/sedwards/source/wine-git/dlls/shell32/control.c:825] in shell32
> (0x0033fcf8)
>  48 0x7ee7e5ea launch+0x3a(what=<register ESI not in topmost frame>)
> [/home/sedwards/source/wine-git/programs/control/control.c:31] in
> control (0x0033fd18)
>  49 0x7ee7e665 WinMain+0x65(hInst=0x7ee70000, hPrev=0x0,
> lpszCmdLine=0x110860, nCmdShow=0x1)
> [/home/sedwards/source/wine-git/programs/control/control.c:70] in
> control (0x0033fe58)
>  50 0x7ee7e963 main+0xa3()
> [/home/sedwards/source/wine-git/dlls/winecrt0/exe_main.c:48] in
> control (0x0033fed8)
>  51 0x7ee7e88b __wine_spec_exe_entry+0x5b(peb=0x7ffdf000)
> [/home/sedwards/source/wine-git/dlls/winecrt0/exe_entry.c:36] in
> control (0x0033ff08)
>  52 0x7b877ef7 start_process+0xc7(arg=0x0)
> [/home/sedwards/source/wine-git/dlls/kernel32/process.c:904] in
> kernel32 (0x0033ffe8)
>
>
> --
> Steven Edwards
>
> "There is one thing stronger than all the armies in the world, and
> that is an idea whose time has come." - Victor Hugo
>
>
>



More information about the wine-devel mailing list