Module: wine Branch: master Commit: deb98a4e83837fa8d575c32302edb1516d21dc2b URL: http://source.winehq.org/git/wine.git/?a=commit;h=deb98a4e83837fa8d575c32302...
Author: Kirill K. Smirnov lich@math.spbu.ru Date: Wed Aug 6 19:47:11 2008 +0400
winhlp32: Load internal file containing pagenum->topicoffset mapping.
---
programs/winhlp32/hlpfile.c | 23 +++++++++++++++++++++++ programs/winhlp32/hlpfile.h | 2 ++ 2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/programs/winhlp32/hlpfile.c b/programs/winhlp32/hlpfile.c index 05d5347..c941bbd 100644 --- a/programs/winhlp32/hlpfile.c +++ b/programs/winhlp32/hlpfile.c @@ -63,6 +63,7 @@ static BOOL HLPFILE_Uncompress_Topic(HLPFILE*); static BOOL HLPFILE_GetContext(HLPFILE*); static BOOL HLPFILE_GetKeywords(HLPFILE*); static BOOL HLPFILE_GetMap(HLPFILE*); +static BOOL HLPFILE_GetTOMap(HLPFILE*); static BOOL HLPFILE_AddPage(HLPFILE*, const BYTE*, const BYTE*, unsigned, unsigned); static BOOL HLPFILE_SkipParagraph(HLPFILE*, const BYTE*, const BYTE*, unsigned*); static void HLPFILE_Uncompress2(HLPFILE*, const BYTE*, const BYTE*, BYTE*, const BYTE*); @@ -293,6 +294,8 @@ static BOOL HLPFILE_DoReadHlpFile(HLPFILE *hlpfile, LPCSTR lpszPath)
if (!HLPFILE_SystemCommands(hlpfile)) return FALSE;
+ if (hlpfile->version <= 16 && !HLPFILE_GetTOMap(hlpfile)) return FALSE; + /* load phrases support */ if (!HLPFILE_UncompressLZ77_Phrases(hlpfile)) HLPFILE_Uncompress_Phrases40(hlpfile); @@ -2577,6 +2580,26 @@ static BOOL HLPFILE_GetMap(HLPFILE *hlpfile)
/*********************************************************************** * + * HLPFILE_GetTOMap + */ +static BOOL HLPFILE_GetTOMap(HLPFILE *hlpfile) +{ + BYTE *cbuf, *cend; + unsigned clen; + + if (!HLPFILE_FindSubFile(hlpfile, "|TOMAP", &cbuf, &cend)) + {WINE_WARN("no tomap section\n"); return FALSE;} + + clen = cend - cbuf - 9; + hlpfile->TOMap = HeapAlloc(GetProcessHeap(), 0, clen); + if (!hlpfile->TOMap) return FALSE; + memcpy(hlpfile->TOMap, cbuf+9, clen); + hlpfile->wTOMapLen = clen/4; + return TRUE; +} + +/*********************************************************************** + * * DeleteMacro */ static void HLPFILE_DeleteMacro(HLPFILE_MACRO* macro) diff --git a/programs/winhlp32/hlpfile.h b/programs/winhlp32/hlpfile.h index 5097259..b0d1f23 100644 --- a/programs/winhlp32/hlpfile.h +++ b/programs/winhlp32/hlpfile.h @@ -100,6 +100,8 @@ typedef struct tagHlpFileFile BYTE* kwdata; unsigned wMapLen; HLPFILE_MAP* Map; + unsigned wTOMapLen; + unsigned* TOMap; unsigned long contents_start;
struct tagHlpFileFile* prev;