pidgin: 95bdb969: Use some fully qualified dll locations.

datallah at pidgin.im datallah at pidgin.im
Mon Aug 30 22:01:36 EDT 2010


----------------------------------------------------------------------
Revision: 95bdb96951c9aaae802bf85e057270a6a37d2ca8
Parent:   b249084b6c452f76d249f5dd1b5335d9838a9927
Author:   datallah at pidgin.im
Date:     08/30/10 21:49:53
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/95bdb96951c9aaae802bf85e057270a6a37d2ca8

Changelog: 

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.

Changes against parent b249084b6c452f76d249f5dd1b5335d9838a9927

  patched  pidgin/win32/gtkwin32dep.c
  patched  pidgin/win32/winpidgin.c
  patched  pidgin/win32/wspell.c

-------------- next part --------------
============================================================
--- pidgin/win32/wspell.c	364332a808025855aae34eed182727f88408d6f3
+++ pidgin/win32/wspell.c	a2067bb6ab86a0e58b82ac23bde3c0e9257d7903
@@ -73,25 +73,29 @@ static void load_gtkspell() {
 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);
 }
 
============================================================
--- pidgin/win32/gtkwin32dep.c	0c232fb8d2dc575958de9e9722a33816d45ab1c3
+++ pidgin/win32/gtkwin32dep.c	e594b4333a0458fa5750039675134bda4f523779
@@ -376,12 +376,16 @@ void winpidgin_init(HINSTANCE hint) {
 
 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;
 
============================================================
--- pidgin/win32/winpidgin.c	46d6fa0233538fc33b4a8fbab84dac4e3d14db69
+++ pidgin/win32/winpidgin.c	b17aad9cc2ed8bfa7566c950fcd9fd38c18bd0fa
@@ -605,9 +605,9 @@ WinMain (struct HINSTANCE__ *hInstance, 
 		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 @@ WinMain (struct HINSTANCE__ *hInstance, 
 	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 @@ WinMain (struct HINSTANCE__ *hInstance, 
 				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 @@ WinMain (struct HINSTANCE__ *hInstance, 
 
 			}
 
-			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 @@ WinMain (struct HINSTANCE__ *hInstance, 
 			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);


More information about the Commits mailing list