Sat, 27 Oct 2007 13:56:54 +0000
Add a --with-extraversion option to ./configure so packagers can fine tune
the version displayed to the end user to assist in support and things.
Fixes #3681
| 3630 | 1 | /* |
| 15884 | 2 | * purple |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
3 | * |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
4 | * File: win32dep.c |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
5 | * Date: June, 2002 |
| 15884 | 6 | * Description: Windows dependant code for Purple |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
7 | * |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
8 | * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com> |
| 3630 | 9 | * |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
10 | * This program is free software; you can redistribute it and/or modify |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
11 | * it under the terms of the GNU General Public License as published by |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
12 | * the Free Software Foundation; either version 2 of the License, or |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
13 | * (at your option) any later version. |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
14 | * |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
15 | * This program is distributed in the hope that it will be useful, |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
18 | * GNU General Public License for more details. |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
19 | * |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
20 | * You should have received a copy of the GNU General Public License |
|
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
21 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18633
diff
changeset
|
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
23 | * |
| 3630 | 24 | */ |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
25 | #define _WIN32_IE 0x500 |
| 3630 | 26 | #include <windows.h> |
|
6425
3e86c949c98a
[gaim-migrate @ 6933]
Herman Bloggs <herman@bluedigits.com>
parents:
6423
diff
changeset
|
27 | #include <io.h> |
| 3630 | 28 | #include <stdlib.h> |
| 29 | #include <stdio.h> | |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
30 | #include <winuser.h> |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
31 | |
| 3630 | 32 | #include <glib.h> |
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
33 | #include <glib/gstdio.h> |
|
4097
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
34 | |
|
18331
23f922d0fc66
Another fix to use the G_GNUC_NULL_TERMINATED compatibility stuff
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
35 | #include "internal.h" |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
36 | #include "debug.h" |
|
6929
47829b408f9d
[gaim-migrate @ 7476]
Herman Bloggs <herman@bluedigits.com>
parents:
6890
diff
changeset
|
37 | #include "notify.h" |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
38 | |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
39 | #include <libintl.h> |
|
5913
4d016c00bb36
[gaim-migrate @ 6345]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
40 | |
|
10673
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
41 | #include "win32dep.h" |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
42 | |
| 3630 | 43 | /* |
| 44 | * DEFINES & MACROS | |
| 45 | */ | |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
46 | |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
47 | /* For shfolder.dll */ |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
48 | typedef HRESULT (CALLBACK* LPFNSHGETFOLDERPATHA)(HWND, int, HANDLE, DWORD, LPSTR); |
|
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10335
diff
changeset
|
49 | typedef HRESULT (CALLBACK* LPFNSHGETFOLDERPATHW)(HWND, int, HANDLE, DWORD, LPWSTR); |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
50 | |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
51 | /* |
| 3630 | 52 | * LOCALS |
| 53 | */ | |
|
14331
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
54 | static char *app_data_dir = NULL, *install_dir = NULL, |
|
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
55 | *lib_dir = NULL, *locale_dir = NULL; |
| 3630 | 56 | |
| 15884 | 57 | static HINSTANCE libpurpledll_hInstance = 0; |
|
6848
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
58 | |
|
4097
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
59 | /* |
|
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
60 | * PUBLIC CODE |
|
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
61 | */ |
|
3ad9e41eb933
[gaim-migrate @ 4312]
Herman Bloggs <herman@bluedigits.com>
parents:
4042
diff
changeset
|
62 | |
|
4406
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
63 | /* Escape windows dir separators. This is needed when paths are saved, |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
64 | and on being read back have their '\' chars used as an escape char. |
|
4555
3ff630a3045a
[gaim-migrate @ 4835]
Herman Bloggs <herman@bluedigits.com>
parents:
4535
diff
changeset
|
65 | Returns an allocated string which needs to be freed. |
|
4406
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
66 | */ |
| 15884 | 67 | char *wpurple_escape_dirsep(const char *filename) { |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
68 | int sepcount = 0; |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
69 | const char *tmp = filename; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
70 | char *ret; |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
71 | int cnt = 0; |
|
4406
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
72 | |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
73 | g_return_val_if_fail(filename != NULL, NULL); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
74 | |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
75 | while(*tmp) { |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
76 | if(*tmp == '\\') |
|
4406
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
77 | sepcount++; |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
78 | tmp++; |
|
4406
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
79 | } |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
80 | ret = g_malloc0(strlen(filename) + sepcount + 1); |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
81 | while(*filename) { |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
82 | ret[cnt] = *filename; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
83 | if(*filename == '\\') |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
84 | ret[++cnt] = '\\'; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
85 | filename++; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
86 | cnt++; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
87 | } |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
88 | ret[cnt] = '\0'; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
89 | return ret; |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
90 | } |
|
a7d91dbcdae8
[gaim-migrate @ 4675]
Herman Bloggs <herman@bluedigits.com>
parents:
4168
diff
changeset
|
91 | |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
92 | /* Determine whether the specified dll contains the specified procedure. |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
93 | If so, load it (if not already loaded). */ |
| 15884 | 94 | FARPROC wpurple_find_and_loadproc(const char *dllname, const char *procedure) { |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
95 | HMODULE hmod; |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
96 | BOOL did_load = FALSE; |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
97 | FARPROC proc = 0; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
98 | |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
99 | if(!(hmod = GetModuleHandle(dllname))) { |
| 15884 | 100 | purple_debug_warning("wpurple", "%s not already loaded; loading it...\n", dllname); |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
101 | if(!(hmod = LoadLibrary(dllname))) { |
| 15884 | 102 | purple_debug_error("wpurple", "Could not load: %s\n", dllname); |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
103 | return NULL; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
104 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
105 | else |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
106 | did_load = TRUE; |
|
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
107 | } |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
108 | |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
109 | if((proc = GetProcAddress(hmod, procedure))) { |
| 15884 | 110 | purple_debug_info("wpurple", "This version of %s contains %s\n", |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
111 | dllname, procedure); |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
112 | return proc; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
113 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
114 | else { |
| 15884 | 115 | purple_debug_warning("wpurple", "Function %s not found in dll %s\n", |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
116 | procedure, dllname); |
|
3983
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
117 | if(did_load) { |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
118 | /* unload dll */ |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
119 | FreeLibrary(hmod); |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
120 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
121 | return NULL; |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
122 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
123 | } |
|
fd54b7e2b090
[gaim-migrate @ 4174]
Herman Bloggs <herman@bluedigits.com>
parents:
3973
diff
changeset
|
124 | |
| 15884 | 125 | /* Determine Purple Paths during Runtime */ |
|
3856
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
126 | |
|
10673
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
127 | /* Get paths to special Windows folders. */ |
| 15884 | 128 | char *wpurple_get_special_folder(int folder_type) { |
|
10673
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
129 | static LPFNSHGETFOLDERPATHA MySHGetFolderPathA = NULL; |
| 13781 | 130 | static LPFNSHGETFOLDERPATHW MySHGetFolderPathW = NULL; |
|
10673
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
131 | char *retval = NULL; |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
132 | |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
133 | if (!MySHGetFolderPathW) { |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
134 | MySHGetFolderPathW = (LPFNSHGETFOLDERPATHW) |
| 15884 | 135 | wpurple_find_and_loadproc("shfolder.dll", "SHGetFolderPathW"); |
|
10673
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
136 | } |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
137 | |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
138 | if (MySHGetFolderPathW) { |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
139 | wchar_t utf_16_dir[MAX_PATH + 1]; |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
140 | |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
141 | if (SUCCEEDED(MySHGetFolderPathW(NULL, folder_type, NULL, |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
142 | SHGFP_TYPE_CURRENT, utf_16_dir))) { |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
143 | retval = g_utf16_to_utf8(utf_16_dir, -1, NULL, NULL, NULL); |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
144 | } |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
145 | } |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
146 | |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
147 | if (!retval) { |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
148 | if (!MySHGetFolderPathA) { |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
149 | MySHGetFolderPathA = (LPFNSHGETFOLDERPATHA) |
| 15884 | 150 | wpurple_find_and_loadproc("shfolder.dll", "SHGetFolderPathA"); |
|
10673
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
151 | } |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
152 | if (MySHGetFolderPathA) { |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
153 | char locale_dir[MAX_PATH + 1]; |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
154 | |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
155 | if (SUCCEEDED(MySHGetFolderPathA(NULL, folder_type, NULL, |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
156 | SHGFP_TYPE_CURRENT, locale_dir))) { |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
157 | retval = g_locale_to_utf8(locale_dir, -1, NULL, NULL, NULL); |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
158 | } |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
159 | } |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
160 | } |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
161 | |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
162 | return retval; |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
163 | } |
|
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
164 | |
| 15884 | 165 | const char *wpurple_install_dir(void) { |
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
166 | static gboolean initialized = FALSE; |
| 3630 | 167 | |
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
168 | if (!initialized) { |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
169 | char *tmp = NULL; |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
170 | if (G_WIN32_HAVE_WIDECHAR_API()) { |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
171 | wchar_t winstall_dir[MAXPATHLEN]; |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
172 | if (GetModuleFileNameW(NULL, winstall_dir, |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
173 | MAXPATHLEN) > 0) { |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
174 | tmp = g_utf16_to_utf8(winstall_dir, -1, |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
175 | NULL, NULL, NULL); |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
176 | } |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
177 | } else { |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
178 | gchar cpinstall_dir[MAXPATHLEN]; |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
179 | if (GetModuleFileNameA(NULL, cpinstall_dir, |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
180 | MAXPATHLEN) > 0) { |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
181 | tmp = g_locale_to_utf8(cpinstall_dir, |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
182 | -1, NULL, NULL, NULL); |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
183 | } |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
184 | } |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
185 | |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
186 | if (tmp == NULL) { |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
187 | tmp = g_win32_error_message(GetLastError()); |
| 15884 | 188 | purple_debug_error("wpurple", |
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
189 | "GetModuleFileName error: %s\n", tmp); |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
190 | g_free(tmp); |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
191 | return NULL; |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
192 | } else { |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
193 | install_dir = g_path_get_dirname(tmp); |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
194 | g_free(tmp); |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
195 | initialized = TRUE; |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
196 | } |
| 3630 | 197 | } |
| 198 | ||
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
199 | return install_dir; |
| 3630 | 200 | } |
| 201 | ||
| 15884 | 202 | const char *wpurple_lib_dir(void) { |
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
203 | static gboolean initialized = FALSE; |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
204 | |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
205 | if (!initialized) { |
| 15884 | 206 | const char *inst_dir = wpurple_install_dir(); |
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
207 | if (inst_dir != NULL) { |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
208 | lib_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "plugins", inst_dir); |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
209 | initialized = TRUE; |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
210 | } else { |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
211 | return NULL; |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
212 | } |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
213 | } |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
214 | |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
215 | return lib_dir; |
| 3630 | 216 | } |
| 217 | ||
| 15884 | 218 | const char *wpurple_locale_dir(void) { |
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
219 | static gboolean initialized = FALSE; |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
220 | |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
221 | if (!initialized) { |
| 15884 | 222 | const char *inst_dir = wpurple_install_dir(); |
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
223 | if (inst_dir != NULL) { |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
224 | locale_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "locale", inst_dir); |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
225 | initialized = TRUE; |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
226 | } else { |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
227 | return NULL; |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
228 | } |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
229 | } |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
230 | |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
231 | return locale_dir; |
| 3630 | 232 | } |
| 233 | ||
| 15884 | 234 | const char *wpurple_data_dir(void) { |
|
14331
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
235 | |
|
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
236 | if (!app_data_dir) { |
| 15884 | 237 | /* Set app data dir, used by purple_home_dir */ |
| 238 | const char *newenv = g_getenv("PURPLEHOME"); | |
|
14331
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
239 | if (newenv) |
|
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
240 | app_data_dir = g_strdup(newenv); |
|
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
241 | else { |
| 15884 | 242 | app_data_dir = wpurple_get_special_folder(CSIDL_APPDATA); |
|
14331
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
243 | if (!app_data_dir) |
|
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
244 | app_data_dir = g_strdup("C:"); |
|
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
245 | } |
| 15884 | 246 | purple_debug_info("wpurple", "Purple settings dir: %s\n", |
|
14331
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
247 | app_data_dir); |
|
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
248 | } |
|
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
249 | |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
250 | return app_data_dir; |
|
6848
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
251 | } |
|
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
252 | |
|
3973
acade2595b85
[gaim-migrate @ 4157]
Herman Bloggs <herman@bluedigits.com>
parents:
3950
diff
changeset
|
253 | /* Miscellaneous */ |
|
acade2595b85
[gaim-migrate @ 4157]
Herman Bloggs <herman@bluedigits.com>
parents:
3950
diff
changeset
|
254 | |
| 15884 | 255 | gboolean wpurple_write_reg_string(HKEY rootkey, const char *subkey, const char *valname, |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
256 | const char *value) { |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
257 | HKEY reg_key; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
258 | gboolean success = FALSE; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
259 | |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
260 | if(G_WIN32_HAVE_WIDECHAR_API()) { |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
261 | wchar_t *wc_subkey = g_utf8_to_utf16(subkey, -1, NULL, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
262 | NULL, NULL); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
263 | |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
264 | if(RegOpenKeyExW(rootkey, wc_subkey, 0, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
265 | KEY_SET_VALUE, ®_key) == ERROR_SUCCESS) { |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
266 | wchar_t *wc_valname = NULL; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
267 | |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
268 | if (valname) |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
269 | wc_valname = g_utf8_to_utf16(valname, -1, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
270 | NULL, NULL, NULL); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
271 | |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
272 | if(value) { |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
273 | wchar_t *wc_value = g_utf8_to_utf16(value, -1, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
274 | NULL, NULL, NULL); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
275 | int len = (wcslen(wc_value) * sizeof(wchar_t)) + 1; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
276 | if(RegSetValueExW(reg_key, wc_valname, 0, REG_SZ, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
277 | (LPBYTE)wc_value, len |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
278 | ) == ERROR_SUCCESS) |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
279 | success = TRUE; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
280 | g_free(wc_value); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
281 | } else |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
282 | if(RegDeleteValueW(reg_key, wc_valname) == ERROR_SUCCESS) |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
283 | success = TRUE; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
284 | |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
285 | g_free(wc_valname); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
286 | } |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
287 | g_free(wc_subkey); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
288 | } else { |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
289 | char *cp_subkey = g_locale_from_utf8(subkey, -1, NULL, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
290 | NULL, NULL); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
291 | if(RegOpenKeyExA(rootkey, cp_subkey, 0, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
292 | KEY_SET_VALUE, ®_key) == ERROR_SUCCESS) { |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
293 | char *cp_valname = NULL; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
294 | if(valname) |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
295 | cp_valname = g_locale_from_utf8(valname, -1, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
296 | NULL, NULL, NULL); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
297 | |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
298 | if (value) { |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
299 | char *cp_value = g_locale_from_utf8(value, -1, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
300 | NULL, NULL, NULL); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
301 | int len = strlen(cp_value) + 1; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
302 | if(RegSetValueExA(reg_key, cp_valname, 0, REG_SZ, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
303 | cp_value, len |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
304 | ) == ERROR_SUCCESS) |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
305 | success = TRUE; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
306 | g_free(cp_value); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
307 | } else |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
308 | if(RegDeleteValueA(reg_key, cp_valname) == ERROR_SUCCESS) |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
309 | success = TRUE; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
310 | |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
311 | g_free(cp_valname); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
312 | } |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
313 | g_free(cp_subkey); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
314 | } |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
315 | |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
316 | if(reg_key != NULL) |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
317 | RegCloseKey(reg_key); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
318 | |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
319 | return success; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
320 | } |
|
6437
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
321 | |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
322 | static HKEY _reg_open_key(HKEY rootkey, const char *subkey, REGSAM access) { |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
323 | HKEY reg_key = NULL; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
324 | LONG rv; |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
325 | |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
326 | if(G_WIN32_HAVE_WIDECHAR_API()) { |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
327 | wchar_t *wc_subkey = g_utf8_to_utf16(subkey, -1, NULL, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
328 | NULL, NULL); |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
329 | rv = RegOpenKeyExW(rootkey, wc_subkey, 0, access, ®_key); |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
330 | g_free(wc_subkey); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
331 | } else { |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
332 | char *cp_subkey = g_locale_from_utf8(subkey, -1, NULL, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
333 | NULL, NULL); |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
334 | rv = RegOpenKeyExA(rootkey, cp_subkey, 0, access, ®_key); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
335 | g_free(cp_subkey); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
336 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
337 | |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
338 | if (rv != ERROR_SUCCESS) { |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
339 | char *errmsg = g_win32_error_message(rv); |
| 15884 | 340 | purple_debug_info("wpurple", "Could not open reg key '%s' subkey '%s'.\nMessage: (%ld) %s\n", |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
341 | ((rootkey == HKEY_LOCAL_MACHINE) ? "HKLM" : |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
342 | (rootkey == HKEY_CURRENT_USER) ? "HKCU" : |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
343 | (rootkey == HKEY_CLASSES_ROOT) ? "HKCR" : "???"), |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
344 | subkey, rv, errmsg); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
345 | g_free(errmsg); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
346 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
347 | |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
348 | return reg_key; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
349 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
350 | |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
351 | static gboolean _reg_read(HKEY reg_key, const char *valname, LPDWORD type, LPBYTE data, LPDWORD data_len) { |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
352 | LONG rv; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
353 | |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
354 | if(G_WIN32_HAVE_WIDECHAR_API()) { |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
355 | wchar_t *wc_valname = NULL; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
356 | if (valname) |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
357 | wc_valname = g_utf8_to_utf16(valname, -1, NULL, NULL, NULL); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
358 | rv = RegQueryValueExW(reg_key, wc_valname, 0, type, data, data_len); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
359 | g_free(wc_valname); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
360 | } else { |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
361 | char *cp_valname = NULL; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
362 | if(valname) |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
363 | cp_valname = g_locale_from_utf8(valname, -1, NULL, NULL, NULL); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
364 | rv = RegQueryValueExA(reg_key, cp_valname, 0, type, data, data_len); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
365 | g_free(cp_valname); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
366 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
367 | |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
368 | if (rv != ERROR_SUCCESS) { |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
369 | char *errmsg = g_win32_error_message(rv); |
| 15884 | 370 | purple_debug_info("wpurple", "Could not read from reg key value '%s'.\nMessage: (%ld) %s\n", |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
371 | valname, rv, errmsg); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
372 | g_free(errmsg); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
373 | } |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
374 | |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
375 | return (rv == ERROR_SUCCESS); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
376 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
377 | |
| 15884 | 378 | gboolean wpurple_read_reg_dword(HKEY rootkey, const char *subkey, const char *valname, LPDWORD result) { |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
379 | |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
380 | DWORD type; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
381 | DWORD nbytes; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
382 | HKEY reg_key = _reg_open_key(rootkey, subkey, KEY_QUERY_VALUE); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
383 | gboolean success = FALSE; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
384 | |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
385 | if(reg_key) { |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
386 | if(_reg_read(reg_key, valname, &type, (LPBYTE)result, &nbytes)) |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
387 | success = TRUE; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
388 | RegCloseKey(reg_key); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
389 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
390 | |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
391 | return success; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
392 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
393 | |
| 15884 | 394 | char *wpurple_read_reg_string(HKEY rootkey, const char *subkey, const char *valname) { |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
395 | |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
396 | DWORD type; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
397 | DWORD nbytes; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
398 | HKEY reg_key = _reg_open_key(rootkey, subkey, KEY_QUERY_VALUE); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
399 | char *result = NULL; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
400 | |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
401 | if(reg_key) { |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
402 | if(_reg_read(reg_key, valname, &type, NULL, &nbytes) && type == REG_SZ) { |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
403 | LPBYTE data; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
404 | if(G_WIN32_HAVE_WIDECHAR_API()) |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
405 | data = (LPBYTE) g_new(wchar_t, ((nbytes + 1) / sizeof(wchar_t)) + 1); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
406 | else |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
407 | data = (LPBYTE) g_malloc(nbytes + 1); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
408 | |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
409 | if(_reg_read(reg_key, valname, &type, data, &nbytes)) { |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
410 | if(G_WIN32_HAVE_WIDECHAR_API()) { |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
411 | wchar_t *wc_temp = (wchar_t*) data; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
412 | wc_temp[nbytes / sizeof(wchar_t)] = '\0'; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
413 | result = g_utf16_to_utf8(wc_temp, -1, |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
414 | NULL, NULL, NULL); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
415 | } else { |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
416 | char *cp_temp = (char*) data; |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
417 | cp_temp[nbytes] = '\0'; |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
418 | result = g_locale_to_utf8(cp_temp, -1, |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
419 | NULL, NULL, NULL); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
420 | } |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
421 | } |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
422 | g_free(data); |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
423 | } |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
424 | RegCloseKey(reg_key); |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
425 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
426 | |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
427 | return result; |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
428 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
429 | |
|
20647
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
430 | /* the winapi headers don't yet have winhttp.h, so we use the struct from msdn directly */ |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
431 | typedef struct { |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
432 | BOOL fAutoDetect; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
433 | LPWSTR lpszAutoConfigUrl; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
434 | LPWSTR lpszProxy; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
435 | LPWSTR lpszProxyBypass; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
436 | } WINHTTP_CURRENT_USER_IE_PROXY_CONFIG; |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
437 | |
|
20647
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
438 | typedef BOOL (CALLBACK* LPFNWINHTTPGETIEPROXYCONFIG)(/*IN OUT*/ WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* pProxyConfig); |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
439 | |
|
20647
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
440 | gboolean wpurple_check_for_proxy_changes(void) { |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
441 | static gboolean loaded = FALSE; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
442 | static LPFNWINHTTPGETIEPROXYCONFIG MyWinHttpGetIEProxyConfig = NULL; |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
443 | |
|
20647
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
444 | WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_proxy_config; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
445 | char *tmp = NULL, *c = NULL; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
446 | gboolean changed = FALSE; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
447 | |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
448 | if (!loaded) { |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
449 | loaded = TRUE; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
450 | |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
451 | if (getenv("HTTP_PROXY") || getenv("http_proxy") || getenv("HTTPPROXY")) { |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
452 | purple_debug_info("wpurple", "HTTP_PROXY env. var already set. Ignoring win32 Internet Settings.\n"); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
453 | return FALSE; |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
454 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
455 | |
|
20647
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
456 | MyWinHttpGetIEProxyConfig = (LPFNWINHTTPGETIEPROXYCONFIG) |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
457 | wpurple_find_and_loadproc("winhttp.dll", "WinHttpGetIEProxyConfigForCurrentUser"); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
458 | if (!MyWinHttpGetIEProxyConfig) |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
459 | purple_debug_info("wpurple", "Unable to read Windows Proxy Settings.\n"); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
460 | } |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
461 | |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
462 | if (!MyWinHttpGetIEProxyConfig) |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
463 | return FALSE; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
464 | |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
465 | ZeroMemory(&ie_proxy_config, sizeof(ie_proxy_config)); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
466 | if (!MyWinHttpGetIEProxyConfig(&ie_proxy_config)) { |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
467 | purple_debug_error("wpurple", "Error reading Windows Proxy Settings(%u).\n", GetLastError()); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
468 | return FALSE; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
469 | } |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
470 | |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
471 | /* We can't do much if it is autodetect*/ |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
472 | if (ie_proxy_config.fAutoDetect) |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
473 | purple_debug_error("wpurple", "Windows Proxy Settings set to autodetect (not supported).\n"); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
474 | else if (ie_proxy_config.lpszProxy) { |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
475 | tmp = g_utf16_to_utf8(ie_proxy_config.lpszProxy, -1, |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
476 | NULL, NULL, NULL); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
477 | /* We can't do anything about the bypass list, as we don't have the url */ |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
478 | } else |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
479 | purple_debug_info("wpurple", "No Windows Proxy Set.\n"); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
480 | |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
481 | if (ie_proxy_config.lpszAutoConfigUrl) |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
482 | GlobalFree(ie_proxy_config.lpszAutoConfigUrl); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
483 | if (ie_proxy_config.lpszProxy) |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
484 | GlobalFree(ie_proxy_config.lpszProxy); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
485 | if (ie_proxy_config.lpszProxyBypass) |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
486 | GlobalFree(ie_proxy_config.lpszProxyBypass); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
487 | |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
488 | /* There are proxy settings for several protocols */ |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
489 | if (tmp && (c = g_strstr_len(tmp, strlen(tmp), "http="))) { |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
490 | char *d; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
491 | c += strlen("http="); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
492 | d = strchr(c, ';'); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
493 | if (d) |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
494 | *d = '\0'; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
495 | /* c now points the proxy server (and port) */ |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
496 | /* There is only a global proxy */ |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
497 | } else if (tmp && strlen(tmp) > 0 && !strchr(tmp, ';')) { |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
498 | c = tmp; |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
499 | } |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
500 | |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
501 | if (c && *c) { |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
502 | const char *current = g_getenv("HTTP_PROXY"); |
|
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
503 | if (!current || strcmp(current, c)) { |
| 15884 | 504 | purple_debug_info("wpurple", "Setting HTTP Proxy: 'http://%s'\n", c); |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
505 | g_setenv("HTTP_PROXY", c, TRUE); |
|
20647
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
506 | changed = TRUE; |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
507 | } |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
508 | } |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
509 | /* If there previously was a proxy set and there isn't one now, clear it */ |
|
20647
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
510 | else if (getenv("HTTP_PROXY")) { |
| 15884 | 511 | purple_debug_info("wpurple", "Clearing HTTP Proxy\n"); |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
512 | g_unsetenv("HTTP_PROXY"); |
|
20647
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
513 | changed = TRUE; |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
514 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
515 | |
|
20647
0541b2df866f
More robust win32 IE proxy settings detection using winhttp. This essentially parses the same registry entries, but we don't have to do the grunt work and it seems to work better. This gives us a start to apply proxy bypass support and autoconfig via PAC file when we can change the API in 3.0.0. I'd also like to change this so we can parse a SOCKS proxy setting and not just fill in the environment variables.
Daniel Atallah <datallah@pidgin.im>
parents:
20597
diff
changeset
|
516 | g_free(tmp); |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
517 | |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15027
diff
changeset
|
518 | return changed; |
|
6437
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
519 | } |
|
809e9334e31f
[gaim-migrate @ 6945]
Herman Bloggs <herman@bluedigits.com>
parents:
6425
diff
changeset
|
520 | |
| 15884 | 521 | void wpurple_init(void) { |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
522 | WORD wVersionRequested; |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
523 | WSADATA wsaData; |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
524 | const char *perlenv; |
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
525 | char *newenv; |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
526 | |
| 15884 | 527 | purple_debug_info("wpurple", "wpurple_init start\n"); |
|
21106
b85fbef13eed
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20747
diff
changeset
|
528 | purple_debug_info("wpurple", "libpurple version: " DISPLAY_VERSION "\n"); |
|
14810
7ee46e25e9d8
[gaim-migrate @ 17505]
Daniel Atallah <datallah@pidgin.im>
parents:
14784
diff
changeset
|
529 | |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
530 | |
| 15884 | 531 | purple_debug_info("wpurple", "Glib:%u.%u.%u\n", |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
532 | glib_major_version, glib_minor_version, glib_micro_version); |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
533 | |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
534 | /* Winsock init */ |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
535 | wVersionRequested = MAKEWORD(2, 2); |
|
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
536 | WSAStartup(wVersionRequested, &wsaData); |
|
6848
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
537 | |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
538 | /* Confirm that the winsock DLL supports 2.2 */ |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
539 | /* Note that if the DLL supports versions greater than |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
540 | 2.2 in addition to 2.2, it will still return 2.2 in |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
541 | wVersion since that is the version we requested. */ |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
542 | if(LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) { |
| 15884 | 543 | purple_debug_error("wpurple", "Could not find a usable WinSock DLL. Oh well.\n"); |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
544 | WSACleanup(); |
|
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
545 | } |
|
3856
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
546 | |
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
547 | /* Set Environmental Variables */ |
| 15884 | 548 | /* Tell perl where to find Purple's perl modules */ |
|
13322
c973bc4b0a53
[gaim-migrate @ 15690]
Daniel Atallah <datallah@pidgin.im>
parents:
12572
diff
changeset
|
549 | perlenv = g_getenv("PERL5LIB"); |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
550 | newenv = g_strdup_printf("%s%s%s" G_DIR_SEPARATOR_S "perlmod;", |
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
551 | perlenv ? perlenv : "", |
|
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
552 | perlenv ? ";" : "", |
| 15884 | 553 | wpurple_install_dir()); |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14331
diff
changeset
|
554 | if (!g_setenv("PERL5LIB", newenv, TRUE)) |
| 15884 | 555 | purple_debug_warning("wpurple", "putenv failed for PERL5LIB\n"); |
|
11323
d9a148f36cbc
[gaim-migrate @ 13528]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
556 | g_free(newenv); |
|
6848
ca91f08b60df
[gaim-migrate @ 7393]
Herman Bloggs <herman@bluedigits.com>
parents:
6816
diff
changeset
|
557 | |
|
14784
3a82321f46f2
[gaim-migrate @ 17476]
Daniel Atallah <datallah@pidgin.im>
parents:
14334
diff
changeset
|
558 | if (!g_thread_supported()) |
|
3a82321f46f2
[gaim-migrate @ 17476]
Daniel Atallah <datallah@pidgin.im>
parents:
14334
diff
changeset
|
559 | g_thread_init(NULL); |
|
3a82321f46f2
[gaim-migrate @ 17476]
Daniel Atallah <datallah@pidgin.im>
parents:
14334
diff
changeset
|
560 | |
| 15884 | 561 | purple_debug_info("wpurple", "wpurple_init end\n"); |
| 3630 | 562 | } |
|
3856
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
563 | |
|
3907
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
564 | /* Windows Cleanup */ |
|
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
565 | |
| 15884 | 566 | void wpurple_cleanup(void) { |
| 567 | purple_debug_info("wpurple", "wpurple_cleanup\n"); | |
|
3907
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
568 | |
|
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
569 | /* winsock cleanup */ |
|
7523
8563b0512405
[gaim-migrate @ 8136]
Herman Bloggs <herman@bluedigits.com>
parents:
7350
diff
changeset
|
570 | WSACleanup(); |
|
3907
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
571 | |
|
10673
3177232170c7
[gaim-migrate @ 12213]
Richard Laager <rlaager@pidgin.im>
parents:
10589
diff
changeset
|
572 | g_free(app_data_dir); |
|
14331
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
573 | app_data_dir = NULL; |
|
6f7f9bd34916
[gaim-migrate @ 16951]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
574 | |
| 15884 | 575 | libpurpledll_hInstance = NULL; |
|
3907
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
576 | } |
|
7de53cfd3660
[gaim-migrate @ 4060]
Herman Bloggs <herman@bluedigits.com>
parents:
3905
diff
changeset
|
577 | |
|
20587
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
578 | long |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
579 | wpurple_get_tz_offset() { |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
580 | TIME_ZONE_INFORMATION tzi; |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
581 | DWORD ret; |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
582 | long off = -1; |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
583 | |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
584 | if ((ret = GetTimeZoneInformation(&tzi)) != TIME_ZONE_ID_INVALID) |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
585 | { |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
586 | off = -(tzi.Bias * 60); |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
587 | if (ret == TIME_ZONE_ID_DAYLIGHT) |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
588 | off -= tzi.DaylightBias * 60; |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
589 | } |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
590 | |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
591 | return off; |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
592 | } |
|
55af483c9e86
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@pidgin.im>
parents:
18633
diff
changeset
|
593 | |
|
3950
0cab330f1cd6
[gaim-migrate @ 4129]
Herman Bloggs <herman@bluedigits.com>
parents:
3907
diff
changeset
|
594 | /* DLL initializer */ |
|
15782
f2da034243cd
I forgot to add the new mingw makefiles.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
595 | /* suppress gcc "no previous prototype" warning */ |
|
f2da034243cd
I forgot to add the new mingw makefiles.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
596 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); |
|
14810
7ee46e25e9d8
[gaim-migrate @ 17505]
Daniel Atallah <datallah@pidgin.im>
parents:
14784
diff
changeset
|
597 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { |
| 15884 | 598 | libpurpledll_hInstance = hinstDLL; |
|
3856
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
599 | return TRUE; |
|
db98b5201da8
[gaim-migrate @ 4008]
Herman Bloggs <herman@bluedigits.com>
parents:
3630
diff
changeset
|
600 | } |