Virtual adapter, change IP address through registry, enable/disable?



Greetings.

I have a virtual adapter based on the NetVMini sample from the XP DDK. I
have been using it (successfully) for tunneling, using IpHlpApi calls to
add/delete IP addresses. However, this implies that the adapter has a dummy
first address (DHCP off, so it usually sits there as 0.0.0.0). I would like
to be able to change the primary address on the adapter instead of adding a
second one when needed. I have seen some virtual adapters who do this exact
thing and I'm wondering what steps are involved.

I know that the following works:
- disable virtual adapter in device manager
- make registry changes in
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{.......}
- enable virtual adapter in device manager

This is rather slow, however, and I was hoping a similar effect could be
obtained by using Windows' media sensing mechanism. I thus tried the
following:

- internally set my connection status to "disconnected" (this is what my
virtual adapter responds to an OID_GEN_MEDIA_CONNECT_STATUS query)
- indicate NDIS_STATUS_MEDIA_DISCONNECTED with NdisMIndicateStatus
- make registry changes, as above
- internally set my connection status to "connected"
- indicate NDIS_STATUS_MEDIA_CONNECTED with NdisMIndicateStatus

Sadly, although this is way faster than the first option, the new IP
information does not seem to get fetched from the registry.

I did some OID debugging and saw that the only OID_GEN_MEDIA_CONNECT_STATUS
(0x00010114) request my adapter received was when I ran IPCONFIG (which
queries the adapters directly). Furthermore, my calls to NdisMIndicateStatus
do not have much of an impact on the way Windows behaves with the adapter
(GetIfEntry's dwOperStatus goes from "Operational" to "Non Operational").

Any ideas?

-----
Benoît Bousquet


.



Relevant Pages

  • Re: ndis passthru basic question
    ... For Passthru there will be a virtual adapter "running" for each adapter that Passthru is bound to. ... On a system with one hardware NIC there may be other software-only NICs and there may be virtual NICs created by other components. ...
    (microsoft.public.development.device.drivers)
  • ndis passthru basic question
    ... ndis passthru. ... "This driver exposes a virtual adapter for each binding to a real or ... virtual NDIS adapter." ...
    (microsoft.public.development.device.drivers)
  • RE: NDIS IM driver DriverEntry called repeatedly with Window 2003
    ... I suspect that when you create a vlan on an adapter some ... kind of vlan virtual adapter is being created (by a lower ... above) your IM driver ... ...
    (microsoft.public.development.device.drivers)
  • Specifying/modifying the MAC of a virtual adapter
    ... Media Access Code for a virtual adapter in a ... Windows XP environment. ... virtual adapter miniport, so it doesn't initialize the 6-byte MAC the same ... This list is provided by the SecurityFocus Security Intelligence Alert ...
    (Pen-Test)
  • Re: ipconfig and network connections empty - Device Manager okay
    ... adapter when the problem occurred. ... degree that in KB825826 the network connections _are_ working and just ... local area connection in the Network and Dial-up Connections folder. ... Trying to install a connection gets one to a screen where one can ...
    (microsoft.public.windowsxp.network_web)