*/
#include <stdio.h>
+#include <Winsock2.h>
#include <windows.h>
#include <setupapi.h>
+#ifndef __MINGW64_VERSION_MAJOR
#include <ddk/cfgmgr32.h>
#include <ddk/newdev.h>
-#include <Winsock2.h>
+#else
+#include <cfgmgr32.h>
+#include <newdev.h>
+#endif
#include <time.h>
#include "platform.h"
#include "tap-windows.h"
#endif
/**
- * Will this binary be run in dryrun-mode?
+ * Will this binary be run in permissions testing mode?
*/
-static BOOL dryrun = FALSE;
+static boolean privilege_testing = FALSE;
/**
* Maximum size of a GNUnet message (GNUNET_SERVER_MAX_MESSAGE_SIZE)
* DHCP and such are all features we will never use in gnunet afaik.
* But for openvpn those are essential.
*/
- if (! tun_up (tap_handle))
- return;
+ if ((privilege_testing) || (! tun_up (tap_handle)))
+ goto teardown_final;
/* Initialize our overlapped IO structures*/
if (! (initialize_io_facility (&tap_read, IOSTATE_READY, FALSE)
}
#endif
- if (dryrun)
- goto teardown;
-
fprintf (stderr, "DEBUG: mainloop has begun\n");
while (std_out.path_open || tap_write.path_open)
CancelIo (tap_handle);
CancelIo (std_in.handle);
CancelIo (std_out.handle);
-
teardown_final:
-
CloseHandle (tap_handle);
}
BOOL have_ip6 = FALSE;
if (argc > 1 && 0 != strcmp (argv[1], "-d")){
- dryrun = TRUE;
- fprintf (stderr, "DEBUG: Running binary in dryrun mode.", argv[0]);
+ privilege_testing = TRUE;
+ fprintf (stderr, "DEBUG: Running binary in privilege testing mode.", argv[0]);
argv++;
argc--;
}