memmcmemer / steam-limiter

Automatically exported from code.google.com/p/steam-limiter
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Close existing open connections as well as filter new ones #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Since the Steam client sometimes will keep a cached connection to a content 
server open for up to a minute after pausing a download, those active 
connections won't necessarily be filtered if the limiter configuration is 
changed rapidly.

To resolve this it's necessary to force-close the connections when the filter 
configuration changes, probably using the IP Helper APIs, particularly 
SetTcpEntry - since this API requires elevation on Vista/Win7, this will 
require an additional executable launch (either the existing monitor using 
ShellExecute to explicitly request elevation or a new app with requireAdmin set 
in the application manifest).

Original issue reported on code.google.com by nigel.bree@gmail.com on 19 Oct 2011 at 3:04

GoogleCodeExporter commented 8 years ago
Steam itself seems to have the IP Helper API loaded into its address space; 
this suggests having the steamfilter.dll bind to the 
[http://msdn.microsoft.com/en-us/library/windows/desktop/aa365928(v=VS.85).aspx 
GetExtendedTcpTable] API and when a filter is set or changes, enumerate the 
table to see if there are any candidates for being closed.

This then sets a unique return value, which the monitor application can use to 
trigger a ShellExecute() of the separate connection-kill application with the 
elevated manifest; given how infrequent the need for this will be since we 
should be able to avoid requesting it unless it's necessary an elevation prompt 
for it should be tolerable.

Original comment by nigel.bree@gmail.com on 20 Oct 2011 at 12:23