winws: save win32 error in windivert send

This commit is contained in:
bol-van 2024-05-01 21:23:16 +03:00
parent 1e8e46c14f
commit 8a09df7097
2 changed files with 5 additions and 3 deletions

View File

@ -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)
{

View File

@ -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);