annotate pidgin/win32/winpidgin.c @ 26053:99c3489e06b0

Wait for local video frame to be realized before starting local video. This fixes half of the BadWindow errors that have plagued vv.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Sun, 14 Dec 2008 23:43:52 +0000
parents daefbf001774
children f0874c392052
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
1 /*
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
2 * winpidgin.c
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
3 *
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
4 * Date: June, 2002
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
5 * Description: Entry point for win32 pidgin, and various win32 dependant
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
6 * routines.
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
7 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
10 * source distribution.
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
11 *
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
16 *
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
21 *
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 18786
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
25 *
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
26 */
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
27
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
28 /* This is for ATTACH_PARENT_PROCESS */
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
29 #ifndef _WIN32_WINNT
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
30 #define _WIN32_WINNT 0x501
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
31 #endif
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
32 #include <windows.h>
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
33 #include <fcntl.h>
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
34 #include <stdlib.h>
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
35 #include <string.h>
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
36 #include <stdio.h>
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
37
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
38 /* These will hopefully be in the win32api next time it is updated - at which point, we'll remove them */
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
39 #ifndef LANG_PERSIAN
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
40 #define LANG_PERSIAN 0x29
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
41 #endif
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
42 #ifndef LANG_BOSNIAN
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
43 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
44 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
45 #endif
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
46 #ifndef SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
47 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
48 #endif
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
49 #ifndef LANG_XHOSA
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
50 #define LANG_XHOSA 0x34
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
51 #endif
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
52
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
53
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15377
diff changeset
54 typedef int (CALLBACK* LPFNPIDGINMAIN)(HINSTANCE, int, char**);
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
55 typedef void (CALLBACK* LPFNSETDLLDIRECTORY)(LPCTSTR);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
56 typedef BOOL (CALLBACK* LPFNATTACHCONSOLE)(DWORD);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
57
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
58 static BOOL portable_mode = FALSE;
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
59
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
60 /*
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
61 * PROTOTYPES
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
62 */
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15377
diff changeset
63 static LPFNPIDGINMAIN pidgin_main = NULL;
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
64 static LPFNSETDLLDIRECTORY MySetDllDirectory = NULL;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
65
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
66 static const char *get_win32_error_message(DWORD err) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
67 static char err_msg[512];
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
68
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
69 FormatMessage(
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
70 FORMAT_MESSAGE_FROM_SYSTEM,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
71 NULL, err,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
72 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
73 (LPTSTR) &err_msg, sizeof(err_msg), NULL);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
74
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
75 return err_msg;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
76 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
77
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
78 static BOOL read_reg_string(HKEY key, char* sub_key, char* val_name, LPBYTE data, LPDWORD data_len) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
79 HKEY hkey;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
80 BOOL ret = FALSE;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
81 LONG retv;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
82
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
83 if (ERROR_SUCCESS == (retv = RegOpenKeyEx(key, sub_key, 0,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
84 KEY_QUERY_VALUE, &hkey))) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
85 if (ERROR_SUCCESS == (retv = RegQueryValueEx(hkey, val_name,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
86 NULL, NULL, data, data_len)))
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
87 ret = TRUE;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
88 else {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
89 const char *err_msg = get_win32_error_message(retv);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
90
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
91 printf("Could not read reg key '%s' subkey '%s' value: '%s'.\nMessage: (%ld) %s\n",
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
92 (key == HKEY_LOCAL_MACHINE) ? "HKLM"
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
93 : ((key == HKEY_CURRENT_USER) ? "HKCU" : "???"),
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
94 sub_key, val_name, retv, err_msg);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
95 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
96 RegCloseKey(hkey);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
97 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
98 else {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
99 TCHAR szBuf[80];
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
100
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
101 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, retv, 0,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
102 (LPTSTR) &szBuf, sizeof(szBuf), NULL);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
103 printf("Could not open reg subkey: %s\nError: (%ld) %s\n",
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
104 sub_key, retv, szBuf);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
105 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
106
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
107 return ret;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
108 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
109
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
110 static void common_dll_prep(const char *path) {
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
111 HMODULE hmod;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
112 HKEY hkey;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
113
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
114 printf("GTK+ path found: %s\n", path);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
115
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
116 if ((hmod = GetModuleHandle("kernel32.dll"))) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
117 MySetDllDirectory = (LPFNSETDLLDIRECTORY) GetProcAddress(
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
118 hmod, "SetDllDirectoryA");
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
119 if (!MySetDllDirectory)
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
120 printf("SetDllDirectory not supported\n");
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
121 } else
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
122 printf("Error getting kernel32.dll module handle\n");
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
123
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
124 /* For Windows XP SP1+ / Server 2003 we use SetDllDirectory to avoid dll hell */
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
125 if (MySetDllDirectory) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
126 printf("Using SetDllDirectory\n");
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
127 MySetDllDirectory(path);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
128 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
129
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
130 /* For the rest, we set the current directory and make sure
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
131 * SafeDllSearch is set to 0 where needed. */
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
132 else {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
133 OSVERSIONINFO osinfo;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
134
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
135 printf("Setting current directory to GTK+ dll directory\n");
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
136 SetCurrentDirectory(path);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
137 /* For Windows 2000 (SP3+) / WinXP (No SP):
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
138 * If SafeDllSearchMode is set to 1, Windows system directories are
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
139 * searched for dlls before the current directory. Therefore we set it
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
140 * to 0.
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
141 */
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
142 osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
143 GetVersionEx(&osinfo);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
144 if ((osinfo.dwMajorVersion == 5 &&
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
145 osinfo.dwMinorVersion == 0 &&
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
146 strcmp(osinfo.szCSDVersion, "Service Pack 3") >= 0) ||
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
147 (osinfo.dwMajorVersion == 5 &&
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
148 osinfo.dwMinorVersion == 1 &&
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
149 strcmp(osinfo.szCSDVersion, "") >= 0)
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
150 ) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
151 DWORD regval = 1;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
152 DWORD reglen = sizeof(DWORD);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
153
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
154 printf("Using Win2k (SP3+) / WinXP (No SP)... Checking SafeDllSearch\n");
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
155 read_reg_string(HKEY_LOCAL_MACHINE,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
156 "System\\CurrentControlSet\\Control\\Session Manager",
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
157 "SafeDllSearchMode",
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
158 (LPBYTE) &regval,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
159 &reglen);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
160
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
161 if (regval != 0) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
162 printf("Trying to set SafeDllSearchMode to 0\n");
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
163 regval = 0;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
164 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
165 "System\\CurrentControlSet\\Control\\Session Manager",
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
166 0, KEY_SET_VALUE, &hkey
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
167 ) == ERROR_SUCCESS) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
168 if (RegSetValueEx(hkey,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
169 "SafeDllSearchMode", 0,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
170 REG_DWORD, (LPBYTE) &regval,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
171 sizeof(DWORD)
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
172 ) != ERROR_SUCCESS)
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
173 printf("Error writing SafeDllSearchMode. Error: %u\n",
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
174 (UINT) GetLastError());
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
175 RegCloseKey(hkey);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
176 } else
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
177 printf("Error opening Session Manager key for writing. Error: %u\n",
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
178 (UINT) GetLastError());
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
179 } else
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
180 printf("SafeDllSearchMode is set to 0\n");
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
181 }/*end else*/
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
182 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
183 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
184
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
185 static void portable_mode_dll_prep(const char *pidgin_dir) {
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
186 /* need to be able to fit MAX_PATH + "PIDGIN_ASPELL_DIR=\\Aspell\\bin" in path2 */
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
187 char path[MAX_PATH + 1];
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
188 char path2[MAX_PATH + 33];
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
189 const char *prev = NULL;
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
190
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
191 /* We assume that GTK+ is installed under \\path\to\Pidgin\..\GTK
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
192 * First we find \\path\to
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
193 */
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
194 if (*pidgin_dir) {
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
195 /* pidgin_dir points to \\path\to\Pidgin */
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
196 const char *tmp = pidgin_dir;
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
197
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
198 while ((tmp = strchr(tmp, '\\'))) {
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
199 prev = tmp;
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
200 tmp++;
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
201 }
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
202 }
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
203
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
204 if (prev) {
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
205 int cnt = (prev - pidgin_dir);
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
206 strncpy(path, pidgin_dir, cnt);
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
207 path[cnt] = '\0';
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
208 } else {
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
209 printf("Unable to determine current executable path. \n"
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
210 "This will prevent the settings dir from being set.\n"
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
211 "Assuming GTK+ is in the PATH.\n");
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
212 return;
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
213 }
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
214
24158
40d03c5388ad Set %HOME% when running in portable mode so that GTK+'s files get stored in the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23669
diff changeset
215 /* Set $HOME so that the GTK+ settings get stored in the right place */
40d03c5388ad Set %HOME% when running in portable mode so that GTK+'s files get stored in the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23669
diff changeset
216 _snprintf(path2, sizeof(path2), "HOME=%s", path);
40d03c5388ad Set %HOME% when running in portable mode so that GTK+'s files get stored in the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23669
diff changeset
217 _putenv(path2);
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
218
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
219 /* Set up the settings dir base to be \\path\to
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
220 * The actual settings dir will be \\path\to\.purple */
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
221 _snprintf(path2, sizeof(path2), "PURPLEHOME=%s", path);
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
222 printf("Setting settings dir: %s\n", path2);
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
223 _putenv(path2);
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
224
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
225 _snprintf(path2, sizeof(path2), "PIDGIN_ASPELL_DIR=%s\\Aspell\\bin", path);
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
226 printf("%s\n", path2);
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
227 _putenv(path2);
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
228
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
229 /* set the GTK+ path to be \\path\to\GTK\bin */
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
230 strcat(path, "\\GTK\\bin");
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
231
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
232 common_dll_prep(path);
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
233 }
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
234
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
235 static void dll_prep() {
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
236 char path[MAX_PATH + 1];
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
237 HKEY hkey;
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
238 char gtkpath[MAX_PATH + 1];
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
239 DWORD plen;
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
240
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
241 plen = sizeof(gtkpath);
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
242 hkey = HKEY_CURRENT_USER;
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
243 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path",
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
244 (LPBYTE) &gtkpath, &plen)) {
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
245 hkey = HKEY_LOCAL_MACHINE;
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
246 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "Path",
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
247 (LPBYTE) &gtkpath, &plen)) {
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
248 printf("GTK+ Path Registry Key not found. "
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
249 "Assuming GTK+ is in the PATH.\n");
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
250 return;
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
251 }
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
252 }
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
253
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
254 /* this value is replaced during a successful RegQueryValueEx() */
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
255 plen = sizeof(path);
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
256 /* Determine GTK+ dll path .. */
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
257 if (!read_reg_string(hkey, "SOFTWARE\\GTK\\2.0", "DllPath",
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
258 (LPBYTE) &path, &plen)) {
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
259 strcpy(path, gtkpath);
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
260 strcat(path, "\\bin");
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
261 }
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
262
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
263 common_dll_prep(path);
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
264 }
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
265
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15377
diff changeset
266 static char* winpidgin_lcid_to_posix(LCID lcid) {
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
267 char *posix = NULL;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
268 int lang_id = PRIMARYLANGID(lcid);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
269 int sub_id = SUBLANGID(lcid);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
270
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
271 switch (lang_id) {
18522
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
272 case LANG_AFRIKAANS: posix = "af"; break;
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
273 case LANG_ARABIC: posix = "ar"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
274 case LANG_AZERI: posix = "az"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
275 case LANG_BENGALI: posix = "bn"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
276 case LANG_BULGARIAN: posix = "bg"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
277 case LANG_CATALAN: posix = "ca"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
278 case LANG_CZECH: posix = "cs"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
279 case LANG_DANISH: posix = "da"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
280 case LANG_ESTONIAN: posix = "et"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
281 case LANG_PERSIAN: posix = "fa"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
282 case LANG_GERMAN: posix = "de"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
283 case LANG_GREEK: posix = "el"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
284 case LANG_ENGLISH:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
285 switch (sub_id) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
286 case SUBLANG_ENGLISH_UK:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
287 posix = "en_GB"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
288 case SUBLANG_ENGLISH_AUS:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
289 posix = "en_AU"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
290 case SUBLANG_ENGLISH_CAN:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
291 posix = "en_CA"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
292 default:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
293 posix = "en"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
294 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
295 break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
296 case LANG_SPANISH: posix = "es"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
297 case LANG_BASQUE: posix = "eu"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
298 case LANG_FINNISH: posix = "fi"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
299 case LANG_FRENCH: posix = "fr"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
300 case LANG_GALICIAN: posix = "gl"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
301 case LANG_GUJARATI: posix = "gu"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
302 case LANG_HEBREW: posix = "he"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
303 case LANG_HINDI: posix = "hi"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
304 case LANG_HUNGARIAN: posix = "hu"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
305 case LANG_ICELANDIC: break;
18522
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
306 case LANG_INDONESIAN: posix = "id"; break;
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
307 case LANG_ITALIAN: posix = "it"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
308 case LANG_JAPANESE: posix = "ja"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
309 case LANG_GEORGIAN: posix = "ka"; break;
18522
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
310 case LANG_KANNADA: posix = "kn"; break;
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
311 case LANG_KOREAN: posix = "ko"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
312 case LANG_LITHUANIAN: posix = "lt"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
313 case LANG_MACEDONIAN: posix = "mk"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
314 case LANG_DUTCH: posix = "nl"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
315 case LANG_NEPALI: posix = "ne"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
316 case LANG_NORWEGIAN:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
317 switch (sub_id) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
318 case SUBLANG_NORWEGIAN_BOKMAL:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
319 posix = "nb"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
320 case SUBLANG_NORWEGIAN_NYNORSK:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
321 posix = "nn"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
322 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
323 break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
324 case LANG_PUNJABI: posix = "pa"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
325 case LANG_POLISH: posix = "pl"; break;
18522
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
326 case LANG_PASHTO: posix = "ps"; break;
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
327 case LANG_PORTUGUESE:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
328 switch (sub_id) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
329 case SUBLANG_PORTUGUESE_BRAZILIAN:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
330 posix = "pt_BR"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
331 default:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
332 posix = "pt"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
333 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
334 break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
335 case LANG_ROMANIAN: posix = "ro"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
336 case LANG_RUSSIAN: posix = "ru"; break;
18522
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
337 case LANG_SLOVAK: posix = "sk"; break;
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
338 case LANG_SLOVENIAN: posix = "sl"; break;
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
339 case LANG_ALBANIAN: posix = "sq"; break;
18786
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
340 /* LANG_CROATIAN == LANG_SERBIAN == LANG_BOSNIAN */
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
341 case LANG_SERBIAN:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
342 switch (sub_id) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
343 case SUBLANG_SERBIAN_LATIN:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
344 posix = "sr@Latn"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
345 case SUBLANG_SERBIAN_CYRILLIC:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
346 posix = "sr"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
347 case SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
348 case SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
349 posix = "bs"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
350 case SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN:
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
351 posix = "hr"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
352 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
353 break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
354 case LANG_SWEDISH: posix = "sv"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
355 case LANG_TAMIL: posix = "ta"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
356 case LANG_TELUGU: posix = "te"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
357 case LANG_THAI: posix = "th"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
358 case LANG_TURKISH: posix = "tr"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
359 case LANG_UKRAINIAN: posix = "uk"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
360 case LANG_VIETNAMESE: posix = "vi"; break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
361 case LANG_XHOSA: posix = "xh"; break;
18522
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
362 case LANG_CHINESE:
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
363 switch (sub_id) {
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
364 case SUBLANG_CHINESE_SIMPLIFIED:
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
365 posix = "zh_CN"; break;
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
366 case SUBLANG_CHINESE_TRADITIONAL:
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
367 posix = "zh_TW"; break;
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
368 default:
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
369 posix = "zh"; break;
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
370 }
baf4849ec7b7 Add win32 LCID lookup mappings for Afrikaans, Indonesian, Kannada, Pashto.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18521
diff changeset
371 break;
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
372 case LANG_URDU: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
373 case LANG_BELARUSIAN: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
374 case LANG_LATVIAN: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
375 case LANG_ARMENIAN: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
376 case LANG_FAEROESE: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
377 case LANG_MALAY: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
378 case LANG_KAZAK: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
379 case LANG_KYRGYZ: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
380 case LANG_SWAHILI: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
381 case LANG_UZBEK: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
382 case LANG_TATAR: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
383 case LANG_ORIYA: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
384 case LANG_MALAYALAM: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
385 case LANG_ASSAMESE: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
386 case LANG_MARATHI: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
387 case LANG_SANSKRIT: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
388 case LANG_MONGOLIAN: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
389 case LANG_KONKANI: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
390 case LANG_MANIPURI: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
391 case LANG_SINDHI: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
392 case LANG_SYRIAC: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
393 case LANG_KASHMIRI: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
394 case LANG_DIVEHI: break;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
395 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
396
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
397 /* Deal with exceptions */
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
398 if (posix == NULL) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
399 switch (lcid) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
400 case 0x0455: posix = "my_MM"; break; /* Myanmar (Burmese) */
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
401 case 9999: posix = "ku"; break; /* Kurdish (from NSIS) */
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
402 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
403 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
404
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
405 return posix;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
406 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
407
16021
5b9a35f9b2e4 Fix some overzealous s/gaim/purple/ stuff.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15871
diff changeset
408 /* Determine and set Pidgin locale as follows (in order of priority):
5b9a35f9b2e4 Fix some overzealous s/gaim/purple/ stuff.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15871
diff changeset
409 - Check PIDGINLANG env var
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
410 - Check NSIS Installer Language reg value
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
411 - Use default user locale
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
412 */
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15377
diff changeset
413 static const char *winpidgin_get_locale() {
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
414 const char *locale = NULL;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
415 LCID lcid;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
416 char data[10];
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
417 DWORD datalen = 10;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
418
16021
5b9a35f9b2e4 Fix some overzealous s/gaim/purple/ stuff.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15871
diff changeset
419 /* Check if user set PIDGINLANG env var */
5b9a35f9b2e4 Fix some overzealous s/gaim/purple/ stuff.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15871
diff changeset
420 if ((locale = getenv("PIDGINLANG")))
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
421 return locale;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
422
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
423 if (!portable_mode && read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\pidgin",
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
424 "Installer Language", (LPBYTE) &data, &datalen)) {
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15377
diff changeset
425 if ((locale = winpidgin_lcid_to_posix(atoi(data))))
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
426 return locale;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
427 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
428
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
429 lcid = GetUserDefaultLCID();
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15377
diff changeset
430 if ((locale = winpidgin_lcid_to_posix(lcid)))
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
431 return locale;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
432
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
433 return "en";
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
434 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
435
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15377
diff changeset
436 static void winpidgin_set_locale() {
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
437 const char *locale = NULL;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
438 char envstr[25];
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
439
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15377
diff changeset
440 locale = winpidgin_get_locale();
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
441
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
442 _snprintf(envstr, 25, "LANG=%s", locale);
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
443 printf("Setting locale: %s\n", envstr);
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
444 _putenv(envstr);
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
445 }
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
446
23669
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
447
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
448 static void winpidgin_add_stuff_to_path() {
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
449 char perl_path[MAX_PATH + 1];
23669
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
450 char *ppath = NULL;
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
451 char mit_kerberos_path[MAX_PATH + 1];
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
452 char *mpath = NULL;
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
453 DWORD plen;
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
454
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
455 printf("%s", "Looking for Perl... ");
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
456
23669
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
457 plen = sizeof(perl_path);
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
458 if (read_reg_string(HKEY_LOCAL_MACHINE, "SOFTWARE\\Perl", "",
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
459 (LPBYTE) &perl_path, &plen)) {
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
460 /* We *could* check for perl510.dll, but it seems unnecessary. */
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
461 printf("found in '%s'.\n", perl_path);
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
462
23669
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
463 if (perl_path[strlen(perl_path) - 1] != '\\')
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
464 strcat(perl_path, "\\");
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
465 strcat(perl_path, "bin");
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
466
23669
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
467 ppath = perl_path;
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
468 } else
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
469 printf("%s", "not found.\n");
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
470
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
471 printf("%s", "Looking for MIT Kerberos... ");
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
472
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
473 plen = sizeof(mit_kerberos_path);
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
474 if (read_reg_string(HKEY_LOCAL_MACHINE, "SOFTWARE\\MIT\\Kerberos", "InstallDir",
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
475 (LPBYTE) &mit_kerberos_path, &plen)) {
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
476 /* We *could* check for gssapi32.dll */
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
477 printf("found in '%s'.\n", mit_kerberos_path);
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
478
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
479 if (mit_kerberos_path[strlen(mit_kerberos_path) - 1] != '\\')
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
480 strcat(mit_kerberos_path, "\\");
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
481 strcat(mit_kerberos_path, "bin");
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
482
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
483 mpath = mit_kerberos_path;
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
484 } else
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
485 printf("%s", "not found.\n");
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
486
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
487 if (ppath != NULL || mpath != NULL) {
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
488 const char *path = getenv("PATH");
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
489 BOOL add_ppath = ppath != NULL && (path == NULL || !strstr(path, ppath));
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
490 BOOL add_mpath = mpath != NULL && (path == NULL || !strstr(path, mpath));
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
491 char *newpath;
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
492 int newlen;
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
493
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
494 if (add_ppath || add_mpath) {
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
495 /* Enough to add "PATH=" + path + ";" + ppath + ";" + mpath + \0 */
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
496 newlen = 6 + (path ? strlen(path) + 1 : 0);
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
497 if (add_ppath)
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
498 newlen += strlen(ppath) + 1;
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
499 if (add_mpath)
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
500 newlen += strlen(mpath) + 1;
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
501 newpath = malloc(newlen);
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
502 *newpath = '\0';
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
503
23669
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
504 _snprintf(newpath, newlen, "PATH=%s%s%s%s%s%s",
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
505 path ? path : "",
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
506 path ? ";" : "",
23669
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
507 add_ppath ? ppath : "",
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
508 add_ppath ? ";" : "",
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
509 add_mpath ? mpath : "",
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
510 add_mpath ? ";" : "");
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
511
23669
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
512 printf("New PATH: %s\n", newpath);
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
513
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
514 _putenv(newpath);
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
515 free(newpath);
23669
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
516 }
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
517 }
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
518 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
519
15613
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
520 #define PIDGIN_WM_FOCUS_REQUEST (WM_APP + 13)
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
521 #define PIDGIN_WM_PROTOCOL_HANDLE (WM_APP + 14)
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
522
21852
c8e37362179a Allow the user to Retry if Pidgin is running when they start the installer. Fixes #4355
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21528
diff changeset
523 static BOOL winpidgin_set_running(BOOL fail_if_running) {
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
524 HANDLE h;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
525
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15377
diff changeset
526 if ((h = CreateMutex(NULL, FALSE, "pidgin_is_running"))) {
21852
c8e37362179a Allow the user to Retry if Pidgin is running when they start the installer. Fixes #4355
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21528
diff changeset
527 DWORD err = GetLastError();
21981
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
528 if (err == ERROR_ALREADY_EXISTS) {
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
529 if (fail_if_running) {
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
530 HWND msg_win;
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
531
21981
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
532 printf("An instance of Pidgin is already running.\n");
20365
9401a46da958 applied changes from d6da6a7a5ad01f170f0fd78424183f73200dc78c
Luke Schierer <lschiere@pidgin.im>
parents: 20329
diff changeset
533
22399
3370f295a1e0 Fix a regression in presenting the existing instance of Pidgin on Windows when the executable is launched a subsequent time. Fixes #5041.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21981
diff changeset
534 if((msg_win = FindWindowEx(NULL, NULL, TEXT("WinpidginMsgWinCls"), NULL)))
21981
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
535 if(SendMessage(msg_win, PIDGIN_WM_FOCUS_REQUEST, (WPARAM) NULL, (LPARAM) NULL))
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
536 return FALSE;
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
537
21981
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
538 /* If we get here, the focus request wasn't successful */
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
539
21981
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
540 MessageBox(NULL,
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
541 "An instance of Pidgin is already running",
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
542 NULL, MB_OK | MB_TOPMOST);
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
543
21981
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
544 return FALSE;
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
545 }
46a9fc98402e This is how the error handling for the win32 single instance mutex is supposed to work.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21917
diff changeset
546 } else if (err != ERROR_SUCCESS)
21917
6492a6ca4b03 Warning fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21852
diff changeset
547 printf("Error (%u) accessing \"pidgin_is_running\" mutex.\n", (UINT) err);
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
548 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
549 return TRUE;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
550 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
551
15613
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
552 #define PROTO_HANDLER_SWITCH "--protocolhandler="
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
553
15613
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
554 static void handle_protocol(char *cmd) {
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
555 char *remote_msg, *tmp1, *tmp2;
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
556 int len;
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
557 SIZE_T len_written;
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
558 HWND msg_win;
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
559 DWORD pid;
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
560 HANDLE process;
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
561
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
562 /* The start of the message */
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
563 tmp1 = cmd + strlen(PROTO_HANDLER_SWITCH);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
564
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
565 /* The end of the message */
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
566 if ((tmp2 = strchr(tmp1, ' ')))
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
567 len = (tmp2 - tmp1);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
568 else
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
569 len = strlen(tmp1);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
570
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
571 if (len == 0) {
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
572 printf("No protocol message specified.\n");
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
573 return;
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
574 }
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
575
22497
6bd3a83e9d8c Fix protocolhandler invocation. Fixes #5248
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22399
diff changeset
576 if (!(msg_win = FindWindowEx(NULL, NULL, TEXT("WinpidginMsgWinCls"), NULL))) {
15613
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
577 printf("Unable to find an instance of Pidgin to handle protocol message.\n");
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
578 return;
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
579 }
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
580
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
581 GetWindowThreadProcessId(msg_win, &pid);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
582 if (!(process = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE, FALSE, pid))) {
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
583 DWORD dw = GetLastError();
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
584 const char *err_msg = get_win32_error_message(dw);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
585 printf("Unable to open Pidgin process. (%u) %s\n", (UINT) dw, err_msg);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
586 return;
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
587 }
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
588
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
589 printf("Trying to handle protocol message:\n'%*s'\n", len, tmp1);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
590
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
591 /* MEM_COMMIT initializes the memory to zero,
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
592 * so we don't need to worry that our section of tmp1 isn't nul-terminated */
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
593 if ((remote_msg = (char*) VirtualAllocEx(process, NULL, len + 1, MEM_COMMIT, PAGE_READWRITE))) {
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
594 if (WriteProcessMemory(process, remote_msg, tmp1, len, &len_written)) {
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
595 if (!SendMessage(msg_win, PIDGIN_WM_PROTOCOL_HANDLE, len_written, (LPARAM) remote_msg))
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
596 printf("Unable to send protocol message to Pidgin instance.\n");
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
597 } else {
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
598 DWORD dw = GetLastError();
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
599 const char *err_msg = get_win32_error_message(dw);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
600 printf("Unable to write to remote memory. (%u) %s\n", (UINT) dw, err_msg);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
601 }
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
602
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
603 VirtualFreeEx(process, remote_msg, 0, MEM_RELEASE);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
604 } else {
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
605 DWORD dw = GetLastError();
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
606 const char *err_msg = get_win32_error_message(dw);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
607 printf("Unable to allocate remote memory. (%u) %s\n", (UINT) dw, err_msg);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
608 }
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
609
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
610 CloseHandle(process);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
611 }
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
612
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
613
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
614 int _stdcall
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
615 WinMain (struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
616 char *lpszCmdLine, int nCmdShow) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
617 char errbuf[512];
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
618 char pidgin_dir[MAX_PATH];
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
619 char exe_name[MAX_PATH];
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
620 HMODULE hmod;
15613
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
621 char *tmp;
18786
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
622 int pidgin_argc = __argc;
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
623 char **pidgin_argv = __argv;
24478
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
624 int i;
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
625 BOOL debug = FALSE, help = FALSE, version = FALSE, multiple = FALSE;
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
626
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
627 /* If debug or help or version flag used, create console for output */
24478
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
628 for (i = 1; i < __argc; i++) {
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
629 if (strstr(__argv[i], "-d") || strstr(__argv[i], "--debug"))
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
630 debug = TRUE;
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
631 else if (strstr(__argv[i], "-h") || strstr(__argv[i], "--help"))
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
632 help = TRUE;
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
633 else if (strstr(__argv[i], "-v") || strstr(__argv[i], "--version"))
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
634 version = TRUE;
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
635 else if (strstr(__argv[i], "-m") || strstr(__argv[i], "--multiple"))
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
636 multiple = TRUE;
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
637 }
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
638
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
639 if (debug || help || version) {
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
640 /* If stdout hasn't been redirected to a file, alloc a console
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
641 * (_istty() doesn't work for stuff using the GUI subsystem) */
20329
24ce4fcce5b0 applied changes from e56db1b8a7bb8729e30fb3bf99a94ff7887fe4ec
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
642 if (_fileno(stdout) == -1 || _fileno(stdout) == -2) {
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
643 LPFNATTACHCONSOLE MyAttachConsole = NULL;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
644 if ((hmod = GetModuleHandle("kernel32.dll"))) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
645 MyAttachConsole =
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
646 (LPFNATTACHCONSOLE)
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
647 GetProcAddress(hmod, "AttachConsole");
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
648 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
649 if ((MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS))
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
650 || AllocConsole()) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
651 freopen("CONOUT$", "w", stdout);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
652 freopen("CONOUT$", "w", stderr);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
653 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
654 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
655 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
656
15613
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
657 /* If this is a protocol handler invocation, deal with it accordingly */
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
658 if ((tmp = strstr(lpszCmdLine, PROTO_HANDLER_SWITCH)) != NULL) {
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
659 handle_protocol(tmp);
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
660 return 0;
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
661 }
b0471b2a1de9 Core support for external protocol URIs. The actual handling of the URIs will be in the prpls and other plugins. This commit only includes the win32 method of actually passing in a URI - the dbus implementation still needs to be written.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15515
diff changeset
662
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
663 /* Load exception handler if we have it */
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
664 if (GetModuleFileName(NULL, pidgin_dir, MAX_PATH) != 0) {
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
665 char *prev = NULL;
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
666 tmp = pidgin_dir;
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
667
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
668 /* primitive dirname() */
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
669 while ((tmp = strchr(tmp, '\\'))) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
670 prev = tmp;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
671 tmp++;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
672 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
673
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
674 if (prev) {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
675 prev[0] = '\0';
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
676
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
677 /* prev++ will now point to the executable file name */
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
678 strcpy(exe_name, prev + 1);
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
679
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
680 strcat(pidgin_dir, "\\exchndl.dll");
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
681 if (LoadLibrary(pidgin_dir))
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
682 printf("Loaded exchndl.dll\n");
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
683
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
684 prev[0] = '\0';
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
685 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
686 } else {
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
687 DWORD dw = GetLastError();
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
688 const char *err_msg = get_win32_error_message(dw);
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
689 _snprintf(errbuf, 512,
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
690 "Error getting module filename.\nError: (%u) %s",
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
691 (UINT) dw, err_msg);
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
692 printf("%s\n", errbuf);
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
693 MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST);
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
694 pidgin_dir[0] = '\0';
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
695 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
696
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
697 /* Determine if we're running in portable mode */
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
698 if (strstr(lpszCmdLine, "--portable-mode")
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
699 || (exe_name != NULL && strstr(exe_name, "-portable.exe"))) {
18786
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
700 int i = 0, c = 0;
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
701
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
702 printf("Running in PORTABLE mode.\n");
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
703 portable_mode = TRUE;
18786
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
704
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
705 /* Remove the --portable-mode arg from the args passed to pidgin so it doesn't choke */
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
706 pidgin_argv = malloc(sizeof(char*) * pidgin_argc);
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
707 for (; i < __argc; i++) {
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
708 if (strstr(__argv[i], "--portable-mode") == NULL) {
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
709 pidgin_argv[c] = __argv[i];
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
710 c++;
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
711 } else
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
712 pidgin_argc--;
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
713 }
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
714 }
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
715
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
716 if (portable_mode)
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
717 portable_mode_dll_prep(pidgin_dir);
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
718 else if (!getenv("PIDGIN_NO_DLL_CHECK"))
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
719 dll_prep();
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
720
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15377
diff changeset
721 winpidgin_set_locale();
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
722
23669
85189641a970 This should have been part of the previous commit related to no longer
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23667
diff changeset
723 winpidgin_add_stuff_to_path();
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
724
18520
850cccc126ad Make the win32 launcher support "--multiple" as well as %PIDGIN_MULTI_INST%
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17145
diff changeset
725 /* If help, version or multiple flag used, do not check Mutex */
24478
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
726 if (!help && !version)
daefbf001774 Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24158
diff changeset
727 if (!winpidgin_set_running(getenv("PIDGIN_MULTI_INST") == NULL && !multiple))
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
728 return 0;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
729
16021
5b9a35f9b2e4 Fix some overzealous s/gaim/purple/ stuff.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15871
diff changeset
730 /* Now we are ready for Pidgin .. */
18521
c36b62c6e0b3 Convert portable winpidgin launcher executable to be the same binary as pidgin.exe and determine which behavior to use at runtime. Running "pidgin.exe --portable-mode" or renaming "pidgin.exe" to "pidgin-portable.exe" will cause the portable mode to be used.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18520
diff changeset
731 if ((hmod = LoadLibrary("pidgin.dll")))
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15377
diff changeset
732 pidgin_main = (LPFNPIDGINMAIN) GetProcAddress(hmod, "pidgin_main");
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
733
15515
75ffc646647f Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15377
diff changeset
734 if (!pidgin_main) {
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
735 DWORD dw = GetLastError();
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
736 BOOL mod_not_found = (dw == ERROR_MOD_NOT_FOUND || dw == ERROR_DLL_NOT_FOUND);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
737 const char *err_msg = get_win32_error_message(dw);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
738
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
739 _snprintf(errbuf, 512, "Error loading pidgin.dll.\nError: (%u) %s%s%s",
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
740 (UINT) dw, err_msg,
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
741 mod_not_found ? "\n" : "",
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
742 mod_not_found ? "This probably means that GTK+ can't be found." : "");
23648
ab5b9acebde3 Update the Perl plugin loader to work with Perl 5.10.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22497
diff changeset
743 printf("%s\n", errbuf);
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
744 MessageBox(NULL, errbuf, TEXT("Error"), MB_OK | MB_TOPMOST);
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
745
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
746 return 0;
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
747 }
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
748
18786
60b405e0b28e Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18522
diff changeset
749 return pidgin_main(hInstance, pidgin_argc, pidgin_argv);
15377
0e17470b47c2 Update win32 build for libpurple and pidgin renames. This compiles, but is far from complete.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
750 }