ReactOS 0.4.17-dev-804-g023d8af
hhctrl.h File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "winuser.h"
#include "winnls.h"
#include "htmlhelp.h"
#include "ole2.h"
#include "exdisp.h"
#include "mshtmhst.h"
#include "commctrl.h"
#include "wine/itss.h"
#include "wine/list.h"
Include dependency graph for hhctrl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ChmPath
 
struct  ContentItem
 
struct  IndexSubItem
 
struct  IndexItem
 
struct  SearchItem
 
struct  CHMInfo
 
struct  HHTab
 
struct  IndexPopup
 
struct  SearchTab
 
struct  ContentsTab
 
struct  wintype_stringsW
 
struct  wintype_stringsA
 
struct  WebBrowserContainer
 
struct  HHInfo
 

Macros

#define COBJMACROS
 
#define WB_GOBACK   0
 
#define WB_GOFORWARD   1
 
#define WB_GOHOME   2
 
#define WB_SEARCH   3
 
#define WB_REFRESH   4
 
#define WB_STOP   5
 
#define WB_PRINT   6
 
#define TAB_CONTENTS   0
 
#define TAB_INDEX   1
 
#define TAB_SEARCH   2
 
#define TAB_FAVORITES   3
 
#define TAB_NUMTABS   TAB_FAVORITES
 

Typedefs

typedef struct ContentItem ContentItem
 
typedef struct IndexSubItem IndexSubItem
 
typedef struct IndexItem IndexItem
 
typedef struct SearchItem SearchItem
 
typedef struct CHMInfo CHMInfo
 

Functions

BOOL InitWebBrowser (HHInfo *, HWND)
 
void ReleaseWebBrowser (HHInfo *)
 
void ResizeWebBrowser (HHInfo *, DWORD, DWORD)
 
void DoPageAction (WebBrowserContainer *, DWORD)
 
void InitContent (HHInfo *)
 
void ReleaseContent (HHInfo *)
 
void ActivateContentTopic (HWND, LPCWSTR, ContentItem *)
 
void InitIndex (HHInfo *)
 
void ReleaseIndex (HHInfo *)
 
CHMInfoOpenCHM (LPCWSTR szFile)
 
BOOL LoadWinTypeFromCHM (HHInfo *info)
 
CHMInfoCloseCHM (CHMInfo *pCHMInfo)
 
void SetChmPath (ChmPath *, LPCWSTR, LPCWSTR)
 
IStreamGetChmStream (CHMInfo *, LPCWSTR, ChmPath *)
 
LPWSTR FindContextAlias (CHMInfo *, DWORD)
 
WCHARGetDocumentTitle (CHMInfo *, LPCWSTR)
 
HHInfoCreateHelpViewer (HHInfo *, LPCWSTR, HWND)
 
void ReleaseHelpViewer (HHInfo *)
 
BOOL NavigateToUrl (HHInfo *, LPCWSTR)
 
BOOL NavigateToChm (HHInfo *, LPCWSTR, LPCWSTR)
 
void MergeChmProperties (HH_WINTYPEW *, HHInfo *, BOOL)
 
void UpdateHelpWindow (HHInfo *info)
 
void InitSearch (HHInfo *info, const char *needle)
 
void ReleaseSearch (HHInfo *info)
 
LPCWSTR skip_schema (LPCWSTR url)
 
void wintype_stringsA_free (struct wintype_stringsA *stringsA)
 
void wintype_stringsW_free (struct wintype_stringsW *stringsW)
 
WCHARdecode_html (const char *html_fragment, int html_fragment_len, UINT code_page)
 
HHInfofind_window (const WCHAR *window)
 
static LPWSTR strdupnAtoW (LPCSTR str, LONG lenA)
 
static LPWSTR strdupAtoW (LPCSTR str)
 
static LPSTR strdupWtoA (LPCWSTR str)
 

Variables

struct list window_list
 
HINSTANCE hhctrl_hinstance
 
BOOL hh_process
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file hhctrl.h.

◆ TAB_CONTENTS

#define TAB_CONTENTS   0

Definition at line 115 of file hhctrl.h.

◆ TAB_FAVORITES

#define TAB_FAVORITES   3

Definition at line 118 of file hhctrl.h.

◆ TAB_INDEX

#define TAB_INDEX   1

Definition at line 116 of file hhctrl.h.

◆ TAB_NUMTABS

#define TAB_NUMTABS   TAB_FAVORITES

Definition at line 119 of file hhctrl.h.

◆ TAB_SEARCH

#define TAB_SEARCH   2

Definition at line 117 of file hhctrl.h.

◆ WB_GOBACK

#define WB_GOBACK   0

Definition at line 45 of file hhctrl.h.

◆ WB_GOFORWARD

#define WB_GOFORWARD   1

Definition at line 46 of file hhctrl.h.

◆ WB_GOHOME

#define WB_GOHOME   2

Definition at line 47 of file hhctrl.h.

◆ WB_PRINT

#define WB_PRINT   6

Definition at line 51 of file hhctrl.h.

◆ WB_REFRESH

#define WB_REFRESH   4

Definition at line 49 of file hhctrl.h.

◆ WB_SEARCH

#define WB_SEARCH   3

Definition at line 48 of file hhctrl.h.

◆ WB_STOP

#define WB_STOP   5

Definition at line 50 of file hhctrl.h.

Typedef Documentation

◆ CHMInfo

◆ ContentItem

◆ IndexItem

◆ IndexSubItem

◆ SearchItem

Function Documentation

◆ ActivateContentTopic()

void ActivateContentTopic ( HWND  hWnd,
LPCWSTR  filename,
ContentItem item 
)

Definition at line 328 of file content.c.

329{
330 if (lstrcmpiW(item->local, filename) == 0)
331 {
333 return;
334 }
335
336 if (item->next)
338
339 if (item->child)
341}
HWND hWnd
Definition: settings.c:17
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
const char * filename
Definition: ioapi.h:137
LONG_PTR LPARAM
Definition: minwindef.h:175
#define TVM_SELECTITEM
Definition: commctrl.h:3483
#define TVGN_CARET
Definition: commctrl.h:3466
void ActivateContentTopic(HWND hWnd, LPCWSTR filename, ContentItem *item)
Definition: content.c:328
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ActivateContentTopic(), and DoSync().

◆ CloseCHM()

CHMInfo * CloseCHM ( CHMInfo pCHMInfo)

Definition at line 683 of file chm.c.

