HOW TO: Find the IP Address of a CE Device Connected Through RAS to a Windows NT Server

Article translations Article translations
Article ID: 301089 - View products that this article applies to.
This article was previously published under Q301089
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

SUMMARY

This article describes a programmatic method for finding the IP address of a Microsoft Windows CE device that is connected through Remote Access Service (RAS) to a Microsoft Windows NT Server in Windows CE versions 2.11 and 2.12. IP addresses are typically assigned by a Dynamic Host Configuration Protocol (DHCP) server.

Requirements

The following items describe the recommended hardware, software, network infrastructure, skills and knowledge, and service packs you will need:
  • Microsoft Windows CE Operating System versions 2.11, 2.12

    -or-
  • Microsoft Windows CE for the Pocket PC

    -or
  • Microsoft Windows CE versions 2.11, 2.12, 3.0, 3.0 Professional Edition for the Handheld PC

    -or-
  • Microsoft Windows CE versions 2.11, 2.12 for the Palm-size PC

Finding the IP Address of a CE Device Connected Through RAS to a Windows NT Server

Unlike Windows CE version 3.0, versions 2.11 and 2.12 do not support the RasGetProjectionInfo() API. This API is also not available in Pocket PC devices.

In essence, by a process of elimination you can programmatically find out the IP address that is assigned to your Windows CE device by the RAS server. The process is somewhat complicated, but you may not have to go beyond step 2 below.

To find the IP address assigned to your Windows CE device by a RAS server:
  1. Call RasEnumConnections(). This gives you the number of active point-to-point protocol (PPP) connections. You can stop here if this number is zero.
  2. Call gethostname(szHost); pHostEnt = gethostbyname(szHost). This gives you a list of IP addresses that are active on the local device. (If it only returns the loopback address, there are no active adapters.) You can stop here if you do not need to know whether the IP addresses are Ethernet PPP IP addresses. If the number of IP addresses returned matches the number of PPP connections from step 1, you are done.
  3. Enumerate through the keys under HLM\Comm in the registry. Check for the "Group"="NDIS" value. This lists all of the network driver interface specification (NDIS) miniports and miniport instances.
  4. For each NDIS miniport, look for the registry subkey Parms\TcpIp. If this subkey exists, it is a miniport instance (in other words, NE20001 rather than NE2000).
  5. For each miniport instance, look at the value "IpAddress", which is the statically assigned IP address for the adapter. Any match to the list that is returned from gethostbyname() is an Ethernet adapter.
  6. For each miniport instance, look at the value "DHCPIpAddress", which is the dynamically assigned IP address for the adapter. Any match to the list that is returned from gethostbyname() is an Ethernet adapter.
  7. IP addresses that remain after you eliminate the Ethernet adapters must be PPP addresses.

REFERENCES

This article is relevant for Pocket PC and earlier versions of Windows CE. Microsoft Windows CE Platform Builder (PB) 3.0 contains a new API that makes this easier.

Properties

Article ID: 301089 - Last Review: February 27, 2014 - Revision: 2.0
APPLIES TO
  • Microsoft Windows CE 3.0 for the Handheld PC Professional Edition
  • Microsoft Windows CE 3.0 for the Handheld PC
  • Microsoft Windows CE 2.12 for the Handheld PC
  • Microsoft Windows CE 2.11 for the Handheld PC
  • Microsoft Windows CE 2.0 for the Handheld PC
  • Microsoft Windows CE 2.12 for the Handheld PC
  • Microsoft Windows CE 2.11 for the Handheld PC
  • Microsoft Windows CE Palm-size PC 2.01 software
Keywords: 
kbnosurvey kbarchive kbhowto kbhowtomaster KB301089

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com