[PATCH 2/2] winhlp32: fix image lookup

Jean-Christophe Cardot jeanchristophe.cardot at gmail.com
Mon Dec 21 14:01:49 CST 2015


Fixes: https://bugs.winehq.org/show_bug.cgi?id=23768

Sometimes files with bitmap images are prefixes with '|' and sometimes
not. Unfortunately, there is no consensus among different pieces of
unofficial documentation. So if the search (e.g. |bm0) failed, then remove
leading '|' and try again.
This is Microsoft winhlp32.exe behaviour.

Tested on Linux (Mageia 5)

Signed-off-by: Jean-Christophe Cardot <wine at cardot.net>
---
 programs/winhlp32/hlpfile.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/programs/winhlp32/hlpfile.c b/programs/winhlp32/hlpfile.c
index e6e386a..4212239 100644
--- a/programs/winhlp32/hlpfile.c
+++ b/programs/winhlp32/hlpfile.c
@@ -514,6 +514,18 @@ static BOOL HLPFILE_FindSubFile(HLPFILE* hlpfile, LPCSTR 
name, BYTE **subbuf, BY
     WINE_TRACE("looking for file '%s'\n", name);
     ptr = HLPFILE_BPTreeSearch(hlpfile->file_buffer + GET_UINT(hlpfile-
>file_buffer, 4),
                                name, comp_FindSubFile);
+    if (!ptr)
+    {   /* Sometimes files with bitmap images are prefixes with '|' and 
sometimes not.
+           Unfortunately, there is no consensus among different pieces of 
unofficial documentation.
+           So remove leading '|' and try again. */
+        CHAR c = *name++;
+        if (c == '|')
+        {
+            WINE_TRACE("not found. try '%s'\n", name);
+            ptr = HLPFILE_BPTreeSearch(hlpfile->file_buffer + GET_UINT(hlpfile-
>file_buffer, 4),
+                                       name, comp_FindSubFile);
+        }
+    }
     if (!ptr) return FALSE;
     *subbuf = hlpfile->file_buffer + GET_UINT(ptr, strlen(name)+1);
     if (*subbuf >= hlpfile->file_buffer + hlpfile->file_buffer_size)
-- 
2.3.10





More information about the wine-patches mailing list