684{
685 if(chm->pITStorage)
686 IITStorage_Release(chm->pITStorage);
687
688 if(chm->pStorage)
689 IStorage_Release(chm->pStorage);
690
691 if(chm->strings_stream)
692 IStream_Release(chm->strings_stream);
693
694 if(chm->strings_size) {
695 DWORD i;
696
697 for(i=0; i<chm->strings_size; i++)
698 free(chm->strings[i]);
699 }
700
701 free(chm->strings);
702 free(chm->defWindow);
703 free(chm->defTitle);
704 free(chm->defTopic);
705 free(chm->defToc);
706 free(chm->szFile);
707 free(chm->compiledFile);
708 free(chm);
709
710 return NULL;
711}
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
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

Referenced by OpenCHM(), and ReleaseHelpViewer().

◆ CreateHelpViewer()

HHInfo * CreateHelpViewer ( HHInfo info,
LPCWSTR  filename,
HWND  caller 
)

Definition at line 1831 of file help.c.

1832{
1833 HHInfo *tmp_info;
1834 unsigned int i;
1835
1836 if(!info)
1837 {
1838 info = calloc(1, sizeof(HHInfo));
1839 list_add_tail(&window_list, &info->entry);
1840 }
1841
1842 /* Set the invalid tab ID (-1) as the default value for all
1843 * of the tabs, this matches a failed TCM_INSERTITEM call.
1844 */
1845 for (i = 0; i < ARRAY_SIZE(info->tabs); i++)
1846 info->tabs[i].id = -1;
1847
1849
1850 info->pCHMInfo = OpenCHM(filename);
1851 if(!info->pCHMInfo) {
1853 return NULL;
1854 }
1855
1856 if (!LoadWinTypeFromCHM(info)) {
1858 return NULL;
1859 }
1860 info->WinType.hwndCaller = caller;
1861
1862 /* If the window is already open then load the file in that existing window */
1863 if ((tmp_info = find_window(info->WinType.pszType)) && tmp_info != info)
1864 {
1866 return CreateHelpViewer(tmp_info, filename, caller);
1867 }
1868
1869 if(!info->viewer_initialized && !CreateViewer(info)) {
1871 return NULL;
1872 }
1873
1874 return info;
1875}
#define ARRAY_SIZE(A)
Definition: main.h:20
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
CHMInfo * OpenCHM(LPCWSTR szFile)
Definition: chm.c:639
BOOL LoadWinTypeFromCHM(HHInfo *info)
Definition: chm.c:357
HHInfo * CreateHelpViewer(HHInfo *info, LPCWSTR filename, HWND caller)
Definition: help.c:1831
struct list window_list
Definition: help.c:51
static BOOL CreateViewer(HHInfo *pHHInfo)
Definition: help.c:1729
void ReleaseHelpViewer(HHInfo *info)
Definition: help.c:1802
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:162
#define calloc
Definition: rosglue.h:14
Definition: hhctrl.h:184
static HWND find_window()
Definition: wclickat.c:251

Referenced by CreateHelpViewer(), and HtmlHelpW().

◆ decode_html()

WCHAR * decode_html ( const char html_fragment,
int  html_fragment_len,
UINT  code_page 
)

Definition at line 1902 of file help.c.

1903{
1904 const char *h = html_fragment, *amp, *sem;
1905 char symbol, *tmp;
1906 int len, tmp_len = 0;
1907 WCHAR *unicode_text;
1908
1909 tmp = malloc(html_fragment_len + 1);
1910 while(1)
1911 {
1912 symbol = 0;
1913 amp = memchr(h, '&', html_fragment + html_fragment_len - h);
1914 if(!amp) break;
1915 len = amp-h;
1916 /* Copy the characters prior to the HTML encoded character */
1917 memcpy(&tmp[tmp_len], h, len);
1918 tmp_len += len;
1919 amp++; /* skip ampersand */
1920 sem = memchr(amp, ';', html_fragment + html_fragment_len - amp);
1921 /* Require a semicolon after the ampersand */
1922 if(!sem)
1923 {
1924 h = amp;
1925 tmp[tmp_len++] = '&';
1926 continue;
1927 }
1928 /* Find the symbol either by using the ANSI character number (prefixed by the pound symbol)
1929 * or by searching the HTML entity table */
1930 len = sem-amp;
1931 if(amp[0] == '#')
1932 {
1933 char *endnum = NULL;
1934 int tmp;
1935
1936 tmp = (char) strtol(amp, &endnum, 10);
1937 if(endnum == sem)
1938 symbol = tmp;
1939 }
1940 else
1941 symbol = find_html_symbol(amp, len);
1942 if(!symbol)
1943 {
1944 FIXME("Failed to translate HTML encoded character '&%.*s;'.\n", len, amp);
1945 h = amp;
1946 tmp[tmp_len++] = '&';
1947 continue;
1948 }
1949 /* Insert the new symbol */
1950 h = sem+1;
1951 tmp[tmp_len++] = symbol;
1952 }
1953 /* Convert any remaining characters */
1954 len = html_fragment_len-(h-html_fragment);
1955 memcpy(&tmp[tmp_len], h, len);
1956 tmp_len += len;
1957 tmp[tmp_len++] = 0; /* NULL-terminate the string */
1958
1959 len = MultiByteToWideChar(code_page, 0, tmp, tmp_len, NULL, 0);
1960 unicode_text = malloc(len * sizeof(WCHAR));
1961 MultiByteToWideChar(code_page, 0, tmp, tmp_len, unicode_text, len);
1962 free(tmp);
1963 return unicode_text;
1964}
#define FIXME(fmt,...)
Definition: precomp.h:53
_Out_opt_ UINT * code_page
#define malloc
Definition: debug_ros.c:4
#define MultiByteToWideChar
Definition: compat.h:110
static char find_html_symbol(const char *entity, int entity_len)
Definition: help.c:1880
_ACRTIMP __msvcrt_long __cdecl strtol(const char *, char **, int)
Definition: string.c:1838
unsigned char
Definition: typeof.h:29
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memchr(s, c, n)
Definition: mkisofs.h:875
static HANDLE sem
Definition: sync.c:799
short WCHAR
Definition: pedump.c:58

Referenced by parse_index_obj_node_param(), and parse_obj_node_param().

◆ DoPageAction()

void DoPageAction ( WebBrowserContainer container,
DWORD  dwAction 
)

Definition at line 753 of file webbrowser.c.

