Mercurial > pidgin
annotate src/win_gaim.c @ 9030:7ab20f829190
[gaim-migrate @ 9806]
Siege updated the code for creating right-click menu's for
buddies, chats, groups, etc. It uses more stuff from the blist
API and less stuff from multi.h. It also combines the code
for right-click menus for chats, buddies, etc. (all types of
blist nodes). So PRPLs and plugins can easily add right-click
menu options to anything in the buddy list in a clean way.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 23 May 2004 17:27:45 +0000 |
parents | 92cbf9713795 |
children | b28f9be379b3 |
rev | line source |
---|---|
4490 | 1 /* |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
2 * win_gaim.c |
4490 | 3 * |
4 * Date: June, 2002 | |
5 * Description: Entry point for win32 gaim, and various win32 dependant | |
6 * routines. | |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
7 * |
8046 | 8 * Gaim is the legal property of its developers, whose names are too numerous |
9 * to list here. Please refer to the COPYRIGHT file distributed with this | |
10 * source distribution. | |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
11 * |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
15 * (at your option) any later version. |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
16 * |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
20 * GNU General Public License for more details. |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
21 * |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
25 * |
4490 | 26 */ |
27 #include <windows.h> | |
7477
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
28 #include <fcntl.h> |
4490 | 29 #include <stdlib.h> |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
30 #include <string.h> |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
31 #include <stdio.h> |
4490 | 32 |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
33 typedef int (CALLBACK* LPFNGAIMMAIN)(HINSTANCE, int, char**); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
34 typedef void (CALLBACK* LPFNSETDLLDIRECTORY)(LPCTSTR); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
35 |
4490 | 36 /* |
37 * PROTOTYPES | |
38 */ | |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
39 static LPFNGAIMMAIN gaim_main = NULL; |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
40 static LPFNSETDLLDIRECTORY MySetDllDirectory = NULL; |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
41 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
42 |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
43 static BOOL read_reg_string(HKEY key, char* sub_key, char* val_name, LPBYTE data, LPDWORD data_len) { |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
44 HKEY hkey; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
45 BOOL ret = FALSE; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
46 int retv; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
47 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
48 if(ERROR_SUCCESS == RegOpenKeyEx(key, |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
49 sub_key, |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
50 0, KEY_QUERY_VALUE, &hkey)) { |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
51 if(ERROR_SUCCESS == (retv=RegQueryValueEx(hkey, val_name, 0, NULL, data, data_len))) |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
52 ret = TRUE; |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
53 else |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
54 printf("Could not read reg key '%s' subkey '%s' value: '%s'\nError: %u\n", |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
55 ((key == HKEY_LOCAL_MACHINE) ? "HKLM" : (key == HKEY_CURRENT_USER) ? "HKCU" : "???"), |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
56 sub_key, val_name, (UINT)GetLastError()); |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
57 RegCloseKey(key); |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
58 } |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
59 else |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
60 printf("Could not open reg subkey: %s\nError: %u\n", sub_key, (UINT)GetLastError()); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
61 |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
62 return ret; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
63 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
64 |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
65 static void dll_prep() { |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
66 char gtkpath[MAX_PATH]; |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
67 char path[MAX_PATH]; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
68 DWORD plen = MAX_PATH; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
69 int gotreg=FALSE; |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
70 HKEY hkey; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
71 HMODULE hmod; |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
72 |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
73 if(!(gotreg = read_reg_string((hkey=HKEY_LOCAL_MACHINE), "SOFTWARE\\GTK\\2.0", "Path", (LPBYTE)>kpath, &plen))) |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
74 gotreg = read_reg_string((hkey=HKEY_CURRENT_USER), "SOFTWARE\\GTK\\2.0", "Path", (LPBYTE)>kpath, &plen); |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
75 |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
76 if(!gotreg) |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
77 return; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
78 |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
79 /* Determine GTK+ dll path .. */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
80 if(!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "DllPath", (LPBYTE)&path, &plen)) { |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
81 char version[10]; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
82 char inst[10]; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
83 DWORD len = 10; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
84 |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
85 strcpy(path, gtkpath); |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
86 if(read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Version", (LPBYTE)&version, &len) && |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
87 read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Installer", (LPBYTE)&inst, &len)) { |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
88 if(strcmp(version, "2.2.2") >= 0 && |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
89 strcmp(inst, "NSIS") == 0) { |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
90 strcat(path, "\\bin"); |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
91 } |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
92 else |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
93 strcat(path, "\\lib"); |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
94 } |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
95 else |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
96 strcat(path, "\\lib"); |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
97 } |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
98 |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
99 printf("GTK+ path found: %s\n", path); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
100 |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
101 if((hmod=GetModuleHandle("kernel32.dll"))) { |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
102 MySetDllDirectory = (LPFNSETDLLDIRECTORY)GetProcAddress(hmod, "SetDllDirectory"); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
103 if(!MySetDllDirectory) |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
104 printf("SetDllDirectory not supported\n"); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
105 } |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
106 else |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
107 printf("Error getting kernel32.dll module handle\n"); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
108 |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
109 /* For Windows XP SP1+ / Server 2003 we use SetDllDirectory to avoid dll hell */ |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
110 if(MySetDllDirectory) { |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
111 printf("Using SetDllDirectory\n"); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
112 MySetDllDirectory(path); |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
113 } |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
114 |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
115 /* For the rest, we set the current directory and make sure SafeDllSearch is set |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
116 to 0 where needed. */ |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
117 else { |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
118 OSVERSIONINFO osinfo; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
119 |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
120 printf("Setting current directory to GTK+ dll directory\n"); |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
121 SetCurrentDirectory(path); |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
122 /* For Windows 2000 (SP3+) / WinXP (No SP): |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
123 * If SafeDllSearchMode is set to 1, Windows system directories are |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
124 * searched for dlls before the current directory. Therefore we set it |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
125 * to 0. |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
126 */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
127 osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
128 GetVersionEx(&osinfo); |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
129 if((osinfo.dwMajorVersion == 5 && |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
130 osinfo.dwMinorVersion == 0 && |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
131 strcmp(osinfo.szCSDVersion, "Service Pack 3") >= 0) || |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
132 (osinfo.dwMajorVersion == 5 && |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
133 osinfo.dwMinorVersion == 1 && |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
134 strcmp(osinfo.szCSDVersion, "") >= 0) |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
135 ) { |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
136 DWORD regval = 1; |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
137 DWORD reglen = sizeof(DWORD); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
138 |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
139 printf("Using Win2k (SP3+) / WinXP (No SP).. Checking SafeDllSearch\n"); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
140 read_reg_string(HKEY_LOCAL_MACHINE, |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
141 "System\\CurrentControlSet\\Control\\Session Manager", |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
142 "SafeDllSearchMode", |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
143 (LPBYTE)®val, |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
144 ®len); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
145 |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
146 if(regval != 0) { |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
147 printf("Trying to set SafeDllSearchMode to 0\n"); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
148 regval = 0; |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
149 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
150 "System\\CurrentControlSet\\Control\\Session Manager", |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
151 0, KEY_SET_VALUE, &hkey) == ERROR_SUCCESS) { |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
152 if(RegSetValueEx(hkey, |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
153 "SafeDllSearchMode", |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
154 0, |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
155 REG_DWORD, |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
156 (LPBYTE) ®val, |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
157 sizeof(DWORD)) != ERROR_SUCCESS) |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
158 printf("Error writing SafeDllSearchMode. Error: %u\n", |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
159 (UINT)GetLastError()); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
160 RegCloseKey(hkey); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
161 } |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
162 else |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
163 printf("Error opening Session Manager key for writing. Error: %u\n", |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
164 (UINT)GetLastError()); |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
165 } |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
166 else |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
167 printf("SafeDllSearchMode is set to 0\n"); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
168 }/*end else*/ |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
169 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
170 } |
4490 | 171 |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
172 static char* wgaim_lcid_to_posix(LCID lcid) { |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
173 switch(lcid) { |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
174 case 1026: return "bg"; /* bulgarian */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
175 case 1027: return "ca"; /* catalan */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
176 case 1050: return "hr"; /* croation */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
177 case 1029: return "cs"; /* czech */ |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
178 case 1030: return "da"; /* danish */ |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
179 case 1043: return "nl"; /* dutch - netherlands */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
180 case 1033: return "en"; /* english - us */ |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
181 case 1035: return "fi"; /* finnish */ |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
182 case 1036: return "fr"; /* french - france */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
183 case 1031: return "de"; /* german - germany */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
184 case 1032: return "el"; /* greek */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
185 case 1037: return "he"; /* hebrew */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
186 case 1038: return "hu"; /* hungarian */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
187 case 1040: return "it"; /* italian - italy */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
188 case 1041: return "ja"; /* japanese */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
189 case 1042: return "ko"; /* korean */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
190 case 1063: return "lt"; /* lithuanian */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
191 case 1071: return "mk"; /* macedonian */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
192 case 1045: return "pl"; /* polish */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
193 case 2070: return "pt"; /* portuguese - portugal */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
194 case 1046: return "pt_BR"; /* portuguese - brazil */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
195 case 1048: return "ro"; /* romanian - romania */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
196 case 1049: return "ru"; /* russian - russia */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
197 case 2074: return "sr@Latn"; /* serbian - latin */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
198 case 3098: return "sr"; /* serbian - cyrillic */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
199 case 2052: return "zh_CN"; /* chinese - china (simple) */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
200 case 1051: return "sk"; /* slovak */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
201 case 1060: return "sl"; /* slovenian */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
202 case 1034: return "es"; /* spanish */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
203 case 1053: return "sv"; /* swedish */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
204 case 1054: return "th"; /* thai */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
205 case 1028: return "zh_TW"; /* chinese - taiwan (traditional) */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
206 case 1055: return "tr"; /* turkish */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
207 case 1058: return "uk"; /* ukrainian */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
208 default: |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
209 return NULL; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
210 } |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
211 } |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
212 |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
213 /* Determine and set Gaim locale as follows (in order of priority): |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
214 - Check LANG env var |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
215 - Check NSIS Installer Language reg value |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
216 - Use default user locale |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
217 */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
218 static void wgaim_set_locale() { |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
219 char data[10]; |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
220 DWORD datalen = 10; |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
221 char* locale=NULL; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
222 char envstr[25]; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
223 LCID lcid; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
224 |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
225 /* Check if user set LANG env var */ |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
226 if((locale = (char*)getenv("LANG"))) { |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
227 goto finish; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
228 } |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
229 |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
230 if(read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\gaim", "Installer Language", (LPBYTE)&data, &datalen)) { |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
231 if((locale = wgaim_lcid_to_posix(atoi(data)))) |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
232 goto finish; |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
233 } |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
234 |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
235 lcid = GetUserDefaultLCID(); |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
236 if((locale = wgaim_lcid_to_posix(lcid))) |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
237 goto finish; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
238 |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
239 finish: |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
240 if(!locale) |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
241 locale = "en"; |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
242 |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
243 snprintf(envstr, 25, "LANG=%s", locale); |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
244 printf("Setting locale: %s\n", envstr); |
7350
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
245 putenv(envstr); |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
246 } |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
247 |
e28728795a45
[gaim-migrate @ 7941]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6890
diff
changeset
|
248 |
4490 | 249 #ifdef __GNUC__ |
250 # ifndef _stdcall | |
251 # define _stdcall __attribute__((stdcall)) | |
252 # endif | |
253 #endif | |
254 | |
255 int _stdcall | |
256 WinMain (struct HINSTANCE__ *hInstance, | |
257 struct HINSTANCE__ *hPrevInstance, | |
258 char *lpszCmdLine, | |
259 int nCmdShow) | |
260 { | |
7477
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
261 char errbuf[512]; |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
262 char gaimdir[MAX_PATH]; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
263 HMODULE hmod; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
264 |
7802
f1d2907db5be
[gaim-migrate @ 8448]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7522
diff
changeset
|
265 /* If debug flag used, create console for output */ |
f1d2907db5be
[gaim-migrate @ 8448]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7522
diff
changeset
|
266 if(strstr(lpszCmdLine, "-d")) { |
f1d2907db5be
[gaim-migrate @ 8448]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7522
diff
changeset
|
267 if(AllocConsole()) |
f1d2907db5be
[gaim-migrate @ 8448]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7522
diff
changeset
|
268 freopen ("CONOUT$", "w", stdout); |
f1d2907db5be
[gaim-migrate @ 8448]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7522
diff
changeset
|
269 } |
f1d2907db5be
[gaim-migrate @ 8448]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7522
diff
changeset
|
270 |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
271 /* Load exception handler if we have it */ |
7477
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
272 if(GetModuleFileName(NULL, gaimdir, MAX_PATH) != 0) { |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
273 char *tmp = gaimdir; |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
274 char *prev = NULL; |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
275 |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
276 while((tmp=strchr(tmp, '\\'))) { |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
277 prev = tmp; |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
278 tmp+=1; |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
279 } |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
280 if(prev) { |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
281 prev[0] = '\0'; |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
282 strcat(gaimdir, "\\exchndl.dll"); |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
283 if(LoadLibrary(gaimdir)) |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
284 printf("Loaded exchndl.dll\n"); |
7477
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
285 } |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
286 } |
7477
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
287 else { |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
288 snprintf(errbuf, 512, "Error getting module filename. Error: %u", (UINT)GetLastError()); |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
289 MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
290 } |
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
291 |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
292 if(!getenv("GAIM_NO_DLL_CHECK")) |
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
293 dll_prep(); |
6816
5aeba37b303c
[gaim-migrate @ 7356]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4490
diff
changeset
|
294 |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
295 wgaim_set_locale(); |
7477
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
296 |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
297 /* Now we are ready for Gaim .. */ |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
298 if((hmod=LoadLibrary("gaim.dll"))) { |
7522
07156f873116
[gaim-migrate @ 8135]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7477
diff
changeset
|
299 gaim_main = (LPFNGAIMMAIN)GetProcAddress(hmod, "gaim_main"); |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
300 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
301 |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
302 if(!gaim_main) { |
7477
29d69daa1ede
[gaim-migrate @ 8090]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7363
diff
changeset
|
303 snprintf(errbuf, 512, "Error loading gaim.dll. Error: %u", (UINT)GetLastError()); |
7356
be11a6f2fe00
[gaim-migrate @ 7949]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7350
diff
changeset
|
304 MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); |
6890
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
305 return 0; |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
306 } |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
307 else |
4eee806af511
[gaim-migrate @ 7436]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
6816
diff
changeset
|
308 return gaim_main (hInstance, __argc, __argv); |
4490 | 309 } |
310 |