- Refactor driver unload functions.

- Packet direction fix for netfilter example.
- Bump version to 1.1.2-rc.
This commit is contained in:
basil00
2013-12-25 11:28:01 +08:00
parent 57934712c6
commit 33f6bec1e5
4 changed files with 46 additions and 35 deletions
+6 -1
View File
@@ -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.
+1 -1
View File
@@ -1 +1 @@
1.1.1
1.1.2-rc
+1 -1
View File
@@ -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))
{
+38 -32
View File
@@ -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 @@ driver_entry_exit:
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 @@ driver_entry_exit:
* 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);
}
}
/*