ReactOS  0.4.14-dev-606-g14ebc0b
hlpfile.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  HLPFILE_WINDOWINFO
 
struct  tagHlpFileLink
 
struct  tagHlpFileHotSpotLink
 
struct  tagHlpFileMacro
 
struct  tagHlpFilePage
 
struct  HLPFILE_MAP
 
struct  HLPFILE_FONT
 
struct  tagHlpFileFile
 
struct  RtfData
 

Macros

#define HLP_DISPLAY30   0x01 /* version 3.0 displayable information */
 
#define HLP_TOPICHDR   0x02 /* topic header information */
 
#define HLP_DISPLAY   0x20 /* version 3.1 displayable information */
 
#define HLP_TABLE   0x23 /* version 3.1 table */
 

Typedefs

typedef struct tagHlpFileLink HLPFILE_LINK
 
typedef struct tagHlpFileHotSpotLink HLPFILE_HOTSPOTLINK
 
typedef struct tagHlpFileMacro HLPFILE_MACRO
 
typedef struct tagHlpFilePage HLPFILE_PAGE
 
typedef struct tagHlpFileFile HLPFILE
 
typedef int(* HLPFILE_BPTreeCompare) (void *p, const void *key, int leaf, void **next)
 
typedef void(* HLPFILE_BPTreeCallback) (void *p, void **next, void *cookie)
 

Functions

HLPFILEHLPFILE_ReadHlpFile (LPCSTR lpszPath)
 
HLPFILE_PAGEHLPFILE_PageByHash (HLPFILE *hlpfile, LONG lHash, ULONG *relative)
 
HLPFILE_PAGEHLPFILE_PageByMap (HLPFILE *hlpfile, LONG lMap, ULONG *relative)
 
HLPFILE_PAGEHLPFILE_PageByOffset (HLPFILE *hlpfile, LONG offset, ULONG *relative)
 
LONG HLPFILE_Hash (LPCSTR lpszContext)
 
void HLPFILE_FreeHlpFile (HLPFILE *)
 
void HLPFILE_BPTreeEnum (BYTE *, HLPFILE_BPTreeCallback cb, void *cookie)
 
BOOL HLPFILE_BrowsePage (HLPFILE_PAGE *, struct RtfData *rd, unsigned font_scale, unsigned relative)
 

Macro Definition Documentation

◆ HLP_DISPLAY

#define HLP_DISPLAY   0x20 /* version 3.1 displayable information */

Definition at line 210 of file hlpfile.h.

◆ HLP_DISPLAY30

#define HLP_DISPLAY30   0x01 /* version 3.0 displayable information */

Definition at line 208 of file hlpfile.h.

◆ HLP_TABLE

#define HLP_TABLE   0x23 /* version 3.1 table */

Definition at line 211 of file hlpfile.h.

◆ HLP_TOPICHDR

#define HLP_TOPICHDR   0x02 /* topic header information */

Definition at line 209 of file hlpfile.h.

Typedef Documentation

◆ HLPFILE

◆ HLPFILE_BPTreeCallback

typedef void(* HLPFILE_BPTreeCallback) (void *p, void **next, void *cookie)

Definition at line 179 of file hlpfile.h.

◆ HLPFILE_BPTreeCompare

typedef int(* HLPFILE_BPTreeCompare) (void *p, const void *key, int leaf, void **next)

Definition at line 168 of file hlpfile.h.

◆ HLPFILE_HOTSPOTLINK

◆ HLPFILE_LINK

◆ HLPFILE_MACRO

◆ HLPFILE_PAGE

Function Documentation

◆ HLPFILE_BPTreeEnum()

void HLPFILE_BPTreeEnum ( BYTE ,
HLPFILE_BPTreeCallback  cb,
void cookie 
)

Definition at line 125 of file hlpfile.c.

