Re: Virtual adapter, change IP address through registry, enable/disable?
- From: "Ajay Agrawal" <ajay_agr@xxxxxxxxxx>
- Date: Thu, 10 Nov 2005 13:17:42 +0530
You can set/change the IP address of virtual adapter by spoofing DHCP
request/response in your virtual adapter driver.
-Ajay
"Benoît Bousquet" <bbousquet@xxxxxxxxxxxxxxxx> wrote in message
news:ujISIwW5FHA.2040@xxxxxxxxxxxxxxxxxxxxxxx
> 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
>
>
.
- References:
- Virtual adapter, change IP address through registry, enable/disable?
- From: Benoît Bousquet
- Virtual adapter, change IP address through registry, enable/disable?
- Prev by Date: Re: What's wrong with IOCTL_SERIAL_WAIT_ON_MASK?
- Next by Date: How to send IRP_MN_QUERY_INTERFACE to the USB Port Driver?
- Previous by thread: Re: Virtual adapter, change IP address through registry, enable/disable?
- Next by thread: Help Testing Driver
- Index(es):