Added patch to fix edge cases in TOOLTIPS_GetTipText.

This commit is contained in:
Erich E. Hoover
2014-07-31 11:15:26 -06:00
parent f9cb758cdc
commit 1ff09d87c5
6 changed files with 95 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ PATCHLIST := Miscellaneous.ok \
shell32-SHCreateSessionKey.ok \
shlwapi-UrlCombine.ok \
strmbase-Lock_Race_Conditions.ok \
user32-GetTipText.ok \
wineboot-HKEY_DYN_DATA.ok \
winepulse-PulseAudio_Support.ok \
winex11-XEMBED.ok \
@@ -579,6 +580,25 @@ strmbase-Lock_Race_Conditions.ok:
echo '+ { "strmbase-Lock_Race_Conditions", "Erich E. Hoover", "Fix possible race conditions in strmbase/quartz." },'; \
) > strmbase-Lock_Race_Conditions.ok
# Patchset user32-GetTipText
# |
# | Included patches:
# | * Handle TOOLTIPS_GetTipText edge cases. [by Erich E. Hoover]
# |
# | This patchset fixes the following Wine bugs:
# | * [#30648] SEGA Genesis / Mega Drive Classic Collection (Steam) crashes on startup
# |
# | Modified files:
# | * dlls/comctl32/tooltips.c
# |
.INTERMEDIATE: user32-GetTipText.ok
user32-GetTipText.ok:
$(PATCH) < user32-GetTipText/0001-Fix-TOOLTIPS_GetTipText-when-a-resource-cannot-be-fo.patch
$(PATCH) < user32-GetTipText/0002-Fix-TOOLTIPS_GetTipText-when-a-NULL-instance-is-used.patch
@( \
echo '+ { "user32-GetTipText", "Erich E. Hoover", "Handle TOOLTIPS_GetTipText edge cases." },'; \
) > user32-GetTipText.ok
# Patchset wineboot-HKEY_DYN_DATA
# |
# | Included patches:

View File

@@ -0,0 +1,34 @@
From f9894bb1a114f2e3d87b153815e37cedb3b6b31b Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Sun, 27 Jul 2014 09:12:15 -0600
Subject: Fix TOOLTIPS_GetTipText when a resource cannot be found.
Based on patch by Nikolay Sivov.
---
dlls/comctl32/tooltips.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c
index f74ea65..b44ccc5 100644
--- a/dlls/comctl32/tooltips.c
+++ b/dlls/comctl32/tooltips.c
@@ -484,6 +484,8 @@ TOOLTIPS_GetTipText (const TOOLTIPS_INFO *infoPtr, INT nTool, WCHAR *buffer)
{
TTTOOL_INFO *toolPtr = &infoPtr->tools[nTool];
+ /* always NULL-terminate the buffer, just in case we fail to load the string */
+ buffer[0] = '\0';
if (IS_INTRESOURCE(toolPtr->lpszText) && toolPtr->hinst) {
/* load a resource */
TRACE("load res string %p %x\n",
@@ -505,7 +507,6 @@ TOOLTIPS_GetTipText (const TOOLTIPS_INFO *infoPtr, INT nTool, WCHAR *buffer)
}
else {
/* no text available */
- buffer[0] = '\0';
}
TRACE("%s\n", debugstr_w(buffer));
--
1.7.9.5

View File

@@ -0,0 +1,35 @@
From 1491fbb70dc29e603a466f85311fc96ee95f0b5c Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Sun, 27 Jul 2014 09:12:50 -0600
Subject: Fix TOOLTIPS_GetTipText when a NULL instance is used.
Based on patch by Nikolay Sivov.
---
dlls/comctl32/tooltips.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c
index b44ccc5..c3e28bb 100644
--- a/dlls/comctl32/tooltips.c
+++ b/dlls/comctl32/tooltips.c
@@ -486,12 +486,11 @@ TOOLTIPS_GetTipText (const TOOLTIPS_INFO *infoPtr, INT nTool, WCHAR *buffer)
/* always NULL-terminate the buffer, just in case we fail to load the string */
buffer[0] = '\0';
- if (IS_INTRESOURCE(toolPtr->lpszText) && toolPtr->hinst) {
- /* load a resource */
- TRACE("load res string %p %x\n",
- toolPtr->hinst, LOWORD(toolPtr->lpszText));
- LoadStringW (toolPtr->hinst, LOWORD(toolPtr->lpszText),
- buffer, INFOTIPSIZE);
+ if (IS_INTRESOURCE(toolPtr->lpszText)) {
+ HINSTANCE hinst = toolPtr->hinst ? toolPtr->hinst : GetModuleHandleW(NULL);
+ /* load a resource */
+ TRACE("load res string %p %x\n", hinst, LOWORD(toolPtr->lpszText));
+ LoadStringW (hinst, LOWORD(toolPtr->lpszText), buffer, INFOTIPSIZE);
}
else if (toolPtr->lpszText) {
if (toolPtr->lpszText == LPSTR_TEXTCALLBACKW) {
--
1.7.9.5

View File

@@ -0,0 +1,4 @@
Author: Erich E. Hoover
Subject: Handle TOOLTIPS_GetTipText edge cases.
Revision: 1
Fixes: [30648] Support for TOOLTIPS_GetTipText edge cases