126 {
127  unsigned magic;
128  unsigned page_size;
129  unsigned cur_page;
130  unsigned level;
131  BYTE *pages, *ptr, *newptr;
132  int i, entries;
133 
134  magic = GET_USHORT(buf, 9);
135  if (magic != 0x293B)
136  {
137  WINE_ERR("Invalid magic in B+ tree: 0x%x\n", magic);
138  return;
139  }
140  page_size = GET_USHORT(buf, 9+4);
141  cur_page = GET_USHORT(buf, 9+26);
142  level = GET_USHORT(buf, 9+32);
143  pages = buf + 9 + 38;
144  while (--level > 0)
145  {
146  ptr = pages + cur_page*page_size;
147  cur_page = GET_USHORT(ptr, 4);
148  }
149  while (cur_page != 0xFFFF)
150  {
151  ptr = pages + cur_page*page_size;
152  entries = GET_SHORT(ptr, 2);
153  ptr += 8;
154  for (i = 0; i < entries; i++)
155  {
156  cb(ptr, (void **)&newptr, cookie);
157  ptr = newptr;
158  }
159  cur_page = GET_USHORT(pages+cur_page*page_size, 6);
160  }
161 }
GLint level
Definition: gl.h:1546
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
u32_t magic(void)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static short GET_SHORT(const BYTE *buffer, unsigned i)
Definition: hlpfile.c:42
static PVOID ptr
Definition: dispmode.c:27
#define WINE_ERR
Definition: debug.h:370
unsigned char BYTE
Definition: mem.h:68
static unsigned short GET_USHORT(const BYTE *buffer, unsigned i)
Definition: hlpfile.c:37
Definition: cookie.c:33
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32

Referenced by WINHELP_IndexDlgProc().

◆ HLPFILE_BrowsePage()

BOOL HLPFILE_BrowsePage ( HLPFILE_PAGE ,
struct RtfData rd,
unsigned  font_scale,
unsigned  relative 
)

Definition at line 1703 of file hlpfile.c.

