I'am developing an application which requires to dynamically update
the TCP/IP protocol settings for a WLAN card, such as DHCP
enabled/disabled, APIPA enabled/disabled, setting IP address, setting
Subnetmask, etc. The program shall run under XP SP1.
I came to the conclusion that I need to provide my own
IntermediateDriver, such as NDISUIO and extend it by my private IOCTL
to rebind an adapter. I've been using the NDISPROT DDK example as a
starting point. (NDISPROT and NDISUIO are basically the same, there is
only very little difference. NDISPROT comes with Server2003 DDK,
whereas NDISUIO comes with XP DDK). Anyway, the NDISPROT IM driver is
running on my XP/SP1 system already.
In nuiouser.h I have defined:
#define IOCTL_NDISPROT_REBIND_ADAPTER \
_NDISPROT_CTL_CODE(0x206,METHOD_BUFFERED,FILE_READ_ACCESS |
FILE_WRITE_ACCESS)

The plan is to call this IOCTL from the application, which also works
already. Now, I stuck a bit, as I dont know much enough about the
inner working of NDIS. My initial idea was, to invoke:
1) ProtocolUnbindAdapter, and
2) ProtocolBindAdapter
from within the 'NdisProtIoControl' function (equals
'NdisuioIoControl' in NDISUIO sample) in ntdisp.c file.
Unfortunatly, I dont know what paramters to use when calling them.
VOID ProtocolBindAdapter(
OUT PNDIS_STATUS Status,
IN NDIS_HANDLE BindContext, //what shall I use here???
IN PNDIS_STRING DeviceName, //what shall I use here???
IN PVOID SystemSpecific1, //what shall I use here???
IN PVOID SystemSpecific2
);
VOID ProtocolUnbindAdapter(
OUT PNDIS_STATUS Status,
IN NDIS_HANDLE ProtocolBindingContext, //what shall I use
here???
IN NDIS_HANDLE UnbindContext //what shall I use here???
);

Can anyone help me on my problem? Does anyone has some example, on how
they have done a similar solution? (PS: WINCE already does have a
REBIND IOCTL, but I doubt that it helps for XP system...)
I'm a still on the right track for dynamically re-initailising the IP,
DHCP stuff?

Re: NDIS Intermediate Driver (NDISPROT) extended with IOCTL_REBIND_ADAPTER by Stephan

Stephan
Thu Dec 11 11:59:29 CST 2003

If you need to rebind the TCP/IP protocol stack to some adapter this
cannot be done from your own protocol driver. You can only bind and
unbind your own protocol in your driver.

Instead, you can use INetCfgComponentBindings::UnbindFrom() and
INetCfgComponentBindings::BindTo() or INetCfgBindingPath::Enable()
(whichever you prefer). See the DDK docs and the netcfg sample in the
DDK for details.

Note that the INetCfg interface can be used by any user mode
application, not just by Notify Objects as the DDK somewhat implies.

Stephan
---
On 11 Dec 2003 08:39:10 -0800, stefan.heiss@fujitsu-siemens.com
(Stefan) wrote:

>I'am developing an application which requires to dynamically update
>the TCP/IP protocol settings for a WLAN card, such as DHCP
>enabled/disabled, APIPA enabled/disabled, setting IP address, setting
>Subnetmask, etc. The program shall run under XP SP1.
>I came to the conclusion that I need to provide my own
>IntermediateDriver, such as NDISUIO and extend it by my private IOCTL
>to rebind an adapter. I've been using the NDISPROT DDK example as a
>starting point. (NDISPROT and NDISUIO are basically the same, there is
>only very little difference. NDISPROT comes with Server2003 DDK,
>whereas NDISUIO comes with XP DDK). Anyway, the NDISPROT IM driver is
>running on my XP/SP1 system already.
>In nuiouser.h I have defined:
>#define IOCTL_NDISPROT_REBIND_ADAPTER \
> _NDISPROT_CTL_CODE(0x206,METHOD_BUFFERED,FILE_READ_ACCESS |
>FILE_WRITE_ACCESS)
>
>The plan is to call this IOCTL from the application, which also works
>already. Now, I stuck a bit, as I dont know much enough about the
>inner working of NDIS. My initial idea was, to invoke:
>1) ProtocolUnbindAdapter, and
>2) ProtocolBindAdapter
>from within the 'NdisProtIoControl' function (equals
>'NdisuioIoControl' in NDISUIO sample) in ntdisp.c file.
>Unfortunatly, I dont know what paramters to use when calling them.
>VOID ProtocolBindAdapter(
> OUT PNDIS_STATUS Status,
> IN NDIS_HANDLE BindContext, //what shall I use here???
> IN PNDIS_STRING DeviceName, //what shall I use here???
> IN PVOID SystemSpecific1, //what shall I use here???
> IN PVOID SystemSpecific2
> );
>VOID ProtocolUnbindAdapter(
> OUT PNDIS_STATUS Status,
> IN NDIS_HANDLE ProtocolBindingContext, //what shall I use
>here???
> IN NDIS_HANDLE UnbindContext //what shall I use here???
> );
>
>Can anyone help me on my problem? Does anyone has some example, on how
>they have done a similar solution? (PS: WINCE already does have a
>REBIND IOCTL, but I doubt that it helps for XP system...)
>I'm a still on the right track for dynamically re-initailising the IP,
>DHCP stuff?

Re: NDIS Intermediate Driver (NDISPROT) extended with IOCTL_REBIND_ADAPTER by Pavel

Pavel
Thu Dec 11 14:13:48 CST 2003

Sorry for jumping in...
but amount of home-brewn "protocols" and "intermediate drivers" hooking to wireless adapters,
becomes really worrying.
They often cause bluescreens when they see something that they don't expect,
or unhook when netcard driver needs to unload due to PnP events, and so on.
:(


"Stefan" <stefan.heiss@fujitsu-siemens.com> wrote in message news:d1995727.0312110839.58f3fe9a@posting.google.com...
> I'am developing an application which requires to dynamically update
> the TCP/IP protocol settings for a WLAN card, such as DHCP
> enabled/disabled, APIPA enabled/disabled, setting IP address, setting
> Subnetmask, etc. The program shall run under XP SP1.
> I came to the conclusion that I need to provide my own
> IntermediateDriver, such as NDISUIO and extend it by my private IOCTL
> to rebind an adapter. I've been using the NDISPROT DDK example as a
> starting point. (NDISPROT and NDISUIO are basically the same, there is
> only very little difference. NDISPROT comes with Server2003 DDK,
> whereas NDISUIO comes with XP DDK). Anyway, the NDISPROT IM driver is
> running on my XP/SP1 system already.
> In nuiouser.h I have defined:
> #define IOCTL_NDISPROT_REBIND_ADAPTER \
> _NDISPROT_CTL_CODE(0x206,METHOD_BUFFERED,FILE_READ_ACCESS |
> FILE_WRITE_ACCESS)
>
> The plan is to call this IOCTL from the application, which also works
> already. Now, I stuck a bit, as I dont know much enough about the
> inner working of NDIS. My initial idea was, to invoke:
> 1) ProtocolUnbindAdapter, and
> 2) ProtocolBindAdapter
> from within the 'NdisProtIoControl' function (equals
> 'NdisuioIoControl' in NDISUIO sample) in ntdisp.c file.
> Unfortunatly, I dont know what paramters to use when calling them.
> VOID ProtocolBindAdapter(
> OUT PNDIS_STATUS Status,
> IN NDIS_HANDLE BindContext, //what shall I use here???
> IN PNDIS_STRING DeviceName, //what shall I use here???
> IN PVOID SystemSpecific1, //what shall I use here???
> IN PVOID SystemSpecific2
> );
> VOID ProtocolUnbindAdapter(
> OUT PNDIS_STATUS Status,
> IN NDIS_HANDLE ProtocolBindingContext, //what shall I use
> here???
> IN NDIS_HANDLE UnbindContext //what shall I use here???
> );
>
> Can anyone help me on my problem? Does anyone has some example, on how
> they have done a similar solution? (PS: WINCE already does have a
> REBIND IOCTL, but I doubt that it helps for XP system...)
> I'm a still on the right track for dynamically re-initailising the IP,
> DHCP stuff?



