If you are writing new code intended for platforms that support Winsock 2.0 or better, you should use the Winsock 2 raw sockets support demonstrated in the Platform SDK sample titled "Ping: SOCK_RAW in Winsock 2.0" available in MSSDK\samples\win32\winsock2\ping. As noted in the Readme.txt, Icmp.dll may be removed from future versions of Windows. Please note, however, that for Windows NT and Windows 2000 implementations, Raw Sockets are subject to security checks and are accessible only to members of the administrator's group. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
Support of Icmp.dll is limited to providing the information in this article and the .h files that accompany Icmp.dll.
Note that the Winsock 1.1 WSAStartup function must be called prior to using the functions exposed by ICMP.DLL. If you do not do this, the first call to IcmpSendEcho will fail with error 10091 (WSASYSNOTREADY).
------------ ICMP README.TXT ---------------
We have had requests in the past to expose the functions exported from icmp.dll. The files in this directory are provided for your convenience in building applications which make use of ICMPSendEcho().
Notice that the functions in icmp.dll are not considered part of the Win32 API and will not be supported in future releases. Once we have a more complete solution in the operating system, this DLL, and the functions it exports, will be dropped.
The ICMPSendEcho() function sends an ICMP echo request to the specified destination IP address and returns any replies received within the timeout specified. The API is synchronous, requiring the process to spawn a thread before calling the API to avoid blocking. An open IcmpHandle is required for the request to complete. IcmpCreateFile() and IcmpCloseHandle() functions are used to create and destroy the context handle.
See also icmpapi.h.