1705 {
1706  HLPFILE *hlpfile = page->file;
1707  BYTE *buf, *end;
1708  DWORD ref = page->reference;
1709  unsigned index, old_index = -1, offset, count = 0, offs = 0;
1710  unsigned cpg, parlen;
1711  char tmp[1024];
1712  const char* ck = NULL;
1713 
1714  rd->in_text = TRUE;
1715  rd->data = rd->ptr = HeapAlloc(GetProcessHeap(), 0, rd->allocated = 32768);
1716  rd->char_pos = 0;
1717  rd->first_link = rd->current_link = NULL;
1718  rd->force_color = FALSE;
1719  rd->font_scale = font_scale;
1720  rd->relative = relative;
1721  rd->char_pos_rel = 0;
1722 
1723  switch (hlpfile->charset)
1724  {
1725  case DEFAULT_CHARSET:
1726  case ANSI_CHARSET: cpg = 1252; break;
1727  case SHIFTJIS_CHARSET: cpg = 932; break;
1728  case HANGEUL_CHARSET: cpg = 949; break;
1729  case GB2312_CHARSET: cpg = 936; break;
1730  case CHINESEBIG5_CHARSET: cpg = 950; break;
1731  case GREEK_CHARSET: cpg = 1253; break;
1732  case TURKISH_CHARSET: cpg = 1254; break;
1733  case HEBREW_CHARSET: cpg = 1255; break;
1734  case ARABIC_CHARSET: cpg = 1256; break;
1735  case BALTIC_CHARSET: cpg = 1257; break;
1736  case VIETNAMESE_CHARSET: cpg = 1258; break;
1737  case RUSSIAN_CHARSET: cpg = 1251; break;
1738  case EE_CHARSET: cpg = 1250; break;
1739  case THAI_CHARSET: cpg = 874; break;
1740  case JOHAB_CHARSET: cpg = 1361; break;
1741  case MAC_CHARSET: ck = "mac"; break;
1742  default:
1743  WINE_FIXME("Unsupported charset %u\n", hlpfile->charset);
1744  cpg = 1252;
1745  }
1746  if (ck)
1747  {
1748  sprintf(tmp, "{\\rtf1\\%s\\deff0", ck);
1749  if (!HLPFILE_RtfAddControl(rd, tmp)) return FALSE;
1750  }
1751  else
1752  {
1753  sprintf(tmp, "{\\rtf1\\ansi\\ansicpg%d\\deff0", cpg);
1754  if (!HLPFILE_RtfAddControl(rd, tmp)) return FALSE;
1755  }
1756 
1757  /* generate font table */
1758  if (!HLPFILE_RtfAddControl(rd, "{\\fonttbl")) return FALSE;
1759  for (index = 0; index < hlpfile->numFonts; index++)
1760  {
1761  const char* family;
1762  switch (hlpfile->fonts[index].LogFont.lfPitchAndFamily & 0xF0)
1763  {
1764  case FF_MODERN: family = "modern"; break;
1765  case FF_ROMAN: family = "roman"; break;
1766  case FF_SWISS: family = "swiss"; break;
1767  case FF_SCRIPT: family = "script"; break;
1768  case FF_DECORATIVE: family = "decor"; break;
1769  default: family = "nil"; break;
1770  }
1771  sprintf(tmp, "{\\f%d\\f%s\\fprq%d\\fcharset%d %s;}",
1772  index, family,
1773  hlpfile->fonts[index].LogFont.lfPitchAndFamily & 0x0F,
1774  hlpfile->fonts[index].LogFont.lfCharSet,
1775  hlpfile->fonts[index].LogFont.lfFaceName);
1776  if (!HLPFILE_RtfAddControl(rd, tmp)) return FALSE;
1777  }
1778  if (!HLPFILE_RtfAddControl(rd, "}")) return FALSE;
1779  /* generate color table */
1780  if (!HLPFILE_RtfAddControl(rd, "{\\colortbl ;\\red0\\green128\\blue0;")) return FALSE;
1781  for (index = 0; index < hlpfile->numFonts; index++)
1782  {
1783  sprintf(tmp, "\\red%d\\green%d\\blue%d;",
1784  GetRValue(hlpfile->fonts[index].color),
1785  GetGValue(hlpfile->fonts[index].color),
1786  GetBValue(hlpfile->fonts[index].color));
1787  if (!HLPFILE_RtfAddControl(rd, tmp)) return FALSE;
1788  }
1789  if (!HLPFILE_RtfAddControl(rd, "}")) return FALSE;
1790 
1791  do
1792  {
1793  if (hlpfile->version <= 16)
1794  {
1795  index = (ref - 0x0C) / hlpfile->dsize;
1796  offset = (ref - 0x0C) % hlpfile->dsize;
1797  }
1798  else
1799  {
1800  index = (ref - 0x0C) >> 14;
1801  offset = (ref - 0x0C) & 0x3FFF;
1802  }
1803 
1804  if (hlpfile->version <= 16 && index != old_index && old_index != -1)
1805  {
1806  /* we jumped to the next block, adjust pointers */
1807  ref -= 12;
1808  offset -= 12;
1809  }
1810 
1811  if (index >= hlpfile->topic_maplen) {WINE_WARN("maplen\n"); break;}
1812  buf = hlpfile->topic_map[index] + offset;
1813  if (buf + 0x15 >= hlpfile->topic_end) {WINE_WARN("extra\n"); break;}
1814  end = min(buf + GET_UINT(buf, 0), hlpfile->topic_end);
1815  if (index != old_index) {offs = 0; old_index = index;}
1816 
1817  switch (buf[0x14])
1818  {
1819  case HLP_TOPICHDR:
1820  if (count++) goto done;
1821  break;
1822  case HLP_DISPLAY30:
1823  case HLP_DISPLAY:
1824  case HLP_TABLE:
1825  if (!HLPFILE_BrowseParagraph(page, rd, buf, end, &parlen)) return FALSE;
1826  if (relative > index * 0x8000 + offs)
1827  rd->char_pos_rel = rd->char_pos;
1828  offs += parlen;
1829  break;
1830  default:
1831  WINE_ERR("buf[0x14] = %x\n", buf[0x14]);
1832  }
1833  if (hlpfile->version <= 16)
1834  {
1835  ref += GET_UINT(buf, 0xc);
1836  if (GET_UINT(buf, 0xc) == 0)
1837  break;
1838  }
1839  else
1840  ref = GET_UINT(buf, 0xc);
1841  } while (ref != 0xffffffff);
1842 done:
1843  page->first_link = rd->first_link;
1844  return HLPFILE_RtfAddControl(rd, "}");
1845 }
unsigned short version
Definition: hlpfile.h:124
int rd
Definition: scanf.h:134
LOGFONTA LogFont
Definition: hlpfile.h:95
COLORREF color
Definition: hlpfile.h:97
#define EE_CHARSET
Definition: wingdi.h:397
#define TRUE
Definition: types.h:120
#define MAC_CHARSET
Definition: wingdi.h:402
#define HLP_DISPLAY30
Definition: hlpfile.h:208
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FF_DECORATIVE
Definition: wingdi.h:446
UINT topic_maplen
Definition: hlpfile.h:138
GLintptr offset
Definition: glext.h:5920
#define GetRValue(rgb)
Definition: wingdi.h:2934
#define CHINESEBIG5_CHARSET
Definition: wingdi.h:389
BYTE lfCharSet
Definition: dimm.idl:50
GLuint GLuint end
Definition: gl.h:1545
unsigned short charset
Definition: hlpfile.h:126
#define DEFAULT_CHARSET
Definition: wingdi.h:383
Definition: send.c:47
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define GetGValue(rgb)
Definition: wingdi.h:2935
static BOOL HLPFILE_RtfAddControl(struct RtfData *rd, const char *str)
Definition: hlpfile.c:706
BYTE ** topic_map
Definition: hlpfile.h:136
static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE *page, struct RtfData *rd, BYTE *buf, BYTE *end, unsigned *parlen)
Definition: hlpfile.c:1223
#define WINE_ERR
Definition: debug.h:370
smooth NULL
Definition: ftsmooth.c:416
Definition: module.h:566
#define TURKISH_CHARSET
Definition: wingdi.h:391
GLuint index
Definition: glext.h:6031
BYTE lfPitchAndFamily
Definition: dimm.idl:54
BYTE * topic_end
Definition: hlpfile.h:137
static unsigned GET_UINT(const BYTE *buffer, unsigned i)
Definition: hlpfile.c:47
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define THAI_CHARSET
Definition: wingdi.h:396
#define SHIFTJIS_CHARSET
Definition: wingdi.h:385
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RUSSIAN_CHARSET
Definition: wingdi.h:395
unsigned numFonts
Definition: hlpfile.h:143
#define index(s, c)
Definition: various.h:29
unsigned char BYTE
Definition: mem.h:68
#define GB2312_CHARSET
Definition: wingdi.h:388
#define FF_ROMAN
Definition: wingdi.h:449
#define FF_SWISS
Definition: wingdi.h:451
#define VIETNAMESE_CHARSET
Definition: wingdi.h:401
#define HEBREW_CHARSET
Definition: wingdi.h:392
#define HLP_DISPLAY
Definition: hlpfile.h:210
#define WINE_WARN
Definition: debug.h:359
#define FF_MODERN
Definition: wingdi.h:448
#define min(a, b)
Definition: monoChain.cc:55
#define HLP_TABLE
Definition: hlpfile.h:211
#define FF_SCRIPT
Definition: wingdi.h:450
#define ARABIC_CHARSET
Definition: wingdi.h:393
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
#define HANGEUL_CHARSET
Definition: wingdi.h:386
#define GetBValue(rgb)
Definition: wingdi.h:2936
#define HLP_TOPICHDR
Definition: hlpfile.h:209
unsigned short dsize
Definition: hlpfile.h:128
#define ANSI_CHARSET
Definition: wingdi.h:382
#define JOHAB_CHARSET
Definition: wingdi.h:400
#define BALTIC_CHARSET
Definition: wingdi.h:394
#define GREEK_CHARSET
Definition: wingdi.h:390
HLPFILE_FONT * fonts
Definition: hlpfile.h:144
#define WINE_FIXME
Definition: debug.h:365