754{
755 if (!container || !container->web_browser)
756 return;
757
758 switch (dwAction)
759 {
760 case WB_GOBACK:
761 IWebBrowser2_GoBack(container->web_browser);
762 break;
763 case WB_GOFORWARD:
764 IWebBrowser2_GoForward(container->web_browser);
765 break;
766 case WB_GOHOME:
767 IWebBrowser2_GoHome(container->web_browser);
768 break;
769 case WB_SEARCH:
770 IWebBrowser2_GoSearch(container->web_browser);
771 break;
772 case WB_REFRESH:
773 IWebBrowser2_Refresh(container->web_browser);
774 break;
775 case WB_STOP:
776 IWebBrowser2_Stop(container->web_browser);
777 break;
778 case WB_PRINT:
779 IWebBrowser2_ExecWB(container->web_browser, OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0);
780 break;
781 }
782}
#define WB_STOP
Definition: hhctrl.h:50
#define WB_GOFORWARD
Definition: hhctrl.h:46
#define WB_GOHOME
Definition: hhctrl.h:47
#define WB_SEARCH
Definition: hhctrl.h:48
#define WB_GOBACK
Definition: hhctrl.h:45
#define WB_PRINT
Definition: hhctrl.h:51
#define WB_REFRESH
Definition: hhctrl.h:49

Referenced by TB_OnClick(), and UI_ShowContextMenu().

◆ find_window()

HHInfo * find_window ( const WCHAR window)

Definition at line 1967 of file help.c.

1968{
1969 HHInfo *info;
1970
1972 {
1973 if (lstrcmpW(info->WinType.pszType, window) == 0)
1974 return info;
1975 }
1976 return NULL;
1977}
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
uint32_t entry
Definition: isohybrid.c:63
static IHTMLWindow2 * window
Definition: events.c:77
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198

◆ FindContextAlias()

LPWSTR FindContextAlias ( CHMInfo chm,
DWORD  index 
)

Definition at line 188 of file chm.c.

189{
190 IStream *ivb_stream;
191 DWORD size, read, i;
192 DWORD *buf;
193 LPCSTR ret = NULL;
195
196 static const WCHAR wszIVB[] = {'#','I','V','B',0};
197
198 hres = IStorage_OpenStream(chm->pStorage, wszIVB, NULL, STGM_READ, 0, &ivb_stream);
199 if(FAILED(hres)) {
200 WARN("Could not open #IVB stream: %08lx\n", hres);
201 return NULL;
202 }
203
204 hres = IStream_Read(ivb_stream, &size, sizeof(size), &read);
205 if(FAILED(hres)) {
206 WARN("Read failed: %08lx\n", hres);
207 IStream_Release(ivb_stream);
208 return NULL;
209 }
210
211 buf = malloc(size);
212 hres = IStream_Read(ivb_stream, buf, size, &read);
213 IStream_Release(ivb_stream);
214 if(FAILED(hres)) {
215 WARN("Read failed: %08lx\n", hres);
216 free(buf);
217 return NULL;
218 }
219
220 size /= 2*sizeof(DWORD);
221
222 for(i=0; i<size; i++) {
223 if(buf[2*i] == index) {
224 ret = GetChmString(chm, buf[2*i+1]);
225 break;
226 }
227 }
228
229 free(buf);
230
231 TRACE("returning %s\n", debugstr_a(ret));
232 return strdupAtoW(ret);
233}
#define read
Definition: acwin.h:97
#define WARN(fmt,...)
Definition: precomp.h:61
static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
Definition: chm.c:35
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:61
return ret
Definition: mutex.c:147
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_a
Definition: kernel32.h:31
HRESULT hres
Definition: protocol.c:465
#define DWORD
Definition: nt_native.h:44
#define STGM_READ
Definition: objbase.h:936
#define TRACE(s)
Definition: solgame.cpp:4
IStorage * pStorage
Definition: hhctrl.h:99
const char * LPCSTR
Definition: typedefs.h:52

Referenced by HtmlHelpW().

◆ GetChmStream()

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

Definition at line 552 of file chm.c.

