title: Enable Internet Connection Sharing programmatically
body: <p>I can do it manually by right-clicking on a network connection, opening the Sharing tab, clicking on the "Allow other network users to connect through this computer's Internet connection" check box, and selecting a "Home networking connection".</p>
  
  <p>While poking around this problem I have found multiple sets of COM interfaces:</p>
  
  <p>1) <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa366128%28v=vs.85%29.aspx" rel="nofollow">Internet Connection Sharing and Internet Connection Firewall Interfaces</a> with INetSharingManager</p>
  
  <p>Its documentation says:</p>
  
  <blockquote>
    <p>Internet Connection Firewall may be altered or unavailable in
    subsequent versions. Instead, use the Windows Firewall API.</p>
  </blockquote>
  
  <p>Moreover, the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa365944%28v=vs.85%29.aspx" rel="nofollow">INetSharingConfiguration.EnableSharing</a> method does not look like it corresponds the procedure described above because its arguments don't include the "Home networking connection".</p>
  
  <p>2) <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa366449%28v=vs.85%29.aspx" rel="nofollow">Windows Firewall for Windows XP with SP2 Interfaces</a></p>
  
  <p>Its documentation references us further:</p>
  
  <blockquote>
    <p>For Windows Vista and later, use of the Windows Firewall with Advanced
    Security API is recommended.</p>
  </blockquote>
  
  <p>3) <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff956124%28v=vs.85%29.aspx" rel="nofollow">Windows Firewall with Advanced Security API</a></p>
  
  <p>There are only the following interfaces: <code>INetFwPolicy2, INetFwProduct, INetFwProducts, INetFwRule, INetFwRule2, INetFwRule3, INetFwRules, INetFwServiceRestriction</code>. Does not look very promising.</p>
  
  <p>Now I'm lost. Which API should I use on Windows 7?</p>