Referenced by WINHELP_SetupText().

◆ HLPFILE_FreeHlpFile()

void HLPFILE_FreeHlpFile ( HLPFILE )

Definition at line 2297 of file hlpfile.c.

2298 {
2299  unsigned i;
2300 
2301  if (!hlpfile || --hlpfile->wRefCount > 0) return;
2302 
2303  if (hlpfile->next) hlpfile->next->prev = hlpfile->prev;
2304  if (hlpfile->prev) hlpfile->prev->next = hlpfile->next;
2305  else first_hlpfile = hlpfile->next;
2306 
2307  if (hlpfile->numFonts)
2308  {
2309  for (i = 0; i < hlpfile->numFonts; i++)
2310  {
2311  DeleteObject(hlpfile->fonts[i].hFont);
2312  }
2313  HeapFree(GetProcessHeap(), 0, hlpfile->fonts);
2314  }
2315 
2316  if (hlpfile->numBmps)
2317  {
2318  for (i = 0; i < hlpfile->numBmps; i++)
2319  {
2320  DeleteObject(hlpfile->bmps[i]);
2321  }
2322  HeapFree(GetProcessHeap(), 0, hlpfile->bmps);
2323  }
2324 
2325  HLPFILE_DeletePage(hlpfile->first_page);
2326  HLPFILE_DeleteMacro(hlpfile->first_macro);
2327 
2328  DestroyIcon(hlpfile->hIcon);
2329  if (hlpfile->numWindows) HeapFree(GetProcessHeap(), 0, hlpfile->windows);
2330  HeapFree(GetProcessHeap(), 0, hlpfile->Context);
2331  HeapFree(GetProcessHeap(), 0, hlpfile->Map);
2332  HeapFree(GetProcessHeap(), 0, hlpfile->lpszTitle);
2333  HeapFree(GetProcessHeap(), 0, hlpfile->lpszCopyright);
2334  HeapFree(GetProcessHeap(), 0, hlpfile->file_buffer);
2335  HeapFree(GetProcessHeap(), 0, hlpfile->phrases_offsets);
2336  HeapFree(GetProcessHeap(), 0, hlpfile->phrases_buffer);
2337  HeapFree(GetProcessHeap(), 0, hlpfile->topic_map);
2338  HeapFree(GetProcessHeap(), 0, hlpfile->help_on_file);
2339  HeapFree(GetProcessHeap(), 0, hlpfile);
2340 }
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define GetProcessHeap()
Definition: compat.h:403
static void HLPFILE_DeletePage(HLPFILE_PAGE *page)
Definition: hlpfile.c:2280
static void HLPFILE_DeleteMacro(HLPFILE_MACRO *macro)
Definition: hlpfile.c:2264
static HLPFILE * first_hlpfile
Definition: hlpfile.c:52
#define HeapFree(x, y, z)
Definition: compat.h:402
struct tagHlpFileFile * next
Definition: hlpfile.h:120

