Fri, 28 Mar 2025 00:32:48 -0500
Fix an alignment issue with the conversation 3 vertical dots menu
If a conversation had notifications and you selected or hovered over it, the
notifications would hide, but the 3 vertical dots menu would be positioned
like the notifications were still visible.
Testing Done:
Joined a bunch of channels and waited for notifications to popup and then verified that the 3 vertical dots menu was in the correct place.
Reviewed at https://reviews.imfreedom.org/r/3932/
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
1 | /* |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
2 | * winpidgin.c |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
3 | * |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
4 | * Date: June, 2002 |
|
41086
631e6cba8635
Fix typos in Pidgin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40840
diff
changeset
|
5 | * Description: Entry point for win32 pidgin, and various win32 dependent |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
6 | * routines. |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
7 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
8 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
10 | * source distribution. |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
11 | * |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
12 | * This program is free software; you can redistribute it and/or modify |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
13 | * it under the terms of the GNU General Public License as published by |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
14 | * the Free Software Foundation; either version 2 of the License, or |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
15 | * (at your option) any later version. |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
16 | * |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
17 | * This program is distributed in the hope that it will be useful, |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
20 | * GNU General Public License for more details. |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
21 | * |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
22 | * You should have received a copy of the GNU General Public License |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
23 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19081
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
25 | * |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
26 | */ |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
27 | |
|
39085
9c8e48e76838
win32: Add warning at top of winpidgin.c to warn against direct linking
Mike Ruprecht <cmaiku@gmail.com>
parents:
39081
diff
changeset
|
28 | /* This file must remain without any immediate dependencies aka don't link |
|
9c8e48e76838
win32: Add warning at top of winpidgin.c to warn against direct linking
Mike Ruprecht <cmaiku@gmail.com>
parents:
39081
diff
changeset
|
29 | * directly to Pidgin, libpidgin, GLib, etc. WinPidgin adds a DLL directory |
|
9c8e48e76838
win32: Add warning at top of winpidgin.c to warn against direct linking
Mike Ruprecht <cmaiku@gmail.com>
parents:
39081
diff
changeset
|
30 | * at runtime if needed and dynamically loads libpidgin via LoadLibrary(). |
|
9c8e48e76838
win32: Add warning at top of winpidgin.c to warn against direct linking
Mike Ruprecht <cmaiku@gmail.com>
parents:
39081
diff
changeset
|
31 | */ |
|
9c8e48e76838
win32: Add warning at top of winpidgin.c to warn against direct linking
Mike Ruprecht <cmaiku@gmail.com>
parents:
39081
diff
changeset
|
32 | |
|
42410
563e7a17c220
Fix possible clash of config headers
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41952
diff
changeset
|
33 | #include "purpleconfig.h" |
|
33941
80fcf7f86e4a
win32: globally define _WIN32_WINNT macro, tune config, move gtkconv themes
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33385
diff
changeset
|
34 | |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
35 | #include <windows.h> |
|
35892
02bf3200b9cb
cross-win32: make use of WIN32_LEAN_AND_MEAN define
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35859
diff
changeset
|
36 | #include <shellapi.h> |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
37 | #include <fcntl.h> |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
38 | #include <stdlib.h> |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
39 | #include <string.h> |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
40 | #include <stdio.h> |
|
29634
80dbf6f777c4
Use a private GTK+ Runtime copy on Windows.
Daniel Atallah <datallah@pidgin.im>
parents:
28536
diff
changeset
|
41 | #include <sys/types.h> |
|
80dbf6f777c4
Use a private GTK+ Runtime copy on Windows.
Daniel Atallah <datallah@pidgin.im>
parents:
28536
diff
changeset
|
42 | #include <sys/stat.h> |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
43 | |
|
41952
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
44 | /* We can't include glib.h per the above warning, so we define our own unused |
|
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
45 | * parameter macro. |
|
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
46 | */ |
|
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
47 | #ifdef __GNUC__ |
|
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
48 | # define PIDGIN_WIN32_UNUSED __attribute__((unused)) |
|
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
49 | #else |
|
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
50 | # define PIDGIN_WIN32_UNUSED |
|
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
51 | #endif |
|
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
52 | |
|
43085
b349c302413c
Remove dead Windows code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43077
diff
changeset
|
53 | typedef int (__cdecl* LPFNPIDGINMAIN)(int, char**); |
|
39078
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
54 | typedef BOOL (WINAPI* LPFNSETDLLDIRECTORY)(LPCWSTR); |
|
33371
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
33365
diff
changeset
|
55 | typedef BOOL (WINAPI* LPFNATTACHCONSOLE)(DWORD); |
|
33365
3d82cc32b7a2
Use SetProcessDEPPolicy to permanently enable DEP during startup on supported
Daniel Atallah <datallah@pidgin.im>
parents:
31362
diff
changeset
|
56 | typedef BOOL (WINAPI* LPFNSETPROCESSDEPPOLICY)(DWORD); |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
57 | |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
58 | /* |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
59 | * PROTOTYPES |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
60 | */ |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15450
diff
changeset
|
61 | static LPFNPIDGINMAIN pidgin_main = NULL; |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
62 | |
|
29878
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
63 | static const wchar_t *get_win32_error_message(DWORD err) { |
|
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
64 | static wchar_t err_msg[512]; |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
65 | |
|
29878
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
66 | FormatMessageW( |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
67 | FORMAT_MESSAGE_FROM_SYSTEM, |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
68 | NULL, err, |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
69 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
|
29878
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
70 | (LPWSTR) &err_msg, sizeof(err_msg) / sizeof(wchar_t), NULL); |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
71 | |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
72 | return err_msg; |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
73 | } |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
74 | |
|
41952
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
75 | int __stdcall |
|
43085
b349c302413c
Remove dead Windows code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43077
diff
changeset
|
76 | WinMain(PIDGIN_WIN32_UNUSED struct HINSTANCE__ *hInstance, |
|
41952
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
77 | PIDGIN_WIN32_UNUSED struct HINSTANCE__ *hPrevInstance, |
|
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
78 | PIDGIN_WIN32_UNUSED char *lpszCmdLine, |
|
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
79 | PIDGIN_WIN32_UNUSED int nCmdShow) |
|
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
80 | { |
|
29878
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
81 | wchar_t errbuf[512]; |
|
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
82 | wchar_t pidgin_dir[MAX_PATH]; |
|
30739
72613eff8b0e
Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents:
29879
diff
changeset
|
83 | wchar_t *pidgin_dir_start = NULL; |
|
29878
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
84 | wchar_t exe_name[MAX_PATH]; |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
85 | HMODULE hmod; |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
86 | int pidgin_argc; |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
87 | char **pidgin_argv; /* This is in utf-8 */ |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
88 | int i, j, k; |
|
43085
b349c302413c
Remove dead Windows code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43077
diff
changeset
|
89 | BOOL debug = FALSE, help = FALSE, version = FALSE, success; |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
90 | LPWSTR *szArglist; |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
91 | LPWSTR cmdLine; |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
92 | |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
93 | /* If debug or help or version flag used, create console for output */ |
|
24795
48d838a2e580
Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <datallah@pidgin.im>
parents:
24433
diff
changeset
|
94 | for (i = 1; i < __argc; i++) { |
|
28536
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
95 | if (strlen(__argv[i]) > 1 && __argv[i][0] == '-') { |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
96 | /* check if we're looking at -- or - option */ |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
97 | if (__argv[i][1] == '-') { |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
98 | if (strstr(__argv[i], "--debug") == __argv[i]) |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
99 | debug = TRUE; |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
100 | else if (strstr(__argv[i], "--help") == __argv[i]) |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
101 | help = TRUE; |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
102 | else if (strstr(__argv[i], "--version") == __argv[i]) |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
103 | version = TRUE; |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
104 | } else { |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
105 | if (strchr(__argv[i], 'd')) |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
106 | debug = TRUE; |
|
31362
e5bfe4ed7307
Allowed pidgin on windows to properly handle combined arguments (i.e. "-dm" as opposed to "-d -m")
Nader Morshed <morshed.nader@gmail.com>
parents:
30739
diff
changeset
|
107 | if (strchr(__argv[i], 'h')) |
|
28536
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
108 | help = TRUE; |
|
31362
e5bfe4ed7307
Allowed pidgin on windows to properly handle combined arguments (i.e. "-dm" as opposed to "-d -m")
Nader Morshed <morshed.nader@gmail.com>
parents:
30739
diff
changeset
|
109 | if (strchr(__argv[i], 'v')) |
|
28536
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
110 | version = TRUE; |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
111 | } |
|
742223a6306a
Patch from Johnson Earls to improve the win32 launcher detection of whether we
Daniel Atallah <datallah@pidgin.im>
parents:
26999
diff
changeset
|
112 | } |
|
24795
48d838a2e580
Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <datallah@pidgin.im>
parents:
24433
diff
changeset
|
113 | } |
|
48d838a2e580
Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <datallah@pidgin.im>
parents:
24433
diff
changeset
|
114 | |
|
33365
3d82cc32b7a2
Use SetProcessDEPPolicy to permanently enable DEP during startup on supported
Daniel Atallah <datallah@pidgin.im>
parents:
31362
diff
changeset
|
115 | /* Permanently enable DEP if the OS supports it */ |
|
3d82cc32b7a2
Use SetProcessDEPPolicy to permanently enable DEP during startup on supported
Daniel Atallah <datallah@pidgin.im>
parents:
31362
diff
changeset
|
116 | if ((hmod = GetModuleHandleW(L"kernel32.dll"))) { |
|
3d82cc32b7a2
Use SetProcessDEPPolicy to permanently enable DEP during startup on supported
Daniel Atallah <datallah@pidgin.im>
parents:
31362
diff
changeset
|
117 | LPFNSETPROCESSDEPPOLICY MySetProcessDEPPolicy = |
|
41952
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
118 | (void *)GetProcAddress(hmod, "SetProcessDEPPolicy"); |
|
33365
3d82cc32b7a2
Use SetProcessDEPPolicy to permanently enable DEP during startup on supported
Daniel Atallah <datallah@pidgin.im>
parents:
31362
diff
changeset
|
119 | if (MySetProcessDEPPolicy) |
|
3d82cc32b7a2
Use SetProcessDEPPolicy to permanently enable DEP during startup on supported
Daniel Atallah <datallah@pidgin.im>
parents:
31362
diff
changeset
|
120 | MySetProcessDEPPolicy(1); //PROCESS_DEP_ENABLE |
|
3d82cc32b7a2
Use SetProcessDEPPolicy to permanently enable DEP during startup on supported
Daniel Atallah <datallah@pidgin.im>
parents:
31362
diff
changeset
|
121 | } |
|
3d82cc32b7a2
Use SetProcessDEPPolicy to permanently enable DEP during startup on supported
Daniel Atallah <datallah@pidgin.im>
parents:
31362
diff
changeset
|
122 | |
|
24795
48d838a2e580
Fix the initial parsing of args in the win32 launcher to be more robust.
Daniel Atallah <datallah@pidgin.im>
parents:
24433
diff
changeset
|
123 | if (debug || help || version) { |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
124 | /* If stdout hasn't been redirected to a file, alloc a console |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
125 | * (_istty() doesn't work for stuff using the GUI subsystem) */ |
|
20221
28e31ee832cd
applied changes from e56db1b8a7bb8729e30fb3bf99a94ff7887fe4ec
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
126 | if (_fileno(stdout) == -1 || _fileno(stdout) == -2) { |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
127 | LPFNATTACHCONSOLE MyAttachConsole = NULL; |
|
33365
3d82cc32b7a2
Use SetProcessDEPPolicy to permanently enable DEP during startup on supported
Daniel Atallah <datallah@pidgin.im>
parents:
31362
diff
changeset
|
128 | if (hmod) |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
129 | MyAttachConsole = |
|
41952
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
130 | (void *)GetProcAddress(hmod, "AttachConsole"); |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
131 | if ((MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS)) |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
132 | || AllocConsole()) { |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
133 | freopen("CONOUT$", "w", stdout); |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
134 | freopen("CONOUT$", "w", stderr); |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
135 | } |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
136 | } |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
137 | } |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
138 | |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
139 | cmdLine = GetCommandLineW(); |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
140 | |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
141 | /* Load exception handler if we have it */ |
|
29878
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
142 | if (GetModuleFileNameW(NULL, pidgin_dir, MAX_PATH) != 0) { |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
143 | |
|
18770
19fd340ce715
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 <datallah@pidgin.im>
parents:
18769
diff
changeset
|
144 | /* primitive dirname() */ |
|
30739
72613eff8b0e
Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents:
29879
diff
changeset
|
145 | pidgin_dir_start = wcsrchr(pidgin_dir, L'\\'); |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
146 | |
|
30739
72613eff8b0e
Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents:
29879
diff
changeset
|
147 | if (pidgin_dir_start) { |
|
29634
80dbf6f777c4
Use a private GTK+ Runtime copy on Windows.
Daniel Atallah <datallah@pidgin.im>
parents:
28536
diff
changeset
|
148 | HMODULE hmod; |
|
30739
72613eff8b0e
Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents:
29879
diff
changeset
|
149 | pidgin_dir_start[0] = L'\0'; |
|
18770
19fd340ce715
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 <datallah@pidgin.im>
parents:
18769
diff
changeset
|
150 | |
|
29635
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29634
diff
changeset
|
151 | /* tmp++ will now point to the executable file name */ |
|
30739
72613eff8b0e
Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents:
29879
diff
changeset
|
152 | wcscpy(exe_name, pidgin_dir_start + 1); |
|
18770
19fd340ce715
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 <datallah@pidgin.im>
parents:
18769
diff
changeset
|
153 | |
|
29878
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
154 | wcscat(pidgin_dir, L"\\exchndl.dll"); |
|
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
155 | if ((hmod = LoadLibraryW(pidgin_dir))) { |
|
33371
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
33365
diff
changeset
|
156 | typedef void (__cdecl* LPFNSETLOGFILE)(const LPCSTR); |
|
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
33365
diff
changeset
|
157 | LPFNSETLOGFILE MySetLogFile; |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
158 | /* exchndl.dll is built without UNICODE */ |
|
29635
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29634
diff
changeset
|
159 | char debug_dir[MAX_PATH]; |
|
40840
b5f355f90ab0
Port the updates from 2.14.2 and the upcoming 2.14.3 to 3.0.0
Gary Kramlich <grim@reaperworld.com>
parents:
39302
diff
changeset
|
160 | wprintf(L"Loaded exchndl.dll\n"); |
|
29635
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29634
diff
changeset
|
161 | /* Temporarily override exchndl.dll's logfile |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29634
diff
changeset
|
162 | * to something sane (Pidgin will override it |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29634
diff
changeset
|
163 | * again when it initializes) */ |
|
41952
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
164 | MySetLogFile = (void *)GetProcAddress(hmod, "SetLogFile"); |
|
33371
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
33365
diff
changeset
|
165 | if (MySetLogFile) { |
|
33385
562961da7c0d
Avoid unnecessary sizeof(char); it must always be 1
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
166 | if (GetTempPathA(sizeof(debug_dir), debug_dir) != 0) { |
|
29635
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29634
diff
changeset
|
167 | strcat(debug_dir, "pidgin.RPT"); |
|
40840
b5f355f90ab0
Port the updates from 2.14.2 and the upcoming 2.14.3 to 3.0.0
Gary Kramlich <grim@reaperworld.com>
parents:
39302
diff
changeset
|
168 | wprintf(L" Setting exchndl.dll LogFile to %s\n", |
|
29635
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29634
diff
changeset
|
169 | debug_dir); |
|
33371
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
33365
diff
changeset
|
170 | MySetLogFile(debug_dir); |
|
29635
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29634
diff
changeset
|
171 | } |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29634
diff
changeset
|
172 | } |
|
33371
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
33365
diff
changeset
|
173 | /* The function signature for SetDebugInfoDir is the same as SetLogFile, |
|
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
33365
diff
changeset
|
174 | * so we can reuse the variable */ |
|
41952
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
175 | MySetLogFile = (void *)GetProcAddress(hmod, "SetDebugInfoDir"); |
|
33371
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
33365
diff
changeset
|
176 | if (MySetLogFile) { |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
177 | char *pidgin_dir_ansi = NULL; |
|
30739
72613eff8b0e
Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents:
29879
diff
changeset
|
178 | /* Restore pidgin_dir to point to where the executable is */ |
|
72613eff8b0e
Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents:
29879
diff
changeset
|
179 | pidgin_dir_start[0] = L'\0'; |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
180 | i = WideCharToMultiByte(CP_ACP, 0, pidgin_dir, |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
181 | -1, NULL, 0, NULL, NULL); |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
182 | if (i != 0) { |
|
33385
562961da7c0d
Avoid unnecessary sizeof(char); it must always be 1
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
183 | pidgin_dir_ansi = malloc(i); |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
184 | i = WideCharToMultiByte(CP_ACP, 0, pidgin_dir, |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
185 | -1, pidgin_dir_ansi, i, NULL, NULL); |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
186 | if (i == 0) { |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
187 | free(pidgin_dir_ansi); |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
188 | pidgin_dir_ansi = NULL; |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
189 | } |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
190 | } |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
191 | if (pidgin_dir_ansi != NULL) { |
|
33385
562961da7c0d
Avoid unnecessary sizeof(char); it must always be 1
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
192 | _snprintf(debug_dir, sizeof(debug_dir), |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
193 | "%s\\pidgin-%s-dbgsym", |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
194 | pidgin_dir_ansi, VERSION); |
|
33385
562961da7c0d
Avoid unnecessary sizeof(char); it must always be 1
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
195 | debug_dir[sizeof(debug_dir) - 1] = '\0'; |
|
40840
b5f355f90ab0
Port the updates from 2.14.2 and the upcoming 2.14.3 to 3.0.0
Gary Kramlich <grim@reaperworld.com>
parents:
39302
diff
changeset
|
196 | wprintf(L" Setting exchndl.dll DebugInfoDir to %s\n", |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
197 | debug_dir); |
|
33371
6d93866a4a3f
Explictly set the calling conventions for some dynamic functions on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
33365
diff
changeset
|
198 | MySetLogFile(debug_dir); |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
199 | free(pidgin_dir_ansi); |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
200 | } |
|
29635
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29634
diff
changeset
|
201 | } |
|
e30bf262a1f2
Use an updated exchndl.dll that supports setting the log file path manually and
Daniel Atallah <datallah@pidgin.im>
parents:
29634
diff
changeset
|
202 | |
|
29634
80dbf6f777c4
Use a private GTK+ Runtime copy on Windows.
Daniel Atallah <datallah@pidgin.im>
parents:
28536
diff
changeset
|
203 | } |
|
18770
19fd340ce715
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 <datallah@pidgin.im>
parents:
18769
diff
changeset
|
204 | |
|
30739
72613eff8b0e
Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents:
29879
diff
changeset
|
205 | /* Restore pidgin_dir to point to where the executable is */ |
|
72613eff8b0e
Use some fully qualified dll locations.
Daniel Atallah <datallah@pidgin.im>
parents:
29879
diff
changeset
|
206 | pidgin_dir_start[0] = L'\0'; |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
207 | } |
|
39078
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
208 | |
|
39081
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
209 | /* Find parent directory to see if it's bin/ */ |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
210 | pidgin_dir_start = wcsrchr(pidgin_dir, L'\\'); |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
211 | |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
212 | /* Add bin/ subdirectory to DLL path if not already in bin/ */ |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
213 | if (pidgin_dir_start == NULL || |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
214 | wcscmp(pidgin_dir_start + 1, L"bin") != 0) { |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
215 | LPFNSETDLLDIRECTORY MySetDllDirectory = NULL; |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
216 | |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
217 | hmod = GetModuleHandleW(L"kernel32.dll"); |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
218 | |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
219 | if (hmod != NULL) { |
|
41952
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
220 | MySetDllDirectory = (void *)GetProcAddress(hmod, "SetDllDirectoryW"); |
|
39081
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
221 | if (MySetDllDirectory == NULL) { |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
222 | DWORD dw = GetLastError(); |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
223 | const wchar_t *err_msg = get_win32_error_message(dw); |
|
39302
64aabebb476b
winpidgin: Fix wprintf() style format for wchar_t strings
Mike Ruprecht <cmaiku@gmail.com>
parents:
39087
diff
changeset
|
224 | wprintf(L"Error loading SetDllDirectory(): (%u) %ls\n", dw, err_msg); |
|
39081
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
225 | } |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
226 | } else { |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
227 | printf("Error getting kernel32.dll handle\n"); |
|
e84ed81142f8
win32: Allow WinPidgin to choose to add bin/ DLL directory at runtime
Mike Ruprecht <cmaiku@gmail.com>
parents:
39079
diff
changeset
|
228 | } |
|
39078
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
229 | |
|
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
230 | if (MySetDllDirectory) { |
|
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
231 | wcscat(pidgin_dir, L"\\bin"); |
|
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
232 | if (MySetDllDirectory(pidgin_dir)) { |
|
39302
64aabebb476b
winpidgin: Fix wprintf() style format for wchar_t strings
Mike Ruprecht <cmaiku@gmail.com>
parents:
39087
diff
changeset
|
233 | wprintf(L"Added DLL directory to search path: %ls\n", |
|
39078
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
234 | pidgin_dir); |
|
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
235 | } else { |
|
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
236 | DWORD dw = GetLastError(); |
|
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
237 | const wchar_t *err_msg = get_win32_error_message(dw); |
|
39302
64aabebb476b
winpidgin: Fix wprintf() style format for wchar_t strings
Mike Ruprecht <cmaiku@gmail.com>
parents:
39087
diff
changeset
|
238 | wprintf(L"Error calling SetDllDirectory(): (%u) %ls\n", dw, err_msg); |
|
39078
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
239 | } |
|
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
240 | } |
|
bbaab5d6a8d5
win32: Simplify complicated DLL preparation
Mike Ruprecht <cmaiku@gmail.com>
parents:
39077
diff
changeset
|
241 | } |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
242 | } else { |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
243 | DWORD dw = GetLastError(); |
|
29878
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
244 | const wchar_t *err_msg = get_win32_error_message(dw); |
|
39086
a6cf683ddc27
win32: Use actual size of errbuf rather than hardcoding a number
Mike Ruprecht <cmaiku@gmail.com>
parents:
39085
diff
changeset
|
245 | _snwprintf(errbuf, sizeof(errbuf) / sizeof(wchar_t), |
|
39302
64aabebb476b
winpidgin: Fix wprintf() style format for wchar_t strings
Mike Ruprecht <cmaiku@gmail.com>
parents:
39087
diff
changeset
|
246 | L"Error getting module filename.\nError: (%u) %ls", |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
247 | (UINT) dw, err_msg); |
|
39302
64aabebb476b
winpidgin: Fix wprintf() style format for wchar_t strings
Mike Ruprecht <cmaiku@gmail.com>
parents:
39087
diff
changeset
|
248 | wprintf(L"%ls\n", errbuf); |
|
29878
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
249 | MessageBoxW(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); |
|
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
250 | pidgin_dir[0] = L'\0'; |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
251 | } |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
252 | |
|
16080
5668a44f275c
Fix some overzealous s/gaim/purple/ stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
15931
diff
changeset
|
253 | /* Now we are ready for Pidgin .. */ |
|
39087
ac9849be4a10
win32: Define libpidgin DLL name in meson to avoid needing to change it
Mike Ruprecht <cmaiku@gmail.com>
parents:
39086
diff
changeset
|
254 | if ((hmod = LoadLibraryW(LIBPIDGIN_DLL_NAMEW))) |
|
41952
e128168d9ea5
Fix a compilation error on windows and many warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
255 | pidgin_main = (void *)GetProcAddress(hmod, "pidgin_main"); |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
256 | |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15450
diff
changeset
|
257 | if (!pidgin_main) { |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
258 | DWORD dw = GetLastError(); |
|
29878
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
259 | const wchar_t *err_msg = get_win32_error_message(dw); |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
260 | |
|
39086
a6cf683ddc27
win32: Use actual size of errbuf rather than hardcoding a number
Mike Ruprecht <cmaiku@gmail.com>
parents:
39085
diff
changeset
|
261 | _snwprintf(errbuf, sizeof(errbuf) / sizeof(wchar_t), |
|
39302
64aabebb476b
winpidgin: Fix wprintf() style format for wchar_t strings
Mike Ruprecht <cmaiku@gmail.com>
parents:
39087
diff
changeset
|
262 | L"Error loading %ls.\nError: (%u) %ls", |
|
39087
ac9849be4a10
win32: Define libpidgin DLL name in meson to avoid needing to change it
Mike Ruprecht <cmaiku@gmail.com>
parents:
39086
diff
changeset
|
263 | LIBPIDGIN_DLL_NAMEW, (UINT) dw, err_msg); |
|
39302
64aabebb476b
winpidgin: Fix wprintf() style format for wchar_t strings
Mike Ruprecht <cmaiku@gmail.com>
parents:
39087
diff
changeset
|
264 | wprintf(L"%ls\n", errbuf); |
|
29878
623d7875f658
We're not going to support a non-UNICODE pidgin.exe
Daniel Atallah <datallah@pidgin.im>
parents:
29807
diff
changeset
|
265 | MessageBoxW(NULL, errbuf, L"Error", MB_OK | MB_TOPMOST); |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
266 | |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
267 | return 0; |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
268 | } |
|
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
269 | |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
270 | /* Convert argv to utf-8*/ |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
271 | szArglist = CommandLineToArgvW(cmdLine, &j); |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
272 | pidgin_argc = j; |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
273 | pidgin_argv = malloc(pidgin_argc* sizeof(char*)); |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
274 | k = 0; |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
275 | for (i = 0; i < j; i++) { |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
276 | success = FALSE; |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
277 | /* Remove the --portable-mode arg from the args passed to pidgin so it doesn't choke */ |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
278 | if (wcsstr(szArglist[i], L"--portable-mode") == NULL) { |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
279 | int len = WideCharToMultiByte(CP_UTF8, 0, szArglist[i], |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
280 | -1, NULL, 0, NULL, NULL); |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
281 | if (len != 0) { |
|
33385
562961da7c0d
Avoid unnecessary sizeof(char); it must always be 1
Daniel Atallah <datallah@pidgin.im>
parents:
33371
diff
changeset
|
282 | char *arg = malloc(len); |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
283 | len = WideCharToMultiByte(CP_UTF8, 0, szArglist[i], |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
284 | -1, arg, len, NULL, NULL); |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
285 | if (len != 0) { |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
286 | pidgin_argv[k++] = arg; |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
287 | success = TRUE; |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
288 | } |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
289 | } |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
290 | if (!success) |
|
39302
64aabebb476b
winpidgin: Fix wprintf() style format for wchar_t strings
Mike Ruprecht <cmaiku@gmail.com>
parents:
39087
diff
changeset
|
291 | wprintf(L"Error converting argument '%ls' to UTF-8\n", |
|
29636
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
292 | szArglist[i]); |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
293 | } |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
294 | if (!success) |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
295 | pidgin_argc--; |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
296 | } |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
297 | LocalFree(szArglist); |
|
cfd62d35ff49
Fix the win32 launcher to support unicode input. This allows the config
Daniel Atallah <datallah@pidgin.im>
parents:
29635
diff
changeset
|
298 | |
|
43085
b349c302413c
Remove dead Windows code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43077
diff
changeset
|
299 | return pidgin_main(pidgin_argc, pidgin_argv); |
|
15450
09e913390266
Restoring win32 stuff that was (I assume accidentally) dropped. I took advantage of the opportunity to try the daggy fix stuff.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
300 | } |