Mercurial > pidgin.yaz
annotate src/win32/win32dep.c @ 11323:caec745e390e
[gaim-migrate @ 13528]
This fixes issues that were happening when wingaim was installed in a non-ASCII path. I can't believe that I didn't notice this before.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Sun, 21 Aug 2005 20:13:22 +0000 |
parents | bb0d7b719af2 |
children | 9f6df41df587 |
rev | line source |
---|---|
3630 | 1 /* |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
2 * gaim |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
3 * |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
4 * File: win32dep.c |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
5 * Date: June, 2002 |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
6 * Description: Windows dependant code for Gaim |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
7 * |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
8 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com> |
3630 | 9 * |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
13 * (at your option) any later version. |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
14 * |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
18 * GNU General Public License for more details. |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
19 * |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
23 * |
3630 | 24 */ |
25 #include <windows.h> | |
6425
26b739bc9f1a
[gaim-migrate @ 6933]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6423
diff
changeset
|
26 #include <io.h> |
3630 | 27 #include <stdlib.h> |
28 #include <stdio.h> | |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
29 #include <winuser.h> |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
30 |
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
31 #include <gtk/gtk.h> |
3630 | 32 #include <glib.h> |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
33 #include <glib/gstdio.h> |
3973
d9287e87ba56
[gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3950
diff
changeset
|
34 #include <gdk/gdkwin32.h> |
4097
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
35 |
3630 | 36 #include "gaim.h" |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
37 #include "debug.h" |
6929
906567be99b2
[gaim-migrate @ 7476]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
38 #include "notify.h" |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
39 |
3630 | 40 #include "stdafx.h" |
41 #include "resource.h" | |
3950
c25cf0495533
[gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
42 #include "MinimizeToTray.h" |
3973
d9287e87ba56
[gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3950
diff
changeset
|
43 #include "winuser_extra.h" |
4535
de9f45c815df
[gaim-migrate @ 4814]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4411
diff
changeset
|
44 #include "idletrack.h" |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
45 #include "zlib.h" |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
46 #include "untar.h" |
3630 | 47 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
48 #include <libintl.h> |
5913
9657e243d001
[gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5854
diff
changeset
|
49 |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
50 #include "win32dep.h" |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
51 |
3630 | 52 /* |
53 * DEFINES & MACROS | |
54 */ | |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
55 #define _(x) gettext(x) |
3950
c25cf0495533
[gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
56 |
3630 | 57 /* |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
58 * DATA STRUCTS |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
59 */ |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
60 |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
61 /* For shfolder.dll */ |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
62 typedef HRESULT (CALLBACK* LPFNSHGETFOLDERPATHA)(HWND, int, HANDLE, DWORD, LPSTR); |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
63 typedef HRESULT (CALLBACK* LPFNSHGETFOLDERPATHW)(HWND, int, HANDLE, DWORD, LPWSTR); |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
64 |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
65 typedef enum { |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
66 SHGFP_TYPE_CURRENT = 0, // current value for user, verify it exists |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
67 SHGFP_TYPE_DEFAULT = 1, // default value, may not exist |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
68 } SHGFP_TYPE; |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
69 |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
70 /* |
3630 | 71 * LOCALS |
72 */ | |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
73 static char *app_data_dir, *install_dir, *lib_dir, *locale_dir; |
3950
c25cf0495533
[gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
74 |
3630 | 75 /* |
76 * GLOBALS | |
77 */ | |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
78 HINSTANCE gaimexe_hInstance = 0; |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
79 HINSTANCE gaimdll_hInstance = 0; |
3630 | 80 |
81 /* | |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
82 * PROTOS |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
83 */ |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
84 |
4097
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
85 FARPROC wgaim_find_and_loadproc(char*, char*); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
86 extern void wgaim_gtkspell_init(); |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
87 char* wgaim_data_dir(void); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
88 |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
89 /* |
3630 | 90 * STATIC CODE |
91 */ | |
92 | |
7526
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
93 static void wgaim_debug_print(GaimDebugLevel level, const char *category, const char *format, va_list args) { |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
94 char *str = NULL; |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
95 if (args != NULL) { |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
96 str = g_strdup_vprintf(format, args); |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
97 } else { |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
98 str = g_strdup(format); |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
99 } |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
100 printf("%s%s%s", category?category:"", category?": ":"",str); |
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
101 g_free(str); |
7526
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
102 } |
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
103 |
7803
ec291c2cad6a
[gaim-migrate @ 8449]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7606
diff
changeset
|
104 static GaimDebugUiOps ops = { |
7526
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
105 wgaim_debug_print |
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
106 }; |
77727178a1df
[gaim-migrate @ 8139]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7523
diff
changeset
|
107 |
4097
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
108 /* |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
109 * PUBLIC CODE |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
110 */ |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
111 |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
112 HINSTANCE wgaim_hinstance(void) { |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
113 return gaimexe_hInstance; |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
114 } |
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
115 |
4406
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
116 /* Escape windows dir separators. This is needed when paths are saved, |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
117 and on being read back have their '\' chars used as an escape char. |
4555
75f75ef235e4
[gaim-migrate @ 4835]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4535
diff
changeset
|
118 Returns an allocated string which needs to be freed. |
4406
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
119 */ |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
120 char* wgaim_escape_dirsep( char* filename ) { |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
121 int sepcount=0; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
122 char* ret=NULL; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
123 int cnt=0; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
124 |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
125 ret = filename; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
126 while(*ret) { |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
127 if(*ret == '\\') |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
128 sepcount++; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
129 ret++; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
130 } |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
131 ret = g_malloc0(strlen(filename) + sepcount + 1); |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
132 while(*filename) { |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
133 ret[cnt] = *filename; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
134 if(*filename == '\\') |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
135 ret[++cnt] = '\\'; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
136 filename++; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
137 cnt++; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
138 } |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
139 ret[cnt] = '\0'; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
140 return ret; |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
141 } |
217572342740
[gaim-migrate @ 4675]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4168
diff
changeset
|
142 |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
143 /* Determine whether the specified dll contains the specified procedure. |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
144 If so, load it (if not already loaded). */ |
4097
929d23ef2ded
[gaim-migrate @ 4312]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4042
diff
changeset
|
145 FARPROC wgaim_find_and_loadproc( char* dllname, char* procedure ) { |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
146 HMODULE hmod; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
147 int did_load=0; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
148 FARPROC proc = 0; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
149 |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
150 if(!(hmod=GetModuleHandle(dllname))) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
151 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "%s not found. Loading it..\n", dllname); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
152 if(!(hmod = LoadLibrary(dllname))) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
153 gaim_debug(GAIM_DEBUG_ERROR, "wgaim", "Could not load: %s\n", dllname); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
154 return NULL; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
155 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
156 else |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
157 did_load = 1; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
158 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
159 |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
160 if((proc=GetProcAddress(hmod, procedure))) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
161 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "This version of %s contains %s\n", |
4555
75f75ef235e4
[gaim-migrate @ 4835]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4535
diff
changeset
|
162 dllname, procedure); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
163 return proc; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
164 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
165 else { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
166 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "Function %s not found in dll %s\n", |
4555
75f75ef235e4
[gaim-migrate @ 4835]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4535
diff
changeset
|
167 procedure, dllname); |
3983
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
168 if(did_load) { |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
169 /* unload dll */ |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
170 FreeLibrary(hmod); |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
171 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
172 return NULL; |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
173 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
174 } |
a1245dcf7b31
[gaim-migrate @ 4174]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3973
diff
changeset
|
175 |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
176 /* Determine Gaim Paths during Runtime */ |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
177 |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
178 /* Get paths to special Windows folders. */ |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
179 char *wgaim_get_special_folder(int folder_type) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
180 static LPFNSHGETFOLDERPATHA MySHGetFolderPathA = NULL; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
181 char *retval = NULL; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
182 #if GLIB_CHECK_VERSION(2,6,0) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
183 static LPFNSHGETFOLDERPATHW MySHGetFolderPathW = NULL; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
184 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
185 if (!MySHGetFolderPathW) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
186 MySHGetFolderPathW = (LPFNSHGETFOLDERPATHW) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
187 wgaim_find_and_loadproc("shfolder.dll", "SHGetFolderPathW"); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
188 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
189 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
190 if (MySHGetFolderPathW) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
191 wchar_t utf_16_dir[MAX_PATH + 1]; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
192 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
193 if (SUCCEEDED(MySHGetFolderPathW(NULL, folder_type, NULL, |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
194 SHGFP_TYPE_CURRENT, utf_16_dir))) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
195 retval = g_utf16_to_utf8(utf_16_dir, -1, NULL, NULL, NULL); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
196 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
197 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
198 #endif |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
199 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
200 if (!retval) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
201 if (!MySHGetFolderPathA) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
202 MySHGetFolderPathA = (LPFNSHGETFOLDERPATHA) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
203 wgaim_find_and_loadproc("shfolder.dll", "SHGetFolderPathA"); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
204 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
205 if (MySHGetFolderPathA) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
206 char locale_dir[MAX_PATH + 1]; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
207 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
208 if (SUCCEEDED(MySHGetFolderPathA(NULL, folder_type, NULL, |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
209 SHGFP_TYPE_CURRENT, locale_dir))) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
210 #if GLIB_CHECK_VERSION(2,6,0) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
211 retval = g_locale_to_utf8(locale_dir, -1, NULL, NULL, NULL); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
212 #else |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
213 retval = g_strdup(locale_dir); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
214 #endif |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
215 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
216 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
217 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
218 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
219 return retval; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
220 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
221 |
3630 | 222 char* wgaim_install_dir(void) { |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
223 static gboolean initialized = FALSE; |
3630 | 224 |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
225 if (!initialized) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
226 char *tmp = NULL; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
227 if (G_WIN32_HAVE_WIDECHAR_API()) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
228 wchar_t winstall_dir[MAXPATHLEN]; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
229 if (GetModuleFileNameW(NULL, winstall_dir, |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
230 MAXPATHLEN) > 0) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
231 tmp = g_utf16_to_utf8(winstall_dir, -1, |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
232 NULL, NULL, NULL); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
233 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
234 } else { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
235 gchar cpinstall_dir[MAXPATHLEN]; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
236 if (GetModuleFileNameA(NULL, cpinstall_dir, |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
237 MAXPATHLEN) > 0) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
238 tmp = g_locale_to_utf8(cpinstall_dir, |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
239 -1, NULL, NULL, NULL); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
240 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
241 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
242 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
243 if (tmp == NULL) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
244 tmp = g_win32_error_message(GetLastError()); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
245 gaim_debug(GAIM_DEBUG_ERROR, "wgaim", |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
246 "GetModuleFileName error: %s\n", tmp); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
247 g_free(tmp); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
248 return NULL; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
249 } else { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
250 install_dir = g_path_get_dirname(tmp); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
251 g_free(tmp); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
252 initialized = TRUE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
253 } |
3630 | 254 } |
255 | |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
256 return install_dir; |
3630 | 257 } |
258 | |
259 char* wgaim_lib_dir(void) { | |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
260 static gboolean initialized = FALSE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
261 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
262 if (!initialized) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
263 char *inst_dir = wgaim_install_dir(); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
264 if (inst_dir != NULL) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
265 lib_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "plugins", inst_dir); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
266 initialized = TRUE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
267 } else { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
268 return NULL; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
269 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
270 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
271 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
272 return lib_dir; |
3630 | 273 } |
274 | |
275 char* wgaim_locale_dir(void) { | |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
276 static gboolean initialized = FALSE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
277 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
278 if (!initialized) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
279 char *inst_dir = wgaim_install_dir(); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
280 if (inst_dir != NULL) { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
281 locale_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "locale", inst_dir); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
282 initialized = TRUE; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
283 } else { |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
284 return NULL; |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
285 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
286 } |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
287 |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
288 return locale_dir; |
3630 | 289 } |
290 | |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
291 char* wgaim_data_dir(void) { |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
292 return app_data_dir; |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
293 } |
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
294 |
3973
d9287e87ba56
[gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3950
diff
changeset
|
295 /* Miscellaneous */ |
d9287e87ba56
[gaim-migrate @ 4157]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3950
diff
changeset
|
296 |
6437
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
297 gboolean wgaim_read_reg_string(HKEY key, char* sub_key, char* val_name, LPBYTE data, LPDWORD data_len) { |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
298 HKEY hkey; |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
299 gboolean ret = FALSE; |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
300 |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
301 if(ERROR_SUCCESS == RegOpenKeyEx(key, |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
302 sub_key, |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
303 0, KEY_QUERY_VALUE, &hkey)) { |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
304 if(ERROR_SUCCESS == RegQueryValueEx(hkey, val_name, 0, NULL, data, data_len)) |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
305 ret = TRUE; |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
306 RegCloseKey(key); |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
307 } |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
308 return ret; |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
309 } |
ae4c3abbaac1
[gaim-migrate @ 6945]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6425
diff
changeset
|
310 |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
311 int wgaim_gz_decompress(const char* in, const char* out) { |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
312 gzFile fin; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
313 FILE *fout; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
314 char buf[1024]; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
315 int ret; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
316 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
317 if((fin = gzopen(in, "rb"))) { |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
318 if(!(fout = g_fopen(out, "wb"))) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
319 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "Error opening file: %s\n", out); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
320 gzclose(fin); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
321 return 0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
322 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
323 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
324 else { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
325 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "gzopen failed to open: %s\n", in); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
326 return 0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
327 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
328 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
329 while((ret=gzread(fin, buf, 1024))) { |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
330 if(fwrite(buf, 1, ret, fout) < ret) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
331 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "Error writing %d bytes to file\n", ret); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
332 gzclose(fin); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
333 fclose(fout); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
334 return 0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
335 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
336 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
337 fclose(fout); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
338 gzclose(fin); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
339 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
340 if(ret < 0) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
341 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_decompress", "gzread failed while reading: %s\n", in); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
342 return 0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
343 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
344 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
345 return 1; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
346 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
347 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
348 int wgaim_gz_untar(const char* filename, const char* destdir) { |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
349 char tmpfile[_MAX_PATH]; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
350 char template[]="wgaimXXXXXX"; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
351 |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
352 sprintf(tmpfile, "%s%s%s", g_get_tmp_dir(), G_DIR_SEPARATOR_S, _mktemp(template)); |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
353 if(wgaim_gz_decompress(filename, tmpfile)) { |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
354 int ret; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
355 if(untar(tmpfile, destdir, UNTAR_FORCE | UNTAR_QUIET)) |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
356 ret=1; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
357 else { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
358 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_untar", "Failure untaring %s\n", tmpfile); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
359 ret=0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
360 } |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
361 g_unlink(tmpfile); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
362 return ret; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
363 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
364 else { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
365 gaim_debug(GAIM_DEBUG_ERROR, "wgaim_gz_untar", "Failed to gz decompress %s\n", filename); |
5008
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
366 return 0; |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
367 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
368 } |
89a5b0e23ea4
[gaim-migrate @ 5343]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4984
diff
changeset
|
369 |
6083
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
370 /* Moved over from old systray.c */ |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
371 void wgaim_systray_minimize( GtkWidget *window ) { |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
372 MinimizeWndToTray(GDK_WINDOW_HWND(window->window)); |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
373 } |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
374 |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
375 void wgaim_systray_maximize( GtkWidget *window ) { |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
376 RestoreWndFromTray(GDK_WINDOW_HWND(window->window)); |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
377 } |
65fad4831077
[gaim-migrate @ 6542]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5913
diff
changeset
|
378 |
10240
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
379 void wgaim_notify_uri(const char *uri) { |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
380 SHELLEXECUTEINFO sinfo; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
381 |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
382 memset(&sinfo, 0, sizeof(sinfo)); |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
383 sinfo.cbSize = sizeof(sinfo); |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
384 sinfo.fMask = SEE_MASK_CLASSNAME; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
385 sinfo.lpVerb = "open"; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
386 sinfo.lpFile = uri; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
387 sinfo.nShow = SW_SHOWNORMAL; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
388 sinfo.lpClass = "http"; |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
389 |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
390 /* We'll allow whatever URI schemes are supported by the |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
391 default http browser. |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
392 */ |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
393 if(!ShellExecuteEx(&sinfo)) |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
394 gaim_debug_error("wgaim", "Error opening URI: %s error: %d\n", uri, (int)sinfo.hInstApp); |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
395 } |
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10213
diff
changeset
|
396 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
397 void wgaim_init(HINSTANCE hint) { |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
398 WORD wVersionRequested; |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
399 WSADATA wsaData; |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
400 char *perlenv; |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
401 char *newenv; |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
402 |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
403 gaim_debug_set_ui_ops(&ops); |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
404 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_init start\n"); |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
405 |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
406 gaimexe_hInstance = hint; |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
407 |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
408 /* Winsock init */ |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
409 wVersionRequested = MAKEWORD( 2, 2 ); |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
410 WSAStartup( wVersionRequested, &wsaData ); |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
411 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
412 /* Confirm that the winsock DLL supports 2.2 */ |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
413 /* Note that if the DLL supports versions greater than |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
414 2.2 in addition to 2.2, it will still return 2.2 in |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
415 wVersion since that is the version we requested. */ |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
416 if ( LOBYTE( wsaData.wVersion ) != 2 || |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
417 HIBYTE( wsaData.wVersion ) != 2 ) { |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
418 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "Could not find a usable WinSock DLL. Oh well.\n"); |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
419 WSACleanup(); |
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
420 } |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
421 |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
422 /* Set Environmental Variables */ |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
423 /* Tell perl where to find Gaim's perl modules */ |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
424 perlenv = (char*) g_getenv("PERL5LIB"); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
425 newenv = g_strdup_printf("PERL5LIB=%s%s%s%s", |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
426 perlenv ? perlenv : "", |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
427 perlenv ? ";" : "", |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
428 wgaim_install_dir(), |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
429 "\\perlmod;"); |
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
430 if (putenv(newenv) < 0) |
6816
5aeba37b303c
[gaim-migrate @ 7356]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6437
diff
changeset
|
431 gaim_debug(GAIM_DEBUG_WARNING, "wgaim", "putenv failed\n"); |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
432 g_free(newenv); |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
433 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
434 /* Set app data dir, used by gaim_home_dir */ |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
435 newenv = (char*) g_getenv("GAIMHOME"); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
436 if (newenv) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
437 app_data_dir = g_strdup(newenv); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
438 } else { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
439 app_data_dir = wgaim_get_special_folder(CSIDL_APPDATA); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
440 if (!app_data_dir) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
441 app_data_dir = g_strdup("C:"); |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10335
diff
changeset
|
442 } |
6848
060aa79a733e
[gaim-migrate @ 7393]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
443 } |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
444 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
445 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "Gaim settings dir: %s\n", app_data_dir); |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
446 |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
447 /* IdleTracker Initialization */ |
4535
de9f45c815df
[gaim-migrate @ 4814]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4411
diff
changeset
|
448 if(!wgaim_set_idlehooks()) |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
449 gaim_debug(GAIM_DEBUG_ERROR, "wgaim", "Failed to initialize idle tracker\n"); |
4861
6cb8b0686e46
[gaim-migrate @ 5188]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4728
diff
changeset
|
450 |
6cb8b0686e46
[gaim-migrate @ 5188]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4728
diff
changeset
|
451 wgaim_gtkspell_init(); |
11323
caec745e390e
[gaim-migrate @ 13528]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11256
diff
changeset
|
452 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_init end\n"); |
3630 | 453 } |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
454 |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
455 /* Windows Cleanup */ |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
456 |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
457 void wgaim_cleanup(void) { |
5854
14891982dbee
[gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5472
diff
changeset
|
458 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "wgaim_cleanup\n"); |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
459 |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
460 /* winsock cleanup */ |
7523
7c3db2b2a790
[gaim-migrate @ 8136]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
461 WSACleanup(); |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
462 |
4535
de9f45c815df
[gaim-migrate @ 4814]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4411
diff
changeset
|
463 /* Idle tracker cleanup */ |
de9f45c815df
[gaim-migrate @ 4814]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4411
diff
changeset
|
464 wgaim_remove_idlehooks(); |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
465 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10589
diff
changeset
|
466 g_free(app_data_dir); |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
467 } |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3905
diff
changeset
|
468 |
3950
c25cf0495533
[gaim-migrate @ 4129]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
469 /* DLL initializer */ |
3856
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
470 BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
471 gaimdll_hInstance = hinstDLL; |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
472 return TRUE; |
50ac7e205045
[gaim-migrate @ 4008]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
473 } |