Referenced by HLPFILE_ReadHlpFile(), WINHELP_DeleteBackSet(), WINHELP_DeleteWindow(), and WINHELP_RememberPage().

◆ HLPFILE_Hash()

LONG HLPFILE_Hash ( LPCSTR  lpszContext)

Definition at line 547 of file hlpfile.c.

548 {
549  LONG lHash = 0;
550  CHAR c;
551 
552  while ((c = *lpszContext++))
553  {
554  CHAR x = 0;
555  if (c >= 'A' && c <= 'Z') x = c - 'A' + 17;
556  if (c >= 'a' && c <= 'z') x = c - 'a' + 17;
557  if (c >= '1' && c <= '9') x = c - '0';
558  if (c == '0') x = 10;
559  if (c == '.') x = 12;
560  if (c == '_') x = 13;
561  if (x) lHash = lHash * 43 + x;
562  }
563  return lHash;
564 }
char CHAR
Definition: xmlstorage.h:175
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
long LONG
Definition: pedump.c:60
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80

Referenced by HLPFILE_AddHotSpotLinks(), MACRO_JumpID(), and WinMain().

◆ HLPFILE_PageByHash()

HLPFILE_PAGE* HLPFILE_PageByHash ( HLPFILE hlpfile,
LONG  lHash,
ULONG relative 
)

