ReactOS  0.4.14-dev-342-gdc047f9
chm.c File Reference
#include "hhctrl.h"
#include "stream.h"
#include "winreg.h"
#include "shlwapi.h"
#include "wine/debug.h"
Include dependency graph for chm.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (htmlhelp)
 
static LPCSTR GetChmString (CHMInfo *chm, DWORD offset)
 
static BOOL ReadChmSystem (CHMInfo *chm)
 
LPWSTR FindContextAlias (CHMInfo *chm, DWORD index)
 
static WCHARFindHTMLHelpSetting (HHInfo *info, const WCHAR *extW)
 
static WCHARMergeChmString (LPCWSTR src, WCHAR **dst)
 
void MergeChmProperties (HH_WINTYPEW *src, HHInfo *info, BOOL override)
 
static WCHARConvertChmString (HHInfo *info, DWORD id)
 
static void wintype_free (HH_WINTYPEW *wintype)
 
BOOL LoadWinTypeFromCHM (HHInfo *info)
 
LPCWSTR skip_schema (LPCWSTR url)
 
void SetChmPath (ChmPath *file, LPCWSTR base_file, LPCWSTR path)
 
IStreamGetChmStream (CHMInfo *info, LPCWSTR parent_chm, ChmPath *chm_file)
 
WCHARGetDocumentTitle (CHMInfo *info, LPCWSTR document)
 
CHMInfoOpenCHM (LPCWSTR szFile)
 
CHMInfoCloseCHM (CHMInfo *chm)
 

Function Documentation

◆ CloseCHM()

CHMInfo* CloseCHM ( CHMInfo chm)

Definition at line 663 of file chm.c.

664 {
665  if(chm->pITStorage)
666  IITStorage_Release(chm->pITStorage);
667 
668  if(chm->pStorage)
669  IStorage_Release(chm->pStorage);
670 
671  if(chm->strings_stream)
672  IStream_Release(chm->strings_stream);
673 
674  if(chm->strings_size) {
675  DWORD i;
676 
677  for(i=0; i<chm->strings_size; i++)
678  heap_free(chm->strings[i]);
679  }
680 
681  heap_free(chm->strings);
682  heap_free(chm->defWindow);
683  heap_free(chm->defTitle);
684  heap_free(chm->defTopic);
685  heap_free(chm->defToc);
686  heap_free(chm->szFile);
687  heap_free(chm->compiledFile);
688  heap_free(chm);
689 
690  return NULL;
691 }
IITStorage * pITStorage
Definition: hhctrl.h:99
char ** strings
Definition: hhctrl.h:104
WCHAR * defToc
Definition: hhctrl.h:111
DWORD strings_size
Definition: hhctrl.h:105
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
smooth NULL
Definition: ftsmooth.c:416
WCHAR * defWindow
Definition: hhctrl.h:108
IStream * strings_stream
Definition: hhctrl.h:103
unsigned long DWORD
Definition: ntddk_ex.h:95
IStorage * pStorage
Definition: hhctrl.h:100
WCHAR * defTopic
Definition: hhctrl.h:109
WCHAR * szFile
Definition: hhctrl.h:101
WCHAR * defTitle
Definition: hhctrl.h:110
WCHAR * compiledFile
Definition: hhctrl.h:107
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by OpenCHM(), and ReleaseHelpViewer().

◆ ConvertChmString()

static WCHAR* ConvertChmString ( HHInfo info,
DWORD  id 
)
inlinestatic

Definition at line 311 of file chm.c.

312 {
313  WCHAR *ret = NULL;
314 
315  if(id)
316  ret = strdupAtoW(GetChmString(info->pCHMInfo, id));
317  return ret;
318 }
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
Definition: chm.c:32
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65

Referenced by LoadWinTypeFromCHM().

◆ FindContextAlias()

LPWSTR FindContextAlias ( CHMInfo chm,
DWORD  index 
)

Definition at line 172 of file chm.c.

