winhelp: use path of parent helpfile while looking for popup window

Kirill K. Smirnov lich at math.spbu.ru
Fri Nov 10 10:37:26 CST 2006


  ChangeLog:
    Use path of parent helpfile while looking for popup window

-------------- next part --------------
diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c
index 389ba5a..8905d6e 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -117,8 +117,25 @@ HLPFILE* WINHELP_LookupHelpFile(LPCSTR l
 {
     HLPFILE*        hlpfile;
     char szFullName[MAX_PATH];
+    char szAddPath[MAX_PATH];
+    char *p;
+
+    /*
+     * NOTE: This is needed by popup windows only.
+     * In other cases it's not needed but does not hurt though.
+     */
+    if (Globals.active_win && Globals.active_win->page && Globals.active_win->page->file)
+    {
+        strcpy(szAddPath, Globals.active_win->page->file->lpszPath);
+        p = strrchr(szAddPath, '\\');
+        if (p) *p = 0;
+    }
 
-    if (!SearchPath(NULL, lpszFile, ".hlp", MAX_PATH, szFullName, NULL))
+    /*
+     * FIXME: Should we swap conditions?
+     */
+    if (!SearchPath(NULL, lpszFile, ".hlp", MAX_PATH, szFullName, NULL) &&
+        !SearchPath(szAddPath, lpszFile, ".hlp", MAX_PATH, szFullName, NULL))
     {
         if (WINHELP_MessageBoxIDS_s(STID_FILE_NOT_FOUND_s, lpszFile, STID_WHERROR,
                                     MB_YESNO|MB_ICONQUESTION) != IDYES)


More information about the wine-patches mailing list