Definition at line 437 of file hlpfile.c.

438 {
439  BYTE *ptr;
440 
441  if (!hlpfile) return NULL;
442  if (!lHash) return HLPFILE_Contents(hlpfile, relative);
443 
444  WINE_TRACE("<%s>[%x]\n", debugstr_a(hlpfile->lpszPath), lHash);
445 
446  /* For win 3.0 files hash values are really page numbers */
447  if (hlpfile->version <= 16)
448  {
449  if (lHash >= hlpfile->wTOMapLen) return NULL;
450  return HLPFILE_PageByOffset(hlpfile, hlpfile->TOMap[lHash], relative);
451  }
452 
454  if (!ptr)
455  {
456  WINE_ERR("Page of hash %x not found in file %s\n", lHash, debugstr_a(hlpfile->lpszPath));
457  return NULL;
458  }
459 
460  return HLPFILE_PageByOffset(hlpfile, GET_UINT(ptr, 4), relative);
461 }
unsigned short version
Definition: hlpfile.h:124
#define LongToPtr(l)
Definition: basetsd.h:91
static void * HLPFILE_BPTreeSearch(BYTE *buf, const void *key, HLPFILE_BPTreeCompare comp)
Definition: hlpfile.c:69
#define WINE_TRACE
Definition: debug.h:353
HLPFILE_PAGE * HLPFILE_PageByOffset(HLPFILE *hlpfile, LONG offset, ULONG *relative)
Definition: hlpfile.c:369
static PVOID ptr
Definition: dispmode.c:27
LPSTR lpszPath
Definition: hlpfile.h:104
#define WINE_ERR
Definition: debug.h:370
smooth NULL
Definition: ftsmooth.c:416
static unsigned GET_UINT(const BYTE *buffer, unsigned i)
Definition: hlpfile.c:47
unsigned * TOMap
Definition: hlpfile.h:116
#define debugstr_a
Definition: kernel32.h:31
unsigned char BYTE
Definition: mem.h:68
BYTE * Context
Definition: hlpfile.h:110
unsigned wTOMapLen
Definition: hlpfile.h:115
static HLPFILE_PAGE * HLPFILE_Contents(HLPFILE *hlpfile, ULONG *relative)
Definition: hlpfile.c:399
static int comp_PageByHash(void *p, const void *key, int leaf, void **next)
Definition: hlpfile.c:420

Referenced by MACRO_JumpContents(), MACRO_JumpHash(), WINHELP_HandleTextMouse(), and WinMain().

◆ HLPFILE_PageByMap()

HLPFILE_PAGE* HLPFILE_PageByMap ( HLPFILE hlpfile,
LONG  lMap,
ULONG relative 
)

Definition at line 467 of file hlpfile.c.

468 {
469  unsigned int i;
470 
471  if (!hlpfile) return 0;
472 
473  WINE_TRACE("<%s>[%x]\n", debugstr_a(hlpfile->lpszPath), lMap);
474 
475  for (i = 0; i < hlpfile->wMapLen; i++)
476  {
477  if (hlpfile->Map[i].lMap == lMap)
478  return HLPFILE_PageByOffset(hlpfile, hlpfile->Map[i].offset, relative);
479  }
480 
481  WINE_ERR("Page of Map %x not found in file %s\n", lMap, debugstr_a(hlpfile->lpszPath));
482  return NULL;
483 }
unsigned long offset
Definition: hlpfile.h:90
#define WINE_TRACE
Definition: debug.h:353
LONG lMap
Definition: hlpfile.h:89
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HLPFILE_PAGE * HLPFILE_PageByOffset(HLPFILE *hlpfile, LONG offset, ULONG *relative)
Definition: hlpfile.c:369
LPSTR lpszPath
Definition: hlpfile.h:104
#define WINE_ERR
Definition: debug.h:370
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_a
Definition: kernel32.h:31
HLPFILE_MAP * Map
Definition: hlpfile.h:114
unsigned wMapLen
Definition: hlpfile.h:113

