Mercurial > pidgin
comparison libpurple/win32/win32dep.c @ 30578:0accc8adb18a
merge of '2f6318bd834113559a405ec68cdb178f2180b680'
and '64e02b98551e11e093e4649f1516f3aceaa321e2'
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 26 Sep 2010 20:16:15 +0000 |
parents | 35d8acf675e9 |
children |
comparison
equal
deleted
inserted
replaced
30577:7b761c8601f7 | 30578:0accc8adb18a |
---|---|
33 * LOCALS | 33 * LOCALS |
34 */ | 34 */ |
35 static char *app_data_dir = NULL, *install_dir = NULL, | 35 static char *app_data_dir = NULL, *install_dir = NULL, |
36 *lib_dir = NULL, *locale_dir = NULL; | 36 *lib_dir = NULL, *locale_dir = NULL; |
37 | 37 |
38 static HINSTANCE libpurpledll_hInstance = 0; | 38 static HINSTANCE libpurpledll_hInstance = NULL; |
39 | 39 |
40 /* | 40 /* |
41 * PUBLIC CODE | 41 * PUBLIC CODE |
42 */ | 42 */ |
43 | 43 |
75 FARPROC wpurple_find_and_loadproc(const char *dllname, const char *procedure) { | 75 FARPROC wpurple_find_and_loadproc(const char *dllname, const char *procedure) { |
76 HMODULE hmod; | 76 HMODULE hmod; |
77 BOOL did_load = FALSE; | 77 BOOL did_load = FALSE; |
78 FARPROC proc = 0; | 78 FARPROC proc = 0; |
79 | 79 |
80 if(!(hmod = GetModuleHandle(dllname))) { | 80 wchar_t *wc_dllname = g_utf8_to_utf16(dllname, -1, NULL, NULL, NULL); |
81 | |
82 if(!(hmod = GetModuleHandleW(wc_dllname))) { | |
81 purple_debug_warning("wpurple", "%s not already loaded; loading it...\n", dllname); | 83 purple_debug_warning("wpurple", "%s not already loaded; loading it...\n", dllname); |
82 if(!(hmod = LoadLibrary(dllname))) { | 84 if(!(hmod = LoadLibraryW(wc_dllname))) { |
83 purple_debug_error("wpurple", "Could not load: %s\n", dllname); | 85 purple_debug_error("wpurple", "Could not load: %s (%s)\n", dllname, |
86 g_win32_error_message(GetLastError())); | |
87 g_free(wc_dllname); | |
84 return NULL; | 88 return NULL; |
85 } | 89 } |
86 else | 90 else |
87 did_load = TRUE; | 91 did_load = TRUE; |
88 } | 92 } |
93 | |
94 g_free(wc_dllname); | |
95 wc_dllname = NULL; | |
89 | 96 |
90 if((proc = GetProcAddress(hmod, procedure))) { | 97 if((proc = GetProcAddress(hmod, procedure))) { |
91 purple_debug_info("wpurple", "This version of %s contains %s\n", | 98 purple_debug_info("wpurple", "This version of %s contains %s\n", |
92 dllname, procedure); | 99 dllname, procedure); |
93 return proc; | 100 return proc; |
122 static gboolean initialized = FALSE; | 129 static gboolean initialized = FALSE; |
123 | 130 |
124 if (!initialized) { | 131 if (!initialized) { |
125 char *tmp = NULL; | 132 char *tmp = NULL; |
126 wchar_t winstall_dir[MAXPATHLEN]; | 133 wchar_t winstall_dir[MAXPATHLEN]; |
127 if (GetModuleFileNameW(NULL, winstall_dir, | 134 if (GetModuleFileNameW(libpurpledll_hInstance, winstall_dir, |
128 MAXPATHLEN) > 0) { | 135 MAXPATHLEN) > 0) { |
129 tmp = g_utf16_to_utf8(winstall_dir, -1, | 136 tmp = g_utf16_to_utf8(winstall_dir, -1, |
130 NULL, NULL, NULL); | 137 NULL, NULL, NULL); |
131 } | 138 } |
132 | 139 |