[python-win32] Network Bindings
Carl Karsten
carl at personnelware.com
Sat Sep 29 02:25:34 CEST 2007
Matt Herbert wrote:
> Tim Golden wrote:
>> OK, I'm not entirely sure what "bindings on a network adapter are".
>
> Network Bindings are simply a list of Clients, Protocols, and Services
> that can be bound to particular adapters in particular orders. This is
> most easily visualized by brining up your Network Connections control
> panel (Start->run->ncpa.cpl). If you right click on any network adapter,
> and select properties, you will see a list of items that have check
> boxes next to them. Each item in that list is bound to that network
> adapter. Un-checking the box, unbinds that item (be it a service,
> protocol, or client). I am trying to find a way to check, and un-check
> those boxes programatically.
>
Sounds like config options. I bet they are registry entries. run regmon,
change a binding, see what happens. if I am right...
Here is a quick excerpt from my AddToPath.py (search this list for the full
source if you want it.)
from _winreg import *
hive = HKEY_LOCAL_MACHINE
key=r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
subkey = 'Path'
h = OpenKeyEx( hive, key, 0, KEY_READ )
curPath = QueryValueEx(h, subkey)[0]
CloseKey(h)
print "adding dir %s" % DirToAdd
h = OpenKeyEx( hive, key, 0, KEY_SET_VALUE )
NewPath = curPath + ';' + DirToAdd
SetValueEx(h, 'path', 0, REG_EXPAND_SZ, NewPath )
CloseKey(h)
Carl K
More information about the python-win32
mailing list