changeset 30897:7be961ff3fa2

Make wpurple_find_and_loadproc() work for non-ASCII full paths
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 31 Aug 2010 00:51:41 +0000
parents ae954cc1abb5
children 31c2dd632ffa
files libpurple/win32/win32dep.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/win32/win32dep.c	Mon Aug 30 18:57:22 2010 +0000
+++ b/libpurple/win32/win32dep.c	Tue Aug 31 00:51:41 2010 +0000
@@ -77,16 +77,22 @@
 	BOOL did_load = FALSE;
 	FARPROC proc = 0;
 
-	if(!(hmod = GetModuleHandle(dllname))) {
+	wchar_t *wc_dllname = g_utf8_to_utf16(dllname, -1, NULL, NULL, NULL);
+
+	if(!(hmod = GetModuleHandleW(wc_dllname))) {
 		purple_debug_warning("wpurple", "%s not already loaded; loading it...\n", dllname);
-		if(!(hmod = LoadLibrary(dllname))) {
+		if(!(hmod = LoadLibraryW(wc_dllname))) {
 			purple_debug_error("wpurple", "Could not load: %s\n", dllname);
+			g_free(wc_dllname);
 			return NULL;
 		}
 		else
 			did_load = TRUE;
 	}
 
+	g_free(wc_dllname);
+	wc_dllname = NULL;
+
 	if((proc = GetProcAddress(hmod, procedure))) {
 		purple_debug_info("wpurple", "This version of %s contains %s\n",
 			dllname, procedure);