comparison libpurple/win32/win32dep.c @ 15822:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents 8e08e961813c
children 4d3b54d818a0
comparison
equal deleted inserted replaced
15821:84b0f9b23ede 15822:32c366eeeb99
1 /* 1 /*
2 * gaim 2 * purple
3 * 3 *
4 * File: win32dep.c 4 * File: win32dep.c
5 * Date: June, 2002 5 * Date: June, 2002
6 * Description: Windows dependant code for Gaim 6 * Description: Windows dependant code for Purple
7 * 7 *
8 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com> 8 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
54 * LOCALS 54 * LOCALS
55 */ 55 */
56 static char *app_data_dir = NULL, *install_dir = NULL, 56 static char *app_data_dir = NULL, *install_dir = NULL,
57 *lib_dir = NULL, *locale_dir = NULL; 57 *lib_dir = NULL, *locale_dir = NULL;
58 58
59 static HINSTANCE libgaimdll_hInstance = 0; 59 static HINSTANCE libpurpledll_hInstance = 0;
60 60
61 static HANDLE proxy_change_event = NULL; 61 static HANDLE proxy_change_event = NULL;
62 static HKEY proxy_regkey = NULL; 62 static HKEY proxy_regkey = NULL;
63 63
64 /* 64 /*
67 67
68 /* Escape windows dir separators. This is needed when paths are saved, 68 /* Escape windows dir separators. This is needed when paths are saved,
69 and on being read back have their '\' chars used as an escape char. 69 and on being read back have their '\' chars used as an escape char.
70 Returns an allocated string which needs to be freed. 70 Returns an allocated string which needs to be freed.
71 */ 71 */
72 char *wgaim_escape_dirsep(const char *filename) { 72 char *wpurple_escape_dirsep(const char *filename) {
73 int sepcount = 0; 73 int sepcount = 0;
74 const char *tmp = filename; 74 const char *tmp = filename;
75 char *ret; 75 char *ret;
76 int cnt = 0; 76 int cnt = 0;
77 77
94 return ret; 94 return ret;
95 } 95 }
96 96
97 /* Determine whether the specified dll contains the specified procedure. 97 /* Determine whether the specified dll contains the specified procedure.
98 If so, load it (if not already loaded). */ 98 If so, load it (if not already loaded). */
99 FARPROC wgaim_find_and_loadproc(const char *dllname, const char *procedure) { 99 FARPROC wpurple_find_and_loadproc(const char *dllname, const char *procedure) {
100 HMODULE hmod; 100 HMODULE hmod;
101 BOOL did_load = FALSE; 101 BOOL did_load = FALSE;
102 FARPROC proc = 0; 102 FARPROC proc = 0;
103 103
104 if(!(hmod = GetModuleHandle(dllname))) { 104 if(!(hmod = GetModuleHandle(dllname))) {
105 gaim_debug_warning("wgaim", "%s not already loaded; loading it...\n", dllname); 105 purple_debug_warning("wpurple", "%s not already loaded; loading it...\n", dllname);
106 if(!(hmod = LoadLibrary(dllname))) { 106 if(!(hmod = LoadLibrary(dllname))) {
107 gaim_debug_error("wgaim", "Could not load: %s\n", dllname); 107 purple_debug_error("wpurple", "Could not load: %s\n", dllname);
108 return NULL; 108 return NULL;
109 } 109 }
110 else 110 else
111 did_load = TRUE; 111 did_load = TRUE;
112 } 112 }
113 113
114 if((proc = GetProcAddress(hmod, procedure))) { 114 if((proc = GetProcAddress(hmod, procedure))) {
115 gaim_debug_info("wgaim", "This version of %s contains %s\n", 115 purple_debug_info("wpurple", "This version of %s contains %s\n",
116 dllname, procedure); 116 dllname, procedure);
117 return proc; 117 return proc;
118 } 118 }
119 else { 119 else {
120 gaim_debug_warning("wgaim", "Function %s not found in dll %s\n", 120 purple_debug_warning("wpurple", "Function %s not found in dll %s\n",
121 procedure, dllname); 121 procedure, dllname);
122 if(did_load) { 122 if(did_load) {
123 /* unload dll */ 123 /* unload dll */
124 FreeLibrary(hmod); 124 FreeLibrary(hmod);
125 } 125 }
126 return NULL; 126 return NULL;
127 } 127 }
128 } 128 }
129 129
130 /* Determine Gaim Paths during Runtime */ 130 /* Determine Purple Paths during Runtime */
131 131
132 /* Get paths to special Windows folders. */ 132 /* Get paths to special Windows folders. */
133 char *wgaim_get_special_folder(int folder_type) { 133 char *wpurple_get_special_folder(int folder_type) {
134 static LPFNSHGETFOLDERPATHA MySHGetFolderPathA = NULL; 134 static LPFNSHGETFOLDERPATHA MySHGetFolderPathA = NULL;
135 static LPFNSHGETFOLDERPATHW MySHGetFolderPathW = NULL; 135 static LPFNSHGETFOLDERPATHW MySHGetFolderPathW = NULL;
136 char *retval = NULL; 136 char *retval = NULL;
137 137
138 if (!MySHGetFolderPathW) { 138 if (!MySHGetFolderPathW) {
139 MySHGetFolderPathW = (LPFNSHGETFOLDERPATHW) 139 MySHGetFolderPathW = (LPFNSHGETFOLDERPATHW)
140 wgaim_find_and_loadproc("shfolder.dll", "SHGetFolderPathW"); 140 wpurple_find_and_loadproc("shfolder.dll", "SHGetFolderPathW");
141 } 141 }
142 142
143 if (MySHGetFolderPathW) { 143 if (MySHGetFolderPathW) {
144 wchar_t utf_16_dir[MAX_PATH + 1]; 144 wchar_t utf_16_dir[MAX_PATH + 1];
145 145
150 } 150 }
151 151
152 if (!retval) { 152 if (!retval) {
153 if (!MySHGetFolderPathA) { 153 if (!MySHGetFolderPathA) {
154 MySHGetFolderPathA = (LPFNSHGETFOLDERPATHA) 154 MySHGetFolderPathA = (LPFNSHGETFOLDERPATHA)
155 wgaim_find_and_loadproc("shfolder.dll", "SHGetFolderPathA"); 155 wpurple_find_and_loadproc("shfolder.dll", "SHGetFolderPathA");
156 } 156 }
157 if (MySHGetFolderPathA) { 157 if (MySHGetFolderPathA) {
158 char locale_dir[MAX_PATH + 1]; 158 char locale_dir[MAX_PATH + 1];
159 159
160 if (SUCCEEDED(MySHGetFolderPathA(NULL, folder_type, NULL, 160 if (SUCCEEDED(MySHGetFolderPathA(NULL, folder_type, NULL,
165 } 165 }
166 166
167 return retval; 167 return retval;
168 } 168 }
169 169
170 const char *wgaim_install_dir(void) { 170 const char *wpurple_install_dir(void) {
171 static gboolean initialized = FALSE; 171 static gboolean initialized = FALSE;
172 172
173 if (!initialized) { 173 if (!initialized) {
174 char *tmp = NULL; 174 char *tmp = NULL;
175 if (G_WIN32_HAVE_WIDECHAR_API()) { 175 if (G_WIN32_HAVE_WIDECHAR_API()) {
188 } 188 }
189 } 189 }
190 190
191 if (tmp == NULL) { 191 if (tmp == NULL) {
192 tmp = g_win32_error_message(GetLastError()); 192 tmp = g_win32_error_message(GetLastError());
193 gaim_debug_error("wgaim", 193 purple_debug_error("wpurple",
194 "GetModuleFileName error: %s\n", tmp); 194 "GetModuleFileName error: %s\n", tmp);
195 g_free(tmp); 195 g_free(tmp);
196 return NULL; 196 return NULL;
197 } else { 197 } else {
198 install_dir = g_path_get_dirname(tmp); 198 install_dir = g_path_get_dirname(tmp);
202 } 202 }
203 203
204 return install_dir; 204 return install_dir;
205 } 205 }
206 206
207 const char *wgaim_lib_dir(void) { 207 const char *wpurple_lib_dir(void) {
208 static gboolean initialized = FALSE; 208 static gboolean initialized = FALSE;
209 209
210 if (!initialized) { 210 if (!initialized) {
211 const char *inst_dir = wgaim_install_dir(); 211 const char *inst_dir = wpurple_install_dir();
212 if (inst_dir != NULL) { 212 if (inst_dir != NULL) {
213 lib_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "plugins", inst_dir); 213 lib_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "plugins", inst_dir);
214 initialized = TRUE; 214 initialized = TRUE;
215 } else { 215 } else {
216 return NULL; 216 return NULL;
218 } 218 }
219 219
220 return lib_dir; 220 return lib_dir;
221 } 221 }
222 222
223 const char *wgaim_locale_dir(void) { 223 const char *wpurple_locale_dir(void) {
224 static gboolean initialized = FALSE; 224 static gboolean initialized = FALSE;
225 225
226 if (!initialized) { 226 if (!initialized) {
227 const char *inst_dir = wgaim_install_dir(); 227 const char *inst_dir = wpurple_install_dir();
228 if (inst_dir != NULL) { 228 if (inst_dir != NULL) {
229 locale_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "locale", inst_dir); 229 locale_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "locale", inst_dir);
230 initialized = TRUE; 230 initialized = TRUE;
231 } else { 231 } else {
232 return NULL; 232 return NULL;
234 } 234 }
235 235
236 return locale_dir; 236 return locale_dir;
237 } 237 }
238 238
239 const char *wgaim_data_dir(void) { 239 const char *wpurple_data_dir(void) {
240 240
241 if (!app_data_dir) { 241 if (!app_data_dir) {
242 /* Set app data dir, used by gaim_home_dir */ 242 /* Set app data dir, used by purple_home_dir */
243 const char *newenv = g_getenv("GAIMHOME"); 243 const char *newenv = g_getenv("PURPLEHOME");
244 if (newenv) 244 if (newenv)
245 app_data_dir = g_strdup(newenv); 245 app_data_dir = g_strdup(newenv);
246 else { 246 else {
247 app_data_dir = wgaim_get_special_folder(CSIDL_APPDATA); 247 app_data_dir = wpurple_get_special_folder(CSIDL_APPDATA);
248 if (!app_data_dir) 248 if (!app_data_dir)
249 app_data_dir = g_strdup("C:"); 249 app_data_dir = g_strdup("C:");
250 } 250 }
251 gaim_debug_info("wgaim", "Gaim settings dir: %s\n", 251 purple_debug_info("wpurple", "Purple settings dir: %s\n",
252 app_data_dir); 252 app_data_dir);
253 } 253 }
254 254
255 return app_data_dir; 255 return app_data_dir;
256 } 256 }
257 257
258 /* Miscellaneous */ 258 /* Miscellaneous */
259 259
260 gboolean wgaim_write_reg_string(HKEY rootkey, const char *subkey, const char *valname, 260 gboolean wpurple_write_reg_string(HKEY rootkey, const char *subkey, const char *valname,
261 const char *value) { 261 const char *value) {
262 HKEY reg_key; 262 HKEY reg_key;
263 gboolean success = FALSE; 263 gboolean success = FALSE;
264 264
265 if(G_WIN32_HAVE_WIDECHAR_API()) { 265 if(G_WIN32_HAVE_WIDECHAR_API()) {
340 g_free(cp_subkey); 340 g_free(cp_subkey);
341 } 341 }
342 342
343 if (rv != ERROR_SUCCESS) { 343 if (rv != ERROR_SUCCESS) {
344 char *errmsg = g_win32_error_message(rv); 344 char *errmsg = g_win32_error_message(rv);
345 gaim_debug_info("wgaim", "Could not open reg key '%s' subkey '%s'.\nMessage: (%ld) %s\n", 345 purple_debug_info("wpurple", "Could not open reg key '%s' subkey '%s'.\nMessage: (%ld) %s\n",
346 ((rootkey == HKEY_LOCAL_MACHINE) ? "HKLM" : 346 ((rootkey == HKEY_LOCAL_MACHINE) ? "HKLM" :
347 (rootkey == HKEY_CURRENT_USER) ? "HKCU" : 347 (rootkey == HKEY_CURRENT_USER) ? "HKCU" :
348 (rootkey == HKEY_CLASSES_ROOT) ? "HKCR" : "???"), 348 (rootkey == HKEY_CLASSES_ROOT) ? "HKCR" : "???"),
349 subkey, rv, errmsg); 349 subkey, rv, errmsg);
350 g_free(errmsg); 350 g_free(errmsg);
370 g_free(cp_valname); 370 g_free(cp_valname);
371 } 371 }
372 372
373 if (rv != ERROR_SUCCESS) { 373 if (rv != ERROR_SUCCESS) {
374 char *errmsg = g_win32_error_message(rv); 374 char *errmsg = g_win32_error_message(rv);
375 gaim_debug_info("wgaim", "Could not read from reg key value '%s'.\nMessage: (%ld) %s\n", 375 purple_debug_info("wpurple", "Could not read from reg key value '%s'.\nMessage: (%ld) %s\n",
376 valname, rv, errmsg); 376 valname, rv, errmsg);
377 g_free(errmsg); 377 g_free(errmsg);
378 } 378 }
379 379
380 return (rv == ERROR_SUCCESS); 380 return (rv == ERROR_SUCCESS);
381 } 381 }
382 382
383 gboolean wgaim_read_reg_dword(HKEY rootkey, const char *subkey, const char *valname, LPDWORD result) { 383 gboolean wpurple_read_reg_dword(HKEY rootkey, const char *subkey, const char *valname, LPDWORD result) {
384 384
385 DWORD type; 385 DWORD type;
386 DWORD nbytes; 386 DWORD nbytes;
387 HKEY reg_key = _reg_open_key(rootkey, subkey, KEY_QUERY_VALUE); 387 HKEY reg_key = _reg_open_key(rootkey, subkey, KEY_QUERY_VALUE);
388 gboolean success = FALSE; 388 gboolean success = FALSE;
394 } 394 }
395 395
396 return success; 396 return success;
397 } 397 }
398 398
399 char *wgaim_read_reg_string(HKEY rootkey, const char *subkey, const char *valname) { 399 char *wpurple_read_reg_string(HKEY rootkey, const char *subkey, const char *valname) {
400 400
401 DWORD type; 401 DWORD type;
402 DWORD nbytes; 402 DWORD nbytes;
403 HKEY reg_key = _reg_open_key(rootkey, subkey, KEY_QUERY_VALUE); 403 HKEY reg_key = _reg_open_key(rootkey, subkey, KEY_QUERY_VALUE);
404 char *result = NULL; 404 char *result = NULL;
430 } 430 }
431 431
432 return result; 432 return result;
433 } 433 }
434 434
435 static void wgaim_refresh_proxy(void) { 435 static void wpurple_refresh_proxy(void) {
436 gboolean set_proxy = FALSE; 436 gboolean set_proxy = FALSE;
437 DWORD enabled = 0; 437 DWORD enabled = 0;
438 438
439 wgaim_read_reg_dword(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY, 439 wpurple_read_reg_dword(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY,
440 "ProxyEnable", &enabled); 440 "ProxyEnable", &enabled);
441 441
442 if (enabled & 1) { 442 if (enabled & 1) {
443 char *c = NULL; 443 char *c = NULL;
444 char *tmp = wgaim_read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY, 444 char *tmp = wpurple_read_reg_string(HKEY_CURRENT_USER, WIN32_PROXY_REGKEY,
445 "ProxyServer"); 445 "ProxyServer");
446 446
447 /* There are proxy settings for several protocols */ 447 /* There are proxy settings for several protocols */
448 if (tmp && (c = g_strstr_len(tmp, strlen(tmp), "http="))) { 448 if (tmp && (c = g_strstr_len(tmp, strlen(tmp), "http="))) {
449 char *d; 449 char *d;
457 } else if (tmp && strlen(tmp) > 0 && !strchr(tmp, ';')) { 457 } else if (tmp && strlen(tmp) > 0 && !strchr(tmp, ';')) {
458 c = tmp; 458 c = tmp;
459 } 459 }
460 460
461 if (c) { 461 if (c) {
462 gaim_debug_info("wgaim", "Setting HTTP Proxy: 'http://%s'\n", c); 462 purple_debug_info("wpurple", "Setting HTTP Proxy: 'http://%s'\n", c);
463 g_setenv("HTTP_PROXY", c, TRUE); 463 g_setenv("HTTP_PROXY", c, TRUE);
464 set_proxy = TRUE; 464 set_proxy = TRUE;
465 } 465 }
466 g_free(tmp); 466 g_free(tmp);
467 } 467 }
468 468
469 /* If there previously was a proxy set and there isn't one now, clear it */ 469 /* If there previously was a proxy set and there isn't one now, clear it */
470 if (getenv("HTTP_PROXY") && !set_proxy) { 470 if (getenv("HTTP_PROXY") && !set_proxy) {
471 gaim_debug_info("wgaim", "Clearing HTTP Proxy\n"); 471 purple_debug_info("wpurple", "Clearing HTTP Proxy\n");
472 g_unsetenv("HTTP_PROXY"); 472 g_unsetenv("HTTP_PROXY");
473 } 473 }
474 } 474 }
475 475
476 static void watch_for_proxy_changes(void) { 476 static void watch_for_proxy_changes(void) {
484 return; 484 return;
485 } 485 }
486 486
487 if (!(proxy_change_event = CreateEvent(NULL, TRUE, FALSE, NULL))) { 487 if (!(proxy_change_event = CreateEvent(NULL, TRUE, FALSE, NULL))) {
488 char *errmsg = g_win32_error_message(GetLastError()); 488 char *errmsg = g_win32_error_message(GetLastError());
489 gaim_debug_error("wgaim", "Unable to watch for proxy changes: %s\n", errmsg); 489 purple_debug_error("wpurple", "Unable to watch for proxy changes: %s\n", errmsg);
490 g_free(errmsg); 490 g_free(errmsg);
491 return; 491 return;
492 } 492 }
493 493
494 rv = RegNotifyChangeKeyValue(proxy_regkey, TRUE, filter, proxy_change_event, TRUE); 494 rv = RegNotifyChangeKeyValue(proxy_regkey, TRUE, filter, proxy_change_event, TRUE);
495 if (rv != ERROR_SUCCESS) { 495 if (rv != ERROR_SUCCESS) {
496 char *errmsg = g_win32_error_message(rv); 496 char *errmsg = g_win32_error_message(rv);
497 gaim_debug_error("wgaim", "Unable to watch for proxy changes: %s\n", errmsg); 497 purple_debug_error("wpurple", "Unable to watch for proxy changes: %s\n", errmsg);
498 g_free(errmsg); 498 g_free(errmsg);
499 CloseHandle(proxy_change_event); 499 CloseHandle(proxy_change_event);
500 proxy_change_event = NULL; 500 proxy_change_event = NULL;
501 } 501 }
502 502
503 } 503 }
504 504
505 gboolean wgaim_check_for_proxy_changes(void) { 505 gboolean wpurple_check_for_proxy_changes(void) {
506 gboolean changed = FALSE; 506 gboolean changed = FALSE;
507 507
508 if (proxy_change_event && WaitForSingleObject(proxy_change_event, 0) == WAIT_OBJECT_0) { 508 if (proxy_change_event && WaitForSingleObject(proxy_change_event, 0) == WAIT_OBJECT_0) {
509 CloseHandle(proxy_change_event); 509 CloseHandle(proxy_change_event);
510 proxy_change_event = NULL; 510 proxy_change_event = NULL;
511 changed = TRUE; 511 changed = TRUE;
512 wgaim_refresh_proxy(); 512 wpurple_refresh_proxy();
513 watch_for_proxy_changes(); 513 watch_for_proxy_changes();
514 } 514 }
515 515
516 return changed; 516 return changed;
517 } 517 }
518 518
519 void wgaim_init(void) { 519 void wpurple_init(void) {
520 WORD wVersionRequested; 520 WORD wVersionRequested;
521 WSADATA wsaData; 521 WSADATA wsaData;
522 const char *perlenv; 522 const char *perlenv;
523 char *newenv; 523 char *newenv;
524 524
525 gaim_debug_info("wgaim", "wgaim_init start\n"); 525 purple_debug_info("wpurple", "wpurple_init start\n");
526 gaim_debug_info("wgaim", "libgaim version: " VERSION "\n"); 526 purple_debug_info("wpurple", "libpurple version: " VERSION "\n");
527 527
528 528
529 gaim_debug_info("wgaim", "Glib:%u.%u.%u\n", 529 purple_debug_info("wpurple", "Glib:%u.%u.%u\n",
530 glib_major_version, glib_minor_version, glib_micro_version); 530 glib_major_version, glib_minor_version, glib_micro_version);
531 531
532 /* Winsock init */ 532 /* Winsock init */
533 wVersionRequested = MAKEWORD(2, 2); 533 wVersionRequested = MAKEWORD(2, 2);
534 WSAStartup(wVersionRequested, &wsaData); 534 WSAStartup(wVersionRequested, &wsaData);
536 /* Confirm that the winsock DLL supports 2.2 */ 536 /* Confirm that the winsock DLL supports 2.2 */
537 /* Note that if the DLL supports versions greater than 537 /* Note that if the DLL supports versions greater than
538 2.2 in addition to 2.2, it will still return 2.2 in 538 2.2 in addition to 2.2, it will still return 2.2 in
539 wVersion since that is the version we requested. */ 539 wVersion since that is the version we requested. */
540 if(LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) { 540 if(LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) {
541 gaim_debug_error("wgaim", "Could not find a usable WinSock DLL. Oh well.\n"); 541 purple_debug_error("wpurple", "Could not find a usable WinSock DLL. Oh well.\n");
542 WSACleanup(); 542 WSACleanup();
543 } 543 }
544 544
545 /* Set Environmental Variables */ 545 /* Set Environmental Variables */
546 /* Tell perl where to find Gaim's perl modules */ 546 /* Tell perl where to find Purple's perl modules */
547 perlenv = g_getenv("PERL5LIB"); 547 perlenv = g_getenv("PERL5LIB");
548 newenv = g_strdup_printf("%s%s%s" G_DIR_SEPARATOR_S "perlmod;", 548 newenv = g_strdup_printf("%s%s%s" G_DIR_SEPARATOR_S "perlmod;",
549 perlenv ? perlenv : "", 549 perlenv ? perlenv : "",
550 perlenv ? ";" : "", 550 perlenv ? ";" : "",
551 wgaim_install_dir()); 551 wpurple_install_dir());
552 if (!g_setenv("PERL5LIB", newenv, TRUE)) 552 if (!g_setenv("PERL5LIB", newenv, TRUE))
553 gaim_debug_warning("wgaim", "putenv failed for PERL5LIB\n"); 553 purple_debug_warning("wpurple", "putenv failed for PERL5LIB\n");
554 g_free(newenv); 554 g_free(newenv);
555 555
556 if (!g_thread_supported()) 556 if (!g_thread_supported())
557 g_thread_init(NULL); 557 g_thread_init(NULL);
558 558
559 /* If the proxy server environment variables are already set, 559 /* If the proxy server environment variables are already set,
560 * we shouldn't override them */ 560 * we shouldn't override them */
561 if (!getenv("HTTP_PROXY") && !getenv("http_proxy") && !getenv("HTTPPROXY")) { 561 if (!getenv("HTTP_PROXY") && !getenv("http_proxy") && !getenv("HTTPPROXY")) {
562 wgaim_refresh_proxy(); 562 wpurple_refresh_proxy();
563 watch_for_proxy_changes(); 563 watch_for_proxy_changes();
564 } else { 564 } else {
565 gaim_debug_info("wgaim", "HTTP_PROXY env. var already set. Ignoring win32 Internet Settings.\n"); 565 purple_debug_info("wpurple", "HTTP_PROXY env. var already set. Ignoring win32 Internet Settings.\n");
566 } 566 }
567 567
568 gaim_debug_info("wgaim", "wgaim_init end\n"); 568 purple_debug_info("wpurple", "wpurple_init end\n");
569 } 569 }
570 570
571 /* Windows Cleanup */ 571 /* Windows Cleanup */
572 572
573 void wgaim_cleanup(void) { 573 void wpurple_cleanup(void) {
574 gaim_debug_info("wgaim", "wgaim_cleanup\n"); 574 purple_debug_info("wpurple", "wpurple_cleanup\n");
575 575
576 /* winsock cleanup */ 576 /* winsock cleanup */
577 WSACleanup(); 577 WSACleanup();
578 578
579 g_free(app_data_dir); 579 g_free(app_data_dir);
582 if (proxy_regkey) { 582 if (proxy_regkey) {
583 RegCloseKey(proxy_regkey); 583 RegCloseKey(proxy_regkey);
584 proxy_regkey = NULL; 584 proxy_regkey = NULL;
585 } 585 }
586 586
587 libgaimdll_hInstance = NULL; 587 libpurpledll_hInstance = NULL;
588 } 588 }
589 589
590 /* DLL initializer */ 590 /* DLL initializer */
591 /* suppress gcc "no previous prototype" warning */ 591 /* suppress gcc "no previous prototype" warning */
592 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); 592 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
593 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { 593 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
594 libgaimdll_hInstance = hinstDLL; 594 libpurpledll_hInstance = hinstDLL;
595 return TRUE; 595 return TRUE;
596 } 596 }