From 980743ad376f625f65def74534d9ae94b5a68593 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 25 Mar 2016 22:50:15 +0100 Subject: [PATCH] winex11-MONITORENUMPROC: Rebase and move code to user32. --- patches/patchinstall.sh | 40 ++++++------ ...o-address-of-rect-in-EnumDisplayMoni.patch | 32 +++++++++ patches/user32-EnumDisplayMonitors/definition | 1 + ...assembler-wrapper-to-call-MONITORENU.patch | 65 ------------------- patches/winex11-MONITORENUMPROC/definition | 1 - 5 files changed, 53 insertions(+), 86 deletions(-) create mode 100644 patches/user32-EnumDisplayMonitors/0001-user32-Set-ecx-to-address-of-rect-in-EnumDisplayMoni.patch create mode 100644 patches/user32-EnumDisplayMonitors/definition delete mode 100644 patches/winex11-MONITORENUMPROC/0001-winex11.drv-Use-assembler-wrapper-to-call-MONITORENU.patch delete mode 100644 patches/winex11-MONITORENUMPROC/definition diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 05890b7f..70315c6b 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "47cf3fe36d4f5a2f83c0d48ee763c256cd6010c5" + echo "4315caeff699325cd681b9beb7d22908b098411b" } # Show version information @@ -326,6 +326,7 @@ patch_enable_all () enable_user32_DeferWindowPos="$1" enable_user32_Dialog_Paint_Event="$1" enable_user32_DrawTextExW="$1" + enable_user32_EnumDisplayMonitors="$1" enable_user32_GetSystemMetrics="$1" enable_user32_Invalidate_Key_State="$1" enable_user32_ListBox_Size="$1" @@ -373,7 +374,6 @@ patch_enable_all () enable_winex11_CandidateWindowPos="$1" enable_winex11_Clipboard_HTML="$1" enable_winex11_DefaultDisplayFrequency="$1" - enable_winex11_MONITORENUMPROC="$1" enable_winex11_Window_Groups="$1" enable_winex11_Window_Style="$1" enable_winex11_XEMBED="$1" @@ -1153,6 +1153,9 @@ patch_enable () user32-DrawTextExW) enable_user32_DrawTextExW="$2" ;; + user32-EnumDisplayMonitors) + enable_user32_EnumDisplayMonitors="$2" + ;; user32-GetSystemMetrics) enable_user32_GetSystemMetrics="$2" ;; @@ -1294,9 +1297,6 @@ patch_enable () winex11-DefaultDisplayFrequency) enable_winex11_DefaultDisplayFrequency="$2" ;; - winex11-MONITORENUMPROC) - enable_winex11_MONITORENUMPROC="$2" - ;; winex11-Window_Groups) enable_winex11_Window_Groups="$2" ;; @@ -6701,6 +6701,21 @@ if test "$enable_user32_DrawTextExW" -eq 1; then ) >> "$patchlist" fi +# Patchset user32-EnumDisplayMonitors +# | +# | This patchset fixes the following Wine bugs: +# | * [#24421] Set %ecx to address of rect in EnumDisplayMonitors callback +# | +# | Modified files: +# | * dlls/user32/misc.c +# | +if test "$enable_user32_EnumDisplayMonitors" -eq 1; then + patch_apply user32-EnumDisplayMonitors/0001-user32-Set-ecx-to-address-of-rect-in-EnumDisplayMoni.patch + ( + echo '+ { "Sebastian Lackner", "user32: Set %ecx to address of rect in EnumDisplayMonitors callback.", 1 },'; + ) >> "$patchlist" +fi + # Patchset user32-GetSystemMetrics # | # | This patchset fixes the following Wine bugs: @@ -7387,21 +7402,6 @@ if test "$enable_winex11_DefaultDisplayFrequency" -eq 1; then ) >> "$patchlist" fi -# Patchset winex11-MONITORENUMPROC -# | -# | This patchset fixes the following Wine bugs: -# | * [#24421] Use assembler wrapper to call MONITORENUMPROC callback -# | -# | Modified files: -# | * dlls/winex11.drv/xinerama.c -# | -if test "$enable_winex11_MONITORENUMPROC" -eq 1; then - patch_apply winex11-MONITORENUMPROC/0001-winex11.drv-Use-assembler-wrapper-to-call-MONITORENU.patch - ( - echo '+ { "Sebastian Lackner", "winex11.drv: Use assembler wrapper to call MONITORENUMPROC callback.", 1 },'; - ) >> "$patchlist" -fi - # Patchset winex11-Window_Groups # | # | This patchset fixes the following Wine bugs: diff --git a/patches/user32-EnumDisplayMonitors/0001-user32-Set-ecx-to-address-of-rect-in-EnumDisplayMoni.patch b/patches/user32-EnumDisplayMonitors/0001-user32-Set-ecx-to-address-of-rect-in-EnumDisplayMoni.patch new file mode 100644 index 00000000..f8f44f21 --- /dev/null +++ b/patches/user32-EnumDisplayMonitors/0001-user32-Set-ecx-to-address-of-rect-in-EnumDisplayMoni.patch @@ -0,0 +1,32 @@ +From 3c1402c7476be339a313f7603439b42f471a4b12 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Fri, 25 Mar 2016 22:46:15 +0100 +Subject: user32: Set %ecx to address of rect in EnumDisplayMonitors callback. + +--- + dlls/user32/misc.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c +index 109809f..54be9c9 100644 +--- a/dlls/user32/misc.c ++++ b/dlls/user32/misc.c +@@ -471,6 +471,7 @@ BOOL WINAPI GetMonitorInfoW(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo) + #ifdef __i386__ + /* Some apps pass a non-stdcall callback to EnumDisplayMonitors, + * so we need a small assembly wrapper to call it. ++ * MJ's Help Diagnostic expects that %ecx contains the address to rect. + */ + struct enumdisplaymonitors_lparam + { +@@ -491,6 +492,7 @@ __ASM_STDCALL_FUNC( enumdisplaymonitors_callback_wrapper, 16, + "pushl 16(%ebp)\n\t" + "pushl 12(%ebp)\n\t" + "pushl 8(%ebp)\n\t" ++ "movl 16(%ebp),%ecx\n\t" + "call *(%eax)\n\t" /* call orig->proc */ + "leave\n\t" + __ASM_CFI(".cfi_def_cfa %esp,4\n\t") +-- +2.7.1 + diff --git a/patches/user32-EnumDisplayMonitors/definition b/patches/user32-EnumDisplayMonitors/definition new file mode 100644 index 00000000..c98f9073 --- /dev/null +++ b/patches/user32-EnumDisplayMonitors/definition @@ -0,0 +1 @@ +Fixes: [24421] Set %ecx to address of rect in EnumDisplayMonitors callback diff --git a/patches/winex11-MONITORENUMPROC/0001-winex11.drv-Use-assembler-wrapper-to-call-MONITORENU.patch b/patches/winex11-MONITORENUMPROC/0001-winex11.drv-Use-assembler-wrapper-to-call-MONITORENU.patch deleted file mode 100644 index 29b6e1b4..00000000 --- a/patches/winex11-MONITORENUMPROC/0001-winex11.drv-Use-assembler-wrapper-to-call-MONITORENU.patch +++ /dev/null @@ -1,65 +0,0 @@ -From c02ba27cd7b2a59b3ad636184602077048dce128 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Fri, 12 Feb 2016 00:08:32 +0100 -Subject: winex11.drv: Use assembler wrapper to call MONITORENUMPROC callback. - ---- - dlls/winex11.drv/xinerama.c | 28 ++++++++++++++++++++++++++-- - 1 file changed, 26 insertions(+), 2 deletions(-) - -diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c -index 7e28726..93fb9be 100644 ---- a/dlls/winex11.drv/xinerama.c -+++ b/dlls/winex11.drv/xinerama.c -@@ -243,6 +243,30 @@ BOOL CDECL X11DRV_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info ) - return TRUE; - } - -+#ifdef __i386__ -+/* MJ's Help Diagnostic expects that %ecx contains the address to rect, -+ * so we need a small assembly wrapper to call the proc. */ -+extern BOOL enum_monitor_wrapper( void *callback, HMONITOR monitor, HDC hdc, RECT *rect, LPARAM data ); -+__ASM_GLOBAL_FUNC( enum_monitor_wrapper, -+ "pushl %ebp\n\t" -+ __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") -+ __ASM_CFI(".cfi_rel_offset %ebp,0\n\t") -+ "movl %esp,%ebp\n\t" -+ __ASM_CFI(".cfi_def_cfa_register %ebp\n\t") -+ "subl $8,%esp\n\t" -+ "pushl 24(%ebp)\n\t" -+ "pushl 20(%ebp)\n\t" -+ "pushl 16(%ebp)\n\t" -+ "pushl 12(%ebp)\n\t" -+ "movl 20(%ebp),%ecx\n\t" -+ "call *8(%ebp)\n\t" -+ "leave\n\t" -+ __ASM_CFI(".cfi_def_cfa %esp,4\n\t") -+ __ASM_CFI(".cfi_same_value %ebp\n\t") -+ "ret" ) -+#else -+#define enum_monitor_wrapper( callback, monitor, hdc, rect, data ) (callback)( (monitor), (hdc), (rect), (data) ) -+#endif - - /*********************************************************************** - * X11DRV_EnumDisplayMonitors (X11DRV.@) -@@ -266,7 +290,7 @@ BOOL CDECL X11DRV_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC pro - RECT monrect = monitors[i].rcMonitor; - OffsetRect( &monrect, -origin.x, -origin.y ); - if (IntersectRect( &monrect, &monrect, &limit )) -- if (!proc( index_to_monitor(i), hdc, &monrect, lp )) -+ if (!enum_monitor_wrapper( proc, index_to_monitor(i), hdc, &monrect, lp )) - return FALSE; - } - } -@@ -276,7 +300,7 @@ BOOL CDECL X11DRV_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC pro - { - RECT unused; - if (!rect || IntersectRect( &unused, &monitors[i].rcMonitor, rect )) -- if (!proc( index_to_monitor(i), 0, &monitors[i].rcMonitor, lp )) -+ if (!enum_monitor_wrapper( proc, index_to_monitor(i), 0, &monitors[i].rcMonitor, lp )) - return FALSE; - } - } --- -2.7.1 - diff --git a/patches/winex11-MONITORENUMPROC/definition b/patches/winex11-MONITORENUMPROC/definition deleted file mode 100644 index b0338237..00000000 --- a/patches/winex11-MONITORENUMPROC/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [24421] Use assembler wrapper to call MONITORENUMPROC callback