Winhelp crash in assertion(0) if .hlp file is not found

Bruno Jesus 00cpxxx at gmail.com
Thu Jul 21 22:50:35 CDT 2011


Hello, I've been in the list for a long time as a reader and after
years I finally managed to get a development computer and restarted
playing with current wine git.

There are about 15 bugs on bugzilla but none of them are related to
this. I'm trying the list first before opening a bug. It's quite
simple to reproduce, although I'm not sure if I can attach the hlp
file here since it's from windows. The crash happens because the help
file needs another help file. There is a button on the screen called
Glossary that needs a file called glossary.hlp. If this file does not
exist wine asks me to point it, if I answer No or yes and then cancel
file selection wine crashes on an assert.

The following lines are displayed on the console:
fixme:winhelp:WINHELP_GetWindowInfo Couldn't find window info for glossary
winhelp.c:270: WINHELP_GetWindowInfo: Assertion `0' failed.
wine: Assertion failed at address 0xb78f0424 (thread 003b), starting debugger...

The following lines are from file winhelp.c, around line 270.
...
    if (strcmp(name, "main") != 0)
    {
        WINE_FIXME("Couldn't find window info for %s\n", name);
        assert(0);
        return NULL;
    }
...

The function WINHELP_OpenHelpWindow does not resist
WINHELP_GetWindowInfo returning NULL. That was why the assert(0) was
added inside it to abort the program execution (as far as I see).
There are 3 calls like this (one on winhelp.c and the others on
macro.c):

...
    WINHELP_OpenHelpWindow(HLPFILE_PageByHash, hlpfile, lHash,
                           WINHELP_GetWindowInfo(hlpfile, wndname), show);
...

My approach to fix this is quite simple: instead of splitting the
above lines on different places and add a check for each of them the
easier way is to simply make OpenHelpWindow resist null pointers and
do not open anything because the user was already warned and asked for
the nonexistent file. The proposed solution (if I may call adding one
"if" a solution) is attached. If anyone has the problematic hlp file
that was the cause to add the assert(0) please send me. Looks like the
assert is there since wine 1.0 according to
http://source.winehq.org/source/programs/winhlp32/winhelp.c?v=wine-1.0

Best wishes,
Bruno

--
universe* god::bigbang (void); //and then it all began...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-winhelp.c-Resist-nonexistent-files-instead-.patch
Type: text/x-patch
Size: 1519 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20110722/6c42e68b/attachment.bin>


More information about the wine-devel mailing list