title: How do you block selected applications from accessing the internet (C++, Win32)
body: <p>I want to have an application or service that is running that, on some schedule, can disable access to the internet for all applications except for specific ones.</p>
  
  <p>I'm trying to create a filter that can be turned on or off under programmatic control. Not just IP addresses and ports, but I want to be able to block specific applications as well, much like Zone Alarm and other software firewalls let you block.</p>
  
  <p>For example, iexplore.exe, skype.exe, firefox.exe, aim.exe.  But still need to allow other applications to connect as needed.</p>
  
  <p>It has to work on Vista as well as XP, but I kind of expect that the method will be different on each of those platforms.  </p>
  
  <p>Basically, the filter has to tie the network communication back to the executable that is making the request and then allow or deny it.</p>
  
  <p><strong>Update:</strong> </p>
  
  <p>On <strong>Vista</strong> at least, it looks like I want to use filters in the <a href="http://msdn.microsoft.com/en-us/library/aa363971(VS.85).aspx" rel="nofollow noreferrer">ALE layers of the WFP</a>.</p>
  
  <p>On <strong>XP</strong>, I'm still looking for the best way to do it. Do I <em>really</em> need to be writing device drivers and dealing with kernel stuff? I'm just a lowly application developer. Kill me now.</p>
  
  <p><strong>Update 2:</strong></p>
  
  <p>Currently looking at the PfCreateInterface and related Pf* API's for pre-Vista systems. </p>