Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to enable/disable network adapters?

1,115 views
Skip to first unread message

Thorsten Kleinhenz

unread,
Jul 11, 2005, 4:42:12 AM7/11/05
to
Hello,

I need to enable/disable network adapters from my VB.NET code, e.g. enable
wlan, disable lan. I know the names of the adapters, so I've thought about
using an api call like the one that is used by the "Network connection
manager" (connmc.exe); there you can choose an adapter from a list, and
enable/disable it. But I haven't found this function, yet. Can anybody point
me into the right direction? Maybe I can "automate" this connmc.exe, meaning
start the exe from my code, select the specific adapter from the list
control, "click" the menu???
Btw, I read about binding, rebinding and unbinding an adapter? What does
this mean? Is it disabling the adapter or is it a kind of reset of the
adapter?

With kind regards,
Thorsten Kleinhenz

Paul G. Tobey [eMVP]

unread,
Jul 11, 2005, 12:31:12 PM7/11/05
to
Enable and Disable in the Network and DialUp Connections manager is actually
setting a bit in the registry for the target adapter and then calling NDIS
to unbind or bind (depending on whether your disabling or enabling the
adapter). NDIS picks up the flag setting during this binding process. I
can't find my notes on the values of flag that represent 'enabled' and
'disabled', but you should be able to use the Remote Registry Editor to
export the registry with a given adapter enabled, then disabled, and a
comparison program to figure that out.

Paul T.

"Thorsten Kleinhenz" <Thorsten...@discussions.microsoft.com> wrote in
message news:E2560D79-7577-4FE6...@microsoft.com...

Dante

unread,
Jul 11, 2005, 6:40:02 PM7/11/05
to
I am also trying to enable/disable network adapters. I have found the
registry key for enabling/disabling network adapter, which is:
[HKEY_LOCAL_MACHINE\Comm\NdisPower]
<adapterName>=dword:00000004 ; disabled (delete this value for enabled)

But i cannot figure out how to do a NDIS bind or NDIS unbind through VB.net.
The only API that i have found is:
VOID NdisMRebindProtocolsToAdapter(
NDIS_HANDLE MiniportAdapterHandle
);

But I do not know how to P/Invoke this function because of the NDIS_HANDLE
struct as it's argument. Any help on how to do an NDIS bind or NDIS unbind
through VB.net ?

Paul G. Tobey [eMVP]

unread,
Jul 11, 2005, 7:29:56 PM7/11/05
to
Use OpenNETCF. The .Net namespace has Unbind, Rebind, and Bind methods for
doing this. Make sure that you get the latest source from the Vault,
however, as there was a recent bug fix.

Paul T.

"Dante" <Da...@discussions.microsoft.com> wrote in message
news:F634902C-D5E7-46D2...@microsoft.com...

Thorsten Kleinhenz

unread,
Jul 18, 2005, 5:26:02 AM7/18/05
to
Hello Paul, hello Dante,
thanks for the information.
Actually I can disable an adapter via setting the mentioned registry key and
unbind the adapter. This sets the adapter even in the ConnectionManager to
disabled. But when I delete the registry key and bind the adapter I need to
enable the adapter via ConnectionManager again... is there anything else I
have to do to enable it? Or could this be a bug in my WinCE.NET 4.2 image?
Another question, what does to bind/unbind "exactly" mean?

Regards,
Thorsten

Paul G. Tobey [eMVP]

unread,
Jul 18, 2005, 1:06:35 PM7/18/05
to
I can't help you with Connection Manager (don't have a PPC, even).

Binding is loading the adapter and attaching it, virtually, to each protocol
stack that the registry wants it connected to. On the desktop, this might
make connections between the adapter, TCP/IP, IPX/SPX (if you are using
NetWare on your network), etc. On Windows CE, it basically just connects
the adapter to TCP/IP. When it's bound, the TCP/IP stack has to get an IP
address for it (by reading it from the registry, if it's a static address,
or by contacting a DHCP server, if that's the configuration), etc.

Paul T.

"Thorsten Kleinhenz" <Thorsten...@discussions.microsoft.com> wrote in

message news:3CCF281B-0645-4BE0...@microsoft.com...

KAUSHIK BOSE

unread,
Feb 23, 2007, 6:40:52 AM2/23/07
to
Plese tell me how will I enable a Loopback adapter of windows 2003 server
from windows registry(HKEY_LOCAL_MACHINE).Step by step.
Suppose I have a standalone machine.I have 2 drive(c: & d:)
c: drive contains windows XP d: drive contains windows 2003 server and
d:drive also contains exchange server2003.
I have a loop back adaptor. Suddenly I disabled the adapter and shut down
the machine.But now I cannot open windows 2003 server. Machine stops and
showing "setting network connections"

KAUSHIK BOSE

unread,
Feb 23, 2007, 6:42:19 AM2/23/07
to
showing "setting network connections".My email address is
kaushik...@yahoo.co.in

Paul G. Tobey [eMVP]

unread,
Feb 26, 2007, 11:43:14 AM2/26/07
to
Let me point out that you've posted to the wrong group. This group is for
discussion of .NET Compact Framework programming on Windows CE and Windows
Mobile devices, not for Windows Server or XP. You'll get better answers
faster if you ask in a sensible group.

Paul T.

"KAUSHIK BOSE" <kaushik...@yahoo.co.in> wrote in message
news:89205b73108342c7...@ureader.com...

Prajwal

unread,
Aug 12, 2009, 3:20:41 AM8/12/09
to
Hi all,

Does any body know how do i disable LAN connection on WIN CE 5 device through my program.

Thanks in advance....

Best Regards,
Prajwal

From http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla:en-US:official&hs=qN8&q=opennetcf+enable+and+disable+LAN&btnG=Search&meta=&aq=f&oq=

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/

Paul G. Tobey [eMVP]

unread,
Aug 12, 2009, 11:40:18 AM8/12/09
to
Check the archives...

If you want to disable the adapter just during the current session (until
the next reboot), you can unbind it from NDIS, after telling NDIS to unpower
the adapter. OpenNETCF's Smart Device Framework has suitable methods for
doing the unbind of an adapter. You'll probably have to unpower the adapter
yourself (although OpenNETCF does have the P/Invoke for SetDevicePower()).
The best reference to this is the actual connection manager code for Windows
CE, which, if you are the device vendor, you can find in
\PUBLIC\COMMON\OAK\DRIVERS\CONNMC.

If you want to permanently disable the adapter (have the adapter disable
after reboot), you have to set a flag in the registry entry for the adapter,
and unbind/unpower it (and save the registry, of course).

Paul T.

"Prajwal" <prajw...@gmail.com> wrote in message
news:260e9012-dfe2-4b6e...@developmentnow.com...

0 new messages