Module: wine Branch: master Commit: 6a2ad1b4796285384e9555e1dccdf52be2749e03 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6a2ad1b4796285384e9555e1dc...
Author: Kirill K. Smirnov lich@math.spbu.ru Date: Thu Dec 13 00:56:09 2007 +0300
winhelp: Read keywords.
---
programs/winhelp/hlpfile.c | 35 +++++++++++++++++++++++++++++++++++ programs/winhelp/hlpfile.h | 2 ++ 2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c index 88cfabb..ff041ec 100644 --- a/programs/winhelp/hlpfile.c +++ b/programs/winhelp/hlpfile.c @@ -86,6 +86,7 @@ static BOOL HLPFILE_UncompressLZ77_Phrases(HLPFILE*); static BOOL HLPFILE_Uncompress_Phrases40(HLPFILE*); static BOOL HLPFILE_Uncompress_Topic(HLPFILE*); static BOOL HLPFILE_GetContext(HLPFILE*); +static BOOL HLPFILE_GetKeywords(HLPFILE*); static BOOL HLPFILE_GetMap(HLPFILE*); static BOOL HLPFILE_AddPage(HLPFILE*, BYTE*, BYTE*, unsigned); static BOOL HLPFILE_AddParagraph(HLPFILE*, BYTE *, BYTE*, unsigned*); @@ -393,6 +394,7 @@ static BOOL HLPFILE_DoReadHlpFile(HLPFILE *hlpfile, LPCSTR lpszPath) ref = GET_UINT(buf, 0xc); } while (ref != 0xffffffff);
+ HLPFILE_GetKeywords(hlpfile); HLPFILE_GetMap(hlpfile); if (hlpfile->version <= 16) return TRUE; return HLPFILE_GetContext(hlpfile); @@ -2026,6 +2028,39 @@ static BOOL HLPFILE_GetContext(HLPFILE *hlpfile)
/*********************************************************************** * + * HLPFILE_GetKeywords + */ +static BOOL HLPFILE_GetKeywords(HLPFILE *hlpfile) +{ + BYTE *cbuf, *cend; + unsigned clen; + + if (!HLPFILE_FindSubFile("|KWBTREE", &cbuf, &cend)) return FALSE; + clen = cend - cbuf; + hlpfile->kwbtree = HeapAlloc(GetProcessHeap(), 0, clen); + if (!hlpfile->kwbtree) return FALSE; + memcpy(hlpfile->kwbtree, cbuf, clen); + + if (!HLPFILE_FindSubFile("|KWDATA", &cbuf, &cend)) + { + WINE_ERR("corrupted help file: kwbtree present but kwdata absent\n"); + HeapFree(GetProcessHeap(), 0, hlpfile->kwbtree); + return FALSE; + } + clen = cend - cbuf; + hlpfile->kwdata = HeapAlloc(GetProcessHeap(), 0, clen); + if (!hlpfile->kwdata) + { + HeapFree(GetProcessHeap(), 0, hlpfile->kwdata); + return FALSE; + } + memcpy(hlpfile->kwdata, cbuf, clen); + + return TRUE; +} + +/*********************************************************************** + * * HLPFILE_GetMap */ static BOOL HLPFILE_GetMap(HLPFILE *hlpfile) diff --git a/programs/winhelp/hlpfile.h b/programs/winhelp/hlpfile.h index 8c9e201..7e6e6e5 100644 --- a/programs/winhelp/hlpfile.h +++ b/programs/winhelp/hlpfile.h @@ -124,6 +124,8 @@ typedef struct tagHlpFileFile HLPFILE_PAGE* first_page; HLPFILE_MACRO* first_macro; BYTE* Context; + BYTE* kwbtree; + BYTE* kwdata; unsigned wMapLen; HLPFILE_MAP* Map; unsigned long contents_start;