ReactOS 0.4.15-dev-7924-g5949c20
hhctrl.h File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wine/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/heap.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) DECLSPEC_HIDDEN
 
void ReleaseWebBrowser (HHInfo *) DECLSPEC_HIDDEN
 
void ResizeWebBrowser (HHInfo *, DWORD, DWORD) DECLSPEC_HIDDEN
 
void DoPageAction (WebBrowserContainer *, DWORD) DECLSPEC_HIDDEN
 
void InitContent (HHInfo *) DECLSPEC_HIDDEN
 
void ReleaseContent (HHInfo *) DECLSPEC_HIDDEN
 
void ActivateContentTopic (HWND, LPCWSTR, ContentItem *) DECLSPEC_HIDDEN
 
void InitIndex (HHInfo *) DECLSPEC_HIDDEN
 
void ReleaseIndex (HHInfo *) DECLSPEC_HIDDEN
 
CHMInfoOpenCHM (LPCWSTR szFile) DECLSPEC_HIDDEN
 
BOOL LoadWinTypeFromCHM (HHInfo *info) DECLSPEC_HIDDEN
 
CHMInfoCloseCHM (CHMInfo *pCHMInfo) DECLSPEC_HIDDEN
 
void SetChmPath (ChmPath *, LPCWSTR, LPCWSTR) DECLSPEC_HIDDEN
 
IStreamGetChmStream (CHMInfo *, LPCWSTR, ChmPath *) DECLSPEC_HIDDEN
 
LPWSTR FindContextAlias (CHMInfo *, DWORD) DECLSPEC_HIDDEN
 
WCHARGetDocumentTitle (CHMInfo *, LPCWSTR) DECLSPEC_HIDDEN
 
HHInfoCreateHelpViewer (HHInfo *, LPCWSTR, HWND) DECLSPEC_HIDDEN
 
void ReleaseHelpViewer (HHInfo *) DECLSPEC_HIDDEN
 
BOOL NavigateToUrl (HHInfo *, LPCWSTR) DECLSPEC_HIDDEN
 
BOOL NavigateToChm (HHInfo *, LPCWSTR, LPCWSTR) DECLSPEC_HIDDEN
 
void MergeChmProperties (HH_WINTYPEW *, HHInfo *, BOOL) DECLSPEC_HIDDEN
 
void UpdateHelpWindow (HHInfo *info) DECLSPEC_HIDDEN
 
void InitSearch (HHInfo *info, const char *needle) DECLSPEC_HIDDEN
 
void ReleaseSearch (HHInfo *info) DECLSPEC_HIDDEN
 
LPCWSTR skip_schema (LPCWSTR url) DECLSPEC_HIDDEN
 
void wintype_stringsA_free (struct wintype_stringsA *stringsA) DECLSPEC_HIDDEN
 
void wintype_stringsW_free (struct wintype_stringsW *stringsW) DECLSPEC_HIDDEN
 
WCHARdecode_html (const char *html_fragment, int html_fragment_len, UINT code_page) DECLSPEC_HIDDEN
 
HHInfofind_window (const WCHAR *window) DECLSPEC_HIDDEN
 
static void__WINE_ALLOC_SIZE (2) heap_realloc_zero(void *mem
 
static LPWSTR strdupW (LPCWSTR str)
 
static LPWSTR strdupnAtoW (LPCSTR str, LONG lenA)
 
static LPWSTR strdupAtoW (LPCSTR str)
 
static LPSTR strdupWtoA (LPCWSTR str)
 

Variables

struct list window_list DECLSPEC_HIDDEN
 
static void size_t len
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file hhctrl.h.

◆ TAB_CONTENTS

#define TAB_CONTENTS   0

Definition at line 116 of file hhctrl.h.

◆ TAB_FAVORITES

#define TAB_FAVORITES   3

Definition at line 119 of file hhctrl.h.

◆ TAB_INDEX

#define TAB_INDEX   1

Definition at line 117 of file hhctrl.h.

◆ TAB_NUMTABS

#define TAB_NUMTABS   TAB_FAVORITES

Definition at line 120 of file hhctrl.h.

◆ TAB_SEARCH

#define TAB_SEARCH   2

Definition at line 118 of file hhctrl.h.

◆ WB_GOBACK

#define WB_GOBACK   0

Definition at line 46 of file hhctrl.h.

◆ WB_GOFORWARD

#define WB_GOFORWARD   1

Definition at line 47 of file hhctrl.h.

◆ WB_GOHOME

#define WB_GOHOME   2

Definition at line 48 of file hhctrl.h.

◆ WB_PRINT

#define WB_PRINT   6

Definition at line 52 of file hhctrl.h.

◆ WB_REFRESH

#define WB_REFRESH   4

Definition at line 50 of file hhctrl.h.

◆ WB_SEARCH

#define WB_SEARCH   3

Definition at line 49 of file hhctrl.h.

◆ WB_STOP

#define WB_STOP   5

Definition at line 51 of file hhctrl.h.

Typedef Documentation

◆ CHMInfo

◆ ContentItem

◆ IndexItem

◆ IndexSubItem

◆ SearchItem

Function Documentation

◆ __WINE_ALLOC_SIZE()

static void * __WINE_ALLOC_SIZE ( )
inlinestatic

◆ ActivateContentTopic()

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

Definition at line 330 of file content.c.

331{
332 if (lstrcmpiW(item->local, filename) == 0)
333 {
335 return;
336 }
337
338 if (item->next)
340
341 if (item->child)
343}
HWND hWnd
Definition: settings.c:17
const char * filename
Definition: ioapi.h:137
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
static ATOM item
Definition: dde.c:856
#define TVM_SELECTITEM
Definition: commctrl.h:3478
#define TVGN_CARET
Definition: commctrl.h:3461
void ActivateContentTopic(HWND hWnd, LPCWSTR filename, ContentItem *item)
Definition: content.c:330
LONG_PTR LPARAM
Definition: windef.h:208
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ActivateContentTopic(), and DoSync().

◆ CloseCHM()

CHMInfo * CloseCHM ( CHMInfo pCHMInfo)

Definition at line 670 of file chm.c.

671{
672 if(chm->pITStorage)
673 IITStorage_Release(chm->pITStorage);
674
675 if(chm->pStorage)
676 IStorage_Release(chm->pStorage);
677
678 if(chm->strings_stream)
679 IStream_Release(chm->strings_stream);
680
681 if(chm->strings_size) {
682 DWORD i;
683
684 for(i=0; i<chm->strings_size; i++)
685 heap_free(chm->strings[i]);
686 }
687
688 heap_free(chm->strings);
689 heap_free(chm->defWindow);
690 heap_free(chm->defTitle);
691 heap_free(chm->defTopic);
692 heap_free(chm->defToc);
693 heap_free(chm->szFile);
694 heap_free(chm->compiledFile);
695 heap_free(chm);
696
697 return NULL;
698}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#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 = heap_alloc_zero(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:33
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
CHMInfo * OpenCHM(LPCWSTR szFile)
Definition: chm.c:626
BOOL LoadWinTypeFromCHM(HHInfo *info)
Definition: chm.c:344
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:169
Definition: hhctrl.h:185
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 = heap_alloc(html_fragment_len+1);
1910 while(1)
1911 {
1912 symbol = 0;
1913 amp = strchr(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 = strchr(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 = heap_alloc(len*sizeof(WCHAR));
1961 MultiByteToWideChar(code_page, 0, tmp, tmp_len, unicode_text, len);
1962 heap_free(tmp);
1963 return unicode_text;
1964}
char * strchr(const char *String, int ch)
Definition: utclib.c:501
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define FIXME(fmt,...)
Definition: debug.h:111
#define MultiByteToWideChar
Definition: compat.h:110
static char find_html_symbol(const char *entity, int entity_len)
Definition: help.c:1880
unsigned char
Definition: typeof.h:29
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HANDLE sem
Definition: sync.c:674
__wchar_t WCHAR
Definition: xmlstorage.h:180

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:51
#define WB_GOFORWARD
Definition: hhctrl.h:47
#define WB_GOHOME
Definition: hhctrl.h:48
#define WB_SEARCH
Definition: hhctrl.h:49
#define WB_GOBACK
Definition: hhctrl.h:46
#define WB_PRINT
Definition: hhctrl.h:52
#define WB_REFRESH
Definition: hhctrl.h:50

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}
uint32_t entry
Definition: isohybrid.c:63
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
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 175 of file chm.c.

176{
177 IStream *ivb_stream;
178 DWORD size, read, i;
179 DWORD *buf;
180 LPCSTR ret = NULL;
182
183 static const WCHAR wszIVB[] = {'#','I','V','B',0};
184
185 hres = IStorage_OpenStream(chm->pStorage, wszIVB, NULL, STGM_READ, 0, &ivb_stream);
186 if(FAILED(hres)) {
187 WARN("Could not open #IVB stream: %08x\n", hres);
188 return NULL;
189 }
190
191 hres = IStream_Read(ivb_stream, &size, sizeof(size), &read);
192 if(FAILED(hres)) {
193 WARN("Read failed: %08x\n", hres);
194 IStream_Release(ivb_stream);
195 return NULL;
196 }
197
199 hres = IStream_Read(ivb_stream, buf, size, &read);
200 IStream_Release(ivb_stream);
201 if(FAILED(hres)) {
202 WARN("Read failed: %08x\n", hres);
203 heap_free(buf);
204 return NULL;
205 }
206
207 size /= 2*sizeof(DWORD);
208
209 for(i=0; i<size; i++) {
210 if(buf[2*i] == index) {
211 ret = GetChmString(chm, buf[2*i+1]);
212 break;
213 }
214 }
215
216 heap_free(buf);
217
218 TRACE("returning %s\n", debugstr_a(ret));
219 return strdupAtoW(ret);
220}
#define read
Definition: acwin.h:96
#define WARN(fmt,...)
Definition: debug.h:112
static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
Definition: chm.c:35
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65
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:917
#define TRACE(s)
Definition: solgame.cpp:4
IStorage * pStorage
Definition: hhctrl.h:100
int ret
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by HtmlHelpW().

◆ GetChmStream()

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

Definition at line 539 of file chm.c.

540{
541 IStorage *storage;
544
545 TRACE("%s (%s :: %s)\n", debugstr_w(parent_chm), debugstr_w(chm_file->chm_file),
546 debugstr_w(chm_file->chm_index));
547
548 if(parent_chm || chm_file->chm_file) {
549 hres = IITStorage_StgOpenStorage(info->pITStorage,
550 chm_file->chm_file ? chm_file->chm_file : parent_chm, NULL,
551 STGM_READ | STGM_SHARE_DENY_WRITE, NULL, 0, &storage);
552 if(FAILED(hres)) {
553 WARN("Could not open storage: %08x\n", hres);
554 return NULL;
555 }
556 }else {
557 storage = info->pStorage;
558 IStorage_AddRef(info->pStorage);
559 }
560
561 hres = IStorage_OpenStream(storage, chm_file->chm_index, NULL, STGM_READ, 0, &stream);
562 IStorage_Release(storage);
563 if(FAILED(hres))
564 WARN("Could not open stream: %08x\n", hres);
565
566 return stream;
567}
#define debugstr_w
Definition: kernel32.h:32
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:922
LPWSTR chm_file
Definition: hhctrl.h:55
LPWSTR chm_index
Definition: hhctrl.h:56
Definition: parse.h:23

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

◆ GetDocumentTitle()

WCHAR * GetDocumentTitle ( CHMInfo info,
LPCWSTR  document 
)

Definition at line 572 of file chm.c.

573{
574 strbuf_t node, node_name, content;
575 WCHAR *document_title = NULL;
576 IStream *str = NULL;
577 IStorage *storage;
580
581 TRACE("%s\n", debugstr_w(document));
582
583 storage = info->pStorage;
584 if(!storage) {
585 WARN("Could not open storage to obtain the title for a document.\n");
586 return NULL;
587 }
588 IStorage_AddRef(storage);
589
590 hres = IStorage_OpenStream(storage, document, NULL, STGM_READ, 0, &str);
591 IStorage_Release(storage);
592 if(FAILED(hres))
593 WARN("Could not open stream: %08x\n", hres);
594
598 strbuf_init(&node_name);
599
600 while(next_node(&stream, &node)) {
601 get_node_name(&node, &node_name);
602
603 TRACE("%s\n", node.buf);
604
605 if(!_strnicmp(node_name.buf, "title", -1)) {
606 if(next_content(&stream, &content) && content.len > 1)
607 {
608 document_title = strdupnAtoW(&content.buf[1], content.len-1);
609 FIXME("magic: %s\n", debugstr_w(document_title));
610 break;
611 }
612 }
613
615 }
616
619 strbuf_free(&node_name);
620 IStream_Release(str);
621
622 return document_title;
623}
content
Definition: atl_ax.c:994
static void strbuf_init(strbuf *buf)
Definition: registrar.c:82
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
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:271
const WCHAR * str
char * buf
Definition: stream.h:27
Definition: dlist.c:348

Referenced by OnTopicChange().

◆ InitContent()

void InitContent ( HHInfo info)

Definition at line 304 of file content.c.

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

Referenced by CreateViewer().

◆ InitIndex()

void InitIndex ( HHInfo info)

Definition at line 265 of file index.c.

266{
268
269 info->index = heap_alloc_zero(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:117
unsigned int index
Definition: notification.c:65

Referenced by CreateViewer().

◆ InitSearch()

void InitSearch ( HHInfo info,
const char needle 
)

Definition at line 222 of file search.c.

223{
224 CHMInfo *chm = info->pCHMInfo;
225 SearchItem *root_item = alloc_search_item(NULL, NULL);
226
227 SearchCHM_Storage(root_item, chm->pStorage, needle);
228 fill_search_tree(info->search.hwndList, root_item->next);
229 if(info->search.root)
231 info->search.root = root_item;
232}
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:152
void ReleaseSearch(HHInfo *info)
Definition: search.c:235
Definition: hhctrl.h:98
struct SearchItem * next
Definition: hhctrl.h:90

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 = heap_alloc_zero(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:300
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT WINAPI OleSetContainedObject(LPUNKNOWN pUnknown, BOOL fContained)
Definition: ole2.c:1168
HRESULT WINAPI OleCreate(REFCLSID rclsid, REFIID riid, DWORD renderopt, LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
Definition: ole2.c:2609
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
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by HH_AddHTMLPane().

◆ LoadWinTypeFromCHM()

BOOL LoadWinTypeFromCHM ( HHInfo info)

Definition at line 344 of file chm.c.

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

Referenced by CreateHelpViewer().

◆ MergeChmProperties()

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

Definition at line 256 of file chm.c.

257{
258 DWORD unhandled_params = src->fsValidMembers & ~(HHWIN_PARAM_PROPERTIES|HHWIN_PARAM_STYLES
263 HH_WINTYPEW *dst = &info->WinType;
264 DWORD merge = override ? src->fsValidMembers : src->fsValidMembers & ~dst->fsValidMembers;
265
266 if (unhandled_params)
267 FIXME("Unsupported fsValidMembers fields: 0x%x\n", unhandled_params);
268
269 dst->fsValidMembers |= merge;
270 if (dst->cbStruct == 0)
271 {
272 /* If the structure has not been filled in yet then use all of the values */
273 dst->cbStruct = sizeof(HH_WINTYPEW);
274 merge = ~0;
275 }
276 if (merge & HHWIN_PARAM_PROPERTIES) dst->fsWinProperties = src->fsWinProperties;
277 if (merge & HHWIN_PARAM_STYLES) dst->dwStyles = src->dwStyles;
278 if (merge & HHWIN_PARAM_EXSTYLES) dst->dwExStyles = src->dwExStyles;
279 if (merge & HHWIN_PARAM_RECT) dst->rcWindowPos = src->rcWindowPos;
280 if (merge & HHWIN_PARAM_NAV_WIDTH) dst->iNavWidth = src->iNavWidth;
281 if (merge & HHWIN_PARAM_SHOWSTATE) dst->nShowState = src->nShowState;
282 if (merge & HHWIN_PARAM_INFOTYPES) dst->paInfoTypes = src->paInfoTypes;
283 if (merge & HHWIN_PARAM_TB_FLAGS) dst->fsToolBarFlags = src->fsToolBarFlags;
284 if (merge & HHWIN_PARAM_EXPANSION) dst->fNotExpanded = src->fNotExpanded;
285 if (merge & HHWIN_PARAM_TABPOS) dst->tabpos = src->tabpos;
286 if (merge & HHWIN_PARAM_TABORDER) memcpy(dst->tabOrder, src->tabOrder, sizeof(src->tabOrder));
287 if (merge & HHWIN_PARAM_HISTORY_COUNT) dst->cHistory = src->cHistory;
288 if (merge & HHWIN_PARAM_CUR_TAB) dst->curNavType = src->curNavType;
289
290 /*
291 * Note: We assume that hwndHelp, hwndCaller, hwndToolBar, hwndNavigation, and hwndHTML cannot be
292 * modified by the user. rcHTML and rcMinSize are not currently supported, so don't bother to copy them.
293 */
294
295 dst->pszType = MergeChmString(src->pszType, &info->stringsW.pszType);
296 dst->pszFile = MergeChmString(src->pszFile, &info->stringsW.pszFile);
297 dst->pszToc = MergeChmString(src->pszToc, &info->stringsW.pszToc);
298 dst->pszIndex = MergeChmString(src->pszIndex, &info->stringsW.pszIndex);
299 dst->pszCaption = MergeChmString(src->pszCaption, &info->stringsW.pszCaption);
300 dst->pszHome = MergeChmString(src->pszHome, &info->stringsW.pszHome);
301 dst->pszJump1 = MergeChmString(src->pszJump1, &info->stringsW.pszJump1);
302 dst->pszJump2 = MergeChmString(src->pszJump2, &info->stringsW.pszJump2);
303 dst->pszUrlJump1 = MergeChmString(src->pszUrlJump1, &info->stringsW.pszUrlJump1);
304 dst->pszUrlJump2 = MergeChmString(src->pszUrlJump2, &info->stringsW.pszUrlJump2);
305
306 /* FIXME: pszCustomTabs is a list of multiple zero-terminated strings so ReadString won't
307 * work in this case
308 */
309#if 0
310 dst->pszCustomTabs = MergeChmString(src->pszCustomTabs, &info->pszCustomTabs);
311#endif
312}
_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:249
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
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1418
Definition: fci.c:127

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 heap_free(chm_path.chm_file);
233 heap_free(chm_path.chm_index);
234
235 return ret;
236}
BOOL NavigateToChm(HHInfo *info, LPCWSTR file, LPCWSTR index)
Definition: help.c:257
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
Definition: hhctrl.h:54

Referenced by HtmlHelpW().

◆ OpenCHM()

CHMInfo * OpenCHM ( LPCWSTR  szFile)

Definition at line 626 of file chm.c.

627{
629 CHMInfo *ret;
630
631 static const WCHAR wszSTRINGS[] = {'#','S','T','R','I','N','G','S',0};
632
633 if (!(ret = heap_alloc_zero(sizeof(CHMInfo))))
634 return NULL;
635 ret->codePage = CP_ACP;
636
637 if (!(ret->szFile = strdupW(szFile))) {
638 heap_free(ret);
639 return NULL;
640 }
641
642 hres = CoCreateInstance(&CLSID_ITStorage, NULL, CLSCTX_INPROC_SERVER,
643 &IID_IITStorage, (void **) &ret->pITStorage) ;
644 if(FAILED(hres)) {
645 WARN("Could not create ITStorage: %08x\n", hres);
646 return CloseCHM(ret);
647 }
648
649 hres = IITStorage_StgOpenStorage(ret->pITStorage, szFile, NULL,
650 STGM_READ | STGM_SHARE_DENY_WRITE, NULL, 0, &ret->pStorage);
651 if(FAILED(hres)) {
652 WARN("Could not open storage: %08x\n", hres);
653 return CloseCHM(ret);
654 }
655 hres = IStorage_OpenStream(ret->pStorage, wszSTRINGS, NULL, STGM_READ, 0,
656 &ret->strings_stream);
657 if(FAILED(hres)) {
658 WARN("Could not open #STRINGS stream: %08x\n", hres);
659 /* It's not critical, so we pass */
660 }
661
662 if(!ReadChmSystem(ret)) {
663 WARN("Could not read #SYSTEM\n");
664 return CloseCHM(ret);
665 }
666
667 return ret;
668}
CHMInfo * CloseCHM(CHMInfo *chm)
Definition: chm.c:670
static BOOL ReadChmSystem(CHMInfo *chm)
Definition: chm.c:82
#define CP_ACP
Definition: compat.h:109
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325

Referenced by CreateHelpViewer().

◆ ReleaseContent()

void ReleaseContent ( HHInfo info)

Definition at line 325 of file content.c.

326{
327 free_content_item(info->content);
328}
static void free_content_item(ContentItem *item)
Definition: content.c:35

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 heap_free(info);
1829}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
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:230
void ReleaseWebBrowser(HHInfo *) DECLSPEC_HIDDEN
Definition: webbrowser.c:720
void ReleaseSearch(HHInfo *info) DECLSPEC_HIDDEN
Definition: search.c:235
void ReleaseIndex(HHInfo *) DECLSPEC_HIDDEN
Definition: index.c:288
void ReleaseContent(HHInfo *info)
Definition: content.c:325
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 heap_free(item->merge.chm_file);
296 heap_free(item->merge.chm_index);
297 while(item) {
298 next = item->next;
299
300 heap_free(item->keyword);
301 for(i=0;i<item->nItems;i++) {
302 heap_free(item->items[i].name);
303 heap_free(item->items[i].local);
304 }
305 heap_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 235 of file search.c.

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

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 503 of file chm.c.

504{
505 LPCWSTR ptr;
506 static const WCHAR separatorW[] = {':',':',0};
507
509
511 if(ptr) {
512 WCHAR chm_file[MAX_PATH];
513 WCHAR rel_path[MAX_PATH];
514 WCHAR base_path[MAX_PATH];
515 LPWSTR p;
516
517 lstrcpyW(base_path, base_file);
518 p = wcsrchr(base_path, '\\');
519 if(p)
520 *p = 0;
521
522 memcpy(rel_path, path, (ptr-path)*sizeof(WCHAR));
523 rel_path[ptr-path] = 0;
524
525 PathCombineW(chm_file, base_path, rel_path);
526
527 file->chm_file = strdupW(chm_file);
528 ptr += 2;
529 }else {
530 file->chm_file = strdupW(base_file);
531 ptr = path;
532 }
533
534 file->chm_index = strdupW(ptr);
535
536 TRACE("ChmFile = {%s %s}\n", debugstr_w(file->chm_file), debugstr_w(file->chm_index));
537}
LPCWSTR skip_schema(LPCWSTR url)
Definition: chm.c:487
#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:317
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

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

◆ skip_schema()

LPCWSTR skip_schema ( LPCWSTR  url)

Definition at line 487 of file chm.c.

488{
489 static const WCHAR its_schema[] = {'i','t','s',':'};
490 static const WCHAR msits_schema[] = {'m','s','-','i','t','s',':'};
491 static const WCHAR mk_schema[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':'};
492
493 if(!_wcsnicmp(its_schema, url, ARRAY_SIZE(its_schema)))
494 return url + ARRAY_SIZE(its_schema);
495 if(!_wcsnicmp(msits_schema, url, ARRAY_SIZE(msits_schema)))
496 return url + ARRAY_SIZE(msits_schema);
497 if(!_wcsnicmp(mk_schema, url, ARRAY_SIZE(mk_schema)))
498 return url + ARRAY_SIZE(mk_schema);
499
500 return url;
501}
static const WCHAR url[]
Definition: encode.c:1432
_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)

Referenced by resolve_filename(), and SetChmPath().

◆ strdupAtoW()

static LPWSTR strdupAtoW ( LPCSTR  str)
inlinestatic

Definition at line 294 of file hhctrl.h.

295{
296 return strdupnAtoW(str, -1);
297}

◆ strdupnAtoW()

static LPWSTR strdupnAtoW ( LPCSTR  str,
LONG  lenA 
)
inlinestatic

Definition at line 271 of file hhctrl.h.

272{
273 LPWSTR ret;
274 DWORD len;
275
276 if(!str)
277 return NULL;
278
279 if (lenA > 0)
280 {
281 /* find length of string */
282 LPCSTR eos = memchr(str, 0, lenA);
283 if (eos) lenA = eos - str;
284 }
285
286 len = MultiByteToWideChar(CP_ACP, 0, str, lenA, NULL, 0)+1; /* +1 for null pad */
287 ret = heap_alloc(len*sizeof(WCHAR));
288 MultiByteToWideChar(CP_ACP, 0, str, lenA, ret, len);
289 ret[len-1] = 0;
290
291 return ret;
292}
static void size_t len
Definition: hhctrl.h:252
#define memchr(s, c, n)
Definition: mkisofs.h:875

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

◆ strdupW()

static LPWSTR strdupW ( LPCWSTR  str)
inlinestatic

Definition at line 256 of file hhctrl.h.

257{
258 LPWSTR ret;
259 int size;
260
261 if(!str)
262 return NULL;
263
264 size = (lstrlenW(str)+1)*sizeof(WCHAR);
266 memcpy(ret, str, size);
267
268 return ret;
269}
#define lstrlenW
Definition: compat.h:750

◆ strdupWtoA()

static LPSTR strdupWtoA ( LPCWSTR  str)
inlinestatic

Definition at line 299 of file hhctrl.h.

300{
301 LPSTR ret;
302 DWORD len;
303
304 if(!str)
305 return NULL;
306
307 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
308 ret = heap_alloc(len);
310 return ret;
311}
#define WideCharToMultiByte
Definition: compat.h:111
char * LPSTR
Definition: xmlstorage.h:182

Referenced by cabinet_next_cabinet(), extract_cabinet(), ITERATE_BindImage(), msi_scrolltext_add_text(), s_remote_GetActionInfo(), and wintypeWtoA().

◆ 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}
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
& rect
Definition: startmenu.cpp:1413
int32_t INT
Definition: typedefs.h:58
#define SWP_NOACTIVATE
Definition: winuser.h:1242
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOZORDER
Definition: winuser.h:1247

Referenced by HtmlHelpW().

◆ wintype_stringsA_free()

void wintype_stringsA_free ( struct wintype_stringsA stringsA)

Definition at line 1787 of file help.c.

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

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 heap_free(stringsW->pszType);
1776 heap_free(stringsW->pszCaption);
1777 heap_free(stringsW->pszToc);
1778 heap_free(stringsW->pszIndex);
1779 heap_free(stringsW->pszFile);
1780 heap_free(stringsW->pszHome);
1781 heap_free(stringsW->pszJump1);
1782 heap_free(stringsW->pszJump2);
1783 heap_free(stringsW->pszUrlJump1);
1784 heap_free(stringsW->pszUrlJump2);
1785}
WCHAR * pszUrlJump1
Definition: hhctrl.h:153
WCHAR * pszUrlJump2
Definition: hhctrl.h:154
WCHAR * pszJump1
Definition: hhctrl.h:151
WCHAR * pszHome
Definition: hhctrl.h:150
WCHAR * pszToc
Definition: hhctrl.h:147
WCHAR * pszCaption
Definition: hhctrl.h:146
WCHAR * pszFile
Definition: hhctrl.h:149
WCHAR * pszJump2
Definition: hhctrl.h:152
WCHAR * pszType
Definition: hhctrl.h:145
WCHAR * pszIndex
Definition: hhctrl.h:148

Referenced by HtmlHelpA(), and ReleaseHelpViewer().

Variable Documentation

◆ DECLSPEC_HIDDEN

BOOL hh_process DECLSPEC_HIDDEN
extern

Definition at line 314 of file hhctrl.h.

◆ len

Initial value:
{
#define GetProcessHeap()
Definition: compat.h:736
#define HeapReAlloc
Definition: compat.h:734
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
Definition: mem.c:156

Definition at line 251 of file hhctrl.h.

Referenced by strdupnAtoW(), and strdupWtoA().