comparison src/win_gaim.c @ 11555:4da9e0d4e8d2

[gaim-migrate @ 13815] Look at the current user registry keys to find GTK+ first, then fall back to the system registry (switched precedence). Pay no attention to the mass of changes, it is mostly whitespace fixes that were irritating me. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Sat, 17 Sep 2005 22:28:18 +0000
parents d83e1fe99d69
children 71945305a87e
comparison
equal deleted inserted replaced
11554:f8443218b7fe 11555:4da9e0d4e8d2
76 (LPTSTR) &szBuf, sizeof(szBuf), NULL); 76 (LPTSTR) &szBuf, sizeof(szBuf), NULL);
77 printf("Could not open reg subkey: %s\nError: (%ld) %s\n", 77 printf("Could not open reg subkey: %s\nError: (%ld) %s\n",
78 sub_key, retv, szBuf); 78 sub_key, retv, szBuf);
79 } 79 }
80 80
81 return ret; 81 return ret;
82 } 82 }
83 83
84 static void dll_prep() { 84 static void dll_prep() {
85 char gtkpath[MAX_PATH + 1]; 85 char gtkpath[MAX_PATH + 1];
86 char path[MAX_PATH + 1]; 86 char path[MAX_PATH + 1];
87 DWORD plen; 87 DWORD plen;
88 BOOL gotreg = FALSE; 88 HKEY hkey;
89 HKEY hkey; 89 HMODULE hmod;
90 HMODULE hmod;
91 90
92 plen = sizeof(gtkpath); 91 plen = sizeof(gtkpath);
93 if(!(gotreg = read_reg_string((hkey=HKEY_LOCAL_MACHINE), "SOFTWARE\\GTK\\2.0", "Path", (LPBYTE)&gtkpath, &plen))) 92 hkey = HKEY_CURRENT_USER;
94 gotreg = read_reg_string((hkey=HKEY_CURRENT_USER), "SOFTWARE\\GTK\\2.0", "Path", (LPBYTE)&gtkpath, &plen); 93 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path",
95 94 (LPBYTE) &gtkpath, &plen)) {
96 if(!gotreg) 95 hkey = HKEY_LOCAL_MACHINE;
97 return; 96 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path",
97 (LPBYTE) &gtkpath, &plen)) {
98 printf("GTK+ Path Registry Key not found. "
99 "Assuming GTK+ is in the PATH.\n");
100 return;
101 }
102 }
98 103
99 /* this value is replaced during a successful RegQueryValueEx() */ 104 /* this value is replaced during a successful RegQueryValueEx() */
100 plen = sizeof(path); 105 plen = sizeof(path);
101 /* Determine GTK+ dll path .. */ 106 /* Determine GTK+ dll path .. */
102 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "DllPath", 107 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "DllPath",
103 (LPBYTE) &path, &plen)) { 108 (LPBYTE) &path, &plen)) {
104 strcpy(path, gtkpath); 109 strcpy(path, gtkpath);
105 strcat(path, "\\bin"); 110 strcat(path, "\\bin");
106 } 111 }
107 112
108 printf("GTK+ path found: %s\n", path); 113 printf("GTK+ path found: %s\n", path);
109 114
110 if((hmod=GetModuleHandle("kernel32.dll"))) { 115 if ((hmod = GetModuleHandle("kernel32.dll"))) {
111 MySetDllDirectory = (LPFNSETDLLDIRECTORY)GetProcAddress(hmod, "SetDllDirectoryA"); 116 MySetDllDirectory = (LPFNSETDLLDIRECTORY) GetProcAddress(
112 if(!MySetDllDirectory) 117 hmod, "SetDllDirectoryA");
113 printf("SetDllDirectory not supported\n"); 118 if (!MySetDllDirectory)
114 } 119 printf("SetDllDirectory not supported\n");
115 else 120 } else
116 printf("Error getting kernel32.dll module handle\n"); 121 printf("Error getting kernel32.dll module handle\n");
117 122
118 /* For Windows XP SP1+ / Server 2003 we use SetDllDirectory to avoid dll hell */ 123 /* For Windows XP SP1+ / Server 2003 we use SetDllDirectory to avoid dll hell */
119 if(MySetDllDirectory) { 124 if (MySetDllDirectory) {
120 printf("Using SetDllDirectory\n"); 125 printf("Using SetDllDirectory\n");
121 MySetDllDirectory(path); 126 MySetDllDirectory(path);
122 } 127 }
123 128
124 /* For the rest, we set the current directory and make sure SafeDllSearch is set 129 /* For the rest, we set the current directory and make sure
125 to 0 where needed. */ 130 * SafeDllSearch is set to 0 where needed. */
126 else { 131 else {
127 OSVERSIONINFO osinfo; 132 OSVERSIONINFO osinfo;
128 133
129 printf("Setting current directory to GTK+ dll directory\n"); 134 printf("Setting current directory to GTK+ dll directory\n");
130 SetCurrentDirectory(path); 135 SetCurrentDirectory(path);
131 /* For Windows 2000 (SP3+) / WinXP (No SP): 136 /* For Windows 2000 (SP3+) / WinXP (No SP):
132 * If SafeDllSearchMode is set to 1, Windows system directories are 137 * If SafeDllSearchMode is set to 1, Windows system directories are
133 * searched for dlls before the current directory. Therefore we set it 138 * searched for dlls before the current directory. Therefore we set it
134 * to 0. 139 * to 0.
135 */ 140 */
136 osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 141 osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
137 GetVersionEx(&osinfo); 142 GetVersionEx(&osinfo);
138 if((osinfo.dwMajorVersion == 5 && 143 if ((osinfo.dwMajorVersion == 5 &&
139 osinfo.dwMinorVersion == 0 && 144 osinfo.dwMinorVersion == 0 &&
140 strcmp(osinfo.szCSDVersion, "Service Pack 3") >= 0) || 145 strcmp(osinfo.szCSDVersion, "Service Pack 3") >= 0) ||
141 (osinfo.dwMajorVersion == 5 && 146 (osinfo.dwMajorVersion == 5 &&
142 osinfo.dwMinorVersion == 1 && 147 osinfo.dwMinorVersion == 1 &&
143 strcmp(osinfo.szCSDVersion, "") >= 0) 148 strcmp(osinfo.szCSDVersion, "") >= 0)
144 ) { 149 ) {
145 DWORD regval = 1; 150 DWORD regval = 1;
146 DWORD reglen = sizeof(DWORD); 151 DWORD reglen = sizeof(DWORD);
147 152
148 printf("Using Win2k (SP3+) / WinXP (No SP).. Checking SafeDllSearch\n"); 153 printf("Using Win2k (SP3+) / WinXP (No SP).. Checking SafeDllSearch\n");
149 read_reg_string(HKEY_LOCAL_MACHINE, 154 read_reg_string(HKEY_LOCAL_MACHINE,
150 "System\\CurrentControlSet\\Control\\Session Manager", 155 "System\\CurrentControlSet\\Control\\Session Manager",
151 "SafeDllSearchMode", 156 "SafeDllSearchMode",
152 (LPBYTE)&regval, 157 (LPBYTE) &regval,
153 &reglen); 158 &reglen);
154 159
155 if(regval != 0) { 160 if (regval != 0) {
156 printf("Trying to set SafeDllSearchMode to 0\n"); 161 printf("Trying to set SafeDllSearchMode to 0\n");
157 regval = 0; 162 regval = 0;
158 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, 163 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
159 "System\\CurrentControlSet\\Control\\Session Manager", 164 "System\\CurrentControlSet\\Control\\Session Manager",
160 0, KEY_SET_VALUE, &hkey) == ERROR_SUCCESS) { 165 0, KEY_SET_VALUE, &hkey
161 if(RegSetValueEx(hkey, 166 ) == ERROR_SUCCESS) {
162 "SafeDllSearchMode", 167 if (RegSetValueEx(hkey,
163 0, 168 "SafeDllSearchMode", 0,
164 REG_DWORD, 169 REG_DWORD, (LPBYTE) &regval,
165 (LPBYTE) &regval, 170 sizeof(DWORD)
166 sizeof(DWORD)) != ERROR_SUCCESS) 171 ) != ERROR_SUCCESS)
167 printf("Error writing SafeDllSearchMode. Error: %u\n", 172 printf("Error writing SafeDllSearchMode. Error: %u\n",
168 (UINT)GetLastError()); 173 (UINT) GetLastError());
169 RegCloseKey(hkey); 174 RegCloseKey(hkey);
170 } 175 } else
171 else 176 printf("Error opening Session Manager key for writing. Error: %u\n",
172 printf("Error opening Session Manager key for writing. Error: %u\n", 177 (UINT) GetLastError());
173 (UINT)GetLastError()); 178 } else
174 } 179 printf("SafeDllSearchMode is set to 0\n");
175 else 180 }/*end else*/
176 printf("SafeDllSearchMode is set to 0\n"); 181 }
177 }/*end else*/
178 }
179 } 182 }
180 183
181 static char* wgaim_lcid_to_posix(LCID lcid) { 184 static char* wgaim_lcid_to_posix(LCID lcid) {
182 switch(lcid) { 185 switch(lcid) {
183 case 1026: return "bg"; /* bulgarian */ 186 case 1026: return "bg"; /* bulgarian */
184 case 2125: return "my_MM"; /* burmese (Myanmar) */ 187 case 2125: return "my_MM"; /* burmese (Myanmar) */
185 case 1027: return "ca"; /* catalan */ 188 case 1027: return "ca"; /* catalan */
186 case 1050: return "hr"; /* croatian */ 189 case 1050: return "hr"; /* croatian */
187 case 1029: return "cs"; /* czech */ 190 case 1029: return "cs"; /* czech */
188 case 1030: return "da"; /* danish */ 191 case 1030: return "da"; /* danish */
189 case 1043: return "nl"; /* dutch - netherlands */ 192 case 1043: return "nl"; /* dutch - netherlands */
190 case 1033: return "en"; /* english - us */ 193 case 1033: return "en"; /* english - us */
191 case 3081: return "en_AU"; /* english - australia */ 194 case 3081: return "en_AU"; /* english - australia */
192 case 4105: return "en_CA"; /* english - canada */ 195 case 4105: return "en_CA"; /* english - canada */
193 case 2057: return "en_GB"; /* english - great britain */ 196 case 2057: return "en_GB"; /* english - great britain */
194 case 1035: return "fi"; /* finnish */ 197 case 1035: return "fi"; /* finnish */
195 case 1036: return "fr"; /* french - france */ 198 case 1036: return "fr"; /* french - france */
196 case 1031: return "de"; /* german - germany */ 199 case 1031: return "de"; /* german - germany */
197 case 1032: return "el"; /* greek */ 200 case 1032: return "el"; /* greek */
198 case 1037: return "he"; /* hebrew */ 201 case 1037: return "he"; /* hebrew */
199 case 1081: return "hi"; /* hindi */ 202 case 1081: return "hi"; /* hindi */
200 case 1038: return "hu"; /* hungarian */ 203 case 1038: return "hu"; /* hungarian */
201 case 1040: return "it"; /* italian - italy */ 204 case 1040: return "it"; /* italian - italy */
202 case 1041: return "ja"; /* japanese */ 205 case 1041: return "ja"; /* japanese */
203 case 1042: return "ko"; /* korean */ 206 case 1042: return "ko"; /* korean */
204 case 1063: return "lt"; /* lithuanian */ 207 case 1063: return "lt"; /* lithuanian */
205 case 1071: return "mk"; /* macedonian */ 208 case 1071: return "mk"; /* macedonian */
206 case 1044: return "no"; /* norwegian */ 209 case 1044: return "no"; /* norwegian */
207 case 1045: return "pl"; /* polish */ 210 case 1045: return "pl"; /* polish */
208 case 2070: return "pt"; /* portuguese - portugal */ 211 case 2070: return "pt"; /* portuguese - portugal */
209 case 1046: return "pt_BR"; /* portuguese - brazil */ 212 case 1046: return "pt_BR"; /* portuguese - brazil */
210 case 1048: return "ro"; /* romanian - romania */ 213 case 1048: return "ro"; /* romanian - romania */
211 case 1049: return "ru"; /* russian - russia */ 214 case 1049: return "ru"; /* russian - russia */
212 case 2074: return "sr@Latn"; /* serbian - latin */ 215 case 2074: return "sr@Latn"; /* serbian - latin */
213 case 3098: return "sr"; /* serbian - cyrillic */ 216 case 3098: return "sr"; /* serbian - cyrillic */
214 case 2052: return "zh_CN"; /* chinese - china (simple) */ 217 case 2052: return "zh_CN"; /* chinese - china (simple) */
215 case 1051: return "sk"; /* slovak */ 218 case 1051: return "sk"; /* slovak */
216 case 1060: return "sl"; /* slovenian */ 219 case 1060: return "sl"; /* slovenian */
217 case 1034: return "es"; /* spanish */ 220 case 1034: return "es"; /* spanish */
218 case 1052: return "sq"; /* albanian */ 221 case 1052: return "sq"; /* albanian */
219 case 1053: return "sv"; /* swedish */ 222 case 1053: return "sv"; /* swedish */
220 case 1054: return "th"; /* thai */ 223 case 1054: return "th"; /* thai */
221 case 1028: return "zh_TW"; /* chinese - taiwan (traditional) */ 224 case 1028: return "zh_TW"; /* chinese - taiwan (traditional) */
222 case 1055: return "tr"; /* turkish */ 225 case 1055: return "tr"; /* turkish */
223 case 1058: return "uk"; /* ukrainian */ 226 case 1058: return "uk"; /* ukrainian */
224 case 1066: return "vi"; /* vietnamese */ 227 case 1066: return "vi"; /* vietnamese */
225 default: 228 default: return NULL;
226 return NULL; 229 }
227 }
228 } 230 }
229 231
230 /* Determine and set Gaim locale as follows (in order of priority): 232 /* Determine and set Gaim locale as follows (in order of priority):
231 - Check GAIMLANG env var 233 - Check GAIMLANG env var
232 - Check NSIS Installer Language reg value 234 - Check NSIS Installer Language reg value
233 - Use default user locale 235 - Use default user locale
234 */ 236 */
235 static const char* wgaim_get_locale() { 237 static const char *wgaim_get_locale() {
236 const char* locale=NULL; 238 const char *locale = NULL;
237 char data[10]; 239 char data[10];
238 DWORD datalen = 10; 240 DWORD datalen = 10;
239 LCID lcid; 241 LCID lcid;
240 242
241 /* Check if user set GAIMLANG env var */ 243 /* Check if user set GAIMLANG env var */
242 if((locale = getenv("GAIMLANG"))) 244 if ((locale = getenv("GAIMLANG")))
243 return locale; 245 return locale;
244 246
245 if(read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\gaim", "Installer Language", (LPBYTE)&data, &datalen)) { 247 if (read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\gaim",
246 if((locale = wgaim_lcid_to_posix(atoi(data)))) 248 "Installer Language", (LPBYTE) &data, &datalen)) {
247 return locale; 249 if ((locale = wgaim_lcid_to_posix(atoi(data))))
248 } 250 return locale;
249 251 }
250 lcid = GetUserDefaultLCID(); 252
251 if((locale = wgaim_lcid_to_posix(lcid))) 253 lcid = GetUserDefaultLCID();
252 return locale; 254 if ((locale = wgaim_lcid_to_posix(lcid)))
253 255 return locale;
254 return "en"; 256
257 return "en";
255 } 258 }
256 259
257 static void wgaim_set_locale() { 260 static void wgaim_set_locale() {
258 const char* locale=NULL; 261 const char *locale = NULL;
259 char envstr[25]; 262 char envstr[25];
260 263
261 locale = wgaim_get_locale(); 264 locale = wgaim_get_locale();
262 265
263 snprintf(envstr, 25, "LANG=%s", locale); 266 snprintf(envstr, 25, "LANG=%s", locale);
264 printf("Setting locale: %s\n", envstr); 267 printf("Setting locale: %s\n", envstr);
265 putenv(envstr); 268 putenv(envstr);
266 } 269 }
267 270
268 static BOOL wgaim_set_running() { 271 static BOOL wgaim_set_running() {
269 HANDLE h; 272 HANDLE h;
270 273
271 if((h=CreateMutex(NULL, FALSE, "gaim_is_running"))) { 274 if ((h = CreateMutex(NULL, FALSE, "gaim_is_running"))) {
272 if(GetLastError() == ERROR_ALREADY_EXISTS) { 275 if (GetLastError() == ERROR_ALREADY_EXISTS) {
273 MessageBox(NULL, "An instance of Gaim is already running", NULL, MB_OK | MB_TOPMOST); 276 MessageBox(NULL,
277 "An instance of Gaim is already running",
278 NULL, MB_OK | MB_TOPMOST);
274 return FALSE; 279 return FALSE;
275 } 280 }
276 } 281 }
277 return TRUE; 282 return TRUE;
278 } 283 }
284 /* If the proxy server environment variables are already set, 289 /* If the proxy server environment variables are already set,
285 * we shouldn't override them */ 290 * we shouldn't override them */
286 if (getenv("HTTP_PROXY") || getenv("http_proxy") || getenv("HTTPPROXY")) 291 if (getenv("HTTP_PROXY") || getenv("http_proxy") || getenv("HTTPPROXY"))
287 return; 292 return;
288 293
289 if (read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY, "ProxyEnable", 294 if (read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY,
295 "ProxyEnable",
290 (LPBYTE) &regval, &reglen) && (regval & 1)) { 296 (LPBYTE) &regval, &reglen) && (regval & 1)) {
291 char proxy_server[2048]; 297 char proxy_server[2048];
292 char *c = NULL; 298 char *c = NULL;
293 reglen = sizeof(proxy_server); 299 reglen = sizeof(proxy_server);
294 300
295 if (!read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY , "ProxyServer", 301 if (!read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY,
296 (LPBYTE) &proxy_server, &reglen)) 302 "ProxyServer", (LPBYTE) &proxy_server, &reglen))
297 return; 303 return;
298 304
299 if ((reglen > strlen("http=")) && (c = strstr(proxy_server, "http="))) { 305 if ((reglen > strlen("http="))
306 && (c = strstr(proxy_server, "http="))) {
300 char *d; 307 char *d;
301 c += strlen("http="); 308 c += strlen("http=");
302 d = strchr(c, ';'); 309 d = strchr(c, ';');
303 if (d) { 310 if (d) {
304 *d = '\0'; 311 *d = '\0';
307 } 314 }
308 315
309 if (c) { 316 if (c) {
310 const char envstr_prefix[] = "HTTP_PROXY=http://"; 317 const char envstr_prefix[] = "HTTP_PROXY=http://";
311 char envstr[sizeof(envstr_prefix) + strlen(c) + 1]; 318 char envstr[sizeof(envstr_prefix) + strlen(c) + 1];
312 snprintf(envstr, sizeof(envstr), "%s%s", envstr_prefix, c); 319 snprintf(envstr, sizeof(envstr), "%s%s",
320 envstr_prefix, c);
313 printf("Setting HTTP Proxy: %s\n", envstr); 321 printf("Setting HTTP Proxy: %s\n", envstr);
314 putenv(envstr); 322 putenv(envstr);
315 } 323 }
316 } 324 }
317 325
322 # define _stdcall __attribute__((stdcall)) 330 # define _stdcall __attribute__((stdcall))
323 # endif 331 # endif
324 #endif 332 #endif
325 333
326 int _stdcall 334 int _stdcall
327 WinMain (struct HINSTANCE__ *hInstance, 335 WinMain (struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance,
328 struct HINSTANCE__ *hPrevInstance, 336 char *lpszCmdLine, int nCmdShow) {
329 char *lpszCmdLine, 337 char errbuf[512];
330 int nCmdShow) 338 char gaimdir[MAX_PATH];
331 { 339 HMODULE hmod;
332 char errbuf[512];
333 char gaimdir[MAX_PATH];
334 HMODULE hmod;
335 340
336 /* If debug or help or version flag used, create console for output */ 341 /* If debug or help or version flag used, create console for output */
337 if (strstr(lpszCmdLine, "-d") || strstr(lpszCmdLine, "-h") || strstr(lpszCmdLine, "-v")) { 342 if (strstr(lpszCmdLine, "-d") || strstr(lpszCmdLine, "-h") || strstr(lpszCmdLine, "-v")) {
338 LPFNATTACHCONSOLE MyAttachConsole = NULL; 343 LPFNATTACHCONSOLE MyAttachConsole = NULL;
339 if ((hmod = GetModuleHandle("kernel32.dll"))) { 344 if ((hmod = GetModuleHandle("kernel32.dll"))) {
344 if ((MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS)) 349 if ((MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS))
345 || AllocConsole()) 350 || AllocConsole())
346 freopen("CONOUT$", "w", stdout); 351 freopen("CONOUT$", "w", stdout);
347 } 352 }
348 353
349 /* Load exception handler if we have it */ 354 /* Load exception handler if we have it */
350 if(GetModuleFileName(NULL, gaimdir, MAX_PATH) != 0) { 355 if (GetModuleFileName(NULL, gaimdir, MAX_PATH) != 0) {
351 char *tmp = gaimdir; 356 char *tmp = gaimdir;
352 char *prev = NULL; 357 char *prev = NULL;
353 358
354 while((tmp=strchr(tmp, '\\'))) { 359 while ((tmp = strchr(tmp, '\\'))) {
355 prev = tmp; 360 prev = tmp;
356 tmp+=1; 361 tmp++;
357 } 362 }
358 if(prev) { 363
359 prev[0] = '\0'; 364 if (prev) {
360 strcat(gaimdir, "\\exchndl.dll"); 365 prev[0] = '\0';
361 if(LoadLibrary(gaimdir)) 366 strcat(gaimdir, "\\exchndl.dll");
362 printf("Loaded exchndl.dll\n"); 367 if (LoadLibrary(gaimdir))
363 } 368 printf("Loaded exchndl.dll\n");
364 } 369 }
365 else { 370 } else {
366 snprintf(errbuf, 512, "Error getting module filename. Error: %u", (UINT)GetLastError()); 371 snprintf(errbuf, 512,
367 MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); 372 "Error getting module filename. Error: %u",
368 } 373 (UINT) GetLastError());
369 374 MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST);
370 if(!getenv("GAIM_NO_DLL_CHECK")) 375 }
371 dll_prep(); 376
377 if (!getenv("GAIM_NO_DLL_CHECK"))
378 dll_prep();
372 379
373 wgaim_set_locale(); 380 wgaim_set_locale();
374 /* If help or version flag used, do not check Mutex */ 381 /* If help or version flag used, do not check Mutex */
375 if(!strstr(lpszCmdLine, "-h") && !strstr(lpszCmdLine, "-v")) 382 if (!strstr(lpszCmdLine, "-h") && !strstr(lpszCmdLine, "-v"))
376 if(!getenv("GAIM_MULTI_INST") && !wgaim_set_running()) 383 if (!getenv("GAIM_MULTI_INST") && !wgaim_set_running())
377 return 0; 384 return 0;
378 385
379 wgaim_set_proxy(); 386 wgaim_set_proxy();
380 387
381 /* Now we are ready for Gaim .. */ 388 /* Now we are ready for Gaim .. */
382 if((hmod=LoadLibrary("gaim.dll"))) { 389 if ((hmod = LoadLibrary("gaim.dll"))) {
383 gaim_main = (LPFNGAIMMAIN)GetProcAddress(hmod, "gaim_main"); 390 gaim_main = (LPFNGAIMMAIN) GetProcAddress(hmod, "gaim_main");
384 } 391 }
385 392
386 if(!gaim_main) { 393 if (!gaim_main) {
387 snprintf(errbuf, 512, "Error loading gaim.dll. Error: %u", (UINT)GetLastError()); 394 snprintf(errbuf, 512, "Error loading gaim.dll. Error: %u",
388 MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); 395 (UINT) GetLastError());
389 return 0; 396 MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST);
390 } 397 return 0;
391 else 398 }
392 return gaim_main (hInstance, __argc, __argv); 399
393 } 400 return gaim_main (hInstance, __argc, __argv);
394 401 }