Kirill K. Smirnov : winhelp: winhelp 3. 0 uses page numbers instead of hash values.
Alexandre Julliard
julliard at winehq.org
Mon Dec 3 09:17:56 CST 2007
Module: wine
Branch: master
Commit: bef9ab5dd517239d5e097eaa9eea47453b571b4e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bef9ab5dd517239d5e097eaa9eea47453b571b4e
Author: Kirill K. Smirnov <lich at math.spbu.ru>
Date: Sat Dec 1 18:59:56 2007 +0300
winhelp: winhelp 3.0 uses page numbers instead of hash values.
---
programs/winhelp/hlpfile.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c
index 1b4fc58..8252446 100644
--- a/programs/winhelp/hlpfile.c
+++ b/programs/winhelp/hlpfile.c
@@ -93,27 +93,22 @@ static BOOL HLPFILE_Uncompress3(char*, const char*, const BYTE*, const BYTE*);
static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst, unsigned dstsz);
static BOOL HLPFILE_ReadFont(HLPFILE* hlpfile);
-#if 0
/***********************************************************************
*
* HLPFILE_PageByNumber
*/
-static HLPFILE_PAGE *HLPFILE_PageByNumber(LPCSTR lpszPath, UINT wNum)
+static HLPFILE_PAGE *HLPFILE_PageByNumber(HLPFILE* hlpfile, UINT wNum)
{
HLPFILE_PAGE *page;
- HLPFILE *hlpfile = HLPFILE_ReadHlpFile(lpszPath);
-
- if (!hlpfile) return 0;
-
- WINE_TRACE("[%s/%u]\n", lpszPath, wNum);
+ UINT temp = wNum;
- for (page = hlpfile->first_page; page && wNum; page = page->next) wNum--;
-
- /* HLPFILE_FreeHlpFile(lpszPath); */
+ WINE_TRACE("<%s>[%u]\n", hlpfile->lpszPath, wNum);
+ for (page = hlpfile->first_page; page && temp; page = page->next) temp--;
+ if (!page)
+ WINE_ERR("Page of number %u not found in file %s\n", wNum, hlpfile->lpszPath);
return page;
}
-#endif
/* FIXME:
* this finds the page containing the offset. The offset can either
@@ -164,6 +159,10 @@ HLPFILE_PAGE *HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash)
WINE_TRACE("<%s>[%x]\n", hlpfile->lpszPath, lHash);
+ /* For win 3.0 files hash values are really page numbers */
+ if (hlpfile->version <= 16)
+ return HLPFILE_PageByNumber(hlpfile, lHash);
+
for (i = 0; i < hlpfile->wContextLen; i++)
{
if (hlpfile->Context[i].lHash == lHash)
More information about the wine-cvs
mailing list