Kirill K. Smirnov : winhelp: Fix index to handle offset value = 0 correclty .

Alexandre Julliard julliard at winehq.org
Mon Jan 7 08:39:22 CST 2008


Module: wine
Branch: master
Commit: 7c97735b09478830b355f7b657086ddf8f06a7fc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7c97735b09478830b355f7b657086ddf8f06a7fc

Author: Kirill K. Smirnov <lich at math.spbu.ru>
Date:   Sun Jan  6 18:35:06 2008 +0300

winhelp: Fix index to handle offset value = 0 correclty.

---

 programs/winhelp/winhelp.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c
index ab516e8..840fb8a 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -1972,6 +1972,10 @@ static void cb_KWBTree(void *p, void **next, void *cookie)
  *
  * Index dialog callback function.
  *
+ * nResult passed to EndDialog:
+ *   1: CANCEL button
+ *  >1: valid offset value +2.
+ *  EndDialog itself can return 0 (error).
  */
 INT_PTR CALLBACK WINHELP_SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
@@ -2011,6 +2015,7 @@ INT_PTR CALLBACK WINHELP_SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA
                     MessageBox(hWnd, "macro keywords not supported yet", "Error", MB_OK | MB_ICONSTOP);
                     return TRUE;
                 }
+                offset += 2;
             }
             /* Fall through */
         case IDCANCEL:
@@ -2051,6 +2056,10 @@ BOOL WINHELP_CreateIndexWindow(void)
                          Globals.active_win->hMainWnd, WINHELP_SearchDlgProc,
                          (LPARAM)hlpfile);
     if (ret > 1)
+    {
+        ret -= 2;
+        WINE_TRACE("got %d as an offset\n", ret);
         WINHELP_CreateHelpWindowByOffset(hlpfile, ret, Globals.active_win->info, SW_NORMAL);
+    }
     return TRUE;
 }




More information about the wine-cvs mailing list