Advertisement

07.21.2008 at 02:45PM PDT, ID: 23583516 | Points: 500
[x]
Attachment Details

Block access from an IP address

Asked by iunknown21 in Windows ATL / WTL / COM Programming, Network Software Firewalls

Tags: C++, C#, VB, doesn't really matter

I would like to programmatically block or allow access to my computer based on IP address or computer name.

I tried sessions and if there was a session that I didnt like, I would close it.  There were problems all over the place with that solution, mostly that it didnt work real well since Explorer will recreate the session if the one it was using got closed.

Right now, Im looking at the Firewall API.  The new Vista Firewall API has all sorts of things that I could use, but Im running 2003.  

I see the Scope property on the INETFwOpenPort, but I dont see any way to set the port to be ALL ports.  I dont want to just block File and Print Sharing but everything but ICMP.  

Does anyone know how to use the Firewall API to block ALL access from a certain address or have any other ideas how to block access from a certain IP?  

Thanks
Start Free Trial
 
Loading Advertisement...
 
[+][-]08.14.2008 at 08:18AM PDT, ID: 22231073

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.14.2008 at 08:22AM PDT, ID: 22231106

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628