From c344dcf96e1c4ae08294c0c6ab42dd135adefe1a Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 27 Jan 2016 07:32:11 +0100 Subject: [PATCH] Added patch to avoid crash when INVALID_HANDLE_VALUE is passed to CloseThemeData. --- patches/patchinstall.sh | 19 +++++++++ ...rash-when-INVALID_HANDLE_VALUE-is-pa.patch | 40 +++++++++++++++++++ patches/uxtheme-CloseThemeData/definition | 1 + 3 files changed, 60 insertions(+) create mode 100644 patches/uxtheme-CloseThemeData/0001-uxtheme-Do-not-crash-when-INVALID_HANDLE_VALUE-is-pa.patch create mode 100644 patches/uxtheme-CloseThemeData/definition diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 42df97c4..d112a9b5 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -312,6 +312,7 @@ patch_enable_all () enable_user32_WM_CAPTURECHANGE="$1" enable_user32_WM_MDICALCCHILDSCROLL="$1" enable_user32_WndProc="$1" + enable_uxtheme_CloseThemeData="$1" enable_uxtheme_GTK_Theming="$1" enable_vcomp_Atomic_I8="$1" enable_version_VerQueryValue="$1" @@ -1076,6 +1077,9 @@ patch_enable () user32-WndProc) enable_user32_WndProc="$2" ;; + uxtheme-CloseThemeData) + enable_uxtheme_CloseThemeData="$2" + ;; uxtheme-GTK_Theming) enable_uxtheme_GTK_Theming="$2" ;; @@ -6316,6 +6320,21 @@ if test "$enable_user32_WndProc" -eq 1; then ) >> "$patchlist" fi +# Patchset uxtheme-CloseThemeData +# | +# | This patchset fixes the following Wine bugs: +# | * [#29862] Do not crash when INVALID_HANDLE_VALUE is passed to CloseThemeData +# | +# | Modified files: +# | * dlls/uxtheme/system.c, dlls/uxtheme/tests/system.c +# | +if test "$enable_uxtheme_CloseThemeData" -eq 1; then + patch_apply uxtheme-CloseThemeData/0001-uxtheme-Do-not-crash-when-INVALID_HANDLE_VALUE-is-pa.patch + ( + echo '+ { "Louis Lenders", "uxtheme: Do not crash when INVALID_HANDLE_VALUE is passed to CloseThemeData.", 1 },'; + ) >> "$patchlist" +fi + # Patchset uxtheme-GTK_Theming # | # | This patchset has the following (direct or indirect) dependencies: diff --git a/patches/uxtheme-CloseThemeData/0001-uxtheme-Do-not-crash-when-INVALID_HANDLE_VALUE-is-pa.patch b/patches/uxtheme-CloseThemeData/0001-uxtheme-Do-not-crash-when-INVALID_HANDLE_VALUE-is-pa.patch new file mode 100644 index 00000000..6bc41940 --- /dev/null +++ b/patches/uxtheme-CloseThemeData/0001-uxtheme-Do-not-crash-when-INVALID_HANDLE_VALUE-is-pa.patch @@ -0,0 +1,40 @@ +From ab3d3417ca146b9a72b395b082b4aae628c39d7c Mon Sep 17 00:00:00 2001 +From: Louis Lenders +Date: Wed, 27 Jan 2016 07:29:50 +0100 +Subject: uxtheme: Do not crash when INVALID_HANDLE_VALUE is passed to + CloseThemeData. + +--- + dlls/uxtheme/system.c | 2 +- + dlls/uxtheme/tests/system.c | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/dlls/uxtheme/system.c b/dlls/uxtheme/system.c +index 8947587..7d07680 100644 +--- a/dlls/uxtheme/system.c ++++ b/dlls/uxtheme/system.c +@@ -746,7 +746,7 @@ void WINAPI SetThemeAppProperties(DWORD dwFlags) + HRESULT WINAPI CloseThemeData(HTHEME hTheme) + { + TRACE("(%p)\n", hTheme); +- if(!hTheme) ++ if(!hTheme || hTheme == INVALID_HANDLE_VALUE) + return E_HANDLE; + return MSSTYLES_CloseThemeClass(hTheme); + } +diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c +index 49eba64..4aeedbc 100644 +--- a/dlls/uxtheme/tests/system.c ++++ b/dlls/uxtheme/tests/system.c +@@ -541,6 +541,8 @@ static void test_CloseThemeData(void) + + hRes = pCloseThemeData(NULL); + ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes); ++ hRes = pCloseThemeData(INVALID_HANDLE_VALUE); ++ ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes); + } + + START_TEST(system) +-- +2.6.4 + diff --git a/patches/uxtheme-CloseThemeData/definition b/patches/uxtheme-CloseThemeData/definition new file mode 100644 index 00000000..a948ab78 --- /dev/null +++ b/patches/uxtheme-CloseThemeData/definition @@ -0,0 +1 @@ +Fixes: [29862] Do not crash when INVALID_HANDLE_VALUE is passed to CloseThemeData