Still playing with Windivert (see original article here), I this time decided to code a transparent proxy.
Principle is the following : divert a destination port (say tcp:80) to a new destination_ip:port.
On the destination ip, i am running privoxy (but any proxy supporting transparent mode would do).
In privoxy config file, I am setting accept-intercepted-requests=1 .
This will be completely transparent for the source application.
Nothing really fancy in the code except may be me storing the orginal remote ip (which we will need to re apply on the traffic back) in an array dynamic_source_port=remote_ip.
Source code and binaries can be found here.