Add tweaks to support windows XP

This commit is contained in:
Hamish Coleman 2023-08-02 18:53:13 +01:00
parent 439939dc7b
commit 3bf584c580
3 changed files with 28 additions and 4 deletions

View File

@ -17,6 +17,7 @@
*/
#include <winsock2.h>
#include <iphlpapi.h>
#include "edge_utils_win32.h"

View File

@ -2,6 +2,9 @@
(C) 2007-22 - Luca Deri <deri@ntop.org>
*/
#include <winsock2.h>
#include <iphlpapi.h>
#include "n2n.h"
#include "n2n_win32.h"
@ -333,6 +336,15 @@ int open_wintap(struct tuntap_dev *device,
/* ****************** */
#ifdef _WIN64
/* Setting the metric is not actually 64-bit specific.
* The assumption here is that anyone needing a metric set will also
* need a new enough OS that they will be on 64-bit.
*
* The alternative is that people trying to run old games are probably on
* Windows XP and are probably 32-bit.
*/
/* metric */
PMIB_IPINTERFACE_ROW Row;
@ -357,6 +369,7 @@ int open_wintap(struct tuntap_dev *device,
free(Row);
}
#endif /* _WIN64 */
/* ****************** */
@ -452,6 +465,8 @@ int tuntap_open(struct tuntap_dev *device,
void tuntap_close(struct tuntap_dev *tuntap) {
#ifdef _WIN64
/* See comment in open_wintap for notes about this ifdef */
PMIB_IPINTERFACE_ROW Row;
if(tuntap->metric) { /* only required if a value has been given (and thus stored) */
@ -471,6 +486,7 @@ void tuntap_close(struct tuntap_dev *tuntap) {
free(Row);
}
#endif /* _WIN64 */
CloseHandle(tuntap->device_handle);
}

View File

@ -51,7 +51,14 @@
#include <sys/socket.h> // for send, socket, AF_INET, recv, connect
#endif
#if defined (__linux__) || defined(_WIN32) /* currently, Linux and Windows only */
#if defined (__linux__) || defined(_WIN64) /* currently, Linux and Windows only */
/* Technically, this could be supported on some 32-bit windows.
* The assumption here is that a version of Windows new enough to
* support the features needed is probably running with 64-bit.
*
* The alternative is that people trying to run old games are probably on
* Windows XP and are probably 32-bit.
*/
#define WITH_ADDRESS 1
@ -1088,16 +1095,16 @@ end_route_tool:
}
#else /* if defined(__linux__) || defined(_WIN32) -- currently, Linux and Windows only */
#else /* if defined(__linux__) || defined(_WIN64) -- currently, Linux and Windows only */
int main (int argc, char* argv[]) {
traceEvent(TRACE_WARNING, "currently, only Linux and Windows are supported");
traceEvent(TRACE_WARNING, "currently, only Linux and 64-bit Windows are supported");
traceEvent(TRACE_WARNING, "if you want to port to other OS, please find the source code having clearly marked the platform-dependant portions");
return 0;
}
#endif /* if defined (__linux__) || defined(_WIN32) -- currently, Linux and Windows only */
#endif /* if defined (__linux__) || defined(_WIN64) -- currently, Linux and Windows only */