Host Name Resolution Using Registry Entries

In Windows NT, one common way to resolve a host name to an IP address is to use a locally-stored database file that contains mappings of IP addresses to host names. Windows CE supports host name resolution by using entries in the registry.

You can store the name-to-IP-address mapping for devices that you connect to regularly by loading HOSTS entries into the HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts\Host Name registry subkey. Host Name stands for the name of the host and is not hard-coded. This subkey contains three entries, ExpireTime, ipaddr, and aliases. The entries are described in Parameters Configurable Using the Registry Editor. Setting a large expire time guarantees that the entry is not deleted from the registry. You can also set the expire time to a short interval of time, as an offset from the current file time. When an application calls gethostbyname, the registry is queried first, before a DNS or WINS request is sent. If the host name is found in the registry, gethostbyname returns the registry values.

Assigning a Device Name

An OEM can configure the name of a particular device more permanently — instead of entering the name each time that the device cold boots — by including the following lines in the Platform.reg file:

[HKEY_LOCAL_MACHINE\Ident]
    "OrigName"="WinCE"
    "Name"="MyUniqueName"

When the device boots, the system copies the original name to the HKEY_LOCAL_MACHINE\Ident\OrigName registry key. If another device wants to connect to your device by using the value of the Name, the other device can do so. If Redir or MSMQ is started, it logs the value of Name with WINS. Even if Redir and MSMQ do not run on your device, your device responds to the IP subnet broadcast from another device on the same subnet.

Note If you update Name after Redir or MSMQ has started, you need to reset the interface before the new name is registered with WINS. To reset the interface, either remove a PCMCIA card and then reinsert it, or use the ipconfig /release command followed by the ipconfig /renew command.

The names of the registry entries for configuring the name of a device may change in future releases.

 Last updated on Friday, April 02, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.