Re: NDIS Intermediate Driver (NDISPROT) extended with IOCTL_REBIND_ADAPTER by Stephan

Stephan
Thu Dec 11 14:46:17 CST 2003

On Thu, 11 Dec 2003 22:13:48 +0200, "Pavel A." <pavel_a@geeklife.com>
wrote:

>Sorry for jumping in...
>but amount of home-brewn "protocols" and "intermediate drivers" hooking to wireless adapters,
>becomes really worrying.
>They often cause bluescreens when they see something that they don't expect,
>or unhook when netcard driver needs to unload due to PnP events, and so on.
>:(

Yup, agreed. There's already too much confusion with all the various
network configuration tools and filter drivers today. I wish there
were better support for Wireless from the OS side. See there is the
real world, and these "stupid" users tend to not be willing to upgrade
to the latest OS so they could benefit from all the new stuff. So
where is all that Wireless support in W9X/WME/W2K? There is none, and
that's exactly why people build all these workaround solutions.

Stephan
(still on W2K)

Re: NDIS Intermediate Driver (NDISPROT) extended with IOCTL_REBIND_ADAPTER by Thomas

Thomas
Fri Dec 12 00:46:39 CST 2003

I have been muling around the topic of filter drivers (not just NDIS) and
filtering in general (no better in user-mode using LSP's).

It's really identical to the Google ranking battles:

1.) Google (Microsoft) could decide (or implement) - to the exclusion of all
others.
2.) Or, there is opportunity for others - but confusion.

Approach 1.) has medium-term apparent appeal - like the appeal of socialized
medicine.

Thomas


"Stephan Wolf" <stewo68@hotmail.com> wrote in message
news:fhlhtvsvcfbo6bha4ihh4i6qug4bpm5inc@4ax.com...
> On Thu, 11 Dec 2003 22:13:48 +0200, "Pavel A." <pavel_a@geeklife.com>
> wrote:
>
> >Sorry for jumping in...
> >but amount of home-brewn "protocols" and "intermediate drivers" hooking
to wireless adapters,
> >becomes really worrying.
> >They often cause bluescreens when they see something that they don't
expect,
> >or unhook when netcard driver needs to unload due to PnP events, and so
on.
> >:(
>
> Yup, agreed. There's already too much confusion with all the various
> network configuration tools and filter drivers today. I wish there
> were better support for Wireless from the OS side. See there is the
> real world, and these "stupid" users tend to not be willing to upgrade
> to the latest OS so they could benefit from all the new stuff. So
> where is all that Wireless support in W9X/WME/W2K? There is none, and
> that's exactly why people build all these workaround solutions.
>
> Stephan
> (still on W2K)



Re: NDIS Intermediate Driver (NDISPROT) extended with IOCTL_REBIND_ADAPTER by stefan

stefan
Fri Dec 12 07:50:55 CST 2003

I've verfied the snetcfg.exe (which becomes compiled by the netcfg
sample from DDK), and found out that one can only uninstall and
install complete network component, such as ms_tcpip for instance.
Unfortunatly, when uninstalling the ms_tcpip component, all its
registry entries are deleted as well under:
HKL\SYSTEM\CurrentControlSet\Services\Tcpip
Therefore, I can not change the IP, DHCP etc. settings as was
described as my original intention. When installing the ms_tcpip, it
comes up with a sort of default-installation for these reg-keys.

So, that would means setting the TCPIP properties using snetcfg.exe is
not possible. I also suppose that when unbinding
using:INetCfgComponentBindings::UnbindFrom(), will also result in a
deletion of the respective reg-keys, do you agree?

What other possibilities are available, to programmatically change the
TCPIP properties (DHCP enabled/disabled, APIPA, IP, Subnetmask etc...)
from within my program?

Thx for your help
Stefan

Stephan Wolf <stewo68@hotmail.com> wrote in message news:<opbhtv45ndk1cl6tfo81r1cs1tcebp4g5j@4ax.com>...
> If you need to rebind the TCP/IP protocol stack to some adapter this
> cannot be done from your own protocol driver. You can only bind and
> unbind your own protocol in your driver.
>
> Instead, you can use INetCfgComponentBindings::UnbindFrom() and
> INetCfgComponentBindings::BindTo() or INetCfgBindingPath::Enable()
> (whichever you prefer). See the DDK docs and the netcfg sample in the
> DDK for details.
>
> Note that the INetCfg interface can be used by any user mode
> application, not just by Notify Objects as the DDK somewhat implies.
>
> Stephan
> ---
> On 11 Dec 2003 08:39:10 -0800, stefan.heiss@fujitsu-siemens.com
> (Stefan) wrote:
>
> >I'am developing an application which requires to dynamically update
> >the TCP/IP protocol settings for a WLAN card, such as DHCP
> >enabled/disabled, APIPA enabled/disabled, setting IP address, setting
> >Subnetmask, etc. The program shall run under XP SP1.
> >I came to the conclusion that I need to provide my own
> >IntermediateDriver, such as NDISUIO and extend it by my private IOCTL
> >to rebind an adapter. I've been using the NDISPROT DDK example as a
> >starting point. (NDISPROT and NDISUIO are basically the same, there is
> >only very little difference. NDISPROT comes with Server2003 DDK,
> >whereas NDISUIO comes with XP DDK). Anyway, the NDISPROT IM driver is
> >running on my XP/SP1 system already.
> >In nuiouser.h I have defined:
> >#define IOCTL_NDISPROT_REBIND_ADAPTER \
> > _NDISPROT_CTL_CODE(0x206,METHOD_BUFFERED,FILE_READ_ACCESS |
> >FILE_WRITE_ACCESS)
> >
> >The plan is to call this IOCTL from the application, which also works
> >already. Now, I stuck a bit, as I dont know much enough about the
> >inner working of NDIS. My initial idea was, to invoke:
> >1) ProtocolUnbindAdapter, and
> >2) ProtocolBindAdapter
> >from within the 'NdisProtIoControl' function (equals
> >'NdisuioIoControl' in NDISUIO sample) in ntdisp.c file.
> >Unfortunatly, I dont know what paramters to use when calling them.
> >VOID ProtocolBindAdapter(
> > OUT PNDIS_STATUS Status,
> > IN NDIS_HANDLE BindContext, //what shall I use here???
> > IN PNDIS_STRING DeviceName, //what shall I use here???
> > IN PVOID SystemSpecific1, //what shall I use here???
> > IN PVOID SystemSpecific2
> > );
> >VOID ProtocolUnbindAdapter(
> > OUT PNDIS_STATUS Status,
> > IN NDIS_HANDLE ProtocolBindingContext, //what shall I use
> >here???
> > IN NDIS_HANDLE UnbindContext //what shall I use here???
> > );
> >
> >Can anyone help me on my problem? Does anyone has some example, on how
> >they have done a similar solution? (PS: WINCE already does have a
> >REBIND IOCTL, but I doubt that it helps for XP system...)
> >I'm a still on the right track for dynamically re-initailising the IP,
> >DHCP stuff?

Re: NDIS Intermediate Driver (NDISPROT) extended with IOCTL_REBIND_ADAPTER by Stephan

Stephan
Mon Dec 15 09:46:47 CST 2003

Sure, uninstalling a complete protocol will also delete all the
configuration info.

But unbinding will not. So this should help you.

Actually, the unbind operation is what happens when you manually
uncheck the protocol entry in a network adapter's properties.

Stephan
---
On 12 Dec 2003 05:50:55 -0800, stefan.heiss@fujitsu-siemens.com
(Stefan) wrote:

>I've verfied the snetcfg.exe (which becomes compiled by the netcfg
>sample from DDK), and found out that one can only uninstall and
>install complete network component, such as ms_tcpip for instance.
>Unfortunatly, when uninstalling the ms_tcpip component, all its
>registry entries are deleted as well under:
>HKL\SYSTEM\CurrentControlSet\Services\Tcpip
>Therefore, I can not change the IP, DHCP etc. settings as was
>described as my original intention. When installing the ms_tcpip, it
>comes up with a sort of default-installation for these reg-keys.
>
>So, that would means setting the TCPIP properties using snetcfg.exe is
>not possible. I also suppose that when unbinding
>using:INetCfgComponentBindings::UnbindFrom(), will also result in a
>deletion of the respective reg-keys, do you agree?
>
>What other possibilities are available, to programmatically change the
>TCPIP properties (DHCP enabled/disabled, APIPA, IP, Subnetmask etc...)
>from within my program?
>
>Thx for your help
>Stefan

Re: NDIS Intermediate Driver (NDISPROT) extended with IOCTL_REBIND_ADAPTER by stefan

stefan
Tue Dec 16 02:42:15 CST 2003

Thanx a lot Stephan for your help. I finally, succeeded in dynamically
renew the IP settings of a dedicated adapter by following your
approach. I would like to add that the DDK bindview example was also
helpful. However, neither netcfg nor bindview is using the
bind/unbind, so I had to get the bits and pieces glued together
myself. I was a little bit afraid, as I've never done any COM
programming before, but I finally succeeded with a couple of hours.
Its not too complicated. So, my approach was:
1) change registry key settings
2) initialise the base INetCfg and COM
3) get an COM object for the tCPIP protocol
4) get an COM object for my adapter
5) unbind TCPIP and adapter using both COM objects, and the unbind
method
6) apply the changes
7) bind TCPIP and the adapter
8) apply the changes again
9) release all the COM stuff...

Hippie:-) It works...

Now, I just need to find a method that tells me when the binding is
finished and the adapter can be used with the new IP address. I hope
there is some message being sent which I can catch.

Best Regards, and thx again for your support
Stefan

Stephan Wolf <stewo68@hotmail.com> wrote in message news:<5nlrtvo5nkdb74m0g4urs5q09hgvtk8tu5@4ax.com>...
> Sure, uninstalling a complete protocol will also delete all the
> configuration info.
>
> But unbinding will not. So this should help you.
>
> Actually, the unbind operation is what happens when you manually
> uncheck the protocol entry in a network adapter's properties.
>
> Stephan
> ---
> On 12 Dec 2003 05:50:55 -0800, stefan.heiss@fujitsu-siemens.com
> (Stefan) wrote:
>
> >I've verfied the snetcfg.exe (which becomes compiled by the netcfg
> >sample from DDK), and found out that one can only uninstall and
> >install complete network component, such as ms_tcpip for instance.
> >Unfortunatly, when uninstalling the ms_tcpip component, all its
> >registry entries are deleted as well under:
> >HKL\SYSTEM\CurrentControlSet\Services\Tcpip
> >Therefore, I can not change the IP, DHCP etc. settings as was
> >described as my original intention. When installing the ms_tcpip, it
> >comes up with a sort of default-installation for these reg-keys.
> >
> >So, that would means setting the TCPIP properties using snetcfg.exe is
> >not possible. I also suppose that when unbinding
> >using:INetCfgComponentBindings::UnbindFrom(), will also result in a
> >deletion of the respective reg-keys, do you agree?
> >
> >What other possibilities are available, to programmatically change the
> >TCPIP properties (DHCP enabled/disabled, APIPA, IP, Subnetmask etc...)
> >from within my program?
> >
> >Thx for your help
> >Stefan

Re: NDIS Intermediate Driver (NDISPROT) extended with IOCTL_REBIND_ADAPTER by Stephan

Stephan
Tue Dec 16 12:24:48 CST 2003

On 16 Dec 2003 00:42:15 -0800, stefan.heiss@fujitsu-siemens.com
(Stefan) wrote:

>Now, I just need to find a method that tells me when the binding is
>finished and the adapter can be used with the new IP address. I hope
>there is some message being sent which I can catch.

Hmm, I guess that you can detect via WinSock or TDI somehow.
Unfortunately, I am not an expert in this field.

Maybe you ever noticed that DHCP can take a quite long time to
actually assign an IP address to an "interface" (i.e. a NIC). There
should exist some mechanism for an app. to know as to when an
interface is ready to be used. Just my two cents though...

Stephan