553{
557
558 TRACE("%s (%s :: %s)\n", debugstr_w(parent_chm), debugstr_w(chm_file->chm_file),
559 debugstr_w(chm_file->chm_index));
560
561 if(parent_chm || chm_file->chm_file) {
562 hres = IITStorage_StgOpenStorage(info->pITStorage,
563 chm_file->chm_file ? chm_file->chm_file : parent_chm, NULL,
565 if(FAILED(hres)) {
566 WARN("Could not open storage: %08lx\n", hres);
567 return NULL;
568 }
569 }else {
570 storage = info->pStorage;
571 IStorage_AddRef(info->pStorage);
572 }
573
574 hres = IStorage_OpenStream(storage, chm_file->chm_index, NULL, STGM_READ, 0, &stream);
575 IStorage_Release(storage);
576 if(FAILED(hres))
577 WARN("Could not open stream: %08lx\n", hres);
578
579 return stream;
580}
#define debugstr_w
Definition: kernel32.h:32
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:941
LPWSTR chm_file
Definition: hhctrl.h:54
LPWSTR chm_index
Definition: hhctrl.h:55
Definition: parse.h:23

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

◆ GetDocumentTitle()

WCHAR * GetDocumentTitle ( CHMInfo info,
LPCWSTR  document 
)

Definition at line 585 of file chm.c.

586{
587 strbuf_t node, node_name, content;
588 WCHAR *document_title = NULL;
589 IStream *str = NULL;
593
594 TRACE("%s\n", debugstr_w(document));
595
596 storage = info->pStorage;
597 if(!storage) {
598 WARN("Could not open storage to obtain the title for a document.\n");
599 return NULL;
600 }
601 IStorage_AddRef(storage);
602
603 hres = IStorage_OpenStream(storage, document, NULL, STGM_READ, 0, &str);
604 IStorage_Release(storage);
605 if(FAILED(hres))
606 WARN("Could not open stream: %08lx\n", hres);
607
611 strbuf_init(&node_name);
612
613 while(next_node(&stream, &node)) {
614 get_node_name(&node, &node_name);
615
616 TRACE("%s\n", node.buf);
617
618 if(!stricmp(node_name.buf, "title")) {
619 if(next_content(&stream, &content) && content.len > 1)
620 {
621 document_title = strdupnAtoW(&content.buf[1], content.len-1);
622 FIXME("magic: %s\n", debugstr_w(document_title));
623 break;
624 }
625 }
626
628 }
629
632 strbuf_free(&node_name);
633 IStream_Release(str);
634
635 return document_title;
636}
content
Definition: atl_ax.c:990
static void strbuf_init(strbuf *buf)
Definition: registrar.c:75
#define stricmp(_String1, _String2)
Definition: compat.h:24
void strbuf_free(strbuf_t *buf)
Definition: stream.c:38
BOOL next_node(stream_t *stream, strbuf_t *buf)
Definition: stream.c:140
BOOL next_content(stream_t *stream, strbuf_t *buf)
Definition: stream.c:105
void strbuf_zero(strbuf_t *buf)
Definition: stream.c:33
void stream_init(stream_t *stream, IStream *str)
Definition: stream.c:54
void get_node_name(strbuf_t *node, strbuf_t *name)
Definition: stream.c:88
static LPWSTR strdupnAtoW(LPCSTR str, LONG lenA)
Definition: hhctrl.h:250
const WCHAR * str
char * buf
Definition: stream.h:27
Definition: dlist.c:348

Referenced by OnTopicChange().

◆ InitContent()

void InitContent ( HHInfo info)

Definition at line 302 of file content.c.

303{
305 insert_type_t insert_type;
306
307 info->content = calloc(1, sizeof(ContentItem));
308 SetChmPath(&info->content->merge, info->pCHMInfo->szFile, info->WinType.pszToc);
309
310 stream = GetChmStream(info->pCHMInfo, info->pCHMInfo->szFile, &info->content->merge);
311 if(!stream) {
312 TRACE("Could not get content stream\n");
313 return;
314 }
315
316 info->content->child = parse_hhc(info, stream, info->content, &insert_type);
317 IStream_Release(stream);
318
319 set_item_parents(NULL, info->content);
320 fill_content_tree(info->tabs[TAB_CONTENTS].hwnd, NULL, info->content);
321}
void SetChmPath(ChmPath *file, LPCWSTR base_file, LPCWSTR path)
Definition: chm.c:516
IStream * GetChmStream(CHMInfo *info, LPCWSTR parent_chm, ChmPath *chm_file)
Definition: chm.c:552
#define TAB_CONTENTS
Definition: hhctrl.h:115
static ContentItem * parse_hhc(HHInfo *, IStream *, ContentItem *, insert_type_t *)
Definition: content.c:227
insert_type_t
Definition: content.c:28
static void set_item_parents(ContentItem *parent, ContentItem *item)
Definition: content.c:293
static void fill_content_tree(HWND hwnd, ContentItem *parent, ContentItem *item)
Definition: content.c:280

Referenced by CreateViewer().

◆ InitIndex()

void InitIndex ( HHInfo info)

Definition at line 265 of file index.c.

266{
268
269 info->index = calloc(1, sizeof(IndexItem));
270 info->index->nItems = 0;
271 SetChmPath(&info->index->merge, info->pCHMInfo->szFile, info->WinType.pszIndex);
272
273 stream = GetChmStream(info->pCHMInfo, info->pCHMInfo->szFile, &info->index->merge);
274 if(!stream) {
275 TRACE("Could not get index stream\n");
276 return;
277 }
278
280 IStream_Release(stream);
281
282 fill_index_tree(info->tabs[TAB_INDEX].hwnd, info->index->next);
283}
static void parse_hhindex(HHInfo *info, IStream *str, IndexItem *item)
Definition: index.c:215
static void fill_index_tree(HWND hwnd, IndexItem *item)
Definition: index.c:28
#define TAB_INDEX
Definition: hhctrl.h:116
unsigned int index
Definition: notification.c:74

Referenced by CreateViewer().

◆ InitSearch()

void InitSearch ( HHInfo info,
const char needle 
)

Definition at line 224 of file search.c.

225{
226 CHMInfo *chm = info->pCHMInfo;
227 SearchItem *root_item = alloc_search_item(NULL, NULL);
228
229 SearchCHM_Storage(root_item, chm->pStorage, needle);
230 fill_search_tree(info->search.hwndList, root_item->next);
231 if(info->search.root)
233 info->search.root = root_item;
234}
static void fill_search_tree(HWND hwndList, SearchItem *item)
Definition: search.c:47
static SearchItem * alloc_search_item(WCHAR *title, const WCHAR *filename)
Definition: search.c:30
static SearchItem * SearchCHM_Storage(SearchItem *item, IStorage *pStorage, const char *needle)
Definition: search.c:154
void ReleaseSearch(HHInfo *info)
Definition: search.c:237
Definition: hhctrl.h:97
struct SearchItem * next
Definition: hhctrl.h:89

Referenced by Child_WndProc().

◆ InitWebBrowser()

BOOL InitWebBrowser ( HHInfo info,
HWND  hwndParent 
)

Definition at line 670 of file webbrowser.c.

671{
673 IOleInPlaceObject *inplace;
674 HRESULT hr;
675 RECT rc;
676
677 container = calloc(1, sizeof(*container));
678 if (!container)
679 return FALSE;
680
681 container->IOleClientSite_iface.lpVtbl = &OleClientSiteVtbl;
682 container->IOleInPlaceSite_iface.lpVtbl = &OleInPlaceSiteVtbl;
683 container->IOleInPlaceFrame_iface.lpVtbl = &OleInPlaceFrameVtbl;
684 container->IDocHostUIHandler_iface.lpVtbl = &DocHostUIHandlerVtbl;
685 container->ref = 1;
686 container->hwndWindow = hwndParent;
687
688 info->web_browser = container;
689
690 hr = OleCreate(&CLSID_WebBrowser, &IID_IOleObject, OLERENDER_DRAW, 0,
691 &container->IOleClientSite_iface, &MyIStorage,
692 (void **)&container->ole_obj);
693
694 if (FAILED(hr)) goto error;
695
697
698 hr = OleSetContainedObject((struct IUnknown *)container->ole_obj, TRUE);
699 if (FAILED(hr)) goto error;
700
701 hr = IOleObject_DoVerb(container->ole_obj, OLEIVERB_SHOW, NULL,
702 &container->IOleClientSite_iface, -1, hwndParent, &rc);
703 if (FAILED(hr)) goto error;
704
705 hr = IOleObject_QueryInterface(container->ole_obj, &IID_IOleInPlaceObject, (void**)&inplace);
706 if (FAILED(hr)) goto error;
707
708 IOleInPlaceObject_SetObjectRects(inplace, &rc, &rc);
709 IOleInPlaceObject_Release(inplace);
710
711 hr = IOleObject_QueryInterface(container->ole_obj, &IID_IWebBrowser2, (void **)&container->web_browser);
712 if (SUCCEEDED(hr))
713 return TRUE;
714
715error:
717 return FALSE;
718}
static HWND hwndParent
Definition: cryptui.c:299
HRESULT hr
Definition: delayimp.cpp:582
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT WINAPI OleSetContainedObject(LPUNKNOWN pUnknown, BOOL fContained)
Definition: ole2.c:1149
HRESULT WINAPI OleCreate(REFCLSID rclsid, REFIID riid, DWORD renderopt, LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
Definition: ole2.c:2596
static const IOleClientSiteVtbl OleClientSiteVtbl
Definition: webbrowser.c:122
void ReleaseWebBrowser(HHInfo *info)
Definition: webbrowser.c:720
static const IOleInPlaceFrameVtbl OleInPlaceFrameVtbl
Definition: webbrowser.c:537
static const IOleInPlaceSiteVtbl OleInPlaceSiteVtbl
Definition: webbrowser.c:429
static IStorage MyIStorage
Definition: webbrowser.c:668
static const IDocHostUIHandlerVtbl DocHostUIHandlerVtbl
Definition: webbrowser.c:296
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define error(str)
Definition: mkdosfs.c:1605
#define OLEIVERB_SHOW
Definition: ole2.h:39
const GUID IID_IOleInPlaceObject
const GUID IID_IOleObject
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by HH_AddHTMLPane().

◆ LoadWinTypeFromCHM()

BOOL LoadWinTypeFromCHM ( HHInfo info)

Definition at line 357 of file chm.c.

358{
359 LARGE_INTEGER liOffset;
360 IStorage *pStorage = info->pCHMInfo->pStorage;
361 IStream *pStream = NULL;
362 HH_WINTYPEW wintype;
363 HRESULT hr;
364 DWORD cbRead;
365 BOOL ret = FALSE;
366
367 static const WCHAR empty[] = {0};
368 static const WCHAR toc_extW[] = {'h','h','c',0};
369 static const WCHAR index_extW[] = {'h','h','k',0};
370 static const WCHAR windowsW[] = {'#','W','I','N','D','O','W','S',0};
371
372 /* HH_WINTYPE as stored on disk. It's identical to HH_WINTYPE except that the pointer fields
373 have been changed to DWORDs, so that the layout on 64-bit remains unchanged. */
374 struct file_wintype
375 {
376 int cbStruct;
377 BOOL fUniCodeStrings;
378 DWORD pszType;
379 DWORD fsValidMembers;
380 DWORD fsWinProperties;
381 DWORD pszCaption;
382 DWORD dwStyles;
383 DWORD dwExStyles;
384 RECT rcWindowPos;
385 int nShowState;
386 DWORD hwndHelp;
387 DWORD hwndCaller;
388 DWORD paInfoTypes;
389 DWORD hwndToolBar;
390 DWORD hwndNavigation;
391 DWORD hwndHTML;
392 int iNavWidth;
393 RECT rcHTML;
394 DWORD pszToc;
395 DWORD pszIndex;
396 DWORD pszFile;
397 DWORD pszHome;
398 DWORD fsToolBarFlags;
399 BOOL fNotExpanded;
400 int curNavType;
401 int tabpos;
402 int idNotify;
403 BYTE tabOrder[HH_MAX_TABS+1];
404 int cHistory;
405 DWORD pszJump1;
406 DWORD pszJump2;
407 DWORD pszUrlJump1;
408 DWORD pszUrlJump2;
409 RECT rcMinSize;
410 int cbInfoTypes;
411 DWORD pszCustomTabs;
412 } file_wintype;
413
414 memset(&wintype, 0, sizeof(wintype));
415 wintype.cbStruct = sizeof(wintype);
416 wintype.fUniCodeStrings = TRUE;
417
418 hr = IStorage_OpenStream(pStorage, windowsW, NULL, STGM_READ, 0, &pStream);
419 if (SUCCEEDED(hr))
420 {
421 /* jump past the #WINDOWS header */
422 liOffset.QuadPart = sizeof(DWORD) * 2;
423
424 hr = IStream_Seek(pStream, liOffset, STREAM_SEEK_SET, NULL);
425 if (FAILED(hr)) goto done;
426
427 /* read the HH_WINTYPE struct data */
428 hr = IStream_Read(pStream, &file_wintype, sizeof(file_wintype), &cbRead);
429 if (FAILED(hr)) goto done;
430
431 /* convert the #STRINGS offsets to actual strings */
432 wintype.pszType = ConvertChmString(info, file_wintype.pszType);
433 wintype.fsValidMembers = file_wintype.fsValidMembers;
434 wintype.fsWinProperties = file_wintype.fsWinProperties;
435 wintype.pszCaption = ConvertChmString(info, file_wintype.pszCaption);
436 wintype.dwStyles = file_wintype.dwStyles;
437 wintype.dwExStyles = file_wintype.dwExStyles;
438 wintype.rcWindowPos = file_wintype.rcWindowPos;
439 wintype.nShowState = file_wintype.nShowState;
440 wintype.iNavWidth = file_wintype.iNavWidth;
441 wintype.rcHTML = file_wintype.rcHTML;
442 wintype.pszToc = ConvertChmString(info, file_wintype.pszToc);
443 wintype.pszIndex = ConvertChmString(info, file_wintype.pszIndex);
444 wintype.pszFile = ConvertChmString(info, file_wintype.pszFile);
445 wintype.pszHome = ConvertChmString(info, file_wintype.pszHome);
446 wintype.fsToolBarFlags = file_wintype.fsToolBarFlags;
447 wintype.fNotExpanded = file_wintype.fNotExpanded;
448 wintype.curNavType = file_wintype.curNavType;
449 wintype.tabpos = file_wintype.tabpos;
450 wintype.idNotify = file_wintype.idNotify;
451 memcpy(&wintype.tabOrder, file_wintype.tabOrder, sizeof(wintype.tabOrder));
452 wintype.cHistory = file_wintype.cHistory;
453 wintype.pszJump1 = ConvertChmString(info, file_wintype.pszJump1);
454 wintype.pszJump2 = ConvertChmString(info, file_wintype.pszJump2);
455 wintype.pszUrlJump1 = ConvertChmString(info, file_wintype.pszUrlJump1);
456 wintype.pszUrlJump2 = ConvertChmString(info, file_wintype.pszUrlJump2);
457 wintype.rcMinSize = file_wintype.rcMinSize;
458 wintype.cbInfoTypes = file_wintype.cbInfoTypes;
459 }
460 else
461 {
462 /* no defined window types so use (hopefully) sane defaults */
463 static const WCHAR defaultwinW[] = {'d','e','f','a','u','l','t','w','i','n','\0'};
464 wintype.pszType = wcsdup(info->pCHMInfo->defWindow ? info->pCHMInfo->defWindow : defaultwinW);
465 wintype.pszToc = wcsdup(info->pCHMInfo->defToc ? info->pCHMInfo->defToc : empty);
466 wintype.pszIndex = wcsdup(empty);
467 wintype.fsValidMembers = 0;
469 wintype.dwStyles = WS_POPUP;
470 wintype.dwExStyles = 0;
471 wintype.nShowState = SW_SHOW;
473 }
474
475 /* merge the new data with any pre-existing HH_WINTYPE structure */
476 MergeChmProperties(&wintype, info, FALSE);
477 if (!info->WinType.pszCaption)
478#ifdef __REACTOS__
479 info->WinType.pszCaption = info->stringsW.pszCaption = (info->pCHMInfo->defTitle ? wcsdup(info->pCHMInfo->defTitle) : HH_LoadString(IDS_DEFTITLE));
480#else
481 info->WinType.pszCaption = info->stringsW.pszCaption = wcsdup(info->pCHMInfo->defTitle ? info->pCHMInfo->defTitle : empty);
482#endif
483 if (!info->WinType.pszFile)
484 info->WinType.pszFile = info->stringsW.pszFile = wcsdup(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : empty);
485 if (!info->WinType.pszToc)
486 info->WinType.pszToc = info->stringsW.pszToc = FindHTMLHelpSetting(info, toc_extW);
487 if (!info->WinType.pszIndex)
488 info->WinType.pszIndex = info->stringsW.pszIndex = FindHTMLHelpSetting(info, index_extW);
489
490 wintype_free(&wintype);
491 ret = TRUE;
492
493done:
494 if (pStream)
495 IStream_Release(pStream);
496
497 return ret;
498}
static void wintype_free(HH_WINTYPEW *wintype)
Definition: chm.c:336
static WCHAR * ConvertChmString(HHInfo *info, DWORD id)
Definition: chm.c:327
static WCHAR * FindHTMLHelpSetting(HHInfo *info, const WCHAR *extW)
Definition: chm.c:239
void MergeChmProperties(HH_WINTYPEW *src, HHInfo *info, BOOL override)
Definition: chm.c:269
static const WCHAR empty[1]
Definition: string.c:47
static LPWSTR HH_LoadString(DWORD dwID)
Definition: help.c:177
static wchar_t * wcsdup(const wchar_t *str)
Definition: string.h:94
unsigned int BOOL
Definition: ntddk_ex.h:94
#define HH_MAX_TABS
Definition: htmlhelp.h:260
@ HHWIN_NAVTYPE_TOC
Definition: htmlhelp.h:217
#define HHWIN_PROP_TRI_PANE
Definition: htmlhelp.h:60
#define WS_POPUP
Definition: pedump.c:616
#define memset(x, y, z)
Definition: compat.h:39
LPCWSTR pszIndex
Definition: htmlhelp.h:359
BYTE tabOrder[HH_MAX_TABS+1]
Definition: htmlhelp.h:367
LPCWSTR pszJump1
Definition: htmlhelp.h:369
LPCWSTR pszHome
Definition: htmlhelp.h:361
DWORD dwStyles
Definition: htmlhelp.h:346
RECT rcWindowPos
Definition: htmlhelp.h:348
DWORD dwExStyles
Definition: htmlhelp.h:347
LPCWSTR pszToc
Definition: htmlhelp.h:358
DWORD fsToolBarFlags
Definition: htmlhelp.h:362
LPCWSTR pszJump2
Definition: htmlhelp.h:370
DWORD fsValidMembers
Definition: htmlhelp.h:343
LPCWSTR pszType
Definition: htmlhelp.h:342
LPCWSTR pszUrlJump2
Definition: htmlhelp.h:372
LPCWSTR pszFile
Definition: htmlhelp.h:360
LPCWSTR pszCaption
Definition: htmlhelp.h:345
DWORD fsWinProperties
Definition: htmlhelp.h:344
BOOL fUniCodeStrings
Definition: htmlhelp.h:341
BOOL fNotExpanded
Definition: htmlhelp.h:363
LPCWSTR pszUrlJump1
Definition: htmlhelp.h:371
RECT rcMinSize
Definition: htmlhelp.h:373
LONGLONG QuadPart
Definition: typedefs.h:114
#define SW_SHOW
Definition: winuser.h:786
unsigned char BYTE
Definition: xxhash.c:193

Referenced by CreateHelpViewer().

◆ MergeChmProperties()

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

Definition at line 269 of file chm.c.

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

Referenced by HtmlHelpW(), and LoadWinTypeFromCHM().

◆ NavigateToChm()

BOOL NavigateToChm ( HHInfo info,
LPCWSTR  file,
LPCWSTR  index 
)

Definition at line 257 of file help.c.

258{
260
261 TRACE("%p %s %s\n", info, debugstr_w(file), debugstr_w(index));
262
263 if ((!info->web_browser) || !AppendFullPathURL(file, buf, index))
264 return FALSE;
265
266 return SUCCEEDED(navigate_url(info, buf));
267}
static BOOL AppendFullPathURL(LPCWSTR file, LPWSTR buf, LPCWSTR index)
Definition: help.c:238
static HRESULT navigate_url(HHInfo *info, LPCWSTR surl)
Definition: help.c:193
Definition: fci.c:123
#define INTERNET_MAX_URL_LENGTH
Definition: wininet.h:51

Referenced by HtmlHelpW(), NavigateToUrl(), OnTopicChange(), PopupChild_WndProc(), and TB_OnClick().

◆ NavigateToUrl()

BOOL NavigateToUrl ( HHInfo info,
LPCWSTR  surl 
)

Definition at line 213 of file help.c.

214{
215 ChmPath chm_path;
216 BOOL ret;
218
219 static const WCHAR url_indicator[] = {':', '/', '/', 0};
220
221 TRACE("%s\n", debugstr_w(surl));
222
223 if (wcsstr(surl, url_indicator)) {
224 hres = navigate_url(info, surl);
225 if(SUCCEEDED(hres))
226 return TRUE;
227 } /* look up in chm if it doesn't look like a full url */
228
229 SetChmPath(&chm_path, info->pCHMInfo->szFile, surl);
230 ret = NavigateToChm(info, chm_path.chm_file, chm_path.chm_index);
231
232 free(chm_path.chm_file);
233 free(chm_path.chm_index);
234
235 return ret;
236}
BOOL NavigateToChm(HHInfo *info, LPCWSTR file, LPCWSTR index)
Definition: help.c:257
_ACRTIMP wchar_t *__cdecl wcsstr(const wchar_t *, const wchar_t *)
Definition: wcs.c:2998
Definition: hhctrl.h:53

Referenced by HtmlHelpW().

◆ OpenCHM()

CHMInfo * OpenCHM ( LPCWSTR  szFile)

Definition at line 639 of file chm.c.

640{
642 CHMInfo *ret;
643
644 static const WCHAR wszSTRINGS[] = {'#','S','T','R','I','N','G','S',0};
645
646 if (!(ret = calloc(1, sizeof(CHMInfo))))
647 return NULL;
648 ret->codePage = CP_ACP;
649
650 if (!(ret->szFile = wcsdup(szFile))) {
651 free(ret);
652 return NULL;
653 }
654
655 hres = CoCreateInstance(&CLSID_ITStorage, NULL, CLSCTX_INPROC_SERVER,
656 &IID_IITStorage, (void **) &ret->pITStorage) ;
657 if(FAILED(hres)) {
658 WARN("Could not create ITStorage: %08lx\n", hres);
659 return CloseCHM(ret);
660 }
661
662 hres = IITStorage_StgOpenStorage(ret->pITStorage, szFile, NULL,
663 STGM_READ | STGM_SHARE_DENY_WRITE, NULL, 0, &ret->pStorage);
664 if(FAILED(hres)) {
665 WARN("Could not open storage: %08lx\n", hres);
666 return CloseCHM(ret);
667 }
668 hres = IStorage_OpenStream(ret->pStorage, wszSTRINGS, NULL, STGM_READ, 0,
669 &ret->strings_stream);
670 if(FAILED(hres)) {
671 WARN("Could not open #STRINGS stream: %08lx\n", hres);
672 /* It's not critical, so we pass */
673 }
674
675 if(!ReadChmSystem(ret)) {
676 WARN("Could not read #SYSTEM\n");
677 return CloseCHM(ret);
678 }
679
680 return ret;
681}
CHMInfo * CloseCHM(CHMInfo *chm)
Definition: chm.c:683
static BOOL ReadChmSystem(CHMInfo *chm)
Definition: chm.c:84
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
#define CP_ACP
Definition: compat.h:109

Referenced by CreateHelpViewer().

◆ ReleaseContent()

void ReleaseContent ( HHInfo info)

Definition at line 323 of file content.c.

324{
325 free_content_item(info->content);
326}
static void free_content_item(ContentItem *item)
Definition: content.c:33

Referenced by ReleaseHelpViewer().

◆ ReleaseHelpViewer()

void ReleaseHelpViewer ( HHInfo info)

Definition at line 1802 of file help.c.

1803{
1804 TRACE("(%p)\n", info);
1805
1806 if (!info)
1807 return;
1808
1809 list_remove(&info->entry);
1810
1811 wintype_stringsA_free(&info->stringsA);
1812 wintype_stringsW_free(&info->stringsW);
1813
1814 if (info->pCHMInfo)
1815 CloseCHM(info->pCHMInfo);
1816
1821
1822 if(info->contents.hImageList)
1823 ImageList_Destroy(info->contents.hImageList);
1824 if(info->WinType.hwndHelp)
1825 DestroyWindow(info->WinType.hwndHelp);
1826
1827 free(info);
1829}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:941
void wintype_stringsW_free(struct wintype_stringsW *stringsW)
Definition: help.c:1773
void wintype_stringsA_free(struct wintype_stringsA *stringsA)
Definition: help.c:1787
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:218
void ReleaseWebBrowser(HHInfo *)
Definition: webbrowser.c:720
void ReleaseIndex(HHInfo *)
Definition: index.c:288
void ReleaseSearch(HHInfo *info)
Definition: search.c:237
void ReleaseContent(HHInfo *info)
Definition: content.c:323
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by CreateHelpViewer(), Help_WndProc(), and HtmlHelpW().

◆ ReleaseIndex()

void ReleaseIndex ( HHInfo info)

Definition at line 288 of file index.c.

289{
291 int i;
292
293 if(!item) return;
294 /* Note: item->merge is identical for all items, only free once */
295 free(item->merge.chm_file);
296 free(item->merge.chm_index);
297 while(item) {
298 next = item->next;
299
300 free(item->keyword);
301 for(i=0;i<item->nItems;i++) {
302 free(item->items[i].name);
303 free(item->items[i].local);
304 }
305 free(item->items);
306
307 item = next;
308 }
309}
static unsigned __int64 next
Definition: rand_nt.c:6

Referenced by ReleaseHelpViewer().

◆ ReleaseSearch()

void ReleaseSearch ( HHInfo info)

Definition at line 237 of file search.c.

238{
239 SearchItem *item = info->search.root;
240
241 info->search.root = NULL;
242 while(item) {
243 free(item->filename);
244 item = item->next;
245 }
246}

Referenced by InitSearch(), and ReleaseHelpViewer().

◆ ReleaseWebBrowser()

void ReleaseWebBrowser ( HHInfo info)

Definition at line 720 of file webbrowser.c.

721{
722 WebBrowserContainer *container = info->web_browser;
724
725 if(!container)
726 return;
727
728 if(container->ole_obj) {
729 IOleInPlaceSite *inplace;
730
731 hres = IOleObject_QueryInterface(container->ole_obj, &IID_IOleInPlaceSite, (void**)&inplace);
732 if(SUCCEEDED(hres)) {
733 IOleInPlaceSite_OnInPlaceDeactivate(inplace);
734 IOleInPlaceSite_Release(inplace);
735 }
736
737 IOleObject_SetClientSite(container->ole_obj, NULL);
738 }
739
740 info->web_browser = NULL;
741 IOleClientSite_Release(&container->IOleClientSite_iface);
742}
const GUID IID_IOleInPlaceSite

Referenced by InitWebBrowser(), and ReleaseHelpViewer().

◆ ResizeWebBrowser()

void ResizeWebBrowser ( HHInfo info,
DWORD  dwWidth,
DWORD  dwHeight 
)

Definition at line 744 of file webbrowser.c.

745{
746 if (!info->web_browser)
747 return;
748
749 IWebBrowser2_put_Width(info->web_browser->web_browser, dwWidth);
750 IWebBrowser2_put_Height(info->web_browser->web_browser, dwHeight);
751}
static const WCHAR dwWidth[]
Definition: provider.c:62
static const WCHAR dwHeight[]
Definition: provider.c:63

Referenced by Help_OnSize().

◆ SetChmPath()

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

Definition at line 516 of file chm.c.

517{
518 LPCWSTR ptr;
519 static const WCHAR separatorW[] = {':',':',0};
520
522
524 if(ptr) {
525 WCHAR chm_file[MAX_PATH];
526 WCHAR rel_path[MAX_PATH];
527 WCHAR base_path[MAX_PATH];
528 LPWSTR p;
529
530 lstrcpyW(base_path, base_file);
531 p = wcsrchr(base_path, '\\');
532 if(p)
533 *p = 0;
534
535 memcpy(rel_path, path, (ptr-path)*sizeof(WCHAR));
536 rel_path[ptr-path] = 0;
537
538 PathCombineW(chm_file, base_path, rel_path);
539
540 file->chm_file = wcsdup(chm_file);
541 ptr += 2;
542 }else {
543 file->chm_file = wcsdup(base_file);
544 ptr = path;
545 }
546
547 file->chm_index = wcsdup(ptr);
548
549 TRACE("ChmFile = {%s %s}\n", debugstr_w(file->chm_file), debugstr_w(file->chm_index));
550}
LPCWSTR skip_schema(LPCWSTR url)
Definition: chm.c:500
#define wcsrchr
Definition: compat.h:16
#define MAX_PATH
Definition: compat.h:34
#define lstrcpyW
Definition: compat.h:749
GLfloat GLfloat p
Definition: glext.h:8902
static PVOID ptr
Definition: dispmode.c:27
static const WCHAR separatorW[]
Definition: itemdlg.c:1561
#define PathCombineW
Definition: pathcch.h:318
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint16_t * LPWSTR
Definition: typedefs.h:56

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

◆ skip_schema()

LPCWSTR skip_schema ( LPCWSTR  url)

Definition at line 500 of file chm.c.

501{
502 static const WCHAR its_schema[] = {'i','t','s',':'};
503 static const WCHAR msits_schema[] = {'m','s','-','i','t','s',':'};
504 static const WCHAR mk_schema[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':'};
505
506 if(!wcsnicmp(its_schema, url, ARRAY_SIZE(its_schema)))
507 return url + ARRAY_SIZE(its_schema);
508 if(!wcsnicmp(msits_schema, url, ARRAY_SIZE(msits_schema)))
509 return url + ARRAY_SIZE(msits_schema);
510 if(!wcsnicmp(mk_schema, url, ARRAY_SIZE(mk_schema)))
511 return url + ARRAY_SIZE(mk_schema);
512
513 return url;
514}
#define wcsnicmp
Definition: compat.h:14
static const WCHAR url[]
Definition: encode.c:1384

Referenced by resolve_filename(), and SetChmPath().

◆ strdupAtoW()

static LPWSTR strdupAtoW ( LPCSTR  str)
inlinestatic

Definition at line 273 of file hhctrl.h.

274{
275 return strdupnAtoW(str, -1);
276}

◆ strdupnAtoW()

static LPWSTR strdupnAtoW ( LPCSTR  str,
LONG  lenA 
)
inlinestatic

Definition at line 250 of file hhctrl.h.

251{
252 LPWSTR ret;
253 DWORD len;
254
255 if(!str)
256 return NULL;
257
258 if (lenA > 0)
259 {
260 /* find length of string */
261 LPCSTR eos = memchr(str, 0, lenA);
262 if (eos) lenA = eos - str;
263 }
264
265 len = MultiByteToWideChar(CP_ACP, 0, str, lenA, NULL, 0)+1; /* +1 for null pad */
266 ret = malloc(len * sizeof(WCHAR));
267 MultiByteToWideChar(CP_ACP, 0, str, lenA, ret, len);
268 ret[len-1] = 0;
269
270 return ret;
271}

Referenced by GetDocumentTitle(), ReadChmSystem(), and strdupAtoW().

◆ strdupWtoA()

static LPSTR strdupWtoA ( LPCWSTR  str)
inlinestatic

Definition at line 278 of file hhctrl.h.

279{
280 LPSTR ret;
281 DWORD len;
282
283 if(!str)
284 return NULL;
285
286 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
287 ret = malloc(len);
289 return ret;
290}
#define WideCharToMultiByte
Definition: compat.h:111
char * LPSTR
Definition: typedefs.h:51

◆ UpdateHelpWindow()

void UpdateHelpWindow ( HHInfo info)

Definition at line 1563 of file help.c.

1564{
1565 if (!info->WinType.hwndHelp)
1566 return;
1567
1568 WARN("Only the size of the window is currently updated.\n");
1569 if (info->WinType.fsValidMembers & HHWIN_PARAM_RECT)
1570 {
1571 RECT *rect = &info->WinType.rcWindowPos;
1572 INT x, y, width, height;
1573
1574 x = rect->left;
1575 y = rect->top;
1576 width = rect->right - x;
1577 height = rect->bottom - y;
1578 SetWindowPos(info->WinType.hwndHelp, NULL, rect->left, rect->top, width, height,
1580 }
1581}
RECT rect
Definition: combotst.c:67
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
int32_t INT
Definition: typedefs.h:58
#define SWP_NOACTIVATE
Definition: winuser.h:1253
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOZORDER
Definition: winuser.h:1258

Referenced by HtmlHelpW().

◆ wintype_stringsA_free()

void wintype_stringsA_free ( struct wintype_stringsA stringsA)

Definition at line 1787 of file help.c.

1788{
1789 free(stringsA->pszType);
1790 free(stringsA->pszCaption);
1791 free(stringsA->pszToc);
1792 free(stringsA->pszIndex);
1793 free(stringsA->pszFile);
1794 free(stringsA->pszHome);
1795 free(stringsA->pszJump1);
1796 free(stringsA->pszJump2);
1797 free(stringsA->pszUrlJump1);
1798 free(stringsA->pszUrlJump2);
1799 free(stringsA->pszCustomTabs);
1800}
char * pszToc
Definition: hhctrl.h:160
char * pszCustomTabs
Definition: hhctrl.h:168
char * pszHome
Definition: hhctrl.h:163
char * pszType
Definition: hhctrl.h:158
char * pszUrlJump2
Definition: hhctrl.h:167
char * pszIndex
Definition: hhctrl.h:161
char * pszJump1
Definition: hhctrl.h:164
char * pszUrlJump1
Definition: hhctrl.h:166
char * pszJump2
Definition: hhctrl.h:165
char * pszCaption
Definition: hhctrl.h:159
char * pszFile
Definition: hhctrl.h:162

Referenced by HtmlHelpA(), and ReleaseHelpViewer().

◆ wintype_stringsW_free()

void wintype_stringsW_free ( struct wintype_stringsW stringsW)

Definition at line 1773 of file help.c.

1774{
1775 free(stringsW->pszType);
1776 free(stringsW->pszCaption);
1777 free(stringsW->pszToc);
1778 free(stringsW->pszIndex);
1779 free(stringsW->pszFile);
1780 free(stringsW->pszHome);
1781 free(stringsW->pszJump1);
1782 free(stringsW->pszJump2);
1783 free(stringsW->pszUrlJump1);
1784 free(stringsW->pszUrlJump2);
1785}
WCHAR * pszUrlJump1
Definition: hhctrl.h:152
WCHAR * pszUrlJump2
Definition: hhctrl.h:153
WCHAR * pszJump1
Definition: hhctrl.h:150
WCHAR * pszHome
Definition: hhctrl.h:149
WCHAR * pszToc
Definition: hhctrl.h:146
WCHAR * pszCaption
Definition: hhctrl.h:145
WCHAR * pszFile
Definition: hhctrl.h:148
WCHAR * pszJump2
Definition: hhctrl.h:151
WCHAR * pszType
Definition: hhctrl.h:144
WCHAR * pszIndex
Definition: hhctrl.h:147

Referenced by HtmlHelpA(), and ReleaseHelpViewer().

Variable Documentation

◆ hh_process

BOOL hh_process
extern

Definition at line 42 of file hhctrl.c.

Referenced by doWinMain(), and Help_WndProc().

◆ hhctrl_hinstance

◆ window_list

struct list window_list
extern

Definition at line 51 of file help.c.

Referenced by CreateHelpViewer(), find_window(), and HtmlHelpW().