Mercurial > pidgin.yaz
annotate gtk/win32/win_gaim.c @ 15282:5d53e67c2512
[gaim-migrate @ 18071]
updated potfiles.in from Jochen Kemnade
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 04 Jan 2007 17:11:48 +0000 |
parents | 92ebda7a7afc |
children |
rev | line source |
---|---|
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
1 /* |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
2 * win_gaim.c |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
3 * |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
4 * Date: June, 2002 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
5 * Description: Entry point for win32 gaim, and various win32 dependant |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
6 * routines. |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
7 * |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
8 * Gaim is the legal property of its developers, whose names are too numerous |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
9 * to list here. Please refer to the COPYRIGHT file distributed with this |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
10 * source distribution. |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
11 * |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
15 * (at your option) any later version. |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
16 * |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
20 * GNU General Public License for more details. |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
21 * |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
25 * |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
26 */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
27 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
28 /* This is for ATTACH_PARENT_PROCESS */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
29 #ifndef _WIN32_WINNT |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
30 #define _WIN32_WINNT 0x501 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
31 #endif |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
32 #include <windows.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
33 #include <fcntl.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
34 #include <stdlib.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
35 #include <string.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
36 #include <stdio.h> |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
37 |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
38 /* These will hopefully be in the win32api next time it is updated - at which point, we'll remove them */ |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
39 #ifndef LANG_PERSIAN |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
40 #define LANG_PERSIAN 0x29 |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
41 #endif |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
42 #ifndef LANG_BOSNIAN |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
43 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05 |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
44 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08 |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
45 #endif |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
46 #ifndef SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
47 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04 |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
48 #endif |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
49 #ifndef LANG_XHOSA |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
50 #define LANG_XHOSA 0x34 |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
51 #endif |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
52 |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
53 |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
54 typedef int (CALLBACK* LPFNGAIMMAIN)(HINSTANCE, int, char**); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
55 typedef void (CALLBACK* LPFNSETDLLDIRECTORY)(LPCTSTR); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
56 typedef BOOL (CALLBACK* LPFNATTACHCONSOLE)(DWORD); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
57 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
58 /* |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
59 * PROTOTYPES |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
60 */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
61 static LPFNGAIMMAIN gaim_main = NULL; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
62 static LPFNSETDLLDIRECTORY MySetDllDirectory = NULL; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
63 |
14942
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
64 static const char *get_win32_error_message(DWORD err) { |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
65 static char err_msg[512]; |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
66 |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
67 FormatMessage( |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
68 FORMAT_MESSAGE_FROM_SYSTEM, |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
69 NULL, err, |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
70 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
71 (LPTSTR) &err_msg, sizeof(err_msg), NULL); |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
72 |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
73 return err_msg; |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
74 } |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
75 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
76 static BOOL read_reg_string(HKEY key, char* sub_key, char* val_name, LPBYTE data, LPDWORD data_len) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
77 HKEY hkey; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
78 BOOL ret = FALSE; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
79 LONG retv; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
80 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
81 if (ERROR_SUCCESS == (retv = RegOpenKeyEx(key, sub_key, 0, |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
82 KEY_QUERY_VALUE, &hkey))) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
83 if (ERROR_SUCCESS == (retv = RegQueryValueEx(hkey, val_name, |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
84 NULL, NULL, data, data_len))) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
85 ret = TRUE; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
86 else { |
14942
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
87 const char *err_msg = get_win32_error_message(retv); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
88 |
14748
95246f6b6414
[gaim-migrate @ 17505]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14595
diff
changeset
|
89 printf("Could not read reg key '%s' subkey '%s' value: '%s'.\nMessage: (%ld) %s\n", |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
90 ((key == HKEY_LOCAL_MACHINE) ? "HKLM" : |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
91 (key == HKEY_CURRENT_USER) ? "HKCU" : |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
92 "???"), |
14942
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
93 sub_key, val_name, retv, err_msg); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
94 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
95 RegCloseKey(hkey); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
96 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
97 else { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
98 TCHAR szBuf[80]; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
99 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
100 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, retv, 0, |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
101 (LPTSTR) &szBuf, sizeof(szBuf), NULL); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
102 printf("Could not open reg subkey: %s\nError: (%ld) %s\n", |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
103 sub_key, retv, szBuf); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
104 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
105 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
106 return ret; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
107 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
108 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
109 static void dll_prep() { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
110 char path[MAX_PATH + 1]; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
111 HMODULE hmod; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
112 HKEY hkey; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
113 #ifdef PORTABLE |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
114 /* We assume that GTK+ is installed under \\path\to\Gaim\..\GTK |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
115 * First we find \\path\to |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
116 */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
117 if (GetModuleFileName(NULL, path, MAX_PATH) != 0) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
118 char *tmp = path; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
119 char *prev = NULL; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
120 char *prev2 = NULL; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
121 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
122 while ((tmp = strchr(tmp, '\\'))) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
123 prev2 = prev; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
124 prev = tmp; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
125 tmp++; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
126 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
127 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
128 if (prev2) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
129 prev2[0] = '\0'; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
130 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
131 } else { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
132 printf("Unable to determine current executable path. \n" |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
133 "This will prevent the settings dir from being set.\n" |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
134 "Assuming GTK+ is in the PATH.\n"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
135 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
136 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
137 if (path) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
138 /* Set up the settings dir base to be \\path\to |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
139 * The actual settings dir will be \\path\to\.gaim */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
140 char settingsdir[strlen(path) + strlen("GAIMHOME=") + 1]; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
141 char aspelldir[strlen(path) + strlen("GAIM_ASPELL_DIR=\\Aspell\\bin") + 1]; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
142 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
143 snprintf(settingsdir, sizeof(settingsdir), "GAIMHOME=%s", path); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
144 printf("Setting settings dir: %s\n", settingsdir); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
145 putenv(settingsdir); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
146 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
147 snprintf(aspelldir, sizeof(aspelldir), "GAIM_ASPELL_DIR=%s\\Aspell\\bin", path); |
15197 | 148 printf("%s", aspelldir); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
149 putenv(aspelldir); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
150 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
151 /* set the GTK+ path to be \\path\to\GTK\bin */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
152 strcat(path, "\\GTK\\bin"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
153 } else |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
154 return; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
155 #else /* PORTABLE */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
156 char gtkpath[MAX_PATH + 1]; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
157 DWORD plen; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
158 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
159 plen = sizeof(gtkpath); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
160 hkey = HKEY_CURRENT_USER; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
161 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path", |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
162 (LPBYTE) >kpath, &plen)) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
163 hkey = HKEY_LOCAL_MACHINE; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
164 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path", |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
165 (LPBYTE) >kpath, &plen)) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
166 printf("GTK+ Path Registry Key not found. " |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
167 "Assuming GTK+ is in the PATH.\n"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
168 return; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
169 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
170 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
171 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
172 /* this value is replaced during a successful RegQueryValueEx() */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
173 plen = sizeof(path); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
174 /* Determine GTK+ dll path .. */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
175 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "DllPath", |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
176 (LPBYTE) &path, &plen)) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
177 strcpy(path, gtkpath); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
178 strcat(path, "\\bin"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
179 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
180 #endif |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
181 printf("GTK+ path found: %s\n", path); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
182 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
183 if ((hmod = GetModuleHandle("kernel32.dll"))) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
184 MySetDllDirectory = (LPFNSETDLLDIRECTORY) GetProcAddress( |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
185 hmod, "SetDllDirectoryA"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
186 if (!MySetDllDirectory) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
187 printf("SetDllDirectory not supported\n"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
188 } else |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
189 printf("Error getting kernel32.dll module handle\n"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
190 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
191 /* For Windows XP SP1+ / Server 2003 we use SetDllDirectory to avoid dll hell */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
192 if (MySetDllDirectory) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
193 printf("Using SetDllDirectory\n"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
194 MySetDllDirectory(path); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
195 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
196 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
197 /* For the rest, we set the current directory and make sure |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
198 * SafeDllSearch is set to 0 where needed. */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
199 else { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
200 OSVERSIONINFO osinfo; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
201 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
202 printf("Setting current directory to GTK+ dll directory\n"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
203 SetCurrentDirectory(path); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
204 /* For Windows 2000 (SP3+) / WinXP (No SP): |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
205 * If SafeDllSearchMode is set to 1, Windows system directories are |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
206 * searched for dlls before the current directory. Therefore we set it |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
207 * to 0. |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
208 */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
209 osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
210 GetVersionEx(&osinfo); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
211 if ((osinfo.dwMajorVersion == 5 && |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
212 osinfo.dwMinorVersion == 0 && |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
213 strcmp(osinfo.szCSDVersion, "Service Pack 3") >= 0) || |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
214 (osinfo.dwMajorVersion == 5 && |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
215 osinfo.dwMinorVersion == 1 && |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
216 strcmp(osinfo.szCSDVersion, "") >= 0) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
217 ) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
218 DWORD regval = 1; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
219 DWORD reglen = sizeof(DWORD); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
220 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
221 printf("Using Win2k (SP3+) / WinXP (No SP)... Checking SafeDllSearch\n"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
222 read_reg_string(HKEY_LOCAL_MACHINE, |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
223 "System\\CurrentControlSet\\Control\\Session Manager", |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
224 "SafeDllSearchMode", |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
225 (LPBYTE) ®val, |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
226 ®len); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
227 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
228 if (regval != 0) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
229 printf("Trying to set SafeDllSearchMode to 0\n"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
230 regval = 0; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
231 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, |
14595
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
232 "System\\CurrentControlSet\\Control\\Session Manager", |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
233 0, KEY_SET_VALUE, &hkey |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
234 ) == ERROR_SUCCESS) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
235 if (RegSetValueEx(hkey, |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
236 "SafeDllSearchMode", 0, |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
237 REG_DWORD, (LPBYTE) ®val, |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
238 sizeof(DWORD) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
239 ) != ERROR_SUCCESS) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
240 printf("Error writing SafeDllSearchMode. Error: %u\n", |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
241 (UINT) GetLastError()); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
242 RegCloseKey(hkey); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
243 } else |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
244 printf("Error opening Session Manager key for writing. Error: %u\n", |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
245 (UINT) GetLastError()); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
246 } else |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
247 printf("SafeDllSearchMode is set to 0\n"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
248 }/*end else*/ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
249 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
250 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
251 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
252 static char* wgaim_lcid_to_posix(LCID lcid) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
253 char *posix = NULL; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
254 int lang_id = PRIMARYLANGID(lcid); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
255 int sub_id = SUBLANGID(lcid); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
256 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
257 switch (lang_id) { |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
258 case LANG_ARABIC: posix = "ar"; break; |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
259 case LANG_AZERI: posix = "az"; break; |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
260 case LANG_BENGALI: posix = "bn"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
261 case LANG_BULGARIAN: posix = "bg"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
262 case LANG_CATALAN: posix = "ca"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
263 case LANG_CHINESE: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
264 switch (sub_id) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
265 case SUBLANG_CHINESE_SIMPLIFIED: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
266 posix = "zh_CN"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
267 case SUBLANG_CHINESE_TRADITIONAL: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
268 posix = "zh_TW"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
269 default: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
270 posix = "zh"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
271 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
272 break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
273 case LANG_CZECH: posix = "cs"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
274 case LANG_DANISH: posix = "da"; break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
275 case LANG_ESTONIAN: posix = "et"; break; |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
276 case LANG_PERSIAN: posix = "fa"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
277 case LANG_GERMAN: posix = "de"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
278 case LANG_GREEK: posix = "el"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
279 case LANG_ENGLISH: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
280 switch (sub_id) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
281 case SUBLANG_ENGLISH_UK: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
282 posix = "en_GB"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
283 case SUBLANG_ENGLISH_AUS: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
284 posix = "en_AU"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
285 case SUBLANG_ENGLISH_CAN: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
286 posix = "en_CA"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
287 default: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
288 posix = "en"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
289 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
290 break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
291 case LANG_SPANISH: posix = "es"; break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
292 case LANG_BASQUE: posix = "eu"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
293 case LANG_FINNISH: posix = "fi"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
294 case LANG_FRENCH: posix = "fr"; break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
295 case LANG_GALICIAN: posix = "gl"; break; |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
296 case LANG_GUJARATI: posix = "gu"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
297 case LANG_HEBREW: posix = "he"; break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
298 case LANG_HINDI: posix = "hi"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
299 case LANG_HUNGARIAN: posix = "hu"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
300 case LANG_ICELANDIC: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
301 case LANG_ITALIAN: posix = "it"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
302 case LANG_JAPANESE: posix = "ja"; break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
303 case LANG_GEORGIAN: posix = "ka"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
304 case LANG_KOREAN: posix = "ko"; break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
305 case LANG_LITHUANIAN: posix = "lt"; break; |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
306 case LANG_MACEDONIAN: posix = "mk"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
307 case LANG_DUTCH: posix = "nl"; break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
308 case LANG_NEPALI: posix = "ne"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
309 case LANG_NORWEGIAN: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
310 switch (sub_id) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
311 case SUBLANG_NORWEGIAN_BOKMAL: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
312 posix = "nb"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
313 case SUBLANG_NORWEGIAN_NYNORSK: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
314 posix = "nn"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
315 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
316 break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
317 case LANG_PUNJABI: posix = "pa"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
318 case LANG_POLISH: posix = "pl"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
319 case LANG_PORTUGUESE: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
320 switch (sub_id) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
321 case SUBLANG_PORTUGUESE_BRAZILIAN: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
322 posix = "pt_BR"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
323 default: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
324 posix = "pt"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
325 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
326 break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
327 case LANG_ROMANIAN: posix = "ro"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
328 case LANG_RUSSIAN: posix = "ru"; break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
329 /* LANG_CROATIAN == LANG_SERBIAN == LANG_BOSNIAN */ |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
330 case LANG_SERBIAN: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
331 switch (sub_id) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
332 case SUBLANG_SERBIAN_LATIN: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
333 posix = "sr@Latn"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
334 case SUBLANG_SERBIAN_CYRILLIC: |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
335 posix = "sr"; break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
336 case SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC: |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
337 case SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN: |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
338 posix = "bs"; break; |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
339 case SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN: |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
340 posix = "hr"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
341 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
342 break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
343 case LANG_SLOVAK: posix = "sk"; break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
344 case LANG_SLOVENIAN: posix = "sl"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
345 case LANG_ALBANIAN: posix = "sq"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
346 case LANG_SWEDISH: posix = "sv"; break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
347 case LANG_TAMIL: posix = "ta"; break; |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
348 case LANG_TELUGU: posix = "te"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
349 case LANG_THAI: posix = "th"; break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
350 case LANG_TURKISH: posix = "tr"; break; |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
351 case LANG_UKRAINIAN: posix = "uk"; break; |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
352 case LANG_VIETNAMESE: posix = "vi"; break; |
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
353 case LANG_XHOSA: posix = "xh"; break; |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
354 case LANG_URDU: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
355 case LANG_INDONESIAN: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
356 case LANG_BELARUSIAN: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
357 case LANG_LATVIAN: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
358 case LANG_ARMENIAN: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
359 case LANG_AFRIKAANS: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
360 case LANG_FAEROESE: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
361 case LANG_MALAY: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
362 case LANG_KAZAK: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
363 case LANG_KYRGYZ: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
364 case LANG_SWAHILI: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
365 case LANG_UZBEK: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
366 case LANG_TATAR: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
367 case LANG_ORIYA: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
368 case LANG_KANNADA: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
369 case LANG_MALAYALAM: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
370 case LANG_ASSAMESE: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
371 case LANG_MARATHI: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
372 case LANG_SANSKRIT: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
373 case LANG_MONGOLIAN: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
374 case LANG_KONKANI: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
375 case LANG_MANIPURI: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
376 case LANG_SINDHI: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
377 case LANG_SYRIAC: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
378 case LANG_KASHMIRI: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
379 case LANG_DIVEHI: break; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
380 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
381 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
382 /* Deal with exceptions */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
383 if (posix == NULL) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
384 switch (lcid) { |
14534
79adfd5ac0b9
[gaim-migrate @ 17255]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14257
diff
changeset
|
385 case 0x0455: posix = "my_MM"; break; /* Myanmar (Burmese) */ |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
386 case 9999: posix = "ku"; break; /* Kurdish (from NSIS) */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
387 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
388 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
389 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
390 return posix; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
391 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
392 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
393 /* Determine and set Gaim locale as follows (in order of priority): |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
394 - Check GAIMLANG env var |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
395 - Check NSIS Installer Language reg value |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
396 - Use default user locale |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
397 */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
398 static const char *wgaim_get_locale() { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
399 const char *locale = NULL; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
400 LCID lcid; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
401 #ifndef PORTABLE |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
402 char data[10]; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
403 DWORD datalen = 10; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
404 #endif |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
405 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
406 /* Check if user set GAIMLANG env var */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
407 if ((locale = getenv("GAIMLANG"))) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
408 return locale; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
409 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
410 #ifndef PORTABLE |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
411 if (read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\gaim", |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
412 "Installer Language", (LPBYTE) &data, &datalen)) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
413 if ((locale = wgaim_lcid_to_posix(atoi(data)))) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
414 return locale; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
415 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
416 #endif |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
417 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
418 lcid = GetUserDefaultLCID(); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
419 if ((locale = wgaim_lcid_to_posix(lcid))) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
420 return locale; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
421 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
422 return "en"; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
423 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
424 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
425 static void wgaim_set_locale() { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
426 const char *locale = NULL; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
427 char envstr[25]; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
428 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
429 locale = wgaim_get_locale(); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
430 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
431 snprintf(envstr, 25, "LANG=%s", locale); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
432 printf("Setting locale: %s\n", envstr); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
433 putenv(envstr); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
434 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
435 |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
436 #define WM_FOCUS_REQUEST (WM_APP + 13) |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
437 |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
438 static BOOL wgaim_set_running() { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
439 HANDLE h; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
440 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
441 if ((h = CreateMutex(NULL, FALSE, "gaim_is_running"))) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
442 if (GetLastError() == ERROR_ALREADY_EXISTS) { |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
443 HWND msg_win; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
444 |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
445 if((msg_win = FindWindow(TEXT("WingaimMsgWinCls"), NULL))) |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
446 if(SendMessage(msg_win, WM_FOCUS_REQUEST, (WPARAM) NULL, (LPARAM) NULL)) |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
447 return FALSE; |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
448 |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
449 /* If we get here, the focus request wasn't successful */ |
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
450 |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
451 MessageBox(NULL, |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
452 "An instance of Gaim is already running", |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
453 NULL, MB_OK | MB_TOPMOST); |
14257
14933d9055a0
[gaim-migrate @ 16939]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14224
diff
changeset
|
454 |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
455 return FALSE; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
456 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
457 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
458 return TRUE; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
459 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
460 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
461 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
462 #ifdef __GNUC__ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
463 # ifndef _stdcall |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
464 # define _stdcall __attribute__((stdcall)) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
465 # endif |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
466 #endif |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
467 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
468 int _stdcall |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
469 WinMain (struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance, |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
470 char *lpszCmdLine, int nCmdShow) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
471 char errbuf[512]; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
472 char gaimdir[MAX_PATH]; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
473 HMODULE hmod; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
474 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
475 /* If debug or help or version flag used, create console for output */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
476 if (strstr(lpszCmdLine, "-d") || strstr(lpszCmdLine, "-h") || strstr(lpszCmdLine, "-v")) { |
14595
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
477 /* If stdout hasn't been redirected to a file, alloc a console |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
478 * (_istty() doesn't work for stuff using the GUI subsystem) */ |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
479 if (_fileno(stdout) == -1) { |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
480 LPFNATTACHCONSOLE MyAttachConsole = NULL; |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
481 if ((hmod = GetModuleHandle("kernel32.dll"))) { |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
482 MyAttachConsole = |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
483 (LPFNATTACHCONSOLE) |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
484 GetProcAddress(hmod, "AttachConsole"); |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
485 } |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
486 if ((MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS)) |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
487 || AllocConsole()) { |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
488 freopen("CONOUT$", "w", stdout); |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
489 freopen("CONOUT$", "w", stderr); |
209e187246c5
[gaim-migrate @ 17322]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14534
diff
changeset
|
490 } |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
491 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
492 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
493 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
494 /* Load exception handler if we have it */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
495 if (GetModuleFileName(NULL, gaimdir, MAX_PATH) != 0) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
496 char *tmp = gaimdir; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
497 char *prev = NULL; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
498 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
499 while ((tmp = strchr(tmp, '\\'))) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
500 prev = tmp; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
501 tmp++; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
502 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
503 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
504 if (prev) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
505 prev[0] = '\0'; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
506 strcat(gaimdir, "\\exchndl.dll"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
507 if (LoadLibrary(gaimdir)) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
508 printf("Loaded exchndl.dll\n"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
509 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
510 } else { |
14942
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
511 DWORD dw = GetLastError(); |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
512 const char *err_msg = get_win32_error_message(dw); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
513 snprintf(errbuf, 512, |
14942
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
514 "Error getting module filename.\nError: (%u) %s", |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
515 (UINT) dw, err_msg); |
15197 | 516 printf("%s", errbuf); |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
517 MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
518 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
519 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
520 #ifndef PORTABLE |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
521 if (!getenv("GAIM_NO_DLL_CHECK")) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
522 #endif |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
523 dll_prep(); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
524 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
525 wgaim_set_locale(); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
526 /* If help or version flag used, do not check Mutex */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
527 if (!strstr(lpszCmdLine, "-h") && !strstr(lpszCmdLine, "-v")) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
528 if (!getenv("GAIM_MULTI_INST") && !wgaim_set_running()) |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
529 return 0; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
530 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
531 /* Now we are ready for Gaim .. */ |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
532 if ((hmod = LoadLibrary("gtkgaim.dll"))) { |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
533 gaim_main = (LPFNGAIMMAIN) GetProcAddress(hmod, "gaim_main"); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
534 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
535 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
536 if (!gaim_main) { |
14942
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
537 DWORD dw = GetLastError(); |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
538 BOOL mod_not_found = (dw == ERROR_MOD_NOT_FOUND || dw == ERROR_DLL_NOT_FOUND); |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
539 const char *err_msg = get_win32_error_message(dw); |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
540 |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
541 snprintf(errbuf, 512, "Error loading gtkgaim.dll.\nError: (%u) %s%s%s", |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
542 (UINT) dw, err_msg, |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
543 mod_not_found ? "\n" : "", |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
544 mod_not_found ? "This probably means that GTK+ can't be found." : ""); |
15197 | 545 printf("%s", errbuf); |
14942
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
546 MessageBox(NULL, errbuf, TEXT("Error"), MB_OK | MB_TOPMOST); |
93107520981e
[gaim-migrate @ 17713]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14748
diff
changeset
|
547 |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
548 return 0; |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
549 } |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
550 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
551 return gaim_main (hInstance, __argc, __argv); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
552 } |