diff --git a/nfq/darkmagic.c b/nfq/darkmagic.c index 19143a0..cb6115b 100644 --- a/nfq/darkmagic.c +++ b/nfq/darkmagic.c @@ -959,7 +959,7 @@ void tcp_rewrite_winsize(struct tcphdr *tcp, uint16_t winsize, uint8_t scale_fac static HANDLE w_filter = NULL; static OVERLAPPED ovl = { .hEvent = NULL }; -DWORD w_win32_error=0; +uint32_t w_win32_error=0; static HANDLE windivert_init_filter(const char *filter, UINT64 flags) { @@ -1082,7 +1082,9 @@ bool windivert_recv(uint8_t *packet, size_t *len, WINDIVERT_ADDRESS *wa) static bool windivert_send_filter(HANDLE hFilter, const uint8_t *packet, size_t len, const WINDIVERT_ADDRESS *wa) { - return WinDivertSend(hFilter,packet,(UINT)len,NULL,wa); + bool b = WinDivertSend(hFilter,packet,(UINT)len,NULL,wa); + w_win32_error = GetLastError(); + return b; } bool windivert_send(const uint8_t *packet, size_t len, const WINDIVERT_ADDRESS *wa) { diff --git a/nfq/darkmagic.h b/nfq/darkmagic.h index ba09180..8108185 100644 --- a/nfq/darkmagic.h +++ b/nfq/darkmagic.h @@ -149,7 +149,7 @@ uint8_t tcp_find_scale_factor(const struct tcphdr *tcp); bool tcp_has_fastopen(const struct tcphdr *tcp); #ifdef __CYGWIN__ -extern DWORD w_win32_error; +extern uint32_t w_win32_error; bool windivert_init(const char *filter); bool windivert_recv(uint8_t *packet, size_t *len, WINDIVERT_ADDRESS *wa);