X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/db6452becbc34d72796f883c4bb26a9860b9eb0a..8d90b8b27bf086da6245030459ab3e5977313eb0:/windows/winhelp.c diff --git a/windows/winhelp.c b/windows/winhelp.c index cc36bee5..8b652c7b 100644 --- a/windows/winhelp.c +++ b/windows/winhelp.c @@ -19,10 +19,8 @@ static int requested_help; static char *help_path; static int help_has_contents; #ifndef NO_HTMLHELP -typedef HWND (CALLBACK *htmlhelp_t)(HWND, LPCSTR, UINT, DWORD); +DECL_WINDOWS_FUNCTION(static, HWND, HtmlHelpA, (HWND, LPCSTR, UINT, DWORD)); static char *chm_path; -static DWORD html_help_cookie; -static htmlhelp_t htmlhelp; #endif /* NO_HTMLHELP */ void init_help(void) @@ -57,26 +55,22 @@ void init_help(void) } else chm_path = NULL; if (chm_path) { - HINSTANCE dllHH = LoadLibrary("hhctrl.ocx"); - if (dllHH) { - htmlhelp = (htmlhelp_t)GetProcAddress(dllHH, "HtmlHelpA"); - if (!htmlhelp) + HINSTANCE dllHH = load_system32_dll("hhctrl.ocx"); + GET_WINDOWS_FUNCTION(dllHH, HtmlHelpA); + if (!p_HtmlHelpA) { + chm_path = NULL; + if (dllHH) FreeLibrary(dllHH); } - if (htmlhelp) - htmlhelp(NULL, NULL, HH_INITIALIZE, (DWORD)&html_help_cookie); - else - chm_path = NULL; } #endif /* NO_HTMLHELP */ } void shutdown_help(void) { -#ifndef NO_HTMLHELP - if (chm_path) - htmlhelp(NULL, NULL, HH_UNINITIALIZE, html_help_cookie); -#endif /* NO_HTMLHELP */ + /* Nothing to do currently. + * (If we were running HTML Help single-threaded, this is where we'd + * call HH_UNINITIALIZE.) */ } int has_help(void) @@ -87,7 +81,7 @@ int has_help(void) * unrealistic, since even Vista will have it if the user * specifically downloads it. */ - return (help_path + return (help_path != NULL #ifndef NO_HTMLHELP || chm_path #endif /* NO_HTMLHELP */ @@ -105,7 +99,7 @@ void launch_help(HWND hwnd, const char *topic) assert(topic[colonpos] != '\0'); fname = dupprintf("%s::/%s.html>main", chm_path, topic + colonpos + 1); - htmlhelp(hwnd, fname, HH_DISPLAY_TOPIC, 0); + p_HtmlHelpA(hwnd, fname, HH_DISPLAY_TOPIC, 0); sfree(fname); } else #endif /* NO_HTMLHELP */ @@ -117,7 +111,7 @@ void launch_help(HWND hwnd, const char *topic) } else { #ifndef NO_HTMLHELP if (chm_path) { - htmlhelp(hwnd, chm_path, HH_DISPLAY_TOPIC, 0); + p_HtmlHelpA(hwnd, chm_path, HH_DISPLAY_TOPIC, 0); } else #endif /* NO_HTMLHELP */ if (help_path) { @@ -133,7 +127,7 @@ void quit_help(HWND hwnd) if (requested_help) { #ifndef NO_HTMLHELP if (chm_path) { - htmlhelp(NULL, NULL, HH_CLOSE_ALL, 0); + p_HtmlHelpA(NULL, NULL, HH_CLOSE_ALL, 0); } else #endif /* NO_HTMLHELP */ if (help_path) {