Commit deb98a4e authored by Kirill K. Smirnov's avatar Kirill K. Smirnov Committed by Alexandre Julliard

winhlp32: Load internal file containing pagenum->topicoffset mapping.

parent a591c64f
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment