We have a legacy WinCE device that's been working fine for years when it was on a closed ethernet network. But now we're trying to get it to work nicely with other devices and it's failing when there's a DHCP server on the network.

The problem is that in order to speed up the boot the original engineers set "DhcpEnableImmediateAutoIP" in the registry. This effectively turns off the timeout where WinCE waits for a while before deciding that there's no DHCP server and does a zeroconfig. But because it doesn't actually turn off the DHCP request it allocates an IP address using zeroconfig then screws up when it gets a second IP address from the DHCP server a few seconds later.

I can see that "DhcpEnableImmediateAutoIP" is one of several keys controlling the DHCP, so I was wondering what would happen if I just set "EnableDHCP" to 0? Does this turn off the DHCP request so it just does a zeroconfig, or does it turn off the zeroconfig as well so it never gets an IP address?

有帮助吗?

解决方案

I eventually found out that EnableDHCP turns off DHCP and then assumes static IP settings (so you need to provide ip address, subnet mask and optionally gateway/dns).

Here are all the options you can set: http://msdn.microsoft.com/en-us/library/ms884977.aspx

Keeping DhcpEnableImmediateAutoIP, set the highest possible value for the AutoInterval : REG_DWORD registry entry which specifies the time interval, in seconds, used to verify if a DHCP server is available. This value is internally multiplied * 1000 to have it in msec so the max value you can set without wrapping corresponds to ~49 days. If the device is always on you'll end after that period in having everything screwed up anyway though...

A definitive solution may be cloning the DHCP client (D:\WINCE600\PRIVATE\WINCEOS\COMM\DHCP) and modify it in order not to send the discover packet, for example stubbing someway the function which is periodically called when the AutoInterval timer elapses.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top