From 0266a1048fc2a774cea62ee72c7b5797344510a9 Mon Sep 17 00:00:00 2001 From: Daan Raman Date: Thu, 7 Mar 2013 11:40:13 +0100 Subject: [PATCH] Type error compiling examples on VS2012 Casting the divert layer argument for the DivertOpen function resolves a type error in VS2012. --- examples/netdump/netdump.c | 2 +- examples/netfilter/netfilter.c | 2 +- examples/passthru/passthru.c | 2 +- examples/webfilter/webfilter.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/netdump/netdump.c b/examples/netdump/netdump.c index 43e996c..26ded3c 100644 --- a/examples/netdump/netdump.c +++ b/examples/netdump/netdump.c @@ -76,7 +76,7 @@ int __cdecl main(int argc, char **argv) console = GetStdHandle(STD_OUTPUT_HANDLE); // Divert traffic matching the filter: - handle = DivertOpen(argv[1], 0, priority, DIVERT_FLAG_SNIFF); + handle = DivertOpen(argv[1], (DIVERT_LAYER)0, priority, DIVERT_FLAG_SNIFF); if (handle == INVALID_HANDLE_VALUE) { if (GetLastError() == ERROR_INVALID_PARAMETER) diff --git a/examples/netfilter/netfilter.c b/examples/netfilter/netfilter.c index 581203d..805f39d 100644 --- a/examples/netfilter/netfilter.c +++ b/examples/netfilter/netfilter.c @@ -149,7 +149,7 @@ int __cdecl main(int argc, char **argv) console = GetStdHandle(STD_OUTPUT_HANDLE); // Divert traffic matching the filter: - handle = DivertOpen(argv[1], 0, priority, 0); + handle = DivertOpen(argv[1], (DIVERT_LAYER)0, priority, 0); if (handle == INVALID_HANDLE_VALUE) { if (GetLastError() == ERROR_INVALID_PARAMETER) diff --git a/examples/passthru/passthru.c b/examples/passthru/passthru.c index f14fbd5..0b8adbd 100644 --- a/examples/passthru/passthru.c +++ b/examples/passthru/passthru.c @@ -56,7 +56,7 @@ int __cdecl main(int argc, char **argv) } // Divert traffic matching the filter: - handle = DivertOpen(argv[1], 0, 0, 0); + handle = DivertOpen(argv[1], (DIVERT_LAYER)0, 0, 0); if (handle == INVALID_HANDLE_VALUE) { if (GetLastError() == ERROR_INVALID_PARAMETER) diff --git a/examples/webfilter/webfilter.c b/examples/webfilter/webfilter.c index 826856d..061bcda 100644 --- a/examples/webfilter/webfilter.c +++ b/examples/webfilter/webfilter.c @@ -163,7 +163,7 @@ int __cdecl main(int argc, char **argv) "ip && " // Only IPv4 supported "tcp.DstPort == 80 && " // HTTP (port 80) only "tcp.PayloadLength > 0", // TCP data packets only - 0, priority, 0 + (DIVERT_LAYER)0, priority, 0 ); if (handle == INVALID_HANDLE_VALUE) {