Referenced by MACRO_JumpContext().

◆ HLPFILE_PageByOffset()

HLPFILE_PAGE* HLPFILE_PageByOffset ( HLPFILE hlpfile,
LONG  offset,
ULONG relative 
)

Definition at line 369 of file hlpfile.c.

370 {
372  HLPFILE_PAGE* found;
373 
374  if (!hlpfile) return 0;
375 
376  WINE_TRACE("<%s>[%x]\n", debugstr_a(hlpfile->lpszPath), offset);
377 
378  if (offset == 0xFFFFFFFF) return NULL;
379  page = NULL;
380 
381  for (found = NULL, page = hlpfile->first_page; page; page = page->next)
382  {
383  if (page->offset <= offset && (!found || found->offset < page->offset))
384  {
385  *relative = offset - page->offset;
386  found = page;
387  }
388  }
389  if (!found)
390  WINE_ERR("Page of offset %u not found in file %s\n",
391  offset, debugstr_a(hlpfile->lpszPath));
392  return found;
393 }
GLintptr offset
Definition: glext.h:5920
#define WINE_TRACE
Definition: debug.h:353
HLPFILE_PAGE * first_page
Definition: hlpfile.h:107
LPSTR lpszPath
Definition: hlpfile.h:104
#define WINE_ERR
Definition: debug.h:370
smooth NULL
Definition: ftsmooth.c:416
Definition: module.h:566
#define debugstr_a
Definition: kernel32.h:31
unsigned offset
Definition: hlpfile.h:76

Referenced by HLPFILE_Contents(), HLPFILE_PageByHash(), HLPFILE_PageByMap(), MACRO_BrowseButtons(), MACRO_Next(), MACRO_Prev(), and WINHELP_CreateIndexWindow().

◆ HLPFILE_ReadHlpFile()

HLPFILE* HLPFILE_ReadHlpFile ( LPCSTR  lpszPath)

Definition at line 2759 of file hlpfile.c.

2760 {
2761  HLPFILE* hlpfile;
2762 
2763  for (hlpfile = first_hlpfile; hlpfile; hlpfile = hlpfile->next)
2764  {
2765  if (!strcmp(lpszPath, hlpfile->lpszPath))
2766  {
2767  hlpfile->wRefCount++;
2768  return hlpfile;
2769  }
2770  }
2771 
2773  sizeof(HLPFILE) + strlen(lpszPath) + 1);
2774  if (!hlpfile) return 0;
2775 
2776  hlpfile->lpszPath = (char*)hlpfile + sizeof(HLPFILE);
2777  hlpfile->contents_start = 0xFFFFFFFF;
2778  hlpfile->next = first_hlpfile;
2779  hlpfile->wRefCount = 1;
2780 
2781  strcpy(hlpfile->lpszPath, lpszPath);
2782 
2783  first_hlpfile = hlpfile;
2784  if (hlpfile->next) hlpfile->next->prev = hlpfile;
2785 
2786  if (!HLPFILE_DoReadHlpFile(hlpfile, lpszPath))
2787  {
2788  HLPFILE_FreeHlpFile(hlpfile);
2789  hlpfile = 0;
2790  }
2791 
2792  return hlpfile;
2793 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
void HLPFILE_FreeHlpFile(HLPFILE *hlpfile)
Definition: hlpfile.c:2297
unsigned long contents_start
Definition: hlpfile.h:117
LPSTR lpszPath
Definition: hlpfile.h:104
static BOOL HLPFILE_DoReadHlpFile(HLPFILE *hlpfile, LPCSTR lpszPath)
Definition: hlpfile.c:2659
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned wRefCount
Definition: hlpfile.h:122
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static HLPFILE * first_hlpfile
Definition: hlpfile.c:52
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
struct tagHlpFileFile * next
Definition: hlpfile.h:120

Referenced by WINHELP_LookupHelpFile().