pidgin.next.minor: 6746d602: Handle non-ASCII protocol names on Win32

datallah at pidgin.im datallah at pidgin.im
Sat Oct 31 15:25:40 EDT 2009


-----------------------------------------------------------------
Revision: 6746d602d91ae610baffb8629463407a20b7b2fd
Ancestor: e18cf238d7dc2b7bd93a3e346da1ca33a93283a5
Author: datallah at pidgin.im
Date: 2009-10-31T19:20:50
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/6746d602d91ae610baffb8629463407a20b7b2fd

Modified files:
        pidgin/gtkutils.c

ChangeLog: 

Handle non-ASCII protocol names on Win32

-------------- next part --------------
============================================================
--- pidgin/gtkutils.c	a37dedd17ea760cfbe6937191712ffc69c1a1521
+++ pidgin/gtkutils.c	786b6d9781e9fef0ba410d6bfdc706981aba48e9
@@ -3415,17 +3415,19 @@ winpidgin_register_win32_url_handlers(vo
 
 	do {
 		DWORD nameSize = 256;
-		char start[256];
+		wchar_t start[256];
 		/* I don't think we need to worry about non-ASCII protocol names */
-		ret = RegEnumKeyExA(HKEY_CLASSES_ROOT, idx++, start, &nameSize,
+		ret = RegEnumKeyExW(HKEY_CLASSES_ROOT, idx++, start, &nameSize,
 							NULL, NULL, NULL, NULL);
 		if (ret == ERROR_SUCCESS) {
 			HKEY reg_key = NULL;
-			ret = RegOpenKeyExA(HKEY_CLASSES_ROOT, start, 0, KEY_READ, &reg_key);
+			ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, start, 0, KEY_READ, &reg_key);
 			if (ret == ERROR_SUCCESS) {
-				ret = RegQueryValueExA(reg_key, "URL Protocol", NULL, NULL, NULL, NULL);
+				ret = RegQueryValueExW(reg_key, L"URL Protocol", NULL, NULL, NULL, NULL);
 				if (ret == ERROR_SUCCESS) {
-					gchar *protocol = g_strdup_printf("%s:", start);
+					gchar *utf8 = g_utf16_to_utf8(start, -1, NULL, NULL, NULL);
+					gchar *protocol = g_strdup_printf("%s:", utf8);
+					g_free(utf8);
 					registered_url_handlers = g_slist_prepend(registered_url_handlers, protocol);
 					/* We still pass everything to the "http" "open" handler for security reasons */
 					gtk_imhtml_class_register_protocol(protocol, url_clicked_cb, link_context_menu);


More information about the Commits mailing list