projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cfc9fee
)
Replace MinGW with Windows to avoid ambiguities
author
Kirill Isakov
<bootctl@gmail.com>
Fri, 25 Mar 2022 17:29:07 +0000
(23:29 +0600)
committer
Kirill Isakov
<bootctl@gmail.com>
Mon, 28 Mar 2022 15:38:29 +0000
(21:38 +0600)
33 files changed:
.ci/tidy/run.sh
patch
|
blob
|
history
src/control.c
patch
|
blob
|
history
src/dropin.c
patch
|
blob
|
history
src/dropin.h
patch
|
blob
|
history
src/event.c
patch
|
blob
|
history
src/event.h
patch
|
blob
|
history
src/fsck.c
patch
|
blob
|
history
src/have.h
patch
|
blob
|
history
src/ifconfig.c
patch
|
blob
|
history
src/invitation.c
patch
|
blob
|
history
src/keys.c
patch
|
blob
|
history
src/logger.c
patch
|
blob
|
history
src/logger.h
patch
|
blob
|
history
src/meson.build
patch
|
blob
|
history
src/names.c
patch
|
blob
|
history
src/net.c
patch
|
blob
|
history
src/net.h
patch
|
blob
|
history
src/net_socket.c
patch
|
blob
|
history
src/nolegacy/crypto.c
patch
|
blob
|
history
src/openssl/crypto.c
patch
|
blob
|
history
src/process.c
patch
|
blob
|
history
src/process.h
patch
|
blob
|
history
src/script.c
patch
|
blob
|
history
src/sptps_test.c
patch
|
blob
|
history
src/tincctl.c
patch
|
blob
|
history
src/tincd.c
patch
|
blob
|
history
src/utils.c
patch
|
blob
|
history
src/utils.h
patch
|
blob
|
history
src/windows/common.h
[moved from
src/mingw/common.h
with 98% similarity]
patch
|
blob
|
history
src/windows/device.c
[moved from
src/mingw/device.c
with 99% similarity]
patch
|
blob
|
history
src/windows/meson.build
[moved from
src/mingw/meson.build
with 92% similarity]
patch
|
blob
|
history
src/xalloc.h
patch
|
blob
|
history
test/integration/splice.c
patch
|
blob
|
history
diff --git
a/.ci/tidy/run.sh
b/.ci/tidy/run.sh
index
36700a2
..
bb97586
100755
(executable)
--- a/
.ci/tidy/run.sh
+++ b/
.ci/tidy/run.sh
@@
-5,7
+5,7
@@
set -eu
./.ci/build.sh "$@"
# Which paths to ignore.
./.ci/build.sh "$@"
# Which paths to ignore.
-paths='src/solaris src/
mingw
src/gcrypt'
+paths='src/solaris src/
windows
src/gcrypt'
case "$(uname -s)" in
Linux)
case "$(uname -s)" in
Linux)
diff --git
a/src/control.c
b/src/control.c
index
175f2bd
..
86e0f68
100644
(file)
--- a/
src/control.c
+++ b/
src/control.c
@@
-185,7
+185,7
@@
bool init_control(void) {
free(localhost);
fclose(f);
free(localhost);
fclose(f);
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
int unix_fd = socket(AF_UNIX, SOCK_STREAM, 0);
if(unix_fd < 0) {
int unix_fd = socket(AF_UNIX, SOCK_STREAM, 0);
if(unix_fd < 0) {
@@
-232,7
+232,7
@@
bool init_control(void) {
}
void exit_control(void) {
}
void exit_control(void) {
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
unlink(unixsocketname);
io_del(&unix_socket);
close(unix_socket.fd);
unlink(unixsocketname);
io_del(&unix_socket);
close(unix_socket.fd);
diff --git
a/src/dropin.c
b/src/dropin.c
index
1489ee6
..
d086ae1
100644
(file)
--- a/
src/dropin.c
+++ b/
src/dropin.c
@@
-130,7
+130,7
@@
int vasprintf(char **buf, const char *fmt, va_list ap) {
#ifndef HAVE_GETTIMEOFDAY
int gettimeofday(struct timeval *tv, void *tz) {
#ifndef HAVE_GETTIMEOFDAY
int gettimeofday(struct timeval *tv, void *tz) {
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
uint64_t lt = (uint64_t)ft.dwLowDateTime | ((uint64_t)ft.dwHighDateTime << 32);
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
uint64_t lt = (uint64_t)ft.dwLowDateTime | ((uint64_t)ft.dwHighDateTime << 32);
diff --git
a/src/dropin.h
b/src/dropin.h
index
9b196b6
..
a1fb6c1
100644
(file)
--- a/
src/dropin.h
+++ b/
src/dropin.h
@@
-52,7
+52,7
@@
extern int gettimeofday(struct timeval *, void *);
} while (0)
#endif
} while (0)
#endif
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
#define mkdir(a, b) mkdir(a)
#ifndef SHUT_RDWR
#define SHUT_RDWR SD_BOTH
#define mkdir(a, b) mkdir(a)
#ifndef SHUT_RDWR
#define SHUT_RDWR SD_BOTH
diff --git
a/src/event.c
b/src/event.c
index
5d0bcef
..
2710a8b
100644
(file)
--- a/
src/event.c
+++ b/
src/event.c
@@
-30,7
+30,7
@@
#include "net.h"
struct timeval now;
#include "net.h"
struct timeval now;
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
#ifdef HAVE_SYS_EPOLL_H
static int epollset = 0;
#ifdef HAVE_SYS_EPOLL_H
static int epollset = 0;
@@
-58,7
+58,7
@@
static inline int event_epoll_init(void) {
#endif
static int io_compare(const io_t *a, const io_t *b) {
#endif
static int io_compare(const io_t *a, const io_t *b) {
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
return a->fd - b->fd;
#else
return a->fd - b->fd;
#else
@@
-114,7
+114,7
@@
void io_add(io_t *io, io_cb_t cb, void *data, int fd, int flags) {
}
io->fd = fd;
}
io->fd = fd;
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if(io->fd != -1) {
io->event = WSACreateEvent();
if(io->fd != -1) {
io->event = WSACreateEvent();
@@
-141,7
+141,7
@@
void io_add(io_t *io, io_cb_t cb, void *data, int fd, int flags) {
#endif
}
#endif
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
void io_add_event(io_t *io, io_cb_t cb, void *data, WSAEVENT event) {
io->event = event;
io_add(io, cb, data, -1, 0);
void io_add_event(io_t *io, io_cb_t cb, void *data, WSAEVENT event) {
io->event = event;
io_add(io, cb, data, -1, 0);
@@
-167,7
+167,7
@@
void io_set(io_t *io, int flags) {
return;
}
return;
}
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
#ifdef HAVE_SYS_EPOLL_H
epoll_ctl(epollset, EPOLL_CTL_DEL, io->fd, NULL);
#ifdef HAVE_SYS_EPOLL_H
epoll_ctl(epollset, EPOLL_CTL_DEL, io->fd, NULL);
@@
-230,7
+230,7
@@
void io_del(io_t *io) {
}
io_set(io, 0);
}
io_set(io, 0);
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if(io->fd != -1 && WSACloseEvent(io->event) == FALSE) {
abort();
if(io->fd != -1 && WSACloseEvent(io->event) == FALSE) {
abort();
@@
-281,7
+281,7
@@
void timeout_del(timeout_t *timeout) {
};
}
};
}
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
// From Matz's Ruby
#ifndef NSIG
// From Matz's Ruby
#ifndef NSIG
@@
-379,7
+379,7
@@
static struct timeval *timeout_execute(struct timeval *diff) {
bool event_loop(void) {
running = true;
bool event_loop(void) {
running = true;
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
#ifdef HAVE_SYS_EPOLL_H
#ifdef HAVE_SYS_EPOLL_H
diff --git
a/src/event.h
b/src/event.h
index
d0f1911
..
70d86f5
100644
(file)
--- a/
src/event.h
+++ b/
src/event.h
@@
-33,7
+33,7
@@
typedef void (*signal_cb_t)(void *data);
typedef struct io_t {
int fd;
int flags;
typedef struct io_t {
int fd;
int flags;
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
WSAEVENT event;
#endif
io_cb_t cb;
WSAEVENT event;
#endif
io_cb_t cb;
@@
-57,7
+57,7
@@
typedef struct signal_t {
extern struct timeval now;
extern void io_add(io_t *io, io_cb_t cb, void *data, int fd, int flags);
extern struct timeval now;
extern void io_add(io_t *io, io_cb_t cb, void *data, int fd, int flags);
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
extern void io_add_event(io_t *io, io_cb_t cb, void *data, WSAEVENT event);
#endif
extern void io_del(io_t *io);
extern void io_add_event(io_t *io, io_cb_t cb, void *data, WSAEVENT event);
#endif
extern void io_del(io_t *io);
diff --git
a/src/fsck.c
b/src/fsck.c
index
fdd584e
..
e726272
100644
(file)
--- a/
src/fsck.c
+++ b/
src/fsck.c
@@
-185,7
+185,7
@@
static void check_conffile(const char *nodename, bool server) {
splay_empty_tree(&config);
}
splay_empty_tree(&config);
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
typedef int uid_t;
static uid_t getuid(void) {
typedef int uid_t;
static uid_t getuid(void) {
@@
-219,7
+219,7
@@
static void check_key_file_mode(const char *fname) {
}
}
}
}
}
}
-#endif // HAVE_
MINGW
+#endif // HAVE_
WINDOWS
static char *read_node_name(void) {
if(access(tinc_conf, R_OK) == 0) {
static char *read_node_name(void) {
if(access(tinc_conf, R_OK) == 0) {
diff --git
a/src/have.h
b/src/have.h
index
f19c599
..
36d17b6
100644
(file)
--- a/
src/have.h
+++ b/
src/have.h
@@
-21,7
+21,7
@@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
#define WINVER 0x0600
#define _WIN32_WINNT 0x0600
#define WIN32_LEAN_AND_MEAN
#define WINVER 0x0600
#define _WIN32_WINNT 0x0600
#define WIN32_LEAN_AND_MEAN
@@
-51,7
+51,7
@@
#define alloca(size) __builtin_alloca(size)
#endif
#define alloca(size) __builtin_alloca(size)
#endif
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
#ifdef HAVE_W32API_H
#include <w32api.h>
#endif
#ifdef HAVE_W32API_H
#include <w32api.h>
#endif
@@
-65,7
+65,7
@@
#include <process.h>
#include <direct.h>
#endif
#include <process.h>
#include <direct.h>
#endif
-#endif // HAVE_
MINGW
+#endif // HAVE_
WINDOWS
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#ifdef HAVE_TERMIOS_H
#include <termios.h>
@@
-237,7
+237,7
@@
#undef STATUS
#endif
#undef STATUS
#endif
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
#define SLASH "\\"
#else
#define SLASH "/"
#define SLASH "\\"
#else
#define SLASH "/"
diff --git
a/src/ifconfig.c
b/src/ifconfig.c
index
59aa94c
..
f4ce313
100644
(file)
--- a/
src/ifconfig.c
+++ b/
src/ifconfig.c
@@
-25,7
+25,7
@@
static long start;
static long start;
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
void ifconfig_header(FILE *out) {
fprintf(out, "#!/bin/sh\n");
start = ftell(out);
void ifconfig_header(FILE *out) {
fprintf(out, "#!/bin/sh\n");
start = ftell(out);
@@
-128,7
+128,7
@@
void ifconfig_address(FILE *out, const char *value) {
return;
}
return;
}
-#elif defined(HAVE_
MINGW
)
+#elif defined(HAVE_
WINDOWS
)
switch(address.type) {
case SUBNET_MAC:
switch(address.type) {
case SUBNET_MAC:
@@
-226,7
+226,7
@@
void ifconfig_route(FILE *out, const char *value) {
}
}
}
}
-#elif defined(HAVE_
MINGW
)
+#elif defined(HAVE_
WINDOWS
)
if(*gateway_str) {
switch(subnet.type) {
if(*gateway_str) {
switch(subnet.type) {
diff --git
a/src/invitation.c
b/src/invitation.c
index
d1e1e61
..
22fd614
100644
(file)
--- a/
src/invitation.c
+++ b/
src/invitation.c
@@
-996,7
+996,7
@@
ask_netname:
char filename2[PATH_MAX];
snprintf(filename, sizeof(filename), "%s" SLASH "tinc-up.invitation", confbase);
char filename2[PATH_MAX];
snprintf(filename, sizeof(filename), "%s" SLASH "tinc-up.invitation", confbase);
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
snprintf(filename2, sizeof(filename2), "%s" SLASH "tinc-up.bat", confbase);
#else
snprintf(filename2, sizeof(filename2), "%s" SLASH "tinc-up", confbase);
snprintf(filename2, sizeof(filename2), "%s" SLASH "tinc-up.bat", confbase);
#else
snprintf(filename2, sizeof(filename2), "%s" SLASH "tinc-up", confbase);
@@
-1028,7
+1028,7
@@
ask_netname:
if(response == 'e') {
char *command;
if(response == 'e') {
char *command;
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
const char *editor = getenv("VISUAL");
if(!editor) {
const char *editor = getenv("VISUAL");
if(!editor) {
@@
-1358,7
+1358,7
@@
next:
continue;
}
continue;
}
-#if HAVE_
MINGW
+#if HAVE_
WINDOWS
// If socket has been shut down, recv() on Windows returns -1 and sets sockerrno
// to WSAESHUTDOWN, while on UNIX-like operating systems recv() returns 0, so we
// If socket has been shut down, recv() on Windows returns -1 and sets sockerrno
// to WSAESHUTDOWN, while on UNIX-like operating systems recv() returns 0, so we
diff --git
a/src/keys.c
b/src/keys.c
index
5f93a5a
..
0485c76
100644
(file)
--- a/
src/keys.c
+++ b/
src/keys.c
@@
-79,7
+79,7
@@
bool disable_old_keys(const char *filename, const char *what) {
return false;
}
return false;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
// We cannot atomically replace files on Windows.
char bakfile[PATH_MAX] = "";
snprintf(bakfile, sizeof(bakfile), "%s.bak", filename);
// We cannot atomically replace files on Windows.
char bakfile[PATH_MAX] = "";
snprintf(bakfile, sizeof(bakfile), "%s.bak", filename);
@@
-95,7
+95,7
@@
bool disable_old_keys(const char *filename, const char *what) {
return false;
}
return false;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
unlink(bakfile);
#endif
fprintf(stderr, "Warning: old key(s) found and disabled.\n");
unlink(bakfile);
#endif
fprintf(stderr, "Warning: old key(s) found and disabled.\n");
@@
-128,7
+128,7
@@
ecdsa_t *read_ecdsa_private_key(splay_tree_t *config_tree, char **keyfile) {
return NULL;
}
return NULL;
}
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
struct stat s;
if(fstat(fileno(fp), &s)) {
struct stat s;
if(fstat(fileno(fp), &s)) {
@@
-262,7
+262,7
@@
rsa_t *read_rsa_private_key(splay_tree_t *config_tree, char **keyfile) {
return NULL;
}
return NULL;
}
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
struct stat s;
if(fstat(fileno(fp), &s)) {
struct stat s;
if(fstat(fileno(fp), &s)) {
diff --git
a/src/logger.c
b/src/logger.c
index
caaf038
..
390023b
100644
(file)
--- a/
src/logger.c
+++ b/
src/logger.c
@@
-34,7
+34,7
@@
debug_t debug_level = DEBUG_NOTHING;
static logmode_t logmode = LOGMODE_STDERR;
static pid_t logpid;
static FILE *logfile = NULL;
static logmode_t logmode = LOGMODE_STDERR;
static pid_t logpid;
static FILE *logfile = NULL;
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
static HANDLE loghandle = NULL;
#endif
static const char *logident = NULL;
static HANDLE loghandle = NULL;
#endif
static const char *logident = NULL;
@@
-72,7
+72,7
@@
static void real_logger(debug_t level, int priority, const char *message) {
break;
case LOGMODE_SYSLOG:
break;
case LOGMODE_SYSLOG:
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
{
const char *messages[] = {message};
ReportEvent(loghandle, priority, 0, 0, NULL, 1, 0, messages, NULL);
{
const char *messages[] = {message};
ReportEvent(loghandle, priority, 0, 0, NULL, 1, 0, messages, NULL);
@@
-195,7
+195,7
@@
void openlogger(const char *ident, logmode_t mode) {
break;
case LOGMODE_SYSLOG:
break;
case LOGMODE_SYSLOG:
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
loghandle = RegisterEventSource(NULL, logident);
if(!loghandle) {
loghandle = RegisterEventSource(NULL, logident);
if(!loghandle) {
@@
-248,7
+248,7
@@
void closelogger(void) {
break;
case LOGMODE_SYSLOG:
break;
case LOGMODE_SYSLOG:
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
DeregisterEventSource(loghandle);
break;
#else
DeregisterEventSource(loghandle);
break;
#else
diff --git
a/src/logger.h
b/src/logger.h
index
5302582
..
e8e9a57
100644
(file)
--- a/
src/logger.h
+++ b/
src/logger.h
@@
-44,7
+44,7
@@
typedef enum logmode_t {
LOGMODE_SYSLOG
} logmode_t;
LOGMODE_SYSLOG
} logmode_t;
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
#define LOG_EMERG EVENTLOG_ERROR_TYPE
#define LOG_ALERT EVENTLOG_ERROR_TYPE
#define LOG_CRIT EVENTLOG_ERROR_TYPE
#define LOG_EMERG EVENTLOG_ERROR_TYPE
#define LOG_ALERT EVENTLOG_ERROR_TYPE
#define LOG_CRIT EVENTLOG_ERROR_TYPE
diff --git
a/src/meson.build
b/src/meson.build
index
92f42fa
..
e37c2db
100644
(file)
--- a/
src/meson.build
+++ b/
src/meson.build
@@
-159,7
+159,7
@@
elif os_name.endswith('bsd') or os_name in ['dragonfly', 'darwin']
elif os_name == 'sunos'
subdir('solaris')
elif os_name == 'windows'
elif os_name == 'sunos'
subdir('solaris')
elif os_name == 'windows'
- subdir('
mingw
')
+ subdir('
windows
')
endif
foreach h : check_headers
endif
foreach h : check_headers
@@
-228,9
+228,7
@@
if not opt_miniupnpc.disabled()
endif
endif
endif
endif
-if opt_curses.auto() and os_name == 'windows'
- message('curses does not link under MinGW')
-else
+if not opt_curses.disabled()
# The meta-dependency covers more alternatives, but is only available in 0.54+
curses_name = meson_version.version_compare('>=0.54') ? 'curses' : 'ncurses'
dep_curses = dependency(curses_name, required: opt_curses, static: static)
# The meta-dependency covers more alternatives, but is only available in 0.54+
curses_name = meson_version.version_compare('>=0.54') ? 'curses' : 'ncurses'
dep_curses = dependency(curses_name, required: opt_curses, static: static)
@@
-242,7
+240,7
@@
endif
# Some distributions do not supply pkg-config files for readline
if opt_readline.auto() and os_name == 'windows'
# Some distributions do not supply pkg-config files for readline
if opt_readline.auto() and os_name == 'windows'
- message('readline
does not link under MinGW
')
+ message('readline
not available on Windows
')
else
dep_readline = dependency('readline', required: opt_readline, static: static)
if not dep_readline.found()
else
dep_readline = dependency('readline', required: opt_readline, static: static)
if not dep_readline.found()
diff --git
a/src/names.c
b/src/names.c
index
c9318fa
..
fa3574b
100644
(file)
--- a/
src/names.c
+++ b/
src/names.c
@@
-39,7
+39,7
@@
char *program_name = NULL;
Set all files and paths according to netname
*/
void make_names(bool daemon) {
Set all files and paths according to netname
*/
void make_names(bool daemon) {
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
HKEY key;
char installdir[1024] = "";
DWORD len = sizeof(installdir);
HKEY key;
char installdir[1024] = "";
DWORD len = sizeof(installdir);
@@
-58,7
+58,7
@@
void make_names(bool daemon) {
identname = xstrdup("tinc");
}
identname = xstrdup("tinc");
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\tinc", 0, KEY_READ, &key)) {
if(!RegQueryValueEx(key, NULL, 0, 0, (LPBYTE)installdir, &len)) {
if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\tinc", 0, KEY_READ, &key)) {
if(!RegQueryValueEx(key, NULL, 0, 0, (LPBYTE)installdir, &len)) {
@@
-94,7
+94,7
@@
void make_names(bool daemon) {
}
}
}
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
(void)daemon;
if(!logfilename) {
(void)daemon;
if(!logfilename) {
diff --git
a/src/net.c
b/src/net.c
index
7f84421
..
9669bc9
100644
(file)
--- a/
src/net.c
+++ b/
src/net.c
@@
-160,7
+160,7
@@
void terminate_connection(connection_t *c, bool report) {
do_outgoing_connection(outgoing);
}
do_outgoing_connection(outgoing);
}
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
/* Clean up dead proxy processes */
while(waitpid(-1, NULL, WNOHANG) > 0);
/* Clean up dead proxy processes */
while(waitpid(-1, NULL, WNOHANG) > 0);
@@
-308,7
+308,7
@@
void handle_meta_connection_data(connection_t *c) {
}
}
}
}
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
static void sigterm_handler(void *data) {
logger(DEBUG_ALWAYS, LOG_NOTICE, "Got %s signal", strsignal(((signal_t *)data)->signum));
event_exit();
static void sigterm_handler(void *data) {
logger(DEBUG_ALWAYS, LOG_NOTICE, "Got %s signal", strsignal(((signal_t *)data)->signum));
event_exit();
@@
-487,7
+487,7
@@
int main_loop(void) {
0, 0
});
0, 0
});
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
signal_t sighup = {0};
signal_t sigterm = {0};
signal_t sigquit = {0};
signal_t sighup = {0};
signal_t sigterm = {0};
signal_t sigquit = {0};
@@
-506,7
+506,7
@@
int main_loop(void) {
return 1;
}
return 1;
}
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
signal_del(&sighup);
signal_del(&sigterm);
signal_del(&sigquit);
signal_del(&sighup);
signal_del(&sigterm);
signal_del(&sigquit);
diff --git
a/src/net.h
b/src/net.h
index
261d9c3
..
1765b1c
100644
(file)
--- a/
src/net.h
+++ b/
src/net.h
@@
-215,7
+215,7
@@
extern void load_all_nodes(void);
extern void try_tx(struct node_t *n, bool mtu);
extern void tarpit(int fd);
extern void try_tx(struct node_t *n, bool mtu);
extern void tarpit(int fd);
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
#define closesocket(s) close(s)
#endif
#define closesocket(s) close(s)
#endif
diff --git
a/src/net_socket.c
b/src/net_socket.c
index
a8e197b
..
dfee573
100644
(file)
--- a/
src/net_socket.c
+++ b/
src/net_socket.c
@@
-47,7
+47,7
@@
int fwmark;
listen_socket_t listen_socket[MAXSOCKETS];
int listen_sockets;
listen_socket_t listen_socket[MAXSOCKETS];
int listen_sockets;
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
io_t unix_socket;
#endif
io_t unix_socket;
#endif
@@
-425,7
+425,7
@@
void finish_connecting(connection_t *c) {
}
static void do_outgoing_pipe(connection_t *c, const char *command) {
}
static void do_outgoing_pipe(connection_t *c, const char *command) {
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
int fd[2];
if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd)) {
int fd[2];
if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd)) {
@@
-783,7
+783,7
@@
void handle_new_meta_connection(void *data, int flags) {
c->allow_request = ID;
}
c->allow_request = ID;
}
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
/*
accept a new UNIX socket connection
*/
/*
accept a new UNIX socket connection
*/
diff --git
a/src/nolegacy/crypto.c
b/src/nolegacy/crypto.c
index
d9df828
..
6965218
100644
(file)
--- a/
src/nolegacy/crypto.c
+++ b/
src/nolegacy/crypto.c
@@
-21,7
+21,7
@@
#include "../crypto.h"
#include "../crypto.h"
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
static int random_fd = -1;
static int random_fd = -1;
diff --git
a/src/openssl/crypto.c
b/src/openssl/crypto.c
index
c2df0af
..
fe5a599
100644
(file)
--- a/
src/openssl/crypto.c
+++ b/
src/openssl/crypto.c
@@
-24,7
+24,7
@@
#include "../crypto.h"
#include "../crypto.h"
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
static int random_fd = -1;
static int random_fd = -1;
diff --git
a/src/process.c
b/src/process.c
index
7deaadf
..
5e7b1db
100644
(file)
--- a/
src/process.c
+++ b/
src/process.c
@@
-25,7
+25,7
@@
#include "process.h"
#include "version.h"
#include "process.h"
#include "version.h"
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
#include "utils.h"
#endif
#include "utils.h"
#endif
@@
-42,7
+42,7
@@
bool use_logfile = false;
/* Some functions the less gifted operating systems might lack... */
/* Some functions the less gifted operating systems might lack... */
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
static SC_HANDLE manager = NULL;
static SC_HANDLE service = NULL;
static SERVICE_STATUS status = {0};
static SC_HANDLE manager = NULL;
static SC_HANDLE service = NULL;
static SERVICE_STATUS status = {0};
@@
-202,7
+202,7
@@
bool init_service(void) {
bool detach(void) {
logmode_t logmode;
bool detach(void) {
logmode_t logmode;
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
signal(SIGPIPE, SIG_IGN);
signal(SIGUSR1, SIG_IGN);
signal(SIGUSR2, SIG_IGN);
signal(SIGPIPE, SIG_IGN);
signal(SIGUSR1, SIG_IGN);
signal(SIGUSR2, SIG_IGN);
@@
-212,7
+212,7
@@
bool detach(void) {
#endif
if(do_detach) {
#endif
if(do_detach) {
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
if(daemon(1, 0)) {
logger(DEBUG_ALWAYS, LOG_ERR, "Couldn't detach from terminal: %s", strerror(errno));
if(daemon(1, 0)) {
logger(DEBUG_ALWAYS, LOG_ERR, "Couldn't detach from terminal: %s", strerror(errno));
diff --git
a/src/process.h
b/src/process.h
index
1aae6de
..
70f1c5c
100644
(file)
--- a/
src/process.h
+++ b/
src/process.h
@@
-29,7
+29,7
@@
extern bool use_syslog;
extern bool detach(void);
extern bool detach(void);
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
#include "event.h"
extern io_t stop_io;
#include "event.h"
extern io_t stop_io;
diff --git
a/src/script.c
b/src/script.c
index
b380931
..
0b16c86
100644
(file)
--- a/
src/script.c
+++ b/
src/script.c
@@
-37,7
+37,7
@@
static void unputenv(const char *p) {
ptrdiff_t len = e - p;
#ifndef HAVE_UNSETENV
ptrdiff_t len = e - p;
#ifndef HAVE_UNSETENV
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
// Windows requires putenv("FOO=") to unset %FOO%
len++;
#endif
// Windows requires putenv("FOO=") to unset %FOO%
len++;
#endif
@@
-148,7
+148,7
@@
bool execute_script(const char *name, environment_t *env) {
/* First check if there is a script */
/* First check if there is a script */
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if(!*scriptextension) {
const char *pathext = getenv("PATHEXT");
if(!*scriptextension) {
const char *pathext = getenv("PATHEXT");
diff --git
a/src/sptps_test.c
b/src/sptps_test.c
index
1da0571
..
baca66b
100644
(file)
--- a/
src/sptps_test.c
+++ b/
src/sptps_test.c
@@
-25,7
+25,7
@@
#include <getopt.h>
#include <getopt.h>
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
#include <pthread.h>
#endif
#include <pthread.h>
#endif
@@
-37,7
+37,7
@@
#include "utils.h"
#include "names.h"
#include "utils.h"
#include "names.h"
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
#define closesocket(s) close(s)
#endif
#define closesocket(s) close(s)
#endif
@@
-160,7
+160,7
@@
static void usage(void) {
fprintf(stderr, message, program_name);
}
fprintf(stderr, message, program_name);
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
int stdin_sock_fd = -1;
int stdin_sock_fd = -1;
@@
-308,7
+308,7
@@
server_err:
return -1;
}
return -1;
}
-#endif // HAVE_
MINGW
+#endif // HAVE_
WINDOWS
int main(int argc, char *argv[]) {
program_name = argv[0];
int main(int argc, char *argv[]) {
program_name = argv[0];
@@
-428,7
+428,7
@@
int main(int argc, char *argv[]) {
#endif
#endif
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
static struct WSAData wsa_state;
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {
static struct WSAData wsa_state;
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {
@@
-566,7
+566,7
@@
int main(int argc, char *argv[]) {
return 1;
}
return 1;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if(!readonly) {
in = start_input_reader();
if(!readonly) {
in = start_input_reader();
@@
-607,7
+607,7
@@
int main(int argc, char *argv[]) {
}
if(FD_ISSET(in, &fds)) {
}
if(FD_ISSET(in, &fds)) {
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
ssize_t len = recv(in, buf, readsize, 0);
#else
ssize_t len = read(in, buf, readsize);
ssize_t len = recv(in, buf, readsize, 0);
#else
ssize_t len = read(in, buf, readsize);
@@
-621,7
+621,7
@@
int main(int argc, char *argv[]) {
}
if(len == 0) {
}
if(len == 0) {
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
shutdown(in, SD_SEND);
closesocket(in);
#endif
shutdown(in, SD_SEND);
closesocket(in);
#endif
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
946e749
..
c700f94
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-281,7
+281,7
@@
ask_filename:
}
}
}
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if(filename[0] != '\\' && filename[0] != '/' && !strchr(filename, ':')) {
#else
if(filename[0] != '\\' && filename[0] != '/' && !strchr(filename, ':')) {
#else
@@
-651,7
+651,7
@@
static bool stop_tincd(void) {
return true;
}
return true;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
static bool remove_service(void) {
SC_HANDLE manager = NULL;
SC_HANDLE service = NULL;
static bool remove_service(void) {
SC_HANDLE manager = NULL;
SC_HANDLE service = NULL;
@@
-748,7
+748,7
@@
bool connect_tincd(bool verbose) {
fclose(f);
fclose(f);
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
if((pid == 0) || (kill(pid, 0) && (errno == ESRCH))) {
fprintf(stderr, "Could not find tincd running at pid %d\n", pid);
if((pid == 0) || (kill(pid, 0) && (errno == ESRCH))) {
fprintf(stderr, "Could not find tincd running at pid %d\n", pid);
@@
-886,7
+886,7
@@
static int cmd_start(int argc, char *argv[]) {
char *c;
char *slash = strrchr(program_name, '/');
char *c;
char *slash = strrchr(program_name, '/');
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if((c = strrchr(program_name, '\\')) > slash) {
slash = c;
if((c = strrchr(program_name, '\\')) > slash) {
slash = c;
@@
-904,7
+904,7
@@
static int cmd_start(int argc, char *argv[]) {
char **nargv = xzalloc((optind + argc) * sizeof(*nargv));
char *arg0 = c;
char **nargv = xzalloc((optind + argc) * sizeof(*nargv));
char *arg0 = c;
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
/*
Windows has no real concept of an "argv array". A command line is just one string.
The CRT of the new process will decode the command line string to generate argv before calling main(), and (by convention)
/*
Windows has no real concept of an "argv array". A command line is just one string.
The CRT of the new process will decode the command line string to generate argv before calling main(), and (by convention)
@@
-925,7
+925,7
@@
static int cmd_start(int argc, char *argv[]) {
nargv[nargc++] = argv[i];
}
nargv[nargc++] = argv[i];
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
int status = spawnvp(_P_WAIT, c, nargv);
free(nargv);
int status = spawnvp(_P_WAIT, c, nargv);
free(nargv);
@@
-1024,7
+1024,7
@@
static int cmd_stop(int argc, char *argv[]) {
return 1;
}
return 1;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
return remove_service() ? EXIT_SUCCESS : EXIT_FAILURE;
#else
return remove_service() ? EXIT_SUCCESS : EXIT_FAILURE;
#else
@@
-2058,7
+2058,7
@@
static int cmd_config(int argc, char *argv[]) {
}
// Replace the configuration file with the new one
}
// Replace the configuration file with the new one
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if(remove(filename)) {
fprintf(stderr, "Error replacing file %s: %s\n", filename, strerror(errno));
if(remove(filename)) {
fprintf(stderr, "Error replacing file %s: %s\n", filename, strerror(errno));
@@
-2234,7
+2234,7
@@
static int cmd_init(int argc, char *argv[]) {
check_port(name);
check_port(name);
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
char filename[PATH_MAX];
snprintf(filename, sizeof(filename), "%s" SLASH "tinc-up", confbase);
char filename[PATH_MAX];
snprintf(filename, sizeof(filename), "%s" SLASH "tinc-up", confbase);
@@
-2396,7
+2396,7
@@
static int cmd_edit(int argc, char *argv[]) {
}
char *command;
}
char *command;
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
const char *editor = getenv("VISUAL");
if(!editor) {
const char *editor = getenv("VISUAL");
if(!editor) {
@@
-3290,7
+3290,7
@@
int main(int argc, char *argv[]) {
return 0;
}
return 0;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
static struct WSAData wsa_state;
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {
static struct WSAData wsa_state;
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {
diff --git
a/src/tincd.c
b/src/tincd.c
index
1ee8769
..
9850eeb
100644
(file)
--- a/
src/tincd.c
+++ b/
src/tincd.c
@@
-37,7
+37,7
@@
#include <lz4.h>
#endif
#include <lz4.h>
#endif
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
@@
-66,7
+66,7
@@
static bool show_version = false;
static bool do_mlock = false;
#endif
static bool do_mlock = false;
#endif
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
/* If nonzero, chroot to netdir after startup. */
static bool do_chroot = false;
/* If nonzero, chroot to netdir after startup. */
static bool do_chroot = false;
@@
-96,7
+96,7
@@
static struct option const long_options[] = {
{NULL, 0, NULL, 0}
};
{NULL, 0, NULL, 0}
};
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
static struct WSAData wsa_state;
int main2(int argc, char **argv);
#endif
static struct WSAData wsa_state;
int main2(int argc, char **argv);
#endif
@@
-121,7
+121,7
@@
static void usage(bool status) {
" --pidfile=FILENAME Write PID and control socket cookie to FILENAME.\n"
" --bypass-security Disables meta protocol security, for debugging.\n"
" -o, --option[HOST.]KEY=VALUE Set global/host configuration value.\n"
" --pidfile=FILENAME Write PID and control socket cookie to FILENAME.\n"
" --bypass-security Disables meta protocol security, for debugging.\n"
" -o, --option[HOST.]KEY=VALUE Set global/host configuration value.\n"
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
" -R, --chroot chroot to NET dir at startup.\n"
" -U, --user=USER setuid to given USER at startup.\n"
#endif
" -R, --chroot chroot to NET dir at startup.\n"
" -U, --user=USER setuid to given USER at startup.\n"
#endif
@@
-196,7
+196,7
@@
static bool parse_options(int argc, char **argv) {
list_insert_tail(&cmdline_conf, cfg);
break;
list_insert_tail(&cmdline_conf, cfg);
break;
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
case 'R':
case 'U':
case 'R':
case 'U':
@@
-289,7
+289,7
@@
exit_fail:
}
static bool drop_privs(void) {
}
static bool drop_privs(void) {
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
uid_t uid = 0;
if(switchuser) {
uid_t uid = 0;
if(switchuser) {
@@
-342,7
+342,7
@@
static bool drop_privs(void) {
return true;
}
return true;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
# define setpriority(level) !SetPriorityClass(GetCurrentProcess(), (level))
static void stop_handler(void *data, int flags) {
# define setpriority(level) !SetPriorityClass(GetCurrentProcess(), (level))
static void stop_handler(void *data, int flags) {
@@
-445,7
+445,7
@@
int main(int argc, char **argv) {
return 1;
}
return 1;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {
logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s", "WSAStartup", winerror(GetLastError()));
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {
logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s", "WSAStartup", winerror(GetLastError()));
@@
-511,7
+511,7
@@
int main(int argc, char **argv) {
#endif
#endif
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
io_add_event(&stop_io, stop_handler, NULL, WSACreateEvent());
if(stop_io.event == FALSE) {
io_add_event(&stop_io, stop_handler, NULL, WSACreateEvent());
if(stop_io.event == FALSE) {
diff --git
a/src/utils.c
b/src/utils.c
index
8b0cd6e
..
4150d92
100644
(file)
--- a/
src/utils.c
+++ b/
src/utils.c
@@
-176,7
+176,7
@@
size_t b64encode_tinc_urlsafe(const void *src, char *dst, size_t length) {
return b64encode_tinc_internal(src, dst, length, base64_urlsafe);
}
return b64encode_tinc_internal(src, dst, length, base64_urlsafe);
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
const char *winerror(int err) {
static char buf[1024], *ptr;
const char *winerror(int err) {
static char buf[1024], *ptr;
diff --git
a/src/utils.h
b/src/utils.h
index
9756a3e
..
5f1bd8b
100644
(file)
--- a/
src/utils.h
+++ b/
src/utils.h
@@
-34,7
+34,7
@@
extern size_t b64encode_tinc(const void *src, char *dst, size_t length);
extern size_t b64encode_tinc_urlsafe(const void *src, char *dst, size_t length);
extern size_t b64decode_tinc(const char *src, void *dst, size_t length);
extern size_t b64encode_tinc_urlsafe(const void *src, char *dst, size_t length);
extern size_t b64decode_tinc(const char *src, void *dst, size_t length);
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
extern const char *winerror(int);
#define strerror(x) ((x)>0?strerror(x):winerror(GetLastError()))
#define sockerrno WSAGetLastError()
extern const char *winerror(int);
#define strerror(x) ((x)>0?strerror(x):winerror(GetLastError()))
#define sockerrno WSAGetLastError()
diff --git
a/src/mingw/common.h
b/src/windows/common.h
similarity index 98%
rename from
src/mingw/common.h
rename to
src/windows/common.h
index
ff052c9
..
dd0e6dd
100644
(file)
--- a/
src/mingw/common.h
+++ b/
src/windows/common.h
@@
-1,5
+1,5
@@
-#ifndef TINC_
MINGW
_COMMON_H
-#define TINC_
MINGW
_COMMON_H
+#ifndef TINC_
WINDOWS
_COMMON_H
+#define TINC_
WINDOWS
_COMMON_H
/*
* TAP-Win32 -- A kernel driver to provide virtual tap device functionality
/*
* TAP-Win32 -- A kernel driver to provide virtual tap device functionality
diff --git
a/src/mingw/device.c
b/src/windows/device.c
similarity index 99%
rename from
src/mingw/device.c
rename to
src/windows/device.c
index
03a1d48
..
51d09f7
100644
(file)
--- a/
src/mingw/device.c
+++ b/
src/windows/device.c
@@
-1,5
+1,5
@@
/*
/*
- device.c -- Interaction with
Windows tap driver in a MinGW environment
+ device.c -- Interaction with
the TAP-Windows driver
Copyright (C) 2002-2005 Ivo Timmermans,
2002-2022 Guus Sliepen <guus@tinc-vpn.org>
Copyright (C) 2002-2005 Ivo Timmermans,
2002-2022 Guus Sliepen <guus@tinc-vpn.org>
diff --git
a/src/mingw/meson.build
b/src/windows/meson.build
similarity index 92%
rename from
src/mingw/meson.build
rename to
src/windows/meson.build
index
5cd2c7b
..
8766bc1
100644
(file)
--- a/
src/mingw/meson.build
+++ b/
src/windows/meson.build
@@
-16,5
+16,3
@@
endforeach
src_tincd += files('device.c')
src_tincd += files('device.c')
-cdata.set('HAVE_MINGW', 1)
-
diff --git
a/src/xalloc.h
b/src/xalloc.h
index
33f30d0
..
da74ce1
100644
(file)
--- a/
src/xalloc.h
+++ b/
src/xalloc.h
@@
-67,7
+67,7
@@
static inline char *xstrdup(const char *s) {
}
static inline int xvasprintf(char **strp, const char *fmt, va_list ap) {
}
static inline int xvasprintf(char **strp, const char *fmt, va_list ap) {
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
char buf[1024];
int result = vsnprintf(buf, sizeof(buf), fmt, ap);
char buf[1024];
int result = vsnprintf(buf, sizeof(buf), fmt, ap);
diff --git
a/test/integration/splice.c
b/test/integration/splice.c
index
07c3503
..
e72d0c7
100644
(file)
--- a/
test/integration/splice.c
+++ b/
test/integration/splice.c
@@
-19,7
+19,7
@@
#include "../../src/system.h"
#include "../../src/system.h"
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
static const char *winerror(int err) {
static char buf[1024], *ptr;
static const char *winerror(int err) {
static char buf[1024], *ptr;
@@
-59,7
+59,7
@@
int main(int argc, char *argv[]) {
protocol = "17.7";
}
protocol = "17.7";
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
static struct WSAData wsa_state;
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {
static struct WSAData wsa_state;
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {