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

This commit is contained in:
Kirill K. Smirnov 2008-08-06 19:47:11 +04:00 committed by Alexandre Julliard
parent a591c64ffd
commit deb98a4e83
2 changed files with 25 additions and 0 deletions

View File

@ -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);
@ -2575,6 +2578,26 @@ static BOOL HLPFILE_GetMap(HLPFILE *hlpfile)
return TRUE;
}
/***********************************************************************
*
* 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

View File

@ -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;