# HG changeset patch # User Daniel Atallah # Date 1283219393 0 # Node ID 3d045343e04d007dd3dbf64c52765d2685586ead # Parent 35d8acf675e9f4a4da60f29b0f22c18895ae1b4a Use some fully qualified dll locations. There wasn't anything wrong with this as far as I can tell, but since we know specifically where what we're looking for is, this is probably better. Also, plug a small leak and try to find our enchant dll instead of any other one that is in the PATH. diff -r 35d8acf675e9 -r 3d045343e04d pidgin/win32/gtkwin32dep.c --- a/pidgin/win32/gtkwin32dep.c Tue Aug 31 01:23:28 2010 +0000 +++ b/pidgin/win32/gtkwin32dep.c Tue Aug 31 01:49:53 2010 +0000 @@ -376,12 +376,16 @@ void winpidgin_init(HINSTANCE hint) { FARPROC proc; + gchar *exchndl_dll_path; purple_debug_info("winpidgin", "winpidgin_init start\n"); exe_hInstance = hint; - proc = wpurple_find_and_loadproc("exchndl.dll", "SetLogFile"); + exchndl_dll_path = g_build_filename(wpurple_install_dir(), "exchndl.dll", NULL); + proc = wpurple_find_and_loadproc(exchndl_dll_path, "SetLogFile"); + g_free(exchndl_dll_path); + exchndl_dll_path = NULL; if (proc) { gchar *debug_dir, *locale_debug_dir; diff -r 35d8acf675e9 -r 3d045343e04d pidgin/win32/winpidgin.c --- a/pidgin/win32/winpidgin.c Tue Aug 31 01:23:28 2010 +0000 +++ b/pidgin/win32/winpidgin.c Tue Aug 31 01:49:53 2010 +0000 @@ -605,9 +605,9 @@ char *lpszCmdLine, int nCmdShow) { wchar_t errbuf[512]; wchar_t pidgin_dir[MAX_PATH]; + wchar_t *pidgin_dir_start = NULL; wchar_t exe_name[MAX_PATH]; HMODULE hmod; - wchar_t *tmp; wchar_t *wtmp; int pidgin_argc; char **pidgin_argv; /* This is in utf-8 */ @@ -672,14 +672,14 @@ if (GetModuleFileNameW(NULL, pidgin_dir, MAX_PATH) != 0) { /* primitive dirname() */ - tmp = wcsrchr(pidgin_dir, L'\\'); + pidgin_dir_start = wcsrchr(pidgin_dir, L'\\'); - if (tmp) { + if (pidgin_dir_start) { HMODULE hmod; - tmp[0] = L'\0'; + pidgin_dir_start[0] = L'\0'; /* tmp++ will now point to the executable file name */ - wcscpy(exe_name, tmp + 1); + wcscpy(exe_name, pidgin_dir_start + 1); wcscat(pidgin_dir, L"\\exchndl.dll"); if ((hmod = LoadLibraryW(pidgin_dir))) { @@ -702,7 +702,8 @@ proc = GetProcAddress(hmod, "SetDebugInfoDir"); if (proc) { char *pidgin_dir_ansi = NULL; - tmp[0] = L'\0'; + /* Restore pidgin_dir to point to where the executable is */ + pidgin_dir_start[0] = L'\0'; i = WideCharToMultiByte(CP_ACP, 0, pidgin_dir, -1, NULL, 0, NULL, NULL); if (i != 0) { @@ -728,7 +729,8 @@ } - tmp[0] = L'\0'; + /* Restore pidgin_dir to point to where the executable is */ + pidgin_dir_start[0] = L'\0'; } } else { DWORD dw = GetLastError(); @@ -763,9 +765,14 @@ return 0; /* Now we are ready for Pidgin .. */ - if ((hmod = LoadLibraryW(L"pidgin.dll"))) + wcscat(pidgin_dir, L"\\pidgin.dll"); + if ((hmod = LoadLibraryW(pidgin_dir))) pidgin_main = (LPFNPIDGINMAIN) GetProcAddress(hmod, "pidgin_main"); + /* Restore pidgin_dir to point to where the executable is */ + if (pidgin_dir_start) + pidgin_dir_start[0] = L'\0'; + if (!pidgin_main) { DWORD dw = GetLastError(); BOOL mod_not_found = (dw == ERROR_MOD_NOT_FOUND || dw == ERROR_DLL_NOT_FOUND); diff -r 35d8acf675e9 -r 3d045343e04d pidgin/win32/wspell.c --- a/pidgin/win32/wspell.c Tue Aug 31 01:23:28 2010 +0000 +++ b/pidgin/win32/wspell.c Tue Aug 31 01:49:53 2010 +0000 @@ -73,25 +73,29 @@ static void load_gtkspell() { UINT old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS); gchar *tmp, *tmp2; + const char *path = g_getenv("PATH"); tmp = g_build_filename(wpurple_install_dir(), "spellcheck", NULL); - tmp2 = g_strdup_printf("%s%s%s", (path ? path : ""), + tmp2 = g_strdup_printf("%s%s%s", tmp, (path ? G_SEARCHPATH_SEPARATOR_S : ""), - tmp); + (path ? path : "")); g_free(tmp); g_setenv("PATH", tmp2, TRUE); + g_free(tmp2); + tmp = g_build_filename(wpurple_install_dir(), "spellcheck", GTKSPELL_DLL, NULL); /* Suppress error popups */ - wpidginspell_new_attach_proxy = (void*) wpurple_find_and_loadproc(GTKSPELL_DLL, "gtkspell_new_attach" ); + wpidginspell_new_attach_proxy = (void*) wpurple_find_and_loadproc(tmp, "gtkspell_new_attach" ); if (wpidginspell_new_attach_proxy) { - wpidginspell_get_from_text_view = (void*) wpurple_find_and_loadproc(GTKSPELL_DLL, "gtkspell_get_from_text_view"); - wpidginspell_detach = (void*) wpurple_find_and_loadproc(GTKSPELL_DLL, "gtkspell_detach"); - wpidginspell_set_language = (void*) wpurple_find_and_loadproc(GTKSPELL_DLL, "gtkspell_set_language"); - wpidginspell_recheck_all = (void*) wpurple_find_and_loadproc(GTKSPELL_DLL, "gtkspell_recheck_all"); + wpidginspell_get_from_text_view = (void*) wpurple_find_and_loadproc(tmp, "gtkspell_get_from_text_view"); + wpidginspell_detach = (void*) wpurple_find_and_loadproc(tmp, "gtkspell_detach"); + wpidginspell_set_language = (void*) wpurple_find_and_loadproc(tmp, "gtkspell_set_language"); + wpidginspell_recheck_all = (void*) wpurple_find_and_loadproc(tmp, "gtkspell_recheck_all"); } else { - purple_debug_warning("wspell", "Couldn't load gtkspell (%s) \n", GTKSPELL_DLL); + purple_debug_warning("wspell", "Couldn't load gtkspell (%s) \n", tmp); /*wpidginspell_new_attach = wgtkspell_new_attach;*/ } + g_free(tmp); SetErrorMode(old_error_mode); }