I'm trying to share internet over a network adapter on windows-7 using NetConLib.dll
.
In order to do this, internet sharing should be disabled on all other network adapters.
In normal cases. I can iterate all the installed network adapters and disable sharing on them. However, sometimes when the network device is unplugged, the adapter is hidden in windows. But it's properties is still present inside windows registry.
I can't even find the adapter in Control Panel.
And off course, can't iterate it using the NetConlib
library.
Possible scenarios.
The easiest way, would be using a windows command to disable internet sharing on all the adapters. Regardless of their visibility.
Is that possible in anyway ?
The second solution is to recover the network adapter from hidden state, so that
NetConlib
could iterate through it and disable it.I tried to find the adapter's properties in windows registry and
unhide
it, But couldn't find anything.
Any solution?
@erm3nda.
Thank you for the informative answer. Although it didn't fix the problem I'm facing with NetConlib
.
SC config correctly shuts down ICS service. But the shared network adapter continues on being flagged as Shared
1. So ICS service being turned off doesn't seem to affect the adapters' settings.
Quite interestingly; when you try to share another adapter using windows GUI (Right click on adapter -> Properties -> Share
), a message is prompted telling you
"there is another adapter being shared currently, your new adapter will be shared instead". You click ok and it's done.
I've been digging the entire internet the whole afternoon to see if there are other solutions using CMD commands.
Maybe there could be a away to share an adapter with a command. This way windows would handle disabling other adapters. In a similar way as when the GUI is used.
1: Windows tells you which adapter is currently being shared in Control Panel\Network and Internet\Network Connections
).