173 {
174  IStream *ivb_stream;
175  DWORD size, read, i;
176  DWORD *buf;
177  LPCSTR ret = NULL;
178  HRESULT hres;
179 
180  static const WCHAR wszIVB[] = {'#','I','V','B',0};
181 
182  hres = IStorage_OpenStream(chm->pStorage, wszIVB, NULL, STGM_READ, 0, &ivb_stream);
183  if(FAILED(hres)) {
184  WARN("Could not open #IVB stream: %08x\n", hres);
185  return NULL;
186  }
187 
188  hres = IStream_Read(ivb_stream, &size, sizeof(size), &read);
189  if(FAILED(hres)) {
190  WARN("Read failed: %08x\n", hres);
191  IStream_Release(ivb_stream);
192  return NULL;
193  }
194 
195  buf = heap_alloc(size);
196  hres = IStream_Read(ivb_stream, buf, size, &read);
197  IStream_Release(ivb_stream);
198  if(FAILED(hres)) {
199  WARN("Read failed: %08x\n", hres);
200  heap_free(buf);
201  return NULL;
202  }
203 
204  size /= 2*sizeof(DWORD);
205 
206  for(i=0; i<size; i++) {
207  if(buf[2*i] == index) {
208  ret = GetChmString(chm, buf[2*i+1]);
209  break;
210  }
211  }
212 
213  heap_free(buf);
214 
215  TRACE("returning %s\n", debugstr_a(ret));
216  return strdupAtoW(ret);
217 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WARN(fmt,...)
Definition: debug.h:111
#define DWORD
Definition: nt_native.h:44
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
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
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
const char * LPCSTR
Definition: xmlstorage.h:183
#define STGM_READ
Definition: objbase.h:916
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
IStorage * pStorage
Definition: hhctrl.h:100
static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
Definition: chm.c:32
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by HtmlHelpW().

◆ FindHTMLHelpSetting()

static WCHAR* FindHTMLHelpSetting ( HHInfo info,
const WCHAR extW 
)
static

Definition at line 223 of file chm.c.

224 {
225  static const WCHAR periodW[] = {'.',0};
226  IStorage *pStorage = info->pCHMInfo->pStorage;
227  IStream *pStream;
228  WCHAR *filename;
229  HRESULT hr;
230 
231  filename = heap_alloc( (lstrlenW(info->pCHMInfo->compiledFile)
232  + lstrlenW(periodW) + lstrlenW(extW) + 1) * sizeof(WCHAR) );
233  lstrcpyW(filename, info->pCHMInfo->compiledFile);
234  lstrcatW(filename, periodW);
235  lstrcatW(filename, extW);
236  hr = IStorage_OpenStream(pStorage, filename, NULL, STGM_READ, 0, &pStream);
237  if (FAILED(hr))
238  {
240  return strdupAtoW("");
241  }
242  IStream_Release(pStream);
243  return filename;
244 }
HRESULT hr
Definition: shlfolder.c:183
const char * filename
Definition: ioapi.h:135
#define lstrlenW
Definition: compat.h:415
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
smooth NULL
Definition: ftsmooth.c:416
#define STGM_READ
Definition: objbase.h:916
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define lstrcpyW
Definition: compat.h:414
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by LoadWinTypeFromCHM().

◆ GetChmStream()

IStream* GetChmStream ( CHMInfo info,
LPCWSTR  parent_chm,
ChmPath chm_file 
)

Definition at line 532 of file chm.c.

533 {
534  IStorage *storage;
535  IStream *stream = NULL;
536  HRESULT hres;
537 
538  TRACE("%s (%s :: %s)\n", debugstr_w(parent_chm), debugstr_w(chm_file->chm_file),
539  debugstr_w(chm_file->chm_index));
540 
541  if(parent_chm || chm_file->chm_file) {
542  hres = IITStorage_StgOpenStorage(info->pITStorage,
543  chm_file->chm_file ? chm_file->chm_file : parent_chm, NULL,
544  STGM_READ | STGM_SHARE_DENY_WRITE, NULL, 0, &storage);
545  if(FAILED(hres)) {
546  WARN("Could not open storage: %08x\n", hres);
547  return NULL;
548  }
549  }else {
550  storage = info->pStorage;
551  IStorage_AddRef(info->pStorage);
552  }
553 
554  hres = IStorage_OpenStream(storage, chm_file->chm_index, NULL, STGM_READ, 0, &stream);
555  IStorage_Release(storage);
556  if(FAILED(hres))
557  WARN("Could not open stream: %08x\n", hres);
558 
559  return stream;
560 }
#define WARN(fmt,...)
Definition: debug.h:111
LPWSTR chm_index
Definition: hhctrl.h:56
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define STGM_READ
Definition: objbase.h:916
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
LPWSTR chm_file
Definition: hhctrl.h:55
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:921

Referenced by InitContent(), InitIndex(), and parse_sitemap_object().

◆ GetChmString()

static LPCSTR GetChmString ( CHMInfo chm,
DWORD  offset 
)
static

Definition at line 32 of file chm.c.

33 {
34  LPCSTR str;
35 
36  if(!chm->strings_stream)
37  return NULL;
38 
39  if(chm->strings_size <= (offset >> BLOCK_BITS)) {
40  chm->strings_size = (offset >> BLOCK_BITS)+1;
41  if(chm->strings)
42  chm->strings = heap_realloc_zero(chm->strings,
43  chm->strings_size*sizeof(char*));
44  else
45  chm->strings = heap_alloc_zero(
46  chm->strings_size*sizeof(char*));
47 
48  }
49 
50  if(!chm->strings[offset >> BLOCK_BITS]) {
52  DWORD read;
53  HRESULT hres;
54 
55  pos.QuadPart = offset & ~BLOCK_MASK;
56  hres = IStream_Seek(chm->strings_stream, pos, STREAM_SEEK_SET, NULL);
57  if(FAILED(hres)) {
58  WARN("Seek failed: %08x\n", hres);
59  return NULL;
60  }
61 
63 
64  hres = IStream_Read(chm->strings_stream, chm->strings[offset >> BLOCK_BITS],
65  BLOCK_SIZE, &read);
66  if(FAILED(hres)) {
67  WARN("Read failed: %08x\n", hres);
69  chm->strings[offset >> BLOCK_BITS] = NULL;
70  return NULL;
71  }
72  }
73 
74  str = chm->strings[offset >> BLOCK_BITS] + (offset & BLOCK_MASK);
75  TRACE("offset %#x => %s\n", offset, debugstr_a(str));
76  return str;
77 }
char ** strings
Definition: hhctrl.h:104
#define WARN(fmt,...)
Definition: debug.h:111
GLintptr offset
Definition: glext.h:5920
DWORD strings_size
Definition: hhctrl.h:105
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
#define BLOCK_BITS
Definition: stream.h:22
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
IStream * strings_stream
Definition: hhctrl.h:103
#define TRACE(s)
Definition: solgame.cpp:4
#define BLOCK_SIZE
Definition: dlist.c:220
HRESULT hres
Definition: protocol.c:465
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
#define BLOCK_MASK
Definition: stream.h:24
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by ConvertChmString(), and FindContextAlias().

◆ GetDocumentTitle()

WCHAR* GetDocumentTitle ( CHMInfo info,
LPCWSTR  document 
)

Definition at line 565 of file chm.c.

566 {
567  strbuf_t node, node_name, content;
568  WCHAR *document_title = NULL;
569  IStream *str = NULL;
570  IStorage *storage;
572  HRESULT hres;
573 
574  TRACE("%s\n", debugstr_w(document));
575 
576  storage = info->pStorage;
577  if(!storage) {
578  WARN("Could not open storage to obtain the title for a document.\n");
579  return NULL;
580  }
581  IStorage_AddRef(storage);
582 
583  hres = IStorage_OpenStream(storage, document, NULL, STGM_READ, 0, &str);
584  IStorage_Release(storage);
585  if(FAILED(hres))
586  WARN("Could not open stream: %08x\n", hres);
587 
589  strbuf_init(&node);
591  strbuf_init(&node_name);
592 
593  while(next_node(&stream, &node)) {
594  get_node_name(&node, &node_name);
595 
596  TRACE("%s\n", node.buf);
597 
598  if(!_strnicmp(node_name.buf, "title", -1)) {
599  if(next_content(&stream, &content) && content.len > 1)
600  {
601  document_title = strdupnAtoW(&content.buf[1], content.len-1);
602  FIXME("magic: %s\n", debugstr_w(document_title));
603  break;
604  }
605  }
606 
607  strbuf_zero(&node);
608  }
609 
610  strbuf_free(&node);
612  strbuf_free(&node_name);
613  IStream_Release(str);
614 
615  return document_title;
616 }
void get_node_name(strbuf_t *node, strbuf_t *name)
Definition: stream.c:88
#define WARN(fmt,...)
Definition: debug.h:111
static LPWSTR strdupnAtoW(LPCSTR str, LONG lenA)
Definition: hhctrl.h:268
BOOL next_node(stream_t *stream, strbuf_t *buf)
Definition: stream.c:140
struct node node
#define debugstr_w
Definition: kernel32.h:32
_Check_return_ _CRTIMP int __cdecl _strnicmp(_In_reads_or_z_(_MaxCount) const char *_Str1, _In_reads_or_z_(_MaxCount) const char *_Str2, _In_ size_t _MaxCount)
#define FIXME(fmt,...)
Definition: debug.h:110
void strbuf_free(strbuf_t *buf)
Definition: stream.c:38
content
Definition: atl_ax.c:993
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define STGM_READ
Definition: objbase.h:916
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static void strbuf_init(strbuf *buf)
Definition: registrar.c:82
BOOL next_content(stream_t *stream, strbuf_t *buf)
Definition: stream.c:105
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
void stream_init(stream_t *stream, IStream *str)
Definition: stream.c:54
void strbuf_zero(strbuf_t *buf)
Definition: stream.c:33
Definition: dlist.c:348
char * buf
Definition: stream.h:27

Referenced by OnTopicChange().

◆ LoadWinTypeFromCHM()

BOOL LoadWinTypeFromCHM ( HHInfo info)

Definition at line 341 of file chm.c.

342 {
343  LARGE_INTEGER liOffset;
344  IStorage *pStorage = info->pCHMInfo->pStorage;
345  IStream *pStream = NULL;
346  HH_WINTYPEW wintype;
347  HRESULT hr;
348  DWORD cbRead;
349  BOOL ret = FALSE;
350 
351  static const WCHAR empty[] = {0};
352  static const WCHAR toc_extW[] = {'h','h','c',0};
353  static const WCHAR index_extW[] = {'h','h','k',0};
354  static const WCHAR windowsW[] = {'#','W','I','N','D','O','W','S',0};
355 
356  /* HH_WINTYPE as stored on disk. It's identical to HH_WINTYPE except that the pointer fields
357  have been changed to DWORDs, so that the layout on 64-bit remains unchanged. */
358  struct file_wintype
359  {
360  int cbStruct;
361  BOOL fUniCodeStrings;
362  DWORD pszType;
363  DWORD fsValidMembers;
364  DWORD fsWinProperties;
365  DWORD pszCaption;
366  DWORD dwStyles;
367  DWORD dwExStyles;
368  RECT rcWindowPos;
369  int nShowState;
370  DWORD hwndHelp;
371  DWORD hwndCaller;
372  DWORD paInfoTypes;
373  DWORD hwndToolBar;
374  DWORD hwndNavigation;
375  DWORD hwndHTML;
376  int iNavWidth;
377  RECT rcHTML;
378  DWORD pszToc;
379  DWORD pszIndex;
380  DWORD pszFile;
381  DWORD pszHome;
382  DWORD fsToolBarFlags;
383  BOOL fNotExpanded;
384  int curNavType;
385  int tabpos;
386  int idNotify;
387  BYTE tabOrder[HH_MAX_TABS+1];
388  int cHistory;
389  DWORD pszJump1;
390  DWORD pszJump2;
391  DWORD pszUrlJump1;
392  DWORD pszUrlJump2;
393  RECT rcMinSize;
394  int cbInfoTypes;
395  DWORD pszCustomTabs;
396  } file_wintype;
397 
398  memset(&wintype, 0, sizeof(wintype));
399  wintype.cbStruct = sizeof(wintype);
400  wintype.fUniCodeStrings = TRUE;
401 
402  hr = IStorage_OpenStream(pStorage, windowsW, NULL, STGM_READ, 0, &pStream);
403  if (SUCCEEDED(hr))
404  {
405  /* jump past the #WINDOWS header */
406  liOffset.QuadPart = sizeof(DWORD) * 2;
407 
408  hr = IStream_Seek(pStream, liOffset, STREAM_SEEK_SET, NULL);
409  if (FAILED(hr)) goto done;
410 
411  /* read the HH_WINTYPE struct data */
412  hr = IStream_Read(pStream, &file_wintype, sizeof(file_wintype), &cbRead);
413  if (FAILED(hr)) goto done;
414 
415  /* convert the #STRINGS offsets to actual strings */
416  wintype.pszType = ConvertChmString(info, file_wintype.pszType);
417  wintype.fsValidMembers = file_wintype.fsValidMembers;
418  wintype.fsWinProperties = file_wintype.fsWinProperties;
419  wintype.pszCaption = ConvertChmString(info, file_wintype.pszCaption);
420  wintype.dwStyles = file_wintype.dwStyles;
421  wintype.dwExStyles = file_wintype.dwExStyles;
422  wintype.rcWindowPos = file_wintype.rcWindowPos;
423  wintype.nShowState = file_wintype.nShowState;
424  wintype.iNavWidth = file_wintype.iNavWidth;
425  wintype.rcHTML = file_wintype.rcHTML;
426  wintype.pszToc = ConvertChmString(info, file_wintype.pszToc);
427  wintype.pszIndex = ConvertChmString(info, file_wintype.pszIndex);
428  wintype.pszFile = ConvertChmString(info, file_wintype.pszFile);
429  wintype.pszHome = ConvertChmString(info, file_wintype.pszHome);
430  wintype.fsToolBarFlags = file_wintype.fsToolBarFlags;
431  wintype.fNotExpanded = file_wintype.fNotExpanded;
432  wintype.curNavType = file_wintype.curNavType;
433  wintype.tabpos = file_wintype.tabpos;
434  wintype.idNotify = file_wintype.idNotify;
435  memcpy(&wintype.tabOrder, file_wintype.tabOrder, sizeof(wintype.tabOrder));
436  wintype.cHistory = file_wintype.cHistory;
437  wintype.pszJump1 = ConvertChmString(info, file_wintype.pszJump1);
438  wintype.pszJump2 = ConvertChmString(info, file_wintype.pszJump2);
439  wintype.pszUrlJump1 = ConvertChmString(info, file_wintype.pszUrlJump1);
440  wintype.pszUrlJump2 = ConvertChmString(info, file_wintype.pszUrlJump2);
441  wintype.rcMinSize = file_wintype.rcMinSize;
442  wintype.cbInfoTypes = file_wintype.cbInfoTypes;
443  }
444  else
445  {
446  /* no defined window types so use (hopefully) sane defaults */
447  static const WCHAR defaultwinW[] = {'d','e','f','a','u','l','t','w','i','n','\0'};
448  wintype.pszType = strdupW(info->pCHMInfo->defWindow ? info->pCHMInfo->defWindow : defaultwinW);
449  wintype.pszToc = strdupW(info->pCHMInfo->defToc ? info->pCHMInfo->defToc : empty);
450  wintype.pszIndex = strdupW(empty);
451  wintype.fsValidMembers = 0;
453  wintype.dwStyles = WS_POPUP;
454  wintype.dwExStyles = 0;
455  wintype.nShowState = SW_SHOW;
456  wintype.curNavType = HHWIN_NAVTYPE_TOC;
457  }
458 
459  /* merge the new data with any pre-existing HH_WINTYPE structure */
460  MergeChmProperties(&wintype, info, FALSE);
461  if (!info->WinType.pszCaption)
462  info->WinType.pszCaption = info->stringsW.pszCaption = strdupW(info->pCHMInfo->defTitle ? info->pCHMInfo->defTitle : empty);
463  if (!info->WinType.pszFile)
464  info->WinType.pszFile = info->stringsW.pszFile = strdupW(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : empty);
465  if (!info->WinType.pszToc)
466  info->WinType.pszToc = info->stringsW.pszToc = FindHTMLHelpSetting(info, toc_extW);
467  if (!info->WinType.pszIndex)
468  info->WinType.pszIndex = info->stringsW.pszIndex = FindHTMLHelpSetting(info, index_extW);
469 
470  wintype_free(&wintype);
471  ret = TRUE;
472 
473 done:
474  if (pStream)
475  IStream_Release(pStream);
476 
477  return ret;
478 }
DWORD fsValidMembers
Definition: htmlhelp.h:343
#define TRUE
Definition: types.h:120
DWORD dwExStyles
Definition: htmlhelp.h:347
LPCWSTR pszIndex
Definition: htmlhelp.h:359
HRESULT hr
Definition: shlfolder.c:183
LPCWSTR pszType
Definition: htmlhelp.h:342
static void wintype_free(HH_WINTYPEW *wintype)
Definition: chm.c:320
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
BYTE tabOrder[HH_MAX_TABS+1]
Definition: htmlhelp.h:367
LPCWSTR pszCaption
Definition: htmlhelp.h:345
DWORD fsToolBarFlags
Definition: htmlhelp.h:362
#define DWORD
Definition: nt_native.h:44
BOOL fUniCodeStrings
Definition: htmlhelp.h:341
RECT rcMinSize
Definition: htmlhelp.h:373
DWORD fsWinProperties
Definition: htmlhelp.h:344
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
LPCWSTR pszToc
Definition: htmlhelp.h:358
LPCWSTR pszJump2
Definition: htmlhelp.h:370
#define STGM_READ
Definition: objbase.h:916
static WCHAR * ConvertChmString(HHInfo *info, DWORD id)
Definition: chm.c:311
LPCWSTR pszHome
Definition: htmlhelp.h:361
__wchar_t WCHAR
Definition: xmlstorage.h:180
RECT rcWindowPos
Definition: htmlhelp.h:348
void MergeChmProperties(HH_WINTYPEW *src, HHInfo *info, BOOL override)
Definition: chm.c:253
LONG HRESULT
Definition: typedefs.h:77
LPCWSTR pszUrlJump1
Definition: htmlhelp.h:371
unsigned long DWORD
Definition: ntddk_ex.h:95
#define HH_MAX_TABS
Definition: htmlhelp.h:260
int ret
BOOL fNotExpanded
Definition: htmlhelp.h:363
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
LPCWSTR pszFile
Definition: htmlhelp.h:360
LPCWSTR pszUrlJump2
Definition: htmlhelp.h:372
#define WS_POPUP
Definition: pedump.c:616
BOOL empty
Definition: button.c:170
LPCWSTR pszJump1
Definition: htmlhelp.h:369
static WCHAR * FindHTMLHelpSetting(HHInfo *info, const WCHAR *extW)
Definition: chm.c:223
#define HHWIN_PROP_TRI_PANE
Definition: htmlhelp.h:60
DWORD dwStyles
Definition: htmlhelp.h:346
#define memset(x, y, z)
Definition: compat.h:39
#define SUCCEEDED(hr)
Definition: intsafe.h:57
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by CreateHelpViewer().

◆ MergeChmProperties()

void MergeChmProperties ( HH_WINTYPEW src,
HHInfo info,
BOOL  override 
)

Definition at line 253 of file chm.c.

254 {
255  DWORD unhandled_params = src->fsValidMembers & ~(HHWIN_PARAM_PROPERTIES|HHWIN_PARAM_STYLES
260  HH_WINTYPEW *dst = &info->WinType;
261  DWORD merge = override ? src->fsValidMembers : src->fsValidMembers & ~dst->fsValidMembers;
262 
263  if (unhandled_params)
264  FIXME("Unsupported fsValidMembers fields: 0x%x\n", unhandled_params);
265 
266  dst->fsValidMembers |= merge;
267  if (dst->cbStruct == 0)
268  {
269  /* If the structure has not been filled in yet then use all of the values */
270  dst->cbStruct = sizeof(HH_WINTYPEW);
271  merge = ~0;
272  }
273  if (merge & HHWIN_PARAM_PROPERTIES) dst->fsWinProperties = src->fsWinProperties;
274  if (merge & HHWIN_PARAM_STYLES) dst->dwStyles = src->dwStyles;
275  if (merge & HHWIN_PARAM_EXSTYLES) dst->dwExStyles = src->dwExStyles;
276  if (merge & HHWIN_PARAM_RECT) dst->rcWindowPos = src->rcWindowPos;
277  if (merge & HHWIN_PARAM_NAV_WIDTH) dst->iNavWidth = src->iNavWidth;
278  if (merge & HHWIN_PARAM_SHOWSTATE) dst->nShowState = src->nShowState;
279  if (merge & HHWIN_PARAM_INFOTYPES) dst->paInfoTypes = src->paInfoTypes;
280  if (merge & HHWIN_PARAM_TB_FLAGS) dst->fsToolBarFlags = src->fsToolBarFlags;
281  if (merge & HHWIN_PARAM_EXPANSION) dst->fNotExpanded = src->fNotExpanded;
282  if (merge & HHWIN_PARAM_TABPOS) dst->tabpos = src->tabpos;
283  if (merge & HHWIN_PARAM_TABORDER) memcpy(dst->tabOrder, src->tabOrder, sizeof(src->tabOrder));
284  if (merge & HHWIN_PARAM_HISTORY_COUNT) dst->cHistory = src->cHistory;
285  if (merge & HHWIN_PARAM_CUR_TAB) dst->curNavType = src->curNavType;
286 
287  /*
288  * Note: We assume that hwndHelp, hwndCaller, hwndToolBar, hwndNavigation, and hwndHTML cannot be
289  * modified by the user. rcHTML and rcMinSize are not currently supported, so don't bother to copy them.
290  */
291 
292  dst->pszType = MergeChmString(src->pszType, &info->stringsW.pszType);
293  dst->pszFile = MergeChmString(src->pszFile, &info->stringsW.pszFile);
294  dst->pszToc = MergeChmString(src->pszToc, &info->stringsW.pszToc);
295  dst->pszIndex = MergeChmString(src->pszIndex, &info->stringsW.pszIndex);
296  dst->pszCaption = MergeChmString(src->pszCaption, &info->stringsW.pszCaption);
297  dst->pszHome = MergeChmString(src->pszHome, &info->stringsW.pszHome);
298  dst->pszJump1 = MergeChmString(src->pszJump1, &info->stringsW.pszJump1);
299  dst->pszJump2 = MergeChmString(src->pszJump2, &info->stringsW.pszJump2);
300  dst->pszUrlJump1 = MergeChmString(src->pszUrlJump1, &info->stringsW.pszUrlJump1);
301  dst->pszUrlJump2 = MergeChmString(src->pszUrlJump2, &info->stringsW.pszUrlJump2);
302 
303  /* FIXME: pszCustomTabs is a list of multiple zero-terminated strings so ReadString won't
304  * work in this case
305  */
306 #if 0
307  dst->pszCustomTabs = MergeChmString(src->pszCustomTabs, &info->pszCustomTabs);
308 #endif
309 }
#define HHWIN_PARAM_EXPANSION
Definition: htmlhelp.h:93
struct tagHH_WINTYPEW HH_WINTYPEW
static WCHAR * MergeChmString(LPCWSTR src, WCHAR **dst)
Definition: chm.c:246
#define HHWIN_PARAM_CUR_TAB
Definition: htmlhelp.h:97
#define HHWIN_PARAM_INFOTYPES
Definition: htmlhelp.h:91
#define HHWIN_PARAM_SHOWSTATE
Definition: htmlhelp.h:90
#define HHWIN_PARAM_NAV_WIDTH
Definition: htmlhelp.h:89
#define HHWIN_PARAM_TABORDER
Definition: htmlhelp.h:95
#define HHWIN_PARAM_TABPOS
Definition: htmlhelp.h:94
#define HHWIN_PARAM_HISTORY_COUNT
Definition: htmlhelp.h:96
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result)
Definition: _algo.c:1419
#define FIXME(fmt,...)
Definition: debug.h:110
#define HHWIN_PARAM_STYLES
Definition: htmlhelp.h:86
unsigned long DWORD
Definition: ntddk_ex.h:95
#define HHWIN_PARAM_EXSTYLES
Definition: htmlhelp.h:87
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define HHWIN_PARAM_TB_FLAGS
Definition: htmlhelp.h:92
GLenum src
Definition: glext.h:6340
#define HHWIN_PARAM_PROPERTIES
Definition: htmlhelp.h:85
GLenum GLenum dst
Definition: glext.h:6340
#define HHWIN_PARAM_RECT
Definition: htmlhelp.h:88

Referenced by HtmlHelpW(), and LoadWinTypeFromCHM().

◆ MergeChmString()

static WCHAR* MergeChmString ( LPCWSTR  src,
WCHAR **  dst 
)
inlinestatic

Definition at line 246 of file chm.c.

247 {
248  if(*dst == NULL)
249  *dst = strdupW(src);
250  return *dst;
251 }
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
smooth NULL
Definition: ftsmooth.c:416
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

Referenced by MergeChmProperties().

◆ OpenCHM()

CHMInfo* OpenCHM ( LPCWSTR  szFile)

Definition at line 619 of file chm.c.

620 {
621  HRESULT hres;
622  CHMInfo *ret;
623 
624  static const WCHAR wszSTRINGS[] = {'#','S','T','R','I','N','G','S',0};
625 
626  if (!(ret = heap_alloc_zero(sizeof(CHMInfo))))
627  return NULL;
628  ret->codePage = CP_ACP;
629 
630  if (!(ret->szFile = strdupW(szFile))) {
631  heap_free(ret);
632  return NULL;
633  }
634 
635  hres = CoCreateInstance(&CLSID_ITStorage, NULL, CLSCTX_INPROC_SERVER,
636  &IID_IITStorage, (void **) &ret->pITStorage) ;
637  if(FAILED(hres)) {
638  WARN("Could not create ITStorage: %08x\n", hres);
639  return CloseCHM(ret);
640  }
641 
642  hres = IITStorage_StgOpenStorage(ret->pITStorage, szFile, NULL,
643  STGM_READ | STGM_SHARE_DENY_WRITE, NULL, 0, &ret->pStorage);
644  if(FAILED(hres)) {
645  WARN("Could not open storage: %08x\n", hres);
646  return CloseCHM(ret);
647  }
648  hres = IStorage_OpenStream(ret->pStorage, wszSTRINGS, NULL, STGM_READ, 0,
649  &ret->strings_stream);
650  if(FAILED(hres)) {
651  WARN("Could not open #STRINGS stream: %08x\n", hres);
652  /* It's not critical, so we pass */
653  }
654 
655  if(!ReadChmSystem(ret)) {
656  WARN("Could not read #SYSTEM\n");
657  return CloseCHM(ret);
658  }
659 
660  return ret;
661 }
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
#define CP_ACP
Definition: compat.h:99
#define WARN(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
Definition: hhctrl.h:97
#define STGM_READ
Definition: objbase.h:916
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
int ret
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
CHMInfo * CloseCHM(CHMInfo *chm)
Definition: chm.c:663
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:921
static BOOL ReadChmSystem(CHMInfo *chm)
Definition: chm.c:79
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by CreateHelpViewer().

◆ ReadChmSystem()

static BOOL ReadChmSystem ( CHMInfo chm)
static

Definition at line 79 of file chm.c.

80 {
81  IStream *stream;
82  DWORD ver=0xdeadbeef, read, buf_size;
83  char *buf;
84  HRESULT hres;
85 
86  struct {
87  WORD code;
88  WORD len;
89  } entry;
90 
91  static const WCHAR wszSYSTEM[] = {'#','S','Y','S','T','E','M',0};
92 
93  hres = IStorage_OpenStream(chm->pStorage, wszSYSTEM, NULL, STGM_READ, 0, &stream);
94  if(FAILED(hres)) {
95  WARN("Could not open #SYSTEM stream: %08x\n", hres);
96  return FALSE;
97  }
98 
99  IStream_Read(stream, &ver, sizeof(ver), &read);
100  TRACE("version is %x\n", ver);
101 
102  buf = heap_alloc(8*sizeof(DWORD));
103  buf_size = 8*sizeof(DWORD);
104 
105  while(1) {
106  hres = IStream_Read(stream, &entry, sizeof(entry), &read);
107  if(hres != S_OK)
108  break;
109 
110  if(entry.len > buf_size)
111  buf = heap_realloc(buf, buf_size=entry.len);
112 
113  hres = IStream_Read(stream, buf, entry.len, &read);
114  if(hres != S_OK)
115  break;
116 
117  switch(entry.code) {
118  case 0x0:
119  TRACE("TOC is %s\n", debugstr_an(buf, entry.len));
120  heap_free(chm->defToc);
121  chm->defToc = strdupnAtoW(buf, entry.len);
122  break;
123  case 0x2:
124  TRACE("Default topic is %s\n", debugstr_an(buf, entry.len));
125  heap_free(chm->defTopic);
126  chm->defTopic = strdupnAtoW(buf, entry.len);
127  break;
128  case 0x3:
129  TRACE("Title is %s\n", debugstr_an(buf, entry.len));
130  heap_free(chm->defTitle);
131  chm->defTitle = strdupnAtoW(buf, entry.len);
132  break;
133  case 0x4:
134  /* TODO: Currently only the Locale ID is loaded from this field */
135  TRACE("Locale is: %d\n", *(LCID*)&buf[0]);
136  if(!GetLocaleInfoW(*(LCID*)&buf[0], LOCALE_IDEFAULTANSICODEPAGE|LOCALE_RETURN_NUMBER,
137  (WCHAR *)&chm->codePage, sizeof(chm->codePage)/sizeof(WCHAR)))
138  chm->codePage = CP_ACP;
139  break;
140  case 0x5:
141  TRACE("Window name is %s\n", debugstr_an(buf, entry.len));
142  chm->defWindow = strdupnAtoW(buf, entry.len);
143  break;
144  case 0x6:
145  TRACE("Compiled file is %s\n", debugstr_an(buf, entry.len));
146  heap_free(chm->compiledFile);
147  chm->compiledFile = strdupnAtoW(buf, entry.len);
148  break;
149  case 0x9:
150  TRACE("Version is %s\n", debugstr_an(buf, entry.len));
151  break;
152  case 0xa:
153  TRACE("Time is %08x\n", *(DWORD*)buf);
154  break;
155  case 0xc:
156  TRACE("Number of info types: %d\n", *(DWORD*)buf);
157  break;
158  case 0xf:
159  TRACE("Check sum: %x\n", *(DWORD*)buf);
160  break;
161  default:
162  TRACE("unhandled code %x, size %x\n", entry.code, entry.len);
163  }
164  }
165 
166  heap_free(buf);
167  IStream_Release(stream);
168 
169  return SUCCEEDED(hres);
170 }
#define LOCALE_IDEFAULTANSICODEPAGE
Definition: winnls.h:38
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CP_ACP
Definition: compat.h:99
#define WARN(fmt,...)
Definition: debug.h:111
static LPWSTR strdupnAtoW(LPCSTR str, LONG lenA)
Definition: hhctrl.h:268
WCHAR * defToc
Definition: hhctrl.h:111
DWORD LCID
Definition: nls.h:13
#define DWORD
Definition: nt_native.h:44
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
smooth NULL
Definition: ftsmooth.c:416
WCHAR * defWindow
Definition: hhctrl.h:108
#define STGM_READ
Definition: objbase.h:916
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT codePage
Definition: hhctrl.h:113
Definition: parse.h:22
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:47
GLuint GLuint stream
Definition: glext.h:7522
uint32_t entry
Definition: isohybrid.c:63
GLenum GLsizei len
Definition: glext.h:6722
int code
Definition: i386-dis.c:3591
IStorage * pStorage
Definition: hhctrl.h:100
#define S_OK
Definition: intsafe.h:59
WCHAR * defTopic
Definition: hhctrl.h:109
WCHAR * defTitle
Definition: hhctrl.h:110
WCHAR * compiledFile
Definition: hhctrl.h:107
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by OpenCHM().

◆ SetChmPath()

void SetChmPath ( ChmPath file,
LPCWSTR  base_file,
LPCWSTR  path 
)

Definition at line 496 of file chm.c.

497 {
498  LPCWSTR ptr;
499  static const WCHAR separatorW[] = {':',':',0};
500 
501  path = skip_schema(path);
502 
504  if(ptr) {
505  WCHAR chm_file[MAX_PATH];
506  WCHAR rel_path[MAX_PATH];
507  WCHAR base_path[MAX_PATH];
508  LPWSTR p;
509 
510  lstrcpyW(base_path, base_file);
511  p = wcsrchr(base_path, '\\');
512  if(p)
513  *p = 0;
514 
515  memcpy(rel_path, path, (ptr-path)*sizeof(WCHAR));
516  rel_path[ptr-path] = 0;
517 
518  PathCombineW(chm_file, base_path, rel_path);
519 
520  file->chm_file = strdupW(chm_file);
521  ptr += 2;
522  }else {
523  file->chm_file = strdupW(base_file);
524  ptr = path;
525  }
526 
527  file->chm_index = strdupW(ptr);
528 
529  TRACE("ChmFile = {%s %s}\n", debugstr_w(file->chm_file), debugstr_w(file->chm_index));
530 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
GLsizei const GLchar ** path
Definition: glext.h:7234
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
#define TRACE(s)
Definition: solgame.cpp:4
static const WCHAR separatorW[]
Definition: itemdlg.c:1561
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define lstrcpyW
Definition: compat.h:414
Definition: services.c:325
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:189
LPCWSTR skip_schema(LPCWSTR url)
Definition: chm.c:480
Definition: fci.c:126

Referenced by InitContent(), InitIndex(), NavigateToUrl(), and parse_obj_node_param().

◆ skip_schema()

LPCWSTR skip_schema ( LPCWSTR  url)

Definition at line 480 of file chm.c.

481 {
482  static const WCHAR its_schema[] = {'i','t','s',':'};
483  static const WCHAR msits_schema[] = {'m','s','-','i','t','s',':'};
484  static const WCHAR mk_schema[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':'};
485 
486  if(!_wcsnicmp(its_schema, url, ARRAY_SIZE(its_schema)))
487  return url + ARRAY_SIZE(its_schema);
488  if(!_wcsnicmp(msits_schema, url, ARRAY_SIZE(msits_schema)))
489  return url + ARRAY_SIZE(msits_schema);
490  if(!_wcsnicmp(mk_schema, url, ARRAY_SIZE(mk_schema)))
491  return url + ARRAY_SIZE(mk_schema);
492 
493  return url;
494 }
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR url[]
Definition: encode.c:1432
#define ARRAY_SIZE(a)
Definition: main.h:24

Referenced by resolve_filename(), and SetChmPath().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( htmlhelp  )

◆ wintype_free()

static void wintype_free ( HH_WINTYPEW wintype)
inlinestatic

Definition at line 320 of file chm.c.

321 {
322  heap_free((void *)wintype->pszType);
323  heap_free((void *)wintype->pszCaption);
324  heap_free(wintype->paInfoTypes);
325  heap_free((void *)wintype->pszToc);
326  heap_free((void *)wintype->pszIndex);
327  heap_free((void *)wintype->pszFile);
328  heap_free((void *)wintype->pszHome);
329  heap_free((void *)wintype->pszJump1);
330  heap_free((void *)wintype->pszJump2);
331  heap_free((void *)wintype->pszUrlJump1);
332  heap_free((void *)wintype->pszUrlJump2);
333  heap_free((void *)wintype->pszCustomTabs);
334 }
LPCWSTR pszIndex
Definition: htmlhelp.h:359
LPCWSTR pszType
Definition: htmlhelp.h:342
LPCWSTR pszCaption
Definition: htmlhelp.h:345
PHH_INFOTYPE paInfoTypes
Definition: htmlhelp.h:352
LPCWSTR pszToc
Definition: htmlhelp.h:358
LPCWSTR pszJump2
Definition: htmlhelp.h:370
LPCWSTR pszHome
Definition: htmlhelp.h:361
LPCWSTR pszUrlJump1
Definition: htmlhelp.h:371
LPCWSTR pszCustomTabs
Definition: htmlhelp.h:375
LPCWSTR pszFile
Definition: htmlhelp.h:360
LPCWSTR pszUrlJump2
Definition: htmlhelp.h:372
LPCWSTR pszJump1
Definition: htmlhelp.h:369
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by LoadWinTypeFromCHM().