There seems to be a set of commands to programatically modify Firewall rules on Windows Server 2008. I have an app that handles a set of sockets, and from time to time it gets a DDoS.
I want to block some IP addresses from receiving the SYN-ACK on the TCP handshake. How can I do that from C++ in MS Visual C++?
As Microsoft only published VB script samples,
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366415%28v=vs.85%29.aspx
You have to translate them to C++ manually if you don’t want to call netsh command in your applications.
Generally speaking, there are a few COM objects you can use, such as HNetCfg.FwMgr. The VB script samples show how to use them properly.
Other references:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366449%28v=vs.85%29.aspx