diff --git a/reactos/dll/win32/hhctrl.ocx/Ko.rc b/reactos/dll/win32/hhctrl.ocx/Ko.rc index 169eb70e472..05f7aafe8ba 100644 --- a/reactos/dll/win32/hhctrl.ocx/Ko.rc +++ b/reactos/dll/win32/hhctrl.ocx/Ko.rc @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT +LANGUAGE LANG_KOREAN, SUBLANG_NEUTRAL STRINGTABLE BEGIN diff --git a/reactos/dll/win32/hhctrl.ocx/No.rc b/reactos/dll/win32/hhctrl.ocx/No.rc index 917e9f2497d..5ff634d02df 100644 --- a/reactos/dll/win32/hhctrl.ocx/No.rc +++ b/reactos/dll/win32/hhctrl.ocx/No.rc @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL +LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL STRINGTABLE BEGIN diff --git a/reactos/dll/win32/hhctrl.ocx/content.c b/reactos/dll/win32/hhctrl.ocx/content.c index c572bafb201..a34c853ce8d 100644 --- a/reactos/dll/win32/hhctrl.ocx/content.c +++ b/reactos/dll/win32/hhctrl.ocx/content.c @@ -32,6 +32,24 @@ typedef enum { INSERT_CHILD } insert_type_t; +static void free_content_item(ContentItem *item) +{ + ContentItem *next; + + while(item) { + next = item->next; + + free_content_item(item->child); + + hhctrl_free(item->name); + hhctrl_free(item->local); + hhctrl_free(item->merge.chm_file); + hhctrl_free(item->merge.chm_index); + + item = next; + } +} + typedef struct { char *buf; int size; @@ -207,6 +225,9 @@ static ContentItem *insert_item(ContentItem *item, ContentItem *new_item, insert if(!item) return new_item; + if(!new_item) + return item; + switch(insert_type) { case INSERT_NEXT: item->next = new_item; @@ -265,6 +286,11 @@ static ContentItem *parse_sitemap_object(HHInfo *info, stream_t *stream, Content }else { WARN("Could not get %s::%s stream\n", debugstr_w(item->merge.chm_file), debugstr_w(item->merge.chm_file)); + + if(!item->name) { + free_content_item(item); + item = NULL; + } } } @@ -411,24 +437,6 @@ void InitContent(HHInfo *info) fill_content_tree(info->tabs[TAB_CONTENTS].hwnd, NULL, info->content); } -static void free_content_item(ContentItem *item) -{ - ContentItem *next; - - while(item) { - next = item->next; - - free_content_item(item->child); - - hhctrl_free(item->name); - hhctrl_free(item->local); - hhctrl_free(item->merge.chm_file); - hhctrl_free(item->merge.chm_index); - - item = next; - } -} - void ReleaseContent(HHInfo *info) { free_content_item(info->content); diff --git a/reactos/dll/win32/hhctrl.ocx/hhctrl.c b/reactos/dll/win32/hhctrl.ocx/hhctrl.c index de66a8a69dd..44a1eb3bf7f 100644 --- a/reactos/dll/win32/hhctrl.ocx/hhctrl.c +++ b/reactos/dll/win32/hhctrl.ocx/hhctrl.c @@ -78,6 +78,7 @@ static const char *command_to_string(UINT command) X( HH_SET_EXCLUSIVE_FILTER ); X( HH_INITIALIZE ); X( HH_UNINITIALIZE ); + X( HH_SAFE_DISPLAY_TOPIC ); X( HH_PRETRANSLATEMESSAGE ); X( HH_SET_GLOBAL_PROPERTY ); default: return "???"; @@ -86,11 +87,11 @@ static const char *command_to_string(UINT command) } /****************************************************************** - * HtmlHelpW (hhctrl.ocx.15) + * HtmlHelpW (HHCTRL.OCX.15) */ -HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD data) +HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR data) { - TRACE("(%p, %s, command=%s, data=%d)\n", + TRACE("(%p, %s, command=%s, data=%lx)\n", caller, debugstr_w( filename ), command_to_string( command ), data); @@ -99,16 +100,37 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD data) case HH_DISPLAY_TOPIC: case HH_DISPLAY_TOC: case HH_DISPLAY_SEARCH:{ + static const WCHAR delimW[] = {':',':',0}; HHInfo *info; BOOL res; + WCHAR chm_file[MAX_PATH]; + const WCHAR *index; FIXME("Not all HH cases handled correctly\n"); + index = strstrW(filename, delimW); + if (index) + { + memcpy(chm_file, filename, (index-filename)*sizeof(WCHAR)); + chm_file[index-filename] = 0; + filename = chm_file; + } + else + { + if (command!=HH_DISPLAY_SEARCH) /* FIXME - use HH_FTS_QUERYW structure in data */ + index = (const WCHAR*)data; + } + info = CreateHelpViewer(filename); - res = NavigateToChm(info, info->pCHMInfo->szFile, info->WinType.pszFile); - if(!res) - ReleaseHelpViewer(info); + if (info) + { + if (!index) + index = info->WinType.pszFile; + res = NavigateToChm(info, info->pCHMInfo->szFile, index); + if(!res) + ReleaseHelpViewer(info); + } return NULL; /* FIXME */ } @@ -137,29 +159,71 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD data) } /****************************************************************** - * HtmlHelpA (hhctrl.ocx.14) + * HtmlHelpA (HHCTRL.OCX.14) */ -HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD data) +HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data) { - WCHAR *wfile = NULL; + WCHAR *wfile = NULL, *wdata = NULL; + DWORD len; HWND result; if (filename) { - DWORD len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 ); - + len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 ); wfile = hhctrl_alloc(len*sizeof(WCHAR)); MultiByteToWideChar( CP_ACP, 0, filename, -1, wfile, len ); } - result = HtmlHelpW( caller, wfile, command, data ); + if (data) + { + switch(command) + { + case HH_ALINK_LOOKUP: + case HH_DISPLAY_SEARCH: + case HH_DISPLAY_TEXT_POPUP: + case HH_GET_LAST_ERROR: + case HH_GET_WIN_TYPE: + case HH_KEYWORD_LOOKUP: + case HH_SET_WIN_TYPE: + case HH_SYNC: + FIXME("structures not handled yet\n"); + break; + + case HH_DISPLAY_INDEX: + case HH_DISPLAY_TOPIC: + case HH_DISPLAY_TOC: + case HH_GET_WIN_HANDLE: + case HH_SAFE_DISPLAY_TOPIC: + len = MultiByteToWideChar( CP_ACP, 0, (const char*)data, -1, NULL, 0 ); + wdata = hhctrl_alloc(len*sizeof(WCHAR)); + MultiByteToWideChar( CP_ACP, 0, (const char*)data, -1, wdata, len ); + break; + + case HH_CLOSE_ALL: + case HH_HELP_CONTEXT: + case HH_INITIALIZE: + case HH_PRETRANSLATEMESSAGE: + case HH_TP_HELP_CONTEXTMENU: + case HH_TP_HELP_WM_HELP: + case HH_UNINITIALIZE: + /* either scalar or pointer to scalar - do nothing */ + break; + + default: + FIXME("Unknown command: %s (%d)\n", command_to_string(command), command); + break; + } + } + + result = HtmlHelpW( caller, wfile, command, wdata ? (DWORD_PTR)wdata : data ); hhctrl_free(wfile); + hhctrl_free(wdata); return result; } /****************************************************************** - * doWinMain (hhctrl.ocx.13) + * doWinMain (HHCTRL.OCX.13) */ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine) { @@ -180,7 +244,7 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine) } /****************************************************************** - * DllGetClassObject (hhctrl.ocx.@) + * DllGetClassObject (HHCTRL.OCX.@) */ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { diff --git a/reactos/dll/win32/hhctrl.ocx/hhctrl.h b/reactos/dll/win32/hhctrl.ocx/hhctrl.h index c362e4e1de2..7c76fe545a5 100644 --- a/reactos/dll/win32/hhctrl.ocx/hhctrl.h +++ b/reactos/dll/win32/hhctrl.ocx/hhctrl.h @@ -38,7 +38,7 @@ #include "initguid.h" #endif -#include "itss.h" +#include "wine/itss.h" #include "wine/unicode.h" #define WB_GOBACK 0 diff --git a/reactos/dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild b/reactos/dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild index 7deba7ee705..e7065a48807 100644 --- a/reactos/dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild +++ b/reactos/dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild @@ -1,34 +1,32 @@ -<module name="hhctrl" type="win32ocx" baseaddress="${BASEADDRESS_HHCTRL}" installbase="system32" installname="hhctrl.ocx" usewrc="false" allowwarnings="true"> - <importlibrary definition="hhctrl.ocx.spec.def" /> - <include base="hhctrl">.</include> - <include base="ReactOS">include/reactos/wine</include> - <include base="ReactOS" root="intermediate">include/reactos/wine</include> - <define name="__REACTOS__" /> - <define name="__WINESRC__" /> - <define name="__USE_W32API" /> - <define name="_WIN32_IE">0x600</define> - <define name="_WIN32_WINNT">0x501</define> - <define name="WINVER">0x501</define> - <dependency>wineheaders</dependency> - <library>wine</library> - <library>uuid</library> - <library>kernel32</library> - <library>user32</library> - <library>gdi32</library> - <library>shell32</library> - <library>comctl32</library> - <library>advapi32</library> - <library>gdi32</library> - <library>ntdll</library> - <library>ole32</library> - <library>oleaut32</library> - <library>shlwapi</library> - <file>chm.c</file> - <file>content.c</file> - <file>help.c</file> - <file>hhctrl.c</file> - <file>regsvr.c</file> - <file>webbrowser.c</file> - <file>hhctrl.rc</file> - <file>hhctrl.ocx.spec</file> -</module> +<module name="hhctrl" type="win32ocx" baseaddress="${BASEADDRESS_HHCTRL}" installbase="system32" installname="hhctrl.ocx" allowwarnings="true"> + <autoregister infsection="OleControlDlls" type="DllRegisterServer" /> + <importlibrary definition="hhctrl.ocx.spec.def" /> + <include base="hhctrl">.</include> + <include base="ReactOS">include/reactos/wine</include> + <define name="__REACTOS__" /> + <define name="__WINESRC__" /> + <define name="__USE_W32API" /> + <define name="_WIN32_IE">0x600</define> + <define name="_WIN32_WINNT">0x501</define> + <define name="WINVER">0x501</define> + <library>wine</library> + <library>advapi32</library> + <library>comctl32</library> + <library>shell32</library> + <library>shlwapi</library> + <library>ole32</library> + <library>oleaut32</library> + <library>user32</library> + <library>gdi32</library> + <library>kernel32</library> + <library>uuid</library> + <library>ntdll</library> + <file>chm.c</file> + <file>content.c</file> + <file>help.c</file> + <file>hhctrl.c</file> + <file>regsvr.c</file> + <file>webbrowser.c</file> + <file>hhctrl.rc</file> + <file>hhctrl.ocx.spec</file> +</module>