@@ -401,14 +401,19 @@ <h2>Table of Contents</h2>
401
401
</ p >
402
402
< ul >
403
403
< li > < code > WINDIVERT_EVENT_SOCKET_BIND</ code > : A < code > bind()</ code > operation.</ li >
404
- < li > < code > WINDIVERT_EVENT_SOCKET_LISTEN</ code > : A < code > listen()</ code > operation.</ li >
404
+ < li > < code > WINDIVERT_EVENT_SOCKET_UNBIND</ code > : A previous binding is
405
+ removed.</ li >
405
406
< li > < code > WINDIVERT_EVENT_SOCKET_CONNECT</ code > : A < code > connect()</ code >
406
407
operation.</ li >
408
+ < li > < code > WINDIVERT_EVENT_SOCKET_DISCONNECT</ code > : A previous connection
409
+ is terminated.</ li >
410
+ < li > < code > WINDIVERT_EVENT_SOCKET_LISTEN</ code > : A < code > listen()</ code > operation.</ li >
407
411
< li > < code > WINDIVERT_EVENT_SOCKET_ACCEPT</ code > : An < code > accept()</ code >
408
412
operation.</ li >
409
413
</ ul >
410
414
< p >
411
- Socket events can be blocked but not injected.
415
+ Socket events, except for < code > UNBIND</ code > /< code > DISCONNECT</ code > ,
416
+ can be blocked, and no socket event can be injected.
412
417
Process ID information is available at this layer.
413
418
Due to technical limitations, the
414
419
< code > WINDIVERT_LAYER_SOCKET</ code > layer cannot capture events that
@@ -429,8 +434,12 @@ <h2>Table of Contents</h2>
429
434
Process ID information is available at this layer,
430
435
meaning that it is possible to determine which (if any) process is using
431
436
WinDivert.
432
- The layer also returns a < q > pseudo packet</ q > that encodes the filter string
433
- associated with the event.
437
+ The layer also returns an < q > object</ q > representation of the filter string
438
+ used to open the handle.
439
+ The object representation can be converted back into a human-readable
440
+ filter string using the
441
+ < a href ="#divert_helper_format_filter "> < code > WinDivertHelperFormatFilter()</ code > </ a >
442
+ function.
434
443
The < code > WINDIVERT_LAYER_REFLECT</ code > layer can also capture events that
435
444
occurred before the handle was opened.
436
445
</ p >
@@ -626,7 +635,7 @@ <h2>Table of Contents</h2>
626
635
For IPv4, the < code > Socket.LocalAddr</ code > and < code > Socket.RemoteAddr</ code >
627
636
fields will be IPv4-mapped IPv6 addresses.
628
637
The < code > WINDIVERT_EVENT_SOCKET_BIND</ code > and
629
- < code > WINDIVERT_EVENT_SOCKET_LISTEN</ code > events will occur before a
638
+ < code > WINDIVERT_EVENT_SOCKET_LISTEN</ code > events can occur before a
630
639
connection attempt has been made, meaning that the
631
640
< code > Socket.RemoteAddr</ code > and < code > Socket.RemotePort</ code > fields
632
641
for these events will be zero.
@@ -955,21 +964,6 @@ <h2>Table of Contents</h2>
955
964
</ tr >
956
965
< tr >
957
966
< td >
958
- < code > WINDIVERT_FLAG_RECV_PARTIAL</ code >
959
- </ td >
960
- < td >
961
- This flags enables < q > partial receives</ q > .
962
- By default, if a packet is too big for the buffer passed to
963
- < a href ="#divert_recv "> < code > WinDivertRecv()</ code > </ a > , the operation
964
- will fail with < code > ERROR_INSUFFICIENT_BUFFER</ code > .
965
- This flag silences this error and only copies part of the packet
966
- up to the buffer size.
967
- The < code > WINDIVERT_FLAG_RECV_PARTIAL</ code > behavior was the default
968
- on older (pre-2.0) versions of WinDivert.
969
- </ td >
970
- </ tr >
971
- < tr >
972
- < td >
973
967
< code > WINDIVERT_FLAG_NO_INSTALL</ code >
974
968
</ td >
975
969
< td >
@@ -985,8 +979,7 @@ <h2>Table of Contents</h2>
985
979
< p >
986
980
Note that any combination of
987
981
< code > (WINDIVERT_FLAG_SNIFF | WINDIVERT_FLAG_DROP)</ code > or
988
- < code > (WINDIVERT_FLAG_RECV_ONLY | WINDIVERT_FLAG_SEND_ONLY)</ code > or
989
- < code > (WINDIVERT_FLAG_RECV_PARTIAL | WINDIVERT_FLAG_SEND_ONLY)</ code >
982
+ < code > (WINDIVERT_FLAG_RECV_ONLY | WINDIVERT_FLAG_SEND_ONLY)</ code >
990
983
are considered invalid.
991
984
</ p >
992
985
< p >
@@ -1165,10 +1158,11 @@ <h2>Table of Contents</h2>
1165
1158
the < code > pPacket</ code > buffer.
1166
1159
If non-< code > NULL</ code > , then the total number of bytes
1167
1160
written to < code > pPacket</ code > will be written to < code > recvLen</ code > .
1168
- Partial receives (where the packet data is truncated) is supported provided
1169
- the handle was opened with the < code > WINDIVERT_FLAG_RECV_PARTIAL</ code > flag set,
1170
- otherwise the operation will fail with < code > ERROR_INSUFFICIENT_BUFFER</ code >
1171
- if the < code > pPacket</ code > buffer is too small.
1161
+ If the < code > pPacket</ code > buffer is too small, the packet will be
1162
+ truncated and the operation will fail with the
1163
+ < code > ERROR_INSUFFICIENT_BUFFER</ code > error code.
1164
+ This error can be ignored if the application only intends to receive part
1165
+ of the packet, e.g., the IP headers only.
1172
1166
For layers that do not capture packets, the < code > pPacket</ code > parameter
1173
1167
should be < code > NULL</ code > and < code > packetLen</ code > should be zero.
1174
1168
</ p > < p >
@@ -2372,8 +2366,8 @@ <h2>Table of Contents</h2>
2372
2366
This function is mainly useful for < q > decompiling</ q > the filter object
2373
2367
representation back into a human-readable filter string representation.
2374
2368
One application is the < code > WINDIVERT_LAYER_REFLECT</ code > layer,
2375
- where a < q > pseudo packet </ q > containing a filter object is returned by
2376
- < a href ="#divert_recv "> < code > WinDivertRecv()</ code > </ a > .
2369
+ where the filter object associated with the reflection event is
2370
+ returned by < a href ="#divert_recv "> < code > WinDivertRecv()</ code > </ a > .
2377
2371
</ p >
2378
2372
</ dd > </ dl >
2379
2373
@@ -2635,9 +2629,11 @@ <h2>Table of Contents</h2>
2635
2629
< tr > < td > < code > PACKET</ code > </ td > < td > ✔</ td > < td > ✔</ td > < td > </ td > < td > </ td > < td > </ td > < td > < code > WINDIVERT_EVENT_NETWORK_PACKET</ code > </ td > </ tr >
2636
2630
< tr > < td > < code > ESTABLISHED</ code > </ td > < td > </ td > < td > </ td > < td > ✔</ td > < td > </ td > < td > </ td > < td > < code > WINDIVERT_EVENT_FLOW_ESTABLISHED</ code > </ td > </ tr >
2637
2631
< tr > < td > < code > DELETED</ code > </ td > < td > </ td > < td > </ td > < td > ✔</ td > < td > </ td > < td > </ td > < td > < code > WINDIVERT_EVENT_FLOW_DELETED</ code > </ td > </ tr >
2638
- < tr > < td > < code > ACCEPT</ code > </ td > < td > </ td > < td > </ td > < td > </ td > < td > ✔</ td > < td > </ td > < td > < code > WINDIVERT_EVENT_SOCKET_ACCEPT</ code > </ td > </ tr >
2639
2632
< tr > < td > < code > BIND</ code > </ td > < td > </ td > < td > </ td > < td > </ td > < td > ✔</ td > < td > </ td > < td > < code > WINDIVERT_EVENT_SOCKET_BIND</ code > </ td > </ tr >
2633
+ < tr > < td > < code > UNBIND</ code > </ td > < td > </ td > < td > </ td > < td > </ td > < td > ✔</ td > < td > </ td > < td > < code > WINDIVERT_EVENT_SOCKET_UNBIND</ code > </ td > </ tr >
2640
2634
< tr > < td > < code > CONNECT</ code > </ td > < td > </ td > < td > </ td > < td > </ td > < td > ✔</ td > < td > </ td > < td > < code > WINDIVERT_EVENT_SOCKET_CONNECT</ code > </ td > </ tr >
2635
+ < tr > < td > < code > DISCONNECT</ code > </ td > < td > </ td > < td > </ td > < td > </ td > < td > ✔</ td > < td > </ td > < td > < code > WINDIVERT_EVENT_SOCKET_DISCONNECT</ code > </ td > </ tr >
2636
+ < tr > < td > < code > ACCEPT</ code > </ td > < td > </ td > < td > </ td > < td > </ td > < td > ✔</ td > < td > </ td > < td > < code > WINDIVERT_EVENT_SOCKET_ACCEPT</ code > </ td > </ tr >
2641
2637
< tr > < td > < code > LISTEN</ code > </ td > < td > </ td > < td > </ td > < td > </ td > < td > ✔</ td > < td > </ td > < td > < code > WINDIVERT_EVENT_SOCKET_LISTEN</ code > </ td > </ tr >
2642
2638
< tr > < td > < code > OPEN</ code > </ td > < td > </ td > < td > </ td > < td > </ td > < td > </ td > < td > ✔</ td > < td > < code > WINDIVERT_EVENT_REFLECT_OPEN</ code > </ td > </ tr >
2643
2639
< tr > < td > < code > CLOSE</ code > </ td > < td > </ td > < td > </ td > < td > </ td > < td > </ td > < td > ✔</ td > < td > < code > WINDIVERT_EVENT_REFLECT_CLOSE</ code > </ td > </ tr >
0 commit comments