]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Replace WIN32 by _WIN32
authorGert Doering <gert@greenie.muc.de>
Sun, 13 Nov 2016 19:52:28 +0000 (20:52 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 15 Nov 2016 08:38:06 +0000 (09:38 +0100)
With c99, "WIN32" is no longer automatically defined when (cross-)building
for Windows, and proper compilation relies on including <windefs.h>,
before checking the macro.  "_WIN32" is the official define that is
guaranteed to be defined by the compiler itself, no includes are needed.

So, mechanically change all occurrances of "WIN32" to "_WIN32".

While at it, get rid of unused WIN32_0_1 #define in syshead.h

See also:
http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefi
ned_macros_detect_operating_system#WindowsCygwinnonPOSIXandMinGW

Trac #746

v2: rebased to master, merge the console[_builtin].c changes

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20161113195228.74090-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13035.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
45 files changed:
doc/doxygen/openvpn.doxyfile
include/openvpn-plugin.h.in
src/compat/compat-gettimeofday.c
src/compat/compat-inet_ntop.c
src/compat/compat-inet_pton.c
src/openvpn/block_dns.c
src/openvpn/block_dns.h
src/openvpn/common.h
src/openvpn/console_builtin.c
src/openvpn/cryptoapi.c
src/openvpn/error.c
src/openvpn/error.h
src/openvpn/event.c
src/openvpn/event.h
src/openvpn/fdmisc.c
src/openvpn/fdmisc.h
src/openvpn/forward.c
src/openvpn/init.c
src/openvpn/manage.c
src/openvpn/manage.h
src/openvpn/misc.c
src/openvpn/misc.h
src/openvpn/openvpn.c
src/openvpn/options.c
src/openvpn/options.h
src/openvpn/otime.h
src/openvpn/platform.c
src/openvpn/platform.h
src/openvpn/plugin.c
src/openvpn/plugin.h
src/openvpn/route.c
src/openvpn/route.h
src/openvpn/sig.c
src/openvpn/sig.h
src/openvpn/socket.c
src/openvpn/socket.h
src/openvpn/ssl.c
src/openvpn/ssl_backend.h
src/openvpn/ssl_mbedtls.c
src/openvpn/ssl_openssl.c
src/openvpn/syshead.h
src/openvpn/tun.c
src/openvpn/tun.h
src/openvpn/win32.c
src/openvpn/win32.h

index 7a02028a1a33a5b9931b3ef976f736a57a986dda..a7d9728ead466105e2fbde4e5af68773b791c8c4 100644 (file)
@@ -235,7 +235,7 @@ EXPAND_ONLY_PREDEF     = NO
 SEARCH_INCLUDES        = YES
 INCLUDE_PATH           =
 INCLUDE_FILE_PATTERNS  =
-PREDEFINED             = WIN32 NTLM USE_LZO ENABLE_FRAGMENT P2MP P2MP_SERVER ENABLE_CRYPTO ENABLE_CRYPTO_OPENSSL ENABLE_PLUGIN ENABLE_MANAGEMENT ENABLE_OCC HAVE_GETTIMEOFDAY
+PREDEFINED             = _WIN32 NTLM USE_LZO ENABLE_FRAGMENT P2MP P2MP_SERVER ENABLE_CRYPTO ENABLE_CRYPTO_OPENSSL ENABLE_PLUGIN ENABLE_MANAGEMENT ENABLE_OCC HAVE_GETTIMEOFDAY
 EXPAND_AS_DEFINED      =
 SKIP_FUNCTION_MACROS   = YES
 #---------------------------------------------------------------------------
index b03a9df7db189f25ef9fbcef2555dfcf8225d504..34ad18b42c19eb6390129b7cc1003d2fcae28d53 100644 (file)
@@ -154,7 +154,7 @@ typedef void *openvpn_plugin_handle_t;
 /*
  * For Windows (needs to be modified for MSVC)
  */
-#if defined(WIN32) && !defined(OPENVPN_PLUGIN_H)
+#if defined(_WIN32) && !defined(OPENVPN_PLUGIN_H)
 # define OPENVPN_EXPORT __declspec(dllexport)
 #else
 # define OPENVPN_EXPORT
index 0f32d5d106b44989adfdc3bb33c86ed097e1c075..19feaae1f2e2a99e89d73f52ffbf43c0c7088329 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "compat.h"
 
-#ifdef WIN32
+#ifdef _WIN32
 /*
  * NOTICE: mingw has much faster gettimeofday!
  * autoconf will set HAVE_GETTIMEOFDAY
@@ -126,6 +126,6 @@ gettimeofday (struct timeval *tv, void *tz)
        return 0;
 }
 
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #endif /* HAVE_GETTIMEOFDAY */
index 0d5214255a57bb9b46d2d5ec141a40b69a04fe5e..786c973c710f281539fb36fced7613c4e9eac0f4 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "compat.h"
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #include <windows.h>
 
index cdc8d4b073b4974882caac2d7c18de6aa9997c45..5965f0d6c5f56badae9c0689861c60abae7e14a2 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "compat.h"
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #include <windows.h>
 #include <string.h>
index 1ca57ba2ab778ee29eea63808444c8d0e9301fd0..cb3ce88e2b7fa0037144c79e855d6b1287b3b3e5 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "syshead.h"
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #include <fwpmu.h>
 #include <initguid.h>
index e94535160f3d4af39ce2ee4c8b28238163814850..f8b6d4fbbc946032dd14539f21dd44a4d2882aa9 100644 (file)
@@ -22,7 +22,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #ifndef OPENVPN_BLOCK_DNS_H
 #define OPENVPN_BLOCK_DNS_H
index 2f85bec2b70ca675a29f63084df695c1103c8aec..1134101dc38dc396532ce0bc075e7e52d8d9245d 100644 (file)
@@ -30,7 +30,7 @@
  */
 #ifdef USE_64_BIT_COUNTERS
   typedef unsigned long long int counter_type;
-# ifdef WIN32
+# ifdef _WIN32
 #  define counter_format  "%I64u"
 # else
 #  define counter_format  "%llu"
index 0434f604d8a1a934ddd5c9d78aaab6e5f39dda2a..6b0211d9eb9dcdd344bb55c336a56c112ab7ba59 100644 (file)
@@ -41,7 +41,7 @@
 #include "buffer.h"
 #include "misc.h"
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #include "win32.h"
 
@@ -119,7 +119,7 @@ static bool get_console_input_win32 (const char *prompt, const bool echo, char *
     return false;
 }
 
-#endif   /* WIN32 */
+#endif   /* _WIN32 */
 
 
 #ifdef HAVE_GETPASS
@@ -176,7 +176,7 @@ static bool get_console_input (const char *prompt, const bool echo, char *input,
     ASSERT (capacity > 0);
     input[0] = '\0';
 
-#if defined(WIN32)
+#if defined(_WIN32)
     return get_console_input_win32 (prompt, echo, input, capacity);
 #elif defined(HAVE_GETPASS)
 
index 853c07b19c020585007f5b61a40a0985dcdfbc50..e107bd3f7619b0c6a80ce493779178e8e41b5383 100644 (file)
@@ -465,4 +465,4 @@ int SSL_CTX_use_CryptoAPI_certificate(SSL_CTX *ssl_ctx, const char *cert_prop)
 #ifdef _MSC_VER  /* Dummy function needed to avoid empty file compiler warning in Microsoft VC */
 static void dummy (void) {}
 #endif
-#endif                         /* WIN32 */
+#endif                         /* _WIN32 */
index bb0ab5b92035f6509da0be203457438317bf9ec5..425bc30525fdb2885bf3432a6fc8cf3ff93af840 100644 (file)
@@ -453,7 +453,7 @@ close_syslog ()
 #endif
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 
 static HANDLE orig_stderr;
 
@@ -471,7 +471,7 @@ get_orig_stderr (void)
 void
 redirect_stdout_stderr (const char *file, bool append)
 {
-#if defined(WIN32)
+#if defined(_WIN32)
   if (!std_redir)
     {
       struct gc_arena gc = gc_new ();
@@ -622,7 +622,7 @@ x_check_status (int status,
              sock->info.mtu_changed = true;
            }
        }
-#elif defined(WIN32)
+#elif defined(_WIN32)
       /* get possible driver error from TAP-Windows driver */
       extended_msg = tap_win_getinfo (tt, &gc);
 #endif
@@ -677,7 +677,7 @@ openvpn_exit (const int status)
 
       tun_abort();
 
-#ifdef WIN32
+#ifdef _WIN32
       uninit_win32 ();
 #endif
 
@@ -737,7 +737,7 @@ crash (void)
 }
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 
 const char *
 strerror_win32 (DWORD errnum, struct gc_arena *gc)
index 2d8fa131ff8fa4f8b0366dd3b762be2802fdb1ff..f43bc38d8a75f247ff638963f85756e228773fe4 100644 (file)
@@ -71,7 +71,7 @@ struct gc_arena;
 
 /* String and Error functions */
 
-#ifdef WIN32
+#ifdef _WIN32
 # define openvpn_errno()             GetLastError()
 # define openvpn_strerror(e, gc)     strerror_win32(e, gc)
   const char *strerror_win32 (DWORD errnum, struct gc_arena *gc);
@@ -261,7 +261,7 @@ void close_syslog ();
 /* log file output */
 void redirect_stdout_stderr (const char *file, bool append);
 
-#ifdef WIN32
+#ifdef _WIN32
 /* get original stderr handle, even if redirected by --log/--log-append */
 HANDLE get_orig_stderr (void);
 #endif
@@ -356,7 +356,7 @@ static inline bool
 ignore_sys_error (const int err)
 {
   /* I/O operation pending */
-#ifdef WIN32
+#ifdef _WIN32
   if (err == WSAEWOULDBLOCK || err == WSAEINVAL)
     return true;
 #else
index c6426911f2401836872b01a0809983d054cb2373..409ad13199daab5d8101434c006b9f9580d13ce7 100644 (file)
@@ -49,7 +49,7 @@
 /*
  * All non-windows OSes are assumed to have select()
  */
-#ifdef WIN32
+#ifdef _WIN32
 #define SELECT 0
 #else
 #define SELECT 1
@@ -74,7 +74,7 @@ tv_to_ms_timeout (const struct timeval *tv)
     return max_int (tv->tv_sec * 1000 + (tv->tv_usec + 500) / 1000, 1);
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 
 struct we_set
 {
@@ -462,7 +462,7 @@ we_init (int *maxevents, unsigned int flags)
   return (struct event_set *) wes;
 }
 
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #if EPOLL
 
@@ -1007,7 +1007,7 @@ static struct event_set *
 event_set_init_simple (int *maxevents, unsigned int flags)
 {
   struct event_set *ret = NULL;
-#ifdef WIN32
+#ifdef _WIN32
   ret = we_init (maxevents, flags);
 #elif POLL && SELECT
 #if 0 /* Define to 1 if EVENT_METHOD_US_TIMEOUT should cause select to be favored over poll */
index bd29fdc1b269653f3250cea632fd19e3c5e2fa21..565343d3f306861b06c4dff97aee6babfeef31a2 100644 (file)
@@ -42,7 +42,7 @@
 #define EVENT_METHOD_US_TIMEOUT   (1<<0)
 #define EVENT_METHOD_FAST         (1<<1)
 
-#ifdef WIN32
+#ifdef _WIN32
 
 typedef const struct rw_handle *event_t;
 
@@ -137,7 +137,7 @@ event_set_return_init (struct event_set_return *esr)
   esr->arg = NULL;
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 
 static inline void
 wait_signal (struct event_set *es, void *arg)
index 7fe449c5e2cf2389fc0ce42948d1e1015eec0898..ce01319713a66e421befa5e8d5e82d0dac4453ef 100644 (file)
@@ -39,7 +39,7 @@
 bool
 set_nonblock_action (int fd)
 {
-#ifdef WIN32
+#ifdef _WIN32
   u_long arg = 1;
   if (ioctlsocket (fd, FIONBIO, &arg))
     return false;
@@ -54,7 +54,7 @@ set_nonblock_action (int fd)
 bool
 set_cloexec_action (int fd)
 {
-#ifndef WIN32
+#ifndef _WIN32
   if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
     return false;
 #endif
index 13d6552d29c9ce1ce84e81c8899ebfe61e6c767e..d34db9bd19478ca86c057b391bc85ff204c40c0f 100644 (file)
@@ -37,7 +37,7 @@ void set_cloexec (int fd);
 
 static inline void openvpn_fd_set(int fd, fd_set *setp)
 {
-#ifndef WIN32 /* The Windows FD_SET() implementation does not overflow */
+#ifndef _WIN32 /* The Windows FD_SET() implementation does not overflow */
   ASSERT (fd >= 0 && fd < FD_SETSIZE);
 #endif
   FD_SET (fd, setp);
index 3a4c26a96928297a22e3e84986d1690c0ddc341a..b50a2e0257716edb366b50945416bbdf7ff1bf8d 100644 (file)
@@ -301,7 +301,7 @@ check_add_routes_dowork (struct context *c)
            {
              register_signal (c, SIGHUP, "ip-fail");
              c->persist.restart_sleep_seconds = 10;
-#ifdef WIN32
+#ifdef _WIN32
              show_routes (M_INFO|M_NOPREFIX);
              show_adapters (M_INFO|M_NOPREFIX);
 #endif
@@ -1420,7 +1420,7 @@ pre_select (struct context *c)
   c->c2.timeval.tv_sec = BIG_TIMEOUT;
   c->c2.timeval.tv_usec = 0;
 
-#if defined(WIN32)
+#if defined(_WIN32)
   if (check_debug_level (D_TAP_WIN_DEBUG))
     {
       c->c2.timeval.tv_sec = 1;
index d3cf7ab9b518e3e168f8c986acdeff336b58e4b7..eaa5e7993d455b547a26a4e359b1ded920846250 100644 (file)
@@ -577,7 +577,7 @@ init_static (void)
   error_reset ();              /* initialize error.c */
   reset_check_status ();       /* initialize status check code in socket.c */
 
-#ifdef WIN32
+#ifdef _WIN32
   init_win32 ();
 #endif
 
@@ -1024,7 +1024,7 @@ format_common_name (struct context *c, struct gc_arena *gc)
 void
 pre_setup (const struct options *options)
 {
-#ifdef WIN32
+#ifdef _WIN32
   if (options->exit_event_name)
     {
       win32_signal_open (&win32_signal,
@@ -1245,7 +1245,7 @@ initialization_sequence_completed (struct context *c, const unsigned int flags)
   /* Test if errors */
   if (flags & ISC_ERRORS)
     {
-#ifdef WIN32
+#ifdef _WIN32
       show_routes (M_INFO|M_NOPREFIX);
       show_adapters (M_INFO|M_NOPREFIX);
       msg (M_INFO, "%s With Errors ( see http://openvpn.net/faq.html#dhcpclientserv )", message);
@@ -1260,7 +1260,7 @@ initialization_sequence_completed (struct context *c, const unsigned int flags)
   if ((flags & (ISC_ERRORS|ISC_SERVER)) == 0)
     c->options.no_advance=true;
 
-#ifdef WIN32
+#ifdef _WIN32
   fork_register_dns_action (c->c1.tuntap);
 #endif
 
@@ -1355,7 +1355,7 @@ do_route (const struct options *options,
       argv_reset (&argv);
     }
 
-#ifdef WIN32
+#ifdef _WIN32
   if (options->show_net_up)
     {
       show_routes (M_INFO|M_NOPREFIX);
@@ -1421,7 +1421,7 @@ do_open_tun (struct context *c)
       /* initialize (but do not open) tun/tap object */
       do_init_tun (c);
 
-#ifdef WIN32
+#ifdef _WIN32
       /* store (hide) interactive service handle in tuntap_options */
       c->c1.tuntap->options.msg_channel = c->options.msg_channel;
       msg (D_ROUTE, "interactive service msg_channel=%u", (unsigned int) c->options.msg_channel);
@@ -1482,7 +1482,7 @@ do_open_tun (struct context *c)
                   c->plugins,
                   OPENVPN_PLUGIN_UP,
                   c->c1.tuntap->actual_name,
-#ifdef WIN32
+#ifdef _WIN32
                   c->c1.tuntap->adapter_index,
 #endif
                   dev_type_string (c->options.dev, c->options.dev_type),
@@ -1495,7 +1495,7 @@ do_open_tun (struct context *c)
                   "up",
                   c->c2.es);
 
-#if defined(WIN32)
+#if defined(_WIN32)
       if (c->options.block_outside_dns)
       {
         dmsg (D_LOW, "Blocking outside DNS");
@@ -1535,7 +1535,7 @@ do_open_tun (struct context *c)
                     c->plugins,
                     OPENVPN_PLUGIN_UP,
                     c->c1.tuntap->actual_name,
-#ifdef WIN32
+#ifdef _WIN32
                     c->c1.tuntap->adapter_index,
 #endif
                     dev_type_string (c->options.dev, c->options.dev_type),
@@ -1547,7 +1547,7 @@ do_open_tun (struct context *c)
                     NULL,
                     "up",
                     c->c2.es);
-#if defined(WIN32)
+#if defined(_WIN32)
       if (c->options.block_outside_dns)
         {
           dmsg (D_LOW, "Blocking outside DNS");
@@ -1585,7 +1585,7 @@ do_close_tun (struct context *c, bool force)
   if (c->c1.tuntap && c->c1.tuntap_owned)
     {
       const char *tuntap_actual = string_alloc (c->c1.tuntap->actual_name, &gc);
-#ifdef WIN32
+#ifdef _WIN32
       DWORD adapter_index = c->c1.tuntap->adapter_index;
 #endif
       const in_addr_t local = c->c1.tuntap->local;
@@ -1611,7 +1611,7 @@ do_close_tun (struct context *c, bool force)
                            c->plugins,
                            OPENVPN_PLUGIN_ROUTE_PREDOWN,
                            tuntap_actual,
-#ifdef WIN32
+#ifdef _WIN32
                            adapter_index,
 #endif
                            NULL,
@@ -1639,7 +1639,7 @@ do_close_tun (struct context *c, bool force)
                       c->plugins,
                       OPENVPN_PLUGIN_DOWN,
                       tuntap_actual,
-#ifdef WIN32
+#ifdef _WIN32
                       adapter_index,
 #endif
                       NULL,
@@ -1653,7 +1653,7 @@ do_close_tun (struct context *c, bool force)
                       "down",
                       c->c2.es);
 
-#if defined(WIN32)
+#if defined(_WIN32)
             if (c->options.block_outside_dns)
             {
                 if (!win_wfp_uninit(c->options.msg_channel))
@@ -1673,7 +1673,7 @@ do_close_tun (struct context *c, bool force)
                         c->plugins,
                         OPENVPN_PLUGIN_DOWN,
                         tuntap_actual,
-#ifdef WIN32
+#ifdef _WIN32
                         adapter_index,
 #endif
                         NULL,
@@ -1687,7 +1687,7 @@ do_close_tun (struct context *c, bool force)
                         "down",
                         c->c2.es);
 
-#if defined(WIN32)
+#if defined(_WIN32)
           if (c->options.block_outside_dns)
             {
               if (!win_wfp_uninit(c->options.msg_channel))
@@ -3173,7 +3173,7 @@ do_setup_fast_io (struct context *c)
 {
   if (c->options.fast_io)
     {
-#ifdef WIN32
+#ifdef _WIN32
       msg (M_INFO, "NOTE: --fast-io is disabled since we are running on Windows");
 #else
       if (!proto_is_udp(c->options.ce.proto))
@@ -3286,7 +3286,7 @@ management_callback_status_p2p (void *arg, const int version, struct status_outp
 void
 management_show_net_callback (void *arg, const int msglevel)
 {
-#ifdef WIN32
+#ifdef _WIN32
   show_routes (msglevel);
   show_adapters (msglevel);
   msg (msglevel, "END");
index 26a2f7ea18e498a7fdb814b5cc0cae2bbea79cc2..77a80061e5d82fb75029ed6a2b4b02ecc5ba9dcd 100644 (file)
@@ -270,7 +270,7 @@ man_delete_unix_socket (struct management *man)
 static void
 man_close_socket (struct management *man, const socket_descriptor_t sd)
 {
-#ifndef WIN32
+#ifndef _WIN32
   /*
    * Windows doesn't need this because the ne32 event is permanently
    * enabled at struct management scope.
@@ -1413,7 +1413,7 @@ man_dispatch_command (struct management *man, struct status_output *so, const ch
   gc_free (&gc);
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 
 static void
 man_start_ne32 (struct management *man)
@@ -1503,7 +1503,7 @@ man_new_connection_post (struct management *man, const char *description)
 
   man_connection_settings_reset (man);
 
-#ifdef WIN32
+#ifdef _WIN32
   man_start_ne32 (man);
 #endif
 
@@ -1590,7 +1590,7 @@ man_accept (struct management *man)
 
       if (socket_defined (man->connection.sd_top))
        {
-#ifdef WIN32
+#ifdef _WIN32
          man_stop_ne32 (man);
 #endif
        }
@@ -1654,7 +1654,7 @@ man_listen (struct management *man)
             print_sockaddr (man->settings.local->ai_addr, &gc));
     }
 
-#ifdef WIN32
+#ifdef _WIN32
   man_start_ne32 (man);
 #endif
   
@@ -1737,7 +1737,7 @@ man_reset_client_socket (struct management *man, const bool exiting)
 {
   if (socket_defined (man->connection.sd_cli))
     {
-#ifdef WIN32
+#ifdef _WIN32
       man_stop_ne32 (man);
 #endif
       man_close_socket (man, man->connection.sd_cli);
@@ -2254,7 +2254,7 @@ man_connection_init (struct management *man)
 {
   if (man->connection.state == MS_INITIAL)
     {
-#ifdef WIN32
+#ifdef _WIN32
       /*
        * This object is a sort of TCP/IP helper
        * for Windows.
@@ -2295,7 +2295,7 @@ man_connection_close (struct management *man)
 
   if (mc->es)
     event_free (mc->es);
-#ifdef WIN32
+#ifdef _WIN32
   net_event_win32_close (&mc->ne32);
 #endif
   if (socket_defined (mc->sd_top))
@@ -2731,7 +2731,7 @@ man_persist_state (unsigned int *persistent, const int n)
   return true;
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 
 void
 management_socket_set (struct management *man,
index 50db38cd5559862f3be09802164f14b5b0eb0a2b..3ffced07a5281a0b43a5d8a133f9787f3e45043c 100644 (file)
@@ -257,7 +257,7 @@ struct man_connection {
   socket_descriptor_t sd_cli;
   struct openvpn_sockaddr remote;
 
-#ifdef WIN32
+#ifdef _WIN32
   struct net_event_win32 ne32;
 #endif
 
index fdee663581ded0ce69ccb3ee43588a326ef1322d..56d43e0a6370248b169284f5162feeda5336181b 100644 (file)
@@ -64,7 +64,7 @@ run_up_down (const char *command,
             const struct plugin_list *plugins,
             int plugin_type,
             const char *arg,
-#ifdef WIN32
+#ifdef _WIN32
             DWORD adapter_index,
 #endif
             const char *dev_type,
@@ -87,7 +87,7 @@ run_up_down (const char *command,
   setenv_str (es, "dev", arg);
   if (dev_type)
     setenv_str (es, "dev_type", dev_type);
-#ifdef WIN32
+#ifdef _WIN32
   setenv_int (es, "dev_idx", adapter_index);
 #endif
 
@@ -196,7 +196,7 @@ const char *
 system_error_message (int stat, struct gc_arena *gc)
 {
   struct buffer out = alloc_buf_gc (256, gc);
-#ifdef WIN32
+#ifdef _WIN32
   if (stat == -1)
     buf_printf (&out, "external program did not execute -- ");
   buf_printf (&out, "returned error code %d", stat);
@@ -252,7 +252,7 @@ openvpn_execve_allowed (const unsigned int flags)
 }
 
 
-#ifndef WIN32
+#ifndef _WIN32
 /*
  * Run execve() inside a fork().  Designed to replicate the semantics of system() but
  * in a safer way that doesn't require the invocation of a shell or the risks
@@ -950,7 +950,7 @@ hostname_randomize(const char *hostname, struct gc_arena *gc)
 const char *
 gen_path (const char *directory, const char *filename, struct gc_arena *gc)
 {
-#ifdef WIN32
+#ifdef _WIN32
   const int CC_PATH_RESERVED = CC_LESS_THAN|CC_GREATER_THAN|CC_COLON|
     CC_DOUBLE_QUOTE|CC_SLASH|CC_BACKSLASH|CC_PIPE|CC_QUESTION_MARK|CC_ASTERISK;
 #else
@@ -961,7 +961,7 @@ gen_path (const char *directory, const char *filename, struct gc_arena *gc)
   if (safe_filename
       && strcmp (safe_filename, ".")
       && strcmp (safe_filename, "..")
-#ifdef WIN32
+#ifdef _WIN32
       && win_safe_filename (safe_filename)
 #endif
       )
@@ -989,7 +989,7 @@ absolute_pathname (const char *pathname)
   if (pathname)
     {
       const int c = pathname[0];
-#ifdef WIN32
+#ifdef _WIN32
       return c == '\\' || (isalpha(c) && pathname[1] == ':' && pathname[2] == '\\');
 #else
       return c == '/';
index cc0a474dd169378d927501c35d32a0342ee68789..b8bbaa7fe09890accbd993cf1f8ff3834845a24f 100644 (file)
@@ -56,7 +56,7 @@ void run_up_down (const char *command,
                  const struct plugin_list *plugins,
                  int plugin_type,
                  const char *arg,
-#ifdef WIN32
+#ifdef _WIN32
                  DWORD adapter_index,
 #endif
                  const char *dev_type,
index 823c3dd13d49c8e4cae9c48f893e01853b7e73eb..5fb2fd9cfaf0a62d572e64cfd95237543ee41856 100644 (file)
@@ -138,7 +138,7 @@ openvpn_main (int argc, char *argv[])
   return 1;
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
   SetConsoleOutputCP (CP_UTF8);
 #endif
 
@@ -172,7 +172,7 @@ openvpn_main (int argc, char *argv[])
 
          /* initialize environmental variable store */
          c.es = env_set_create (NULL);
-#ifdef WIN32
+#ifdef _WIN32
          set_win_sys_path_via_env (c.es);
 #endif
 
@@ -220,7 +220,7 @@ openvpn_main (int argc, char *argv[])
 
          /* print version number */
          msg (M_INFO, "%s", title_string);
-#ifdef WIN32
+#ifdef _WIN32
          show_windows_version(M_INFO);
 #endif
          show_library_versions(M_INFO);
@@ -312,7 +312,7 @@ openvpn_main (int argc, char *argv[])
   return 0;                                /* NOTREACHED */
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 int
 wmain (int argc, wchar_t *wargv[]) {
   char **argv;
index 4d31e4c0b7affa9c739153e5e273ec995c3c37c8..443f96b15d9bb46073f2400be48cee57dbe9aedb 100644 (file)
@@ -592,7 +592,7 @@ static const char usage_message[] =
   "                        Default is CN in the Subject field.\n"
 #endif
   "--verify-hash   : Specify SHA1 fingerprint for level-1 cert.\n"
-#ifdef WIN32
+#ifdef _WIN32
   "--cryptoapicert select-string : Load the certificate and private key from the\n"
   "                  Windows Certificate System Store.\n"
 #endif
@@ -670,7 +670,7 @@ static const char usage_message[] =
   "--show-digests  : Show message digest algorithms to use with --auth option.\n"
   "--show-engines  : Show hardware crypto accelerator engines (if available).\n"
   "--show-tls      : Show all TLS ciphers (TLS used only as a control channel).\n"
-#ifdef WIN32
+#ifdef _WIN32
   "\n"
   "Windows Specific:\n"
   "--win-sys path    : Pathname of Windows system directory. Default is the pathname\n"
@@ -720,7 +720,7 @@ static const char usage_message[] =
   "                       optional parameter controls the initial state of ex.\n"
   "--show-net-up   : Show " PACKAGE_NAME "'s view of routing table and net adapter list\n"
   "                  after TAP adapter is up and routes have been added.\n"
-#ifdef WIN32
+#ifdef _WIN32
   "--block-outside-dns   : Block DNS on other network adapters to prevent DNS leaks\n"
 #endif
   "Windows Standalone Options:\n"
@@ -816,7 +816,7 @@ init_options (struct options *o, const bool init_gc)
 #ifdef TARGET_LINUX
   o->tuntap_options.txqueuelen = 100;
 #endif
-#ifdef WIN32
+#ifdef _WIN32
 #if 0
   o->tuntap_options.ip_win32_type = IPW32_SET_ADAPTIVE;
 #else
@@ -879,7 +879,7 @@ init_options (struct options *o, const bool init_gc)
   o->auth_token_generate = false;
 
   /* Set default --tmp-dir */
-#ifdef WIN32
+#ifdef _WIN32
   /* On Windows, find temp dir via enviroment variables */
   o->tmp_dir = win_get_tempdir();
 #else
@@ -888,7 +888,7 @@ init_options (struct options *o, const bool init_gc)
   if( !o->tmp_dir ) {
           o->tmp_dir = "/tmp";
   }
-#endif /* WIN32 */
+#endif /* _WIN32 */
 #endif /* P2MP_SERVER */
   o->allow_recursive_routing = false;
 }
@@ -1141,7 +1141,7 @@ parse_hash_fingerprint(const char *str, int nbytes, int msglevel, struct gc_aren
 }
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #ifndef ENABLE_SMALL
 
@@ -1186,7 +1186,7 @@ show_tuntap_options (const struct tuntap_options *o)
 #endif
 #endif
 
-#if defined(WIN32) || defined(TARGET_ANDROID)
+#if defined(_WIN32) || defined(TARGET_ANDROID)
 static void
 dhcp_option_address_parse (const char *name, const char *parm, in_addr_t *array, int *len, int msglevel)
 {
@@ -1741,7 +1741,7 @@ show_settings (const struct options *o)
   show_p2mp_parms (o);
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
   SHOW_BOOL (show_net_up);
   SHOW_INT (route_method);
   SHOW_BOOL (block_outside_dns);
@@ -2033,7 +2033,7 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
    * Windows-specific options.
    */
 
-#ifdef WIN32
+#ifdef _WIN32
       if (dev == DEV_TYPE_TUN && !(pull || (options->ifconfig_local && options->ifconfig_remote_netmask)))
        msg (M_USAGE, "On Windows, --ifconfig is required when --dev tun is used");
 
@@ -2512,7 +2512,7 @@ options_postprocess_mutate_ce (struct options *o, struct connection_entry *ce)
 static void
 options_postprocess_mutate_invariant (struct options *options)
 {
-#ifdef WIN32
+#ifdef _WIN32
   const int dev = dev_type_enum (options->dev, options->dev_type);
 #endif
 
@@ -2523,7 +2523,7 @@ options_postprocess_mutate_invariant (struct options *options)
   if (options->inetd == INETD_NOWAIT)
     options->ifconfig_noexec = true;
 
-#ifdef WIN32
+#ifdef _WIN32
   if ((dev == DEV_TYPE_TUN || dev == DEV_TYPE_TAP) && !options->route_delay_defined)
     {
       if (options->mode == MODE_POINT_TO_POINT)
@@ -2546,7 +2546,7 @@ options_postprocess_mutate_invariant (struct options *options)
    */
   if (options->mode == MODE_SERVER)
     {
-#ifdef WIN32
+#ifdef _WIN32
       /*
        * We need to explicitly set --tap-sleep because
        * we do not schedule event timers in the top-level context.
@@ -2689,7 +2689,7 @@ options_postprocess_mutate (struct options *o)
 static void
 warn_if_group_others_accessible (const char* filename)
 {
-#ifndef WIN32
+#ifndef _WIN32
 #ifdef HAVE_STAT
   if (strcmp (filename, INLINE_FILE_TAG))
     {
@@ -3608,7 +3608,7 @@ usage_small (void)
   openvpn_exit (OPENVPN_EXIT_STATUS_USAGE); /* exit point */
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 void show_windows_version(const unsigned int flags)
 {
   struct gc_arena gc = gc_new ();
@@ -3642,7 +3642,7 @@ usage_version (void)
 {
   msg (M_INFO|M_NOPREFIX, "%s", title_string);
   show_library_versions( M_INFO|M_NOPREFIX );
-#ifdef WIN32
+#ifdef _WIN32
   show_windows_version( M_INFO|M_NOPREFIX );
 #endif
   msg (M_INFO|M_NOPREFIX, "Originally developed by James Yonan");
@@ -3689,7 +3689,7 @@ positive_atoi (const char *str)
   return i < 0 ? 0 : i;
 }
 
-#ifdef WIN32  /* This function is only used when compiling on Windows */
+#ifdef _WIN32  /* This function is only used when compiling on Windows */
 static unsigned int
 atou (const char *str)
 {
@@ -6274,7 +6274,7 @@ add_option (struct options *options,
 #endif
   else if (streq (p[0], "msg-channel") && p[1])
     {
-#ifdef WIN32
+#ifdef _WIN32
       VERIFY_PERMISSION (OPT_P_GENERAL);
       HANDLE process = GetCurrentProcess ();
       HANDLE handle = (HANDLE) atoi (p[1]);
@@ -6290,7 +6290,7 @@ add_option (struct options *options,
       goto err;
 #endif
     }
-#ifdef WIN32
+#ifdef _WIN32
   else if (streq (p[0], "win-sys") && p[1] && !p[2])
     {
       VERIFY_PERMISSION (OPT_P_GENERAL);
@@ -6371,7 +6371,7 @@ add_option (struct options *options,
       to->ip_win32_defined = true; 
     }
 #endif
-#if defined(WIN32) || defined(TARGET_ANDROID)
+#if defined(_WIN32) || defined(TARGET_ANDROID)
   else if (streq (p[0], "dhcp-option") && p[1] && !p[3])
     {
       struct tuntap_options *o = &options->tuntap_options;
@@ -6424,7 +6424,7 @@ add_option (struct options *options,
       o->dhcp_options = true;
     }
 #endif
-#ifdef WIN32
+#ifdef _WIN32
   else if (streq (p[0], "show-adapters") && !p[1])
     {
       VERIFY_PERMISSION (OPT_P_GENERAL);
index 0ebea30c4cf052c9f54191edc41dea10e6c57db1..d51150bf89ecd09b165689f0e027954de2cf946f 100644 (file)
@@ -578,7 +578,7 @@ struct options
   /* special state parms */
   int foreign_option_index;
 
-#ifdef WIN32
+#ifdef _WIN32
   HANDLE msg_channel;
   const char *exit_event_name;
   bool exit_event_initial_state;
@@ -655,7 +655,7 @@ struct options
 #define PUSH_DEFINED(opt) (false)
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #define ROUTE_OPTION_FLAGS(o) ((o)->route_method & ROUTE_METHOD_MASK)
 #else
 #define ROUTE_OPTION_FLAGS(o) (0)
@@ -693,7 +693,7 @@ void usage_small (void);
 
 void show_library_versions(const unsigned int flags);
 
-#ifdef WIN32
+#ifdef _WIN32
 void show_windows_version(const unsigned int flags);
 #endif
 
index 4ca103266c56899c728af0d3345d7e06fb126edb..c0b0f38c94941385a20fd0e3783c25739ce3036c 100644 (file)
@@ -76,8 +76,8 @@ openvpn_gettimeofday (struct timeval *tv, void *tz)
 static inline void
 update_time (void)
 {
-#ifdef WIN32
-  /* on WIN32, gettimeofday is faster than time(NULL) */
+#ifdef _WIN32
+  /* on _WIN32, gettimeofday is faster than time(NULL) */
   struct timeval tv;
   openvpn_gettimeofday (&tv, NULL);
 #else
@@ -90,8 +90,8 @@ update_time (void)
 static inline void
 update_time (void)
 {
-#if defined(WIN32)
-  /* on WIN32, gettimeofday is faster than time(NULL) */
+#if defined(_WIN32)
+  /* on _WIN32, gettimeofday is faster than time(NULL) */
   struct timeval tv;
   if (!gettimeofday (&tv, NULL))
     {
index 16d4daca6f305379bdf5498c657de6d65fededc7..634364726c9f04491e1f49022cdc552df75d3649 100644 (file)
@@ -158,7 +158,7 @@ platform_nice (int niceval)
 unsigned int
 platform_getpid ()
 {
-#ifdef WIN32
+#ifdef _WIN32
   return (unsigned int) GetCurrentProcessId ();
 #else
 #ifdef HAVE_GETPID
@@ -190,7 +190,7 @@ int
 platform_chdir (const char* dir)
 {
 #ifdef HAVE_CHDIR
-#ifdef WIN32
+#ifdef _WIN32
   int res;
   struct gc_arena gc = gc_new ();
   res = _wchdir (wide_string (dir, &gc));
@@ -210,7 +210,7 @@ platform_chdir (const char* dir)
 bool
 platform_system_ok (int stat)
 {
-#ifdef WIN32
+#ifdef _WIN32
   return stat == 0;
 #else
   return stat != -1 && WIFEXITED (stat) && WEXITSTATUS (stat) == 0;
@@ -220,7 +220,7 @@ platform_system_ok (int stat)
 int
 platform_access (const char *path, int mode)
 {
-#ifdef WIN32
+#ifdef _WIN32
   struct gc_arena gc = gc_new ();
   int ret = _waccess (wide_string (path, &gc), mode & ~X_OK);
   gc_free (&gc);
@@ -236,7 +236,7 @@ platform_access (const char *path, int mode)
 void
 platform_sleep_milliseconds (unsigned int n)
 {
-#ifdef WIN32
+#ifdef _WIN32
   Sleep (n);
 #else
   struct timeval tv;
@@ -252,7 +252,7 @@ platform_sleep_milliseconds (unsigned int n)
 void
 platform_sleep_until_signal (void)
 {
-#ifdef WIN32
+#ifdef _WIN32
   ASSERT (0);
 #else
   select (0, NULL, NULL, NULL, NULL);
@@ -263,7 +263,7 @@ platform_sleep_until_signal (void)
 bool
 platform_unlink (const char *filename)
 {
-#if defined(WIN32)
+#if defined(_WIN32)
   struct gc_arena gc = gc_new ();
   BOOL ret = DeleteFileW (wide_string (filename, &gc));
   gc_free (&gc);
@@ -278,7 +278,7 @@ platform_unlink (const char *filename)
 FILE *
 platform_fopen (const char *path, const char *mode)
 {
-#ifdef WIN32
+#ifdef _WIN32
   struct gc_arena gc = gc_new ();
   FILE *f = _wfopen (wide_string (path, &gc), wide_string (mode, &gc));
   gc_free (&gc);
@@ -291,7 +291,7 @@ platform_fopen (const char *path, const char *mode)
 int
 platform_open (const char *path, int flags, int mode)
 {
-#ifdef WIN32
+#ifdef _WIN32
   struct gc_arena gc = gc_new ();
   int fd = _wopen (wide_string (path, &gc), flags, mode);
   gc_free (&gc);
@@ -304,7 +304,7 @@ platform_open (const char *path, int flags, int mode)
 int
 platform_stat (const char *path, platform_stat_t *buf)
 {
-#ifdef WIN32
+#ifdef _WIN32
   struct gc_arena gc = gc_new ();
   int res = _wstat (wide_string (path, &gc), buf);
   gc_free (&gc);
index 7c0a4d723a67d1070d6eca0b2bf28079603035f5..fe2685aeef1001c6065c1de62388a08a784a4e44 100644 (file)
@@ -130,7 +130,7 @@ int platform_putenv (char *string);
 FILE *platform_fopen (const char *path, const char *mode);
 int platform_open (const char *path, int flags, int mode);
 
-#ifdef WIN32
+#ifdef _WIN32
 typedef struct _stat platform_stat_t;
 #else
 typedef struct stat platform_stat_t;
index 542e5b1f2b67b9c7e7ca5de04ffbf5b764a0eb81..24434383d322de4400d7c208f45c313c832b01db 100644 (file)
@@ -175,7 +175,7 @@ plugin_option_list_print (const struct plugin_option_list *list, int msglevel)
 }
 #endif
 
-#ifndef WIN32
+#ifndef _WIN32
 
 static void
 libdl_resolve_symbol (void *handle, void **dest, const char *symbol, const char *plugin_name, const unsigned int flags)
@@ -206,7 +206,7 @@ plugin_init_item (struct plugin *p, const struct plugin_option *o)
   p->so_pathname = o->so_pathname;
   p->plugin_type_mask = plugin_supported_types ();
 
-#ifndef WIN32
+#ifndef _WIN32
 
   p->handle = NULL;
 #if defined(PLUGIN_LIBDIR)
@@ -519,10 +519,10 @@ plugin_close_item (struct plugin *p)
       if (p->plugin_handle)
        (*p->close)(p->plugin_handle);
 
-#ifndef WIN32
+#ifndef _WIN32
       if (dlclose (p->handle))
        msg (M_WARN, "PLUGIN_CLOSE: dlclose() failed on plugin: %s", p->so_pathname);
-#elif defined(WIN32)
+#elif defined(_WIN32)
       if (!FreeLibrary (p->module))
        msg (M_WARN, "PLUGIN_CLOSE: FreeLibrary() failed on plugin: %s", p->so_pathname);
 #endif
index 3c010476afefe357b7d7ba0ebd98bcfc3e3bf1d0..b1e045889d018bbefcefbb90ac5ed2d3987c7f12 100644 (file)
@@ -59,7 +59,7 @@ struct plugin {
   unsigned int plugin_type_mask;
   int requested_initialization_point;
 
-#ifndef WIN32
+#ifndef _WIN32
   void *handle;
 #else
   HMODULE module;
index 98bb228f7155cd3e537013a891f7fb5c076fc6fd..fec12c11bee8be652861007cf4b4394e32597ad2 100644 (file)
@@ -49,7 +49,7 @@
 #include <linux/rtnetlink.h>           /* RTM_GETROUTE etc. */
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include "openvpn-msg.h"
 
 #define METRIC_NOT_USED ((DWORD)-1)
@@ -807,7 +807,7 @@ init_route_ipv6_list (struct route_ipv6_list *rl6,
          if ( !(rl6->rgi6.flags & RGI_ON_LINK) )
            { r6->gateway = rl6->rgi6.gateway.addr_ipv6; }
          r6->metric = 1;
-#ifdef WIN32
+#ifdef _WIN32
          r6->adapter_index = rl6->rgi6.adapter_index;
 #else
          r6->iface = rl6->rgi6.iface;
@@ -1214,7 +1214,7 @@ print_default_gateway(const int msglevel,
        buf_printf (&out, " %s", print_in_addr_t (rgi->gateway.addr, 0, &gc));
       if (rgi->flags & RGI_NETMASK_DEFINED)
        buf_printf (&out, "/%s", print_in_addr_t (rgi->gateway.netmask, 0, &gc));
-#ifdef WIN32
+#ifdef _WIN32
       if (rgi->flags & RGI_IFACE_DEFINED)
        buf_printf (&out, " I=%u", (unsigned int)rgi->adapter_index);
 #else
@@ -1235,7 +1235,7 @@ print_default_gateway(const int msglevel,
        buf_printf (&out, " ON_LINK");
       if (rgi6->flags & RGI_NETMASK_DEFINED)
        buf_printf (&out, "/%d", rgi6->gateway.netbits_ipv6);
-#ifdef WIN32
+#ifdef _WIN32
       if (rgi6->flags & RGI_IFACE_DEFINED)
        buf_printf (&out, " I=%u", (unsigned int)rgi6->adapter_index);
 #else
@@ -1454,7 +1454,7 @@ add_route (struct route_ipv4 *r,
     buf_printf (&out, "%s %s %s", network, netmask, gateway);
   management_android_control (management, "ROUTE", buf_bptr(&out));
 
-#elif defined (WIN32)
+#elif defined (_WIN32)
   {
     DWORD ai = TUN_ADAPTER_INDEX_INVALID;
     argv_printf (&argv, "%s%sc ADD %s MASK %s %s",
@@ -1682,7 +1682,7 @@ add_route_ipv6 (struct route_ipv6 *r6, const struct tuntap *tt, unsigned int fla
   if (! (r6->flags & RT_DEFINED) )
     return;
 
-#ifndef WIN32
+#ifndef _WIN32
   if ( r6->iface != NULL )             /* vpn server special route */
     {
       device = r6->iface;
@@ -1777,7 +1777,7 @@ add_route_ipv6 (struct route_ipv6 *r6, const struct tuntap *tt, unsigned int fla
 
     management_android_control (management, "ROUTE6", buf_bptr(&out));
 
-#elif defined (WIN32)
+#elif defined (_WIN32)
 
   if (tt->options.msg_channel)
     status = add_route_ipv6_service (r6, tt);
@@ -1967,7 +1967,7 @@ delete_route (struct route_ipv4 *r,
   argv_msg (D_ROUTE, &argv);
   openvpn_execve_check (&argv, es, 0, "ERROR: Linux route delete command failed");
 
-#elif defined (WIN32)
+#elif defined (_WIN32)
   
   argv_printf (&argv, "%s%sc DELETE %s MASK %s %s",
               get_win_sys_path(),
@@ -2114,7 +2114,7 @@ delete_route_ipv6 (const struct route_ipv6 *r6, const struct tuntap *tt, unsigne
   if ((r6->flags & (RT_DEFINED|RT_ADDED)) != (RT_DEFINED|RT_ADDED))
     return;
 
-#ifndef WIN32
+#ifndef _WIN32
   if ( r6->iface != NULL )             /* vpn server special route */
     {
       device = r6->iface;
@@ -2180,7 +2180,7 @@ delete_route_ipv6 (const struct route_ipv6 *r6, const struct tuntap *tt, unsigne
   argv_msg (D_ROUTE, &argv);
   openvpn_execve_check (&argv, es, 0, "ERROR: Linux route -6/-A inet6 del command failed");
 
-#elif defined (WIN32)
+#elif defined (_WIN32)
 
   if (tt->options.msg_channel)
     del_route_ipv6_service (r6, tt);
@@ -2316,7 +2316,7 @@ delete_route_ipv6 (const struct route_ipv6 *r6, const struct tuntap *tt, unsigne
  * to get the current default gateway.
  */
 
-#if defined(WIN32)
+#if defined(_WIN32)
 
 static const MIB_IPFORWARDTABLE *
 get_windows_routing_table (struct gc_arena *gc)
@@ -3694,7 +3694,7 @@ int netmask_to_netbits2 (in_addr_t netmask)
  * so that outgoing packets to these servers don't end up in the tunnel.
  */
 
-#if defined(WIN32)
+#if defined(_WIN32)
 
 static void
 add_host_route_if_nonlocal (struct route_bypass *rb, const in_addr_t addr)
@@ -3768,7 +3768,7 @@ get_bypass_addresses (struct route_bypass *rb, const unsigned int flags)  /* PLA
  * Used by redirect-gateway autolocal feature
  */
 
-#if defined(WIN32)
+#if defined(_WIN32)
 
 int
 test_local_addr (const in_addr_t addr, const struct route_gateway_info *rgi)
index 58a57484ac083a64fc34a46eedce7cf8c69a3904..c358681e548bdcc872ea9ad29a5c75beb6b0ccab 100644 (file)
@@ -33,7 +33,7 @@
 #include "tun.h"
 #include "misc.h"
 
-#ifdef WIN32
+#ifdef _WIN32
 /*
  * Windows route methods
  */
@@ -130,7 +130,7 @@ struct route_ipv6 {
   struct in6_addr gateway;
   int metric;
   /* gateway interface */
-# ifdef WIN32
+# ifdef _WIN32
   DWORD adapter_index;         /* interface or ~0 if undefined */
 #else
   char * iface;                        /* interface name (null terminated) */
@@ -153,7 +153,7 @@ struct route_gateway_info {
   unsigned int flags;
 
   /* gateway interface */
-# ifdef WIN32
+# ifdef _WIN32
   DWORD adapter_index;  /* interface or ~0 if undefined */
 #else
   char iface[16]; /* interface name (null terminated), may be empty */
@@ -181,7 +181,7 @@ struct route_ipv6_gateway_info {
   unsigned int flags;
 
   /* gateway interface */
-# ifdef WIN32
+# ifdef _WIN32
   DWORD adapter_index;  /* interface or ~0 if undefined */
 #else
   char iface[16]; /* interface name (null terminated), may be empty */
@@ -333,7 +333,7 @@ void print_route_options (const struct route_option_list *rol,
 
 void print_routes (const struct route_list *rl, int level);
 
-#ifdef WIN32
+#ifdef _WIN32
 
 void show_routes (int msglev);
 bool test_routes (const struct route_list *rl, const struct tuntap *tt);
index 718b78600e343a5a9566e87542f767320bd4ac06..0ff14379569deae9e74ba20602a5d8525a533073 100644 (file)
@@ -221,7 +221,7 @@ static int signal_mode; /* GLOBAL */
 void
 pre_init_signal_catch (void)
 {
-#ifndef WIN32
+#ifndef _WIN32
 #ifdef HAVE_SIGNAL_H
   signal_mode = SM_PRE_INIT;
   signal (SIGINT, signal_handler);
@@ -231,13 +231,13 @@ pre_init_signal_catch (void)
   signal (SIGUSR2, SIG_IGN);
   signal (SIGPIPE, SIG_IGN);
 #endif /* HAVE_SIGNAL_H */
-#endif /* WIN32 */
+#endif /* _WIN32 */
 }
 
 void
 post_init_signal_catch (void)
 {
-#ifndef WIN32
+#ifndef _WIN32
 #ifdef HAVE_SIGNAL_H
   signal_mode = SM_POST_INIT;
   signal (SIGINT, signal_handler);
@@ -291,7 +291,7 @@ print_status (const struct context *c, struct status_output *so)
   status_printf (so, "Pre-encrypt truncations," counter_format, c->c2.n_trunc_pre_encrypt);
   status_printf (so, "Post-decrypt truncations," counter_format, c->c2.n_trunc_post_decrypt);
 #endif
-#ifdef WIN32
+#ifdef _WIN32
   if (tuntap_defined (c->c1.tuntap))
     status_printf (so, "TAP-WIN32 driver status,\"%s\"",
         tap_win_getinfo (c->c1.tuntap, &gc));
index c2c7b54e1cf0525cef0fe935368e83bee6e8f443..2875a4c9c790a129173167bbbcefa454abdd3761 100644 (file)
@@ -79,7 +79,7 @@ void register_signal (struct context *c, int sig, const char *text);
 void process_explicit_exit_notification_timer_wakeup (struct context *c);
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 
 static inline void
 get_signal (volatile int *sig)
index a9aaa2a267ad549b0b8f963ee2df7f837bc57c7e..c233f2b6f7dab519b27dccc173293772ab4982d4 100644 (file)
@@ -376,7 +376,7 @@ openvpn_getaddrinfo (unsigned int flags,
        */
       while (true)
         {
-#ifndef WIN32
+#ifndef _WIN32
          res_init ();
 #endif
           /* try hostname lookup */
@@ -690,7 +690,7 @@ socket_set_buffers (int fd, const struct socket_buffer_size *sbs)
 static bool
 socket_set_tcp_nodelay (int sd, int state)
 {
-#if defined(WIN32) || (defined(HAVE_SETSOCKOPT) && defined(IPPROTO_TCP) && defined(TCP_NODELAY))
+#if defined(_WIN32) || (defined(HAVE_SETSOCKOPT) && defined(IPPROTO_TCP) && defined(TCP_NODELAY))
   if (setsockopt (sd, IPPROTO_TCP, TCP_NODELAY, (void *) &state, sizeof (state)) != 0)
     {
       msg (M_WARN, "NOTE: setsockopt TCP_NODELAY=%d failed", state);
@@ -761,7 +761,7 @@ create_socket_tcp (struct addrinfo* addrinfo)
   if ((sd = socket (addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) < 0)
     msg (M_ERR, "Cannot create TCP socket");
 
-#ifndef WIN32 /* using SO_REUSEADDR on Windows will cause bind to succeed on port conflicts! */
+#ifndef _WIN32 /* using SO_REUSEADDR on Windows will cause bind to succeed on port conflicts! */
   /* set SO_REUSEADDR on socket */
   {
     int on = 1;
@@ -1066,7 +1066,7 @@ socket_listen_accept (socket_descriptor_t sd,
 /* older mingw versions and WinXP do not have this define,
  * but Vista and up support the functionality - just define it here
  */
-#ifdef WIN32
+#ifdef _WIN32
 # ifndef IPV6_V6ONLY
 #  define IPV6_V6ONLY 27
 # endif
@@ -1141,7 +1141,7 @@ openvpn_connect (socket_descriptor_t sd,
   if (status)
     status = openvpn_errno ();
   if (
-#ifdef WIN32
+#ifdef _WIN32
     status == WSAEWOULDBLOCK
 #else
     status == EINPROGRESS
@@ -1184,7 +1184,7 @@ openvpn_connect (socket_descriptor_t sd,
            {
              if (--connect_timeout < 0)
                {
-#ifdef WIN32
+#ifdef _WIN32
                  status = WSAETIMEDOUT;
 #else
                  status = ETIMEDOUT;
@@ -1296,7 +1296,7 @@ socket_connect (socket_descriptor_t* sd,
 static void
 socket_frame_init (const struct frame *frame, struct link_socket *sock)
 {
-#ifdef WIN32
+#ifdef _WIN32
   overlapped_io_init (&sock->reads, frame, FALSE, false);
   overlapped_io_init (&sock->writes, frame, TRUE, false);
   sock->rw_handle.read = sock->reads.overlapped.hEvent;
@@ -1305,7 +1305,7 @@ socket_frame_init (const struct frame *frame, struct link_socket *sock)
 
   if (link_socket_connection_oriented (sock))
     {
-#ifdef WIN32
+#ifdef _WIN32
       stream_buf_init (&sock->stream_buf,
                       &sock->reads.buf_init,
                       sock->sockflags,
@@ -1971,7 +1971,7 @@ link_socket_close (struct link_socket *sock)
 
       if (socket_defined (sock->sd))
        {
-#ifdef WIN32
+#ifdef _WIN32
          close_net_event_win32 (&sock->listen_handle, sock->sd, 0);
 #endif
          if (!gremlin)
@@ -1981,7 +1981,7 @@ link_socket_close (struct link_socket *sock)
                msg (M_WARN | M_ERRNO, "TCP/UDP: Close Socket failed");
            }
          sock->sd = SOCKET_UNDEFINED;
-#ifdef WIN32
+#ifdef _WIN32
          if (!gremlin)
            {
              overlapped_io_close (&sock->reads);
@@ -2176,7 +2176,7 @@ socket_stat (const struct link_socket *s, unsigned int rwflags, struct gc_arena
        {
          buf_printf (&out, "S%s",
                      (s->rwflags_debug & EVENT_READ) ? "R" : "r");
-#ifdef WIN32
+#ifdef _WIN32
          buf_printf (&out, "%s",
                      overlapped_io_state_ascii (&s->reads));
 #endif
@@ -2185,7 +2185,7 @@ socket_stat (const struct link_socket *s, unsigned int rwflags, struct gc_arena
        {
          buf_printf (&out, "S%s",
                      (s->rwflags_debug & EVENT_WRITE) ? "W" : "w");
-#ifdef WIN32
+#ifdef _WIN32
          buf_printf (&out, "%s",
                      overlapped_io_state_ascii (&s->writes));
 #endif
@@ -2360,7 +2360,7 @@ stream_buf_close (struct stream_buf* sb)
 event_t
 socket_listen_event_handle (struct link_socket *s)
 {
-#ifdef WIN32
+#ifdef _WIN32
   if (!defined_net_event_win32 (&s->listen_handle))
     init_net_event_win32 (&s->listen_handle, FD_ACCEPT, s->sd, 0);
   return &s->listen_handle;
@@ -2837,7 +2837,7 @@ link_socket_read_tcp (struct link_socket *sock,
 
   if (!sock->stream_buf.residual_fully_formed)
     {
-#ifdef WIN32
+#ifdef _WIN32
       len = socket_finalize (sock->sd, &sock->reads, buf, NULL);
 #else
       struct buffer frag;
@@ -2862,7 +2862,7 @@ link_socket_read_tcp (struct link_socket *sock,
     return buf->len = 0; /* no error, but packet is still incomplete */
 }
 
-#ifndef WIN32
+#ifndef _WIN32
 
 #if ENABLE_IP_PKTINFO
 
@@ -2983,7 +2983,7 @@ link_socket_write_tcp (struct link_socket *sock,
   ASSERT (len <= sock->stream_buf.maxlen);
   len = htonps (len);
   ASSERT (buf_write_prepend (buf, &len, sizeof (len)));
-#ifdef WIN32
+#ifdef _WIN32
   return link_socket_write_win32 (sock, buf, to);
 #else
   return link_socket_write_tcp_posix (sock, buf, to);  
@@ -3071,7 +3071,7 @@ link_socket_write_udp_posix_sendmsg (struct link_socket *sock,
  * Win32 overlapped socket I/O functions.
  */
 
-#ifdef WIN32
+#ifdef _WIN32
 
 int
 socket_recv_queue (struct link_socket *sock, int maxsize)
@@ -3379,7 +3379,7 @@ socket_finalize (SOCKET s,
            case sizeof(struct sockaddr_in):
            case sizeof(struct sockaddr_in6):
            /* TODO(jjo): for some reason (?) I'm getting 24,28 for AF_INET6
-            * under WIN32*/
+            * under _WIN32*/
            case sizeof(struct sockaddr_in6)-4:
              break;
            default:
@@ -3405,7 +3405,7 @@ socket_finalize (SOCKET s,
   return ret;
 }
 
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 /*
  * Socket event notification
@@ -3426,7 +3426,7 @@ socket_set (struct link_socket *s,
          rwflags &= ~EVENT_READ;
        }
       
-#ifdef WIN32
+#ifdef _WIN32
       if (rwflags & EVENT_READ)
        socket_recv_queue (s, 0);
 #endif
index e1607f4e736f9955cbe28af8a8b931916bd25cdf..2a82d8894f6c6d717c0ac312c21aba2eb948a3cc 100644 (file)
@@ -169,7 +169,7 @@ struct link_socket
   socket_descriptor_t sd;
   socket_descriptor_t ctrl_sd;  /* only used for UDP over Socks */
 
-#ifdef WIN32
+#ifdef _WIN32
   struct overlapped_io reads;
   struct overlapped_io writes;
   struct rw_handle rw_handle;
@@ -257,7 +257,7 @@ struct link_socket
 #define MSG_NOSIGNAL 0
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #define openvpn_close_socket(s) closesocket(s)
 
@@ -842,7 +842,7 @@ socket_connection_reset (const struct link_socket *sock, int status)
       else if (status < 0)
        {
          const int err = openvpn_errno ();
-#ifdef WIN32
+#ifdef _WIN32
          return err == WSAECONNRESET || err == WSAECONNABORTED;
 #else
          return err == ECONNRESET;
@@ -950,7 +950,7 @@ stream_buf_read_setup (struct link_socket* sock)
 int link_socket_read_tcp (struct link_socket *sock,
                          struct buffer *buf);
 
-#ifdef WIN32
+#ifdef _WIN32
 
 static inline int
 link_socket_read_udp_win32 (struct link_socket *sock,
@@ -978,7 +978,7 @@ link_socket_read (struct link_socket *sock,
     {
       int res;
 
-#ifdef WIN32
+#ifdef _WIN32
       res = link_socket_read_udp_win32 (sock, buf, from);
 #else
       res = link_socket_read_udp_posix (sock, buf, from);
@@ -1006,7 +1006,7 @@ int link_socket_write_tcp (struct link_socket *sock,
                           struct buffer *buf,
                           struct link_socket_actual *to);
 
-#ifdef WIN32
+#ifdef _WIN32
 
 static inline int
 link_socket_write_win32 (struct link_socket *sock,
@@ -1068,7 +1068,7 @@ link_socket_write_udp (struct link_socket *sock,
                       struct buffer *buf,
                       struct link_socket_actual *to)
 {
-#ifdef WIN32
+#ifdef _WIN32
   return link_socket_write_win32 (sock, buf, to);
 #else
   return link_socket_write_udp_posix (sock, buf, to);
@@ -1138,7 +1138,7 @@ socket_read_residual (const struct link_socket *s)
 static inline event_t
 socket_event_handle (const struct link_socket *s)
 {
-#ifdef WIN32
+#ifdef _WIN32
   return &s->rw_handle;
 #else
   return s->sd;
@@ -1169,7 +1169,7 @@ socket_set_listen_persistent (struct link_socket *s,
 static inline void
 socket_reset_listen_persistent (struct link_socket *s)
 {
-#ifdef WIN32
+#ifdef _WIN32
   reset_net_event_win32 (&s->listen_handle, s->sd);
 #endif
 }
index 4a0cd6f3fd71faa66155ee970380b20f9477d99d..0c279ccdbbf3bdfd9bf8c9107047a07a127970fe 100644 (file)
@@ -1978,7 +1978,7 @@ push_peer_info(struct buffer *buf, struct tls_session *session)
       buf_printf (&out, "IV_PLAT=freebsd\n");
 #elif defined(TARGET_ANDROID)
       buf_printf (&out, "IV_PLAT=android\n");
-#elif defined(WIN32)
+#elif defined(_WIN32)
       buf_printf (&out, "IV_PLAT=win\n");
 #endif
 
@@ -2008,7 +2008,7 @@ push_peer_info(struct buffer *buf, struct tls_session *session)
          if (rgi.flags & RGI_HWADDR_DEFINED)
            buf_printf (&out, "IV_HWADDR=%s\n", format_hex_ex (rgi.hwaddr, 6, 0, 1, ":", &gc));
          buf_printf (&out, "IV_SSL=%s\n", get_ssl_library_version() );
-#if defined(WIN32)
+#if defined(_WIN32)
          buf_printf (&out, "IV_PLAT_VER=%s\n", win32_version_string (&gc, false));
 #endif
         }
index a61f03a7cbae9deade0d83ff6ce0dcbabbdd1b26..726a621e0a28ee547f03982e1b67dc202fde51fd 100644 (file)
@@ -232,7 +232,7 @@ int tls_ctx_load_pkcs12(struct tls_root_ctx *ctx, const char *pkcs12_file,
  */
 #ifdef ENABLE_CRYPTOAPI
 void tls_ctx_load_cryptoapi(struct tls_root_ctx *ctx, const char *cryptoapi_cert);
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 /**
  * Load certificate file into the given TLS context. If the given certificate
index c2aff405a921618bc23c8e25e8a46dffd8dc7f60..7f95f14508e241a8330241fd9e7a0ace764d390d 100644 (file)
@@ -283,7 +283,7 @@ tls_ctx_load_cryptoapi(struct tls_root_ctx *ctx, const char *cryptoapi_cert)
 {
   msg(M_FATAL, "Windows CryptoAPI not yet supported for mbed TLS.");
 }
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 void
 tls_ctx_load_cert_file (struct tls_root_ctx *ctx, const char *cert_file,
index 171cd02a6eb3be595116beef1e46ff7fea15dc16..48ca4090b586b81f8254ee67b6a71d428a033772 100644 (file)
@@ -632,7 +632,7 @@ tls_ctx_load_cryptoapi(struct tls_root_ctx *ctx, const char *cryptoapi_cert)
   if (!SSL_CTX_use_CryptoAPI_certificate (ctx->ctx, cryptoapi_cert))
     crypto_msg (M_FATAL, "Cannot load certificate \"%s\" from Microsoft Certificate Store", cryptoapi_cert);
 }
-#endif /* WIN32 */
+#endif /* ENABLE_CRYPTOAPI */
 
 static void
 tls_ctx_add_extra_certs (struct tls_root_ctx *ctx, BIO *bio)
index e969ccfa6355f800db40820856d38cad227173c1..8de7d87293d2329e02d84b7ad6964655e16cb436 100644 (file)
@@ -37,7 +37,7 @@
 # define unlikely(x)    (x)
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <windows.h>
 #include <winsock2.h>
 #define sleep(x) Sleep((x)*1000)
@@ -64,7 +64,7 @@
 # include <sys/wait.h>
 #endif
 
-#ifndef WIN32
+#ifndef _WIN32
 #ifndef WEXITSTATUS
 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
 #endif
 
 #endif /* TARGET_DARWIN */
 
-#ifdef WIN32
+#ifdef _WIN32
  // Missing declarations for MinGW 32.
  // #if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 2
  typedef int MIB_TCP_STATE;
 /*
  * Do we have nanoseconds gettimeofday?
  */
-#if defined(HAVE_GETTIMEOFDAY) || defined(WIN32)
+#if defined(HAVE_GETTIMEOFDAY) || defined(_WIN32)
 #define HAVE_GETTIMEOFDAY_NANOSECONDS 1
 #endif
 
@@ -470,26 +470,16 @@ typedef unsigned short sa_family_t;
 /*
  * Directory separation char
  */
-#ifdef WIN32
+#ifdef _WIN32
 #define OS_SPECIFIC_DIRSEP '\\'
 #else
 #define OS_SPECIFIC_DIRSEP '/'
 #endif
 
-/*
- * Define a boolean value based
- * on Win32 status.
- */
-#ifdef WIN32
-#define WIN32_0_1 1
-#else
-#define WIN32_0_1 0
-#endif
-
 /*
  * Our socket descriptor type.
  */
-#ifdef WIN32
+#ifdef _WIN32
 #define SOCKET_UNDEFINED (INVALID_SOCKET)
 typedef SOCKET socket_descriptor_t;
 #else
@@ -590,7 +580,7 @@ socket_defined (const socket_descriptor_t sd)
 /*
  * Do we support Unix domain sockets?
  */
-#if defined(PF_UNIX) && !defined(WIN32)
+#if defined(PF_UNIX) && !defined(_WIN32)
 #define UNIX_SOCK_SUPPORT 1
 #else
 #define UNIX_SOCK_SUPPORT 0
@@ -624,7 +614,7 @@ socket_defined (const socket_descriptor_t sd)
 /*
  * Do we have CryptoAPI capability?
  */
-#if defined(WIN32) && defined(ENABLE_CRYPTO) && defined(ENABLE_CRYPTO_OPENSSL)
+#if defined(_WIN32) && defined(ENABLE_CRYPTO) && defined(ENABLE_CRYPTO_OPENSSL)
 #define ENABLE_CRYPTOAPI
 #endif
 
index 2a87e09b35081ce238141ac7d45ddafc2519008e..d37e27e763a22525110017b8799d66a2b97ac5d5 100644 (file)
 
 #include "memdbg.h"
 
-#ifdef WIN32
+#ifdef _WIN32
 #include "openvpn-msg.h"
 #endif
 
 #include <string.h>
 
-#ifdef WIN32
+#ifdef _WIN32
 
 /* #define SIMULATE_DHCP_FAILED */       /* simulate bad DHCP negotiation */
 
@@ -198,7 +198,7 @@ guess_tuntap_dev (const char *dev,
                  const char *dev_node,
                  struct gc_arena *gc)
 {
-#ifdef WIN32
+#ifdef _WIN32
   const int dt = dev_type_enum (dev, dev_type);
   if (dt == DEV_TYPE_TUN || dt == DEV_TYPE_TAP)
     {
@@ -421,7 +421,7 @@ tun_stat (const struct tuntap *tt, unsigned int rwflags, struct gc_arena *gc)
        {
          buf_printf (&out, "T%s",
                      (tt->rwflags_debug & EVENT_READ) ? "R" : "r");
-#ifdef WIN32
+#ifdef _WIN32
          buf_printf (&out, "%s",
                      overlapped_io_state_ascii (&tt->reads));
 #endif
@@ -430,7 +430,7 @@ tun_stat (const struct tuntap *tt, unsigned int rwflags, struct gc_arena *gc)
        {
          buf_printf (&out, "T%s",
                      (tt->rwflags_debug & EVENT_WRITE) ? "W" : "w");
-#ifdef WIN32
+#ifdef _WIN32
          buf_printf (&out, "%s",
                      overlapped_io_state_ascii (&tt->writes));
 #endif
@@ -611,7 +611,7 @@ init_tun (const char *dev,       /* --dev option */
          tt->broadcast = generate_ifconfig_broadcast_addr (tt->local, tt->remote_netmask);
        }
 
-#ifdef WIN32
+#ifdef _WIN32
       /*
        * Make sure that both ifconfig addresses are part of the
        * same .252 subnet.
@@ -665,7 +665,7 @@ init_tun_post (struct tuntap *tt,
               const struct tuntap_options *options)
 {
   tt->options = *options;
-#ifdef WIN32
+#ifdef _WIN32
   overlapped_io_init (&tt->reads, frame, FALSE, true);
   overlapped_io_init (&tt->writes, frame, TRUE, true);
   tt->rw_handle.read = tt->reads.overlapped.hEvent;
@@ -674,7 +674,7 @@ init_tun_post (struct tuntap *tt,
 #endif
 }
 
-#if defined(WIN32) || \
+#if defined(_WIN32) || \
     defined(TARGET_DARWIN) || defined(TARGET_NETBSD) || defined(TARGET_OPENBSD)
 
 /* some of the platforms will auto-add a "network route" pointing
@@ -1346,7 +1346,7 @@ do_ifconfig (struct tuntap *tt,
          }
        env_set_destroy (aix_es);
       }
-#elif defined (WIN32)
+#elif defined (_WIN32)
       {
         ASSERT (actual != NULL);
 
@@ -1405,7 +1405,7 @@ static void
 clear_tuntap (struct tuntap *tuntap)
 {
   CLEAR (*tuntap);
-#ifdef WIN32
+#ifdef _WIN32
   tuntap->hand = NULL;
 #else
   tuntap->fd = -1;
@@ -1502,7 +1502,7 @@ read_tun_header (struct tuntap* tt, uint8_t *buf, int len)
 #endif
 
 
-#ifndef WIN32
+#ifndef _WIN32
 static void
 open_tun_generic (const char *dev, const char *dev_type, const char *dev_node,
                  bool dynamic, struct tuntap *tt)
@@ -3012,7 +3012,7 @@ read_tun (struct tuntap* tt, uint8_t *buf, int len)
     return read (tt->fd, buf, len);
 }
 
-#elif defined(WIN32)
+#elif defined(_WIN32)
 
 int
 tun_read_queue (struct tuntap *tt, int maxsize)
index 6e3086c722861321e46b49624405e1d9f7762941..dedd915c350ad260717fa487c619efc172226992 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef TUN_H
 #define TUN_H
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <winioctl.h>
 #include <tap-windows.h>
 #endif
@@ -38,7 +38,7 @@
 #include "proto.h"
 #include "misc.h"
 
-#if defined(WIN32) || defined(TARGET_ANDROID)
+#if defined(_WIN32) || defined(TARGET_ANDROID)
 
 #define TUN_ADAPTER_INDEX_INVALID ((DWORD)-1)
 
@@ -58,7 +58,7 @@ struct tuntap_options {
 # define IPW32_SET_N            5
   int ip_win32_type;
 
-#ifdef WIN32
+#ifdef _WIN32
   HANDLE msg_channel;
 #endif
 
@@ -157,7 +157,7 @@ struct tuntap
   struct in6_addr remote_ipv6;
   int netbits_ipv6;
 
-#ifdef WIN32
+#ifdef _WIN32
   HANDLE hand;
   struct overlapped_io reads;
   struct overlapped_io writes;
@@ -197,7 +197,7 @@ struct tuntap
 static inline bool
 tuntap_defined (const struct tuntap *tt)
 {
-#ifdef WIN32
+#ifdef _WIN32
   return tt && tt->hand != NULL;
 #else
   return tt && tt->fd >= 0;
@@ -298,7 +298,7 @@ ifconfig_order(void)
   return IFCONFIG_AFTER_TUN_OPEN;
 #elif defined(TARGET_NETBSD)
   return IFCONFIG_AFTER_TUN_OPEN;
-#elif defined(WIN32)
+#elif defined(_WIN32)
   return IFCONFIG_AFTER_TUN_OPEN;
 #elif defined(TARGET_ANDROID)
   return IFCONFIG_BEFORE_TUN_OPEN;
@@ -322,7 +322,7 @@ route_order(void)
 }
 
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #define TUN_PASS_BUFFER
 
@@ -476,7 +476,7 @@ tun_standby (struct tuntap *tt)
 static inline event_t
 tun_event_handle (const struct tuntap *tt)
 {
-#ifdef WIN32
+#ifdef _WIN32
   return &tt->rw_handle;
 #else
   return tt->fd;
@@ -499,7 +499,7 @@ tun_set (struct tuntap *tt,
          if (persistent)
            *persistent = rwflags;
        }
-#ifdef WIN32
+#ifdef _WIN32
       if (rwflags & EVENT_READ)
        tun_read_queue (tt, 0);
 #endif
index ad721cdb3adbd62dd54a5cfcf09fa8b66ec58b57..00bc7ac2ed9de52ad229f470b86039ec4fa4445c 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "syshead.h"
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #include "buffer.h"
 #include "error.h"
index 619878f657240338c8c41810dd9a5e7dd0eae16b..11e42f4b4ebd97fb7746f9f7b7628a4de1091a99 100644 (file)
@@ -22,7 +22,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef WIN32
+#ifdef _WIN32
 #ifndef OPENVPN_WIN32_H
 #define OPENVPN_WIN32_H