diff --git a/CHANGELOG b/CHANGELOG index 4800350..781c7ad 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,7 +18,7 @@ WinDivert 1.0.4 WinDivert 1.0.5 - Fix the DIVERT_NETWORK_FORWARD_LAYER implementation. - Upgrade Visual Studio support to 2012. -WinDivert 1.1.0 +WinDivert 1.1.0-rc - Re-brand "DIVERT" to "WINDIVERT" throughout the code-base. - New flag: * WINDIVERT_FLAG_NO_CHECKSUM: Do not guarantee that diverted packets @@ -36,3 +36,8 @@ WinDivert 1.1.0 load. WinDivert 1.1.1 - Fixed a BSOD that sometimes occurs when the driver is unloaded. +WinDivert 1.1.2-rc + - Renamed drivers to "WinDivert32.sys" and "WinDivert64.sys". Both can + exist in the same directory, and WinDivert.dll automatically loads the + right correct version. + - Deprecate both the WinDivert.inf and WdfCoInstaller*.dll files. diff --git a/VERSION b/VERSION index 524cb55..0b8acc8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.1 +1.1.2-rc diff --git a/examples/netfilter/netfilter.c b/examples/netfilter/netfilter.c index a47d30b..96f8050 100644 --- a/examples/netfilter/netfilter.c +++ b/examples/netfilter/netfilter.c @@ -348,7 +348,7 @@ int __cdecl main(int argc, char **argv) WinDivertHelperCalcChecksums((PVOID)dnrv6, icmpv6_length, 0); memcpy(&send_addr, &recv_addr, sizeof(send_addr)); - send_addr.Direction = WINDIVERT_DIRECTION_OUTBOUND; + send_addr.Direction = !recv_addr.Direction; if (!WinDivertSend(handle, (PVOID)dnrv6, icmpv6_length, &send_addr, NULL)) { diff --git a/sys/windivert.c b/sys/windivert.c index 0535582..3eff13e 100644 --- a/sys/windivert.c +++ b/sys/windivert.c @@ -334,6 +334,7 @@ static UINT32 windivert_context_priority(UINT32 priority0) /* * Prototypes. */ +static void windivert_driver_unload(void); extern VOID windivert_ioctl(IN WDFQUEUE queue, IN WDFREQUEST request, IN size_t in_length, IN size_t out_len, IN ULONG code); static NTSTATUS windivert_read(context_t context, WDFREQUEST request); @@ -709,22 +710,7 @@ extern NTSTATUS DriverEntry(IN PDRIVER_OBJECT driver_obj, if (!NT_SUCCESS(status)) { - if (inject_handle != NULL) - { - FwpsInjectionHandleDestroy0(inject_handle); - } - if (injectv6_handle != NULL) - { - FwpsInjectionHandleDestroy0(injectv6_handle); - } - if (pool_handle != NULL) - { - NdisFreeNetBufferListPool(pool_handle); - } - if (engine_handle != NULL) - { - FwpmEngineClose0(engine_handle); - } + windivert_driver_unload(); } return status; @@ -734,25 +720,45 @@ extern NTSTATUS DriverEntry(IN PDRIVER_OBJECT driver_obj, * WinDivert driver unload routine. */ extern VOID windivert_unload(IN WDFDRIVER Driver) +{ + windivert_driver_unload(); +} + +/* + * WinDivert driver unload. + */ +static void windivert_driver_unload(void) { DEBUG("UNLOAD: unloading the WinDivert driver"); - FwpmSubLayerDeleteByKey0(engine_handle, - &layer_inbound_network_ipv4->sublayer_guid); - FwpmSubLayerDeleteByKey0(engine_handle, - &layer_outbound_network_ipv4->sublayer_guid); - FwpmSubLayerDeleteByKey0(engine_handle, - &layer_inbound_network_ipv6->sublayer_guid); - FwpmSubLayerDeleteByKey0(engine_handle, - &layer_outbound_network_ipv6->sublayer_guid); - FwpmSubLayerDeleteByKey0(engine_handle, - &layer_forward_network_ipv4->sublayer_guid); - FwpmSubLayerDeleteByKey0(engine_handle, - &layer_forward_network_ipv6->sublayer_guid); - FwpsInjectionHandleDestroy0(inject_handle); - FwpsInjectionHandleDestroy0(injectv6_handle); - NdisFreeNetBufferListPool(pool_handle); - FwpmEngineClose0(engine_handle); + if (inject_handle != NULL) + { + FwpsInjectionHandleDestroy0(inject_handle); + } + if (injectv6_handle != NULL) + { + FwpsInjectionHandleDestroy0(injectv6_handle); + } + if (pool_handle != NULL) + { + NdisFreeNetBufferListPool(pool_handle); + } + if (engine_handle != NULL) + { + FwpmSubLayerDeleteByKey0(engine_handle, + &layer_inbound_network_ipv4->sublayer_guid); + FwpmSubLayerDeleteByKey0(engine_handle, + &layer_outbound_network_ipv4->sublayer_guid); + FwpmSubLayerDeleteByKey0(engine_handle, + &layer_inbound_network_ipv6->sublayer_guid); + FwpmSubLayerDeleteByKey0(engine_handle, + &layer_outbound_network_ipv6->sublayer_guid); + FwpmSubLayerDeleteByKey0(engine_handle, + &layer_forward_network_ipv4->sublayer_guid); + FwpmSubLayerDeleteByKey0(engine_handle, + &layer_forward_network_ipv6->sublayer_guid); + FwpmEngineClose0(engine_handle); + } } /*