annotate libpurple/win32/win32dep.h @ 32519:13d06d60fc49

*** Plucked rev d1d77da56217f3a083e1d459bef054db9f1d5699 (qulogic@pidgin.im): Rearrange code to prevent a NULL-deference. Thanks to clh for pointing out this issue. Closes #14392.
author Mark Doliner <mark@kingant.net>
date Sat, 18 Feb 2012 23:00:10 +0000
parents 1568dc7a14f8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
2 * purple
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 * File: win32dep.h
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 15822
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 #ifndef _WIN32DEP_H_
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #define _WIN32DEP_H_
22726
1cd99421c696 Include winsock2.h before windows.h is included to avoid winsock.h being
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22545
diff changeset
25 #include <winsock2.h>
1cd99421c696 Include winsock2.h before windows.h is included to avoid winsock.h being
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22545
diff changeset
26 #include <windows.h>
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include <shlobj.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include <process.h>
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
29 #include "wpurpleerror.h"
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "libc_interface.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31
23970
54eb782d4721 Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22726
diff changeset
32
22545
322b92e28005 Add extern "C" wrappers to win32 headers. There is also a change here that I thought I committed earlier that should provide better error messages for winsock errors.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20514
diff changeset
33 #ifdef __cplusplus
322b92e28005 Add extern "C" wrappers to win32 headers. There is also a change here that I thought I committed earlier that should provide better error messages for winsock errors.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20514
diff changeset
34 extern "C" {
322b92e28005 Add extern "C" wrappers to win32 headers. There is also a change here that I thought I committed earlier that should provide better error messages for winsock errors.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20514
diff changeset
35 #endif /* __cplusplus */
322b92e28005 Add extern "C" wrappers to win32 headers. There is also a change here that I thought I committed earlier that should provide better error messages for winsock errors.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20514
diff changeset
36
23970
54eb782d4721 Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22726
diff changeset
37 /* the winapi headers don't yet have winhttp.h, so we use the struct from msdn directly */
54eb782d4721 Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22726
diff changeset
38 typedef struct {
54eb782d4721 Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22726
diff changeset
39 BOOL fAutoDetect;
54eb782d4721 Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22726
diff changeset
40 LPWSTR lpszAutoConfigUrl;
54eb782d4721 Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22726
diff changeset
41 LPWSTR lpszProxy;
54eb782d4721 Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22726
diff changeset
42 LPWSTR lpszProxyBypass;
54eb782d4721 Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22726
diff changeset
43 } WINHTTP_CURRENT_USER_IE_PROXY_CONFIG;
54eb782d4721 Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22726
diff changeset
44
15397
1ec72a759b5c Fix win32 build for status icon changes
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15373
diff changeset
45 /* rpcndr.h defines small as char, causing problems, so we need to undefine it */
1ec72a759b5c Fix win32 build for status icon changes
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15373
diff changeset
46 #undef small
1ec72a759b5c Fix win32 build for status icon changes
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15373
diff changeset
47
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 * PROTOS
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 ** win32dep.c
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 **/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 /* Windows helper functions */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
56 FARPROC wpurple_find_and_loadproc(const char *dllname, const char *procedure);
24034
1568dc7a14f8 Warnings cleanup from Lee Roach. Fixes #6242.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
57 gboolean wpurple_read_reg_dword(HKEY rootkey, const char *subkey, const char *valname, LPDWORD result);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
58 char *wpurple_read_reg_string(HKEY rootkey, const char *subkey, const char *valname); /* needs to be g_free'd */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
59 gboolean wpurple_write_reg_string(HKEY rootkey, const char *subkey, const char *valname, const char *value);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
60 char *wpurple_escape_dirsep(const char *filename); /* needs to be g_free'd */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
61 GIOChannel *wpurple_g_io_channel_win32_new_socket(int socket); /* Until we get the post-2.8 glib win32 giochannel implementation working, use the thread-based one */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
63 /* Determine Purple paths */
22545
322b92e28005 Add extern "C" wrappers to win32 headers. There is also a change here that I thought I committed earlier that should provide better error messages for winsock errors.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20514
diff changeset
64 gchar *wpurple_get_special_folder(int folder_type); /* needs to be g_free'd */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
65 const char *wpurple_install_dir(void);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
66 const char *wpurple_lib_dir(void);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
67 const char *wpurple_locale_dir(void);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
68 const char *wpurple_data_dir(void);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 /* init / cleanup */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
71 void wpurple_init(void);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
72 void wpurple_cleanup(void);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73
20503
905891855710 3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@hxbc.us>
parents: 15822
diff changeset
74 long wpurple_get_tz_offset(void);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 * MACROS
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 /*
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
81 * Purple specific
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
83 #define DATADIR wpurple_install_dir()
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
84 #define LIBDIR wpurple_lib_dir()
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15397
diff changeset
85 #define LOCALEDIR wpurple_locale_dir()
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86
22545
322b92e28005 Add extern "C" wrappers to win32 headers. There is also a change here that I thought I committed earlier that should provide better error messages for winsock errors.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20514
diff changeset
87 #ifdef __cplusplus
322b92e28005 Add extern "C" wrappers to win32 headers. There is also a change here that I thought I committed earlier that should provide better error messages for winsock errors.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20514
diff changeset
88 }
322b92e28005 Add extern "C" wrappers to win32 headers. There is also a change here that I thought I committed earlier that should provide better error messages for winsock errors.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20514
diff changeset
89 #endif /* __cplusplus */
322b92e28005 Add extern "C" wrappers to win32 headers. There is also a change here that I thought I committed earlier that should provide better error messages for winsock errors.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20514
diff changeset
90
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 #endif /* _WIN32DEP_H_ */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92