Windows-7: disable Internet sharing on a network adapter when it is in a hidden state?

I am trying to use the Internet through a network adapter on Windows 7 using NetConLib.dll .

To do this, Internet access must be disabled on all other network adapters.

In ordinary cases. I can iterate through all installed network adapters and disable their sharing. However, sometimes when the network device is disconnected, the adapter is hidden in the windows. But its properties are still present in the Windows registry.

I can’t even find the adapter in the control panel. And of course, he cannot NetConlib over it using the NetConlib library.


Possible scenarios.

  • The easiest way is to use the windows command to disable the Internet sharing of all adapters. Regardless of their visibility.

    Is this possible anyway?

  • The second solution is to restore the network adapter from a hidden state so that NetConlib can scroll and disconnect it.

    I tried to find the adapter properties in the Windows registry and unhide , but found nothing.

Any solution?


@ erm3nda.

Thanks for the informative answer. Although this did not fix the problem that I encountered NetConlib .

SC configuration correctly disables ICS. But the shared network adapter continues to mark as Shared 1 . Therefore, a disabled ICS does not affect adapter settings.

Quite interesting; when you try to share another adapter using the Windows GUI ( Right click on adapter -> Properties -> Share ) a message appears with a message

"another adapter is currently in use, the new adapter will be shared." You click "OK" and execute.

I’ve been digging the entire Internet all day to find out if there are other solutions using CMD commands.

Perhaps you may have access to another adapter using the command. Thus, windows will handle disconnecting other adapters. Similar to how the graphical interface is used.


1: Windows tells you which adapter is currently used in Control Panel\Network and Internet\Network Connections ).

+6
source share
2 answers

Possible Solution 1: Disable ICS altogether. You can stop the ICS service, so none of the connections will be in a shared state and will not conflict with NetConLib.dll . (Not sure about hidden ones, you should try).

You can control it from the command line using: net start SharedAccess or net stop SharedAccess

In addition, if you need to disable it during reboot, you must disable the service using: sc config SharedAccess start= disabled

Notes and links:

  • Running sc config display "start = OPTIONS" and some others. Space below = and parameter is required. You can check the result of services.msc from Run or cmd.
  • Exec net to display options. The name of the service is located on services.msc in the "Service Name" section of ICS.
  • netsh routing no longer works on Win7, so you can start / stop / enable / disable but not enable a specific interface. You must install handMouse ... This does not work under Win7 ICS in XP system
  • sc config command was from this cool documentation I found today .

Possible Solution 2: Remove Ghost Interfaces? I also try to use adapters and interfaces in the registry and see nothing about show / hid / ghost / enabled or the like. I am also looking here for kb 314053 for the registry registry.

I can fix the attempt. Possible solution 1 :) or directly remove the hidden / ghost adapters. You can do this in two ways. The Devcon removal option will also remove the drivers.

The main use for finding network cards is devcon findall =net , you can also devcon findall =net *ndis* list all ndis cards. The main use for removal will be devcon remove =net *ndis* to remove all types of ndis cards.

I am also trying to enable / disable commands, but nothing has changed in the list of network interfaces. I removed my own Wi-Fi card to check it :) In any case, I did not notice any options about the "Unhide" function for such devices in the partition panel.

NEW EDIT (too many details, right?)

I found a tool called ics-manager from this superuser entry. - read answer No. 3 You can download directly from the utapyngo Git project page .

It is based on the .Net Framework 4. Yo must download and run build.bat to compile both exe (you also have a C # source). The solution is to get only the compiled version of IcsManager.exe (command line version) with the only necessary library IcsManagerLibrary.dll.

This application also uses NetConLib.dll , so you can use it or read the source to find out which function you need and implement it in your development.

If you have problems with the IP range "192.168.137.1", you can install it from the registry on an ongoing basis or run netsh interface ipv4 set address name="YOUR-INTERFACE" source=static addr=192.168.2.1 mask=255.255.255.0 . You will get ugly errors when starting the netsh interface using tildes or accutes in the interface name (the default Spanish ethernet name is "Conexión de áreal local" ... just kidding).

Note. You can pack it all at once, using Bat to call IcsManager.exe 'first with the necessary arguments, and then run the netsh configure command later from the same batch to the full configuration.

A comment. About the hint when trying to overwrite a common connection, this, of course, because only one can be shared. I also see that they are configured as Public and Home to set the pair, but I can’t find where the registry key is ... Also do some export from reg and use Diffs, no luck. I got stuck in diff and started looking for “ICS C ++ and C #” on Google and then found it.

Optional: I got netsh him in a bat and he launched for Windows Task when an Ethernet cable is connected (here's how) to use it with Android Reverse Tethering. As you can see, I am too interesting in your question because it makes me study better and also learned a lot.

I'm sorry for my bad english. I do not. Best wishes.

+5
source

I found that by going into the device manager, you can show hidden devices and try to disable Internet sharing on the adapters.

Hope this is almost what you are asking for. Good luck

ATM

Source: http://msdn.microsoft.com/en-us/library/windows/hardware/ff553955%28v=vs.85%29.aspx

+1
source

Source: https://habr.com/ru/post/956793/


All Articles