ReactOS  0.4.15-dev-1171-gab82533
ping.c File Reference
#include <stdlib.h>
#include <windef.h>
#include <winbase.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>
#include <icmpapi.h>
#include <conutils.h>
#include "resource.h"
#include <debug.h>
Include dependency graph for ping.c:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 
#define WIN32_NO_STATUS
 
#define NDEBUG
 
#define SIZEOF_ICMP_ERROR   8
 
#define SIZEOF_IO_STATUS_BLOCK   8
 
#define DEFAULT_TIMEOUT   1000
 
#define MAX_SEND_SIZE   65500
 

Functions

static BOOL ParseCmdLine (int argc, PWSTR argv[])
 
static BOOL ResolveTarget (PCWSTR target)
 
static void Ping (void)
 
static void PrintStats (void)
 
static BOOL WINAPI ConsoleCtrlHandler (DWORD ControlType)
 
int wmain (int argc, WCHAR *argv[])
 

Variables

static HANDLE hIcmpFile = INVALID_HANDLE_VALUE
 
static ULONG Timeout = 4000
 
static int Family = AF_UNSPEC
 
static ULONG RequestSize = 32
 
static ULONG PingCount = 4
 
static BOOL PingForever = FALSE
 
static PADDRINFOW Target = NULL
 
static PCWSTR TargetName = NULL
 
static WCHAR Address [46]
 
static WCHAR CanonName [NI_MAXHOST]
 
static BOOL ResolveAddress = FALSE
 
static ULONG RTTMax = 0
 
static ULONG RTTMin = 0
 
static ULONG RTTTotal = 0
 
static ULONG EchosSent = 0
 
static ULONG EchosReceived = 0
 
static ULONG EchosSuccessful = 0
 
static IP_OPTION_INFORMATION IpOptions
 

Macro Definition Documentation

◆ DEFAULT_TIMEOUT

#define DEFAULT_TIMEOUT   1000

Definition at line 51 of file ping.c.

◆ MAX_SEND_SIZE

#define MAX_SEND_SIZE   65500

Definition at line 52 of file ping.c.

◆ NDEBUG

#define NDEBUG

Definition at line 46 of file ping.c.

◆ SIZEOF_ICMP_ERROR

#define SIZEOF_ICMP_ERROR   8

Definition at line 49 of file ping.c.

◆ SIZEOF_IO_STATUS_BLOCK

#define SIZEOF_IO_STATUS_BLOCK   8

Definition at line 50 of file ping.c.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 32 of file ping.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 34 of file ping.c.

Function Documentation

◆ ConsoleCtrlHandler()

static BOOL WINAPI ConsoleCtrlHandler ( DWORD  ControlType)
static

Definition at line 675 of file ping.c.

676 {
677  switch (ControlType)
678  {
679  case CTRL_C_EVENT:
680  PrintStats();
682  return FALSE;
683 
684  case CTRL_BREAK_EVENT:
685  PrintStats();
687  return TRUE;
688 
689  case CTRL_CLOSE_EVENT:
690  PrintStats();
691  return FALSE;
692 
693  default:
694  return FALSE;
695  }
696 }
#define CTRL_BREAK_EVENT
Definition: wincon.h:69
#define CTRL_CLOSE_EVENT
Definition: wincon.h:70
#define TRUE
Definition: types.h:120
#define CTRL_C_EVENT
Definition: wincon.h:68
#define FALSE
Definition: types.h:117
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
static void PrintStats(void)
Definition: ping.c:658
#define IDS_CTRL_C
Definition: resource.h:5
#define StdOut
Definition: stream.h:82
#define IDS_CTRL_BREAK
Definition: resource.h:4

Referenced by wmain().

◆ ParseCmdLine()

static BOOL ParseCmdLine ( int  argc,
PWSTR  argv[] 
)
static

Definition at line 168 of file ping.c.

169 {
170  int i;
171 
172  if (argc < 2)
173  {
175  return FALSE;
176  }
177 
178  for (i = 1; i < argc; i++)
179  {
180  if (argv[i][0] == L'-' || argv[i][0] == L'/')
181  {
182  switch (argv[i][1])
183  {
184  case L't':
185  PingForever = TRUE;
186  break;
187 
188  case L'a':
190  break;
191 
192  case L'n':
193  {
194  if (i + 1 < argc)
195  {
196  PingForever = FALSE;
197  PingCount = wcstoul(argv[++i], NULL, 0);
198  if (PingCount == 0)
199  {
201  return FALSE;
202  }
203  }
204  else
205  {
207  return FALSE;
208  }
209  break;
210  }
211 
212  case L'l':
213  {
214  if (i + 1 < argc)
215  {
216  RequestSize = wcstoul(argv[++i], NULL, 0);
218  {
220  return FALSE;
221  }
222  }
223  else
224  {
226  return FALSE;
227  }
228  break;
229  }
230 
231  case L'f':
232  {
233  if (Family == AF_INET6)
234  {
236  return FALSE;
237  }
238 
239  Family = AF_INET;
241  break;
242  }
243 
244  case L'i':
245  {
246  if (i + 1 < argc)
247  {
248  ULONG Ttl = wcstoul(argv[++i], NULL, 0);
249 
250  if ((Ttl == 0) || (Ttl > UCHAR_MAX))
251  {
253  return FALSE;
254  }
255 
256  IpOptions.Ttl = (UCHAR)Ttl;
257  }
258  else
259  {
261  return FALSE;
262  }
263  break;
264  }
265 
266  case L'v':
267  {
268  if (Family == AF_INET6)
269  {
271  return FALSE;
272  }
273 
274  Family = AF_INET;
275 
276  if (i + 1 < argc)
277  {
278  /* This option has been deprecated. Don't do anything. */
279  i++;
280  }
281  else
282  {
284  return FALSE;
285  }
286 
287  break;
288  }
289 
290  case L'w':
291  {
292  if (i + 1 < argc)
293  {
294  Timeout = wcstoul(argv[++i], NULL, 0);
295  if (Timeout < DEFAULT_TIMEOUT)
297  }
298  else
299  {
301  return FALSE;
302  }
303  break;
304  }
305 
306  case L'R':
307  {
308  if (Family == AF_INET)
309  {
311  return FALSE;
312  }
313 
314  Family = AF_INET6;
315 
316  /* This option has been deprecated. Don't do anything. */
317  break;
318  }
319 
320  case L'4':
321  {
322  if (Family == AF_INET6)
323  {
325  return FALSE;
326  }
327 
328  Family = AF_INET;
329  break;
330  }
331 
332  case L'6':
333  {
334  if (Family == AF_INET)
335  {
337  return FALSE;
338  }
339 
340  Family = AF_INET6;
341  break;
342  }
343 
344  case L'?':
346  return FALSE;
347 
348  default:
351  return FALSE;
352  }
353  }
354  else
355  {
356  if (TargetName != NULL)
357  {
359  return FALSE;
360  }
361 
362  TargetName = argv[i];
363  }
364  }
365 
366  if (TargetName == NULL)
367  {
369  return FALSE;
370  }
371 
372  return TRUE;
373 }
static int argc
Definition: ServiceArgs.c:12
#define IP_FLAG_DF
Definition: ipexport.h:53
static ULONG RequestSize
Definition: ping.c:63
#define TRUE
Definition: types.h:120
static ULONG PingCount
Definition: ping.c:64
#define IDS_WRONG_FAMILY
Definition: resource.h:12
#define IDS_USAGE
Definition: resource.h:3
#define MAX_SEND_SIZE
Definition: ping.c:52
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define argv
Definition: mplay32.c:18
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static int Family
Definition: ping.c:62
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define IDS_MISSING_ADDRESS
Definition: resource.h:7
#define AF_INET6
Definition: winsock.h:369
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
#define StdErr
Definition: stream.h:83
unsigned char Ttl
Definition: ipexport.h:33
unsigned char UCHAR
Definition: xmlstorage.h:181
static const WCHAR L[]
Definition: oid.c:1250
#define IDS_BAD_VALUE
Definition: resource.h:11
unsigned char Flags
Definition: ipexport.h:35
static IP_OPTION_INFORMATION IpOptions
Definition: ping.c:79
#define IDS_BAD_PARAMETER
Definition: resource.h:10
#define UINT_MAX
Definition: limits.h:41
#define IDS_MISSING_VALUE
Definition: resource.h:8
static ULONG Timeout
Definition: ping.c:61
#define UCHAR_MAX
Definition: limits.h:25
static BOOL ResolveAddress
Definition: ping.c:70
#define StdOut
Definition: stream.h:82
unsigned int ULONG
Definition: retypes.h:1
#define AF_INET
Definition: tcpip.h:117
#define IDS_BAD_OPTION
Definition: resource.h:9
static BOOL PingForever
Definition: ping.c:65
#define DEFAULT_TIMEOUT
Definition: ping.c:51
static PCWSTR TargetName
Definition: ping.c:67

Referenced by wmain().

◆ Ping()

static void Ping ( void  )
static

Definition at line 419 of file ping.c.

420 {
422  PVOID SendBuffer = NULL;
423  DWORD ReplySize = 0;
424  DWORD Status;
425 
426  if (RequestSize != 0)
427  {
428  SendBuffer = malloc(RequestSize);
429  if (SendBuffer == NULL)
430  {
432  exit(1);
433  }
434 
435  ZeroMemory(SendBuffer, RequestSize);
436  }
437 
438  if (Family == AF_INET6)
439  {
440  ReplySize += sizeof(ICMPV6_ECHO_REPLY);
441  }
442  else
443  {
444 #ifdef _WIN64
445  ReplySize += sizeof(ICMP_ECHO_REPLY32);
446 #else
447  ReplySize += sizeof(ICMP_ECHO_REPLY);
448 #endif
449  }
450 
452 
453  ReplyBuffer = malloc(ReplySize);
454  if (ReplyBuffer == NULL)
455  {
457  free(SendBuffer);
458  exit(1);
459  }
460 
461  ZeroMemory(ReplyBuffer, ReplySize);
462 
463  EchosSent++;
464 
465  if (Family == AF_INET6)
466  {
467  struct sockaddr_in6 Source;
468 
469  ZeroMemory(&Source, sizeof(Source));
470  Source.sin6_family = AF_INET6;
471 
473  &Source,
474  (struct sockaddr_in6 *)Target->ai_addr,
475  SendBuffer, (USHORT)RequestSize, &IpOptions,
476  ReplyBuffer, ReplySize, Timeout);
477  }
478  else
479  {
481  ((PSOCKADDR_IN)Target->ai_addr)->sin_addr.s_addr,
482  SendBuffer, (USHORT)RequestSize, &IpOptions,
483  ReplyBuffer, ReplySize, Timeout);
484  }
485 
486  free(SendBuffer);
487 
488  if (Status == 0)
489  {
490  Status = GetLastError();
491  switch (Status)
492  {
493  case IP_REQ_TIMED_OUT:
495  break;
496 
497  default:
499  break;
500  }
501  }
502  else
503  {
504  SOCKADDR_IN6 SockAddrIn6;
505  SOCKADDR_IN SockAddrIn;
506  PSOCKADDR SockAddr;
507  socklen_t Size;
508 
509  EchosReceived++;
510 
511  ZeroMemory(&SockAddrIn, sizeof(SockAddrIn));
512  ZeroMemory(&SockAddrIn6, sizeof(SockAddrIn6));
513 
514  if (Family == AF_INET6)
515  {
516  PICMPV6_ECHO_REPLY pEchoReply;
517  PIPV6_ADDRESS_EX Ipv6Addr;
518 
519  pEchoReply = (PICMPV6_ECHO_REPLY)ReplyBuffer;
520 
521  Ipv6Addr = (PIPV6_ADDRESS_EX)&pEchoReply->Address;
522  SockAddrIn6.sin6_family = AF_INET6;
523  CopyMemory(SockAddrIn6.sin6_addr.u.Word, Ipv6Addr->sin6_addr, sizeof(SockAddrIn6.sin6_addr));
524  //SockAddrIn6.sin6_addr = Ipv6Addr->sin6_addr;
525  SockAddr = (PSOCKADDR)&SockAddrIn6;
526  Size = sizeof(SOCKADDR_IN6);
527 
528  GetNameInfoW(SockAddr,
529  Size,
530  Address,
531  NI_MAXHOST,
532  NULL,
533  0,
535 
537 
538  switch (pEchoReply->Status)
539  {
540  case IP_SUCCESS:
541  {
542  EchosSuccessful++;
543 
544  if (pEchoReply->RoundTripTime == 0)
546  else
548 
549  if (pEchoReply->RoundTripTime < RTTMin || RTTMin == 0)
550  RTTMin = pEchoReply->RoundTripTime;
551 
552  if (pEchoReply->RoundTripTime > RTTMax || RTTMax == 0)
553  RTTMax = pEchoReply->RoundTripTime;
554 
555  ConPuts(StdOut, L"\n");
556 
557  RTTTotal += pEchoReply->RoundTripTime;
558  break;
559  }
560 
563  break;
564 
567  break;
568 
571  break;
572 
573  default:
575  break;
576  }
577  }
578  else
579  {
580 #ifdef _WIN64
581  PICMP_ECHO_REPLY32 pEchoReply;
582 #else
583  PICMP_ECHO_REPLY pEchoReply;
584 #endif
585  IPAddr *IP4Addr;
586 
587 #ifdef _WIN64
588  pEchoReply = (PICMP_ECHO_REPLY32)ReplyBuffer;
589 #else
590  pEchoReply = (PICMP_ECHO_REPLY)ReplyBuffer;
591 #endif
592 
593  IP4Addr = (IPAddr *)&pEchoReply->Address;
594  SockAddrIn.sin_family = AF_INET;
595  SockAddrIn.sin_addr.S_un.S_addr = *IP4Addr;
596  SockAddr = (PSOCKADDR)&SockAddrIn;
597  Size = sizeof(SOCKADDR_IN);
598 
599  GetNameInfoW(SockAddr,
600  Size,
601  Address,
602  NI_MAXHOST,
603  NULL,
604  0,
606 
608 
609  switch (pEchoReply->Status)
610  {
611  case IP_SUCCESS:
612  {
613  EchosSuccessful++;
614 
616 
617  if (pEchoReply->RoundTripTime == 0)
619  else
621 
623 
624  if (pEchoReply->RoundTripTime < RTTMin || RTTMin == 0)
625  RTTMin = pEchoReply->RoundTripTime;
626 
627  if (pEchoReply->RoundTripTime > RTTMax || RTTMax == 0)
628  RTTMax = pEchoReply->RoundTripTime;
629 
630  RTTTotal += pEchoReply->RoundTripTime;
631  break;
632  }
633 
636  break;
637 
640  break;
641 
644  break;
645 
646  default:
648  break;
649  }
650  }
651  }
652 
653  free(ReplyBuffer);
654 }
#define IDS_REQUEST_TIMED_OUT
Definition: resource.h:26
UINT32 RoundTripTime
Definition: ipexport.h:86
static ULONG RequestSize
Definition: ping.c:63
struct _IPV6_ADDRESS_EX * PIPV6_ADDRESS_EX
#define NI_NUMERICHOST
Definition: ws2def.h:354
ADDRESS_FAMILY sin6_family
Definition: ws2ipdef.h:179
#define IDS_REPLY_TIME_0MS
Definition: resource.h:21
struct icmp_echo_reply * PICMP_ECHO_REPLY
#define free
Definition: debug_ros.c:5
static ULONG EchosSuccessful
Definition: ping.c:77
INT ConPuts(IN PCON_STREAM Stream, IN PCWSTR szStr)
Definition: outstream.c:427
#define IDS_DEST_NET_UNREACHABLE
Definition: resource.h:25
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define ZeroMemory
Definition: winbase.h:1648
static ULONG RTTMax
Definition: ping.c:72
struct sockaddr * PSOCKADDR
Definition: winsock.h:485
#define IP_TTL_EXPIRED_TRANSIT
Definition: ipexport.h:126
static HANDLE hIcmpFile
Definition: ping.c:60
USHORT Word[8]
Definition: in6addr.h:6
static PADDRINFOW Target
Definition: ping.c:66
#define IDS_REPLY_STATUS
Definition: resource.h:23
IPAddr Address
Definition: ipexport.h:84
union in6_addr::@2951 u
static ULONG EchosSent
Definition: ping.c:75
static int Family
Definition: ping.c:62
#define IDS_REPLY_TIME_MS
Definition: resource.h:20
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
#define AF_INET6
Definition: winsock.h:369
static ULONG EchosReceived
Definition: ping.c:76
#define IDS_REPLY_TTL
Definition: resource.h:22
ULONG IPAddr
Definition: pfhook.h:35
IP_OPTION_INFORMATION Options
Definition: ipexport.h:90
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
#define IDS_DEST_HOST_UNREACHABLE
Definition: resource.h:24
static ULONG RTTTotal
Definition: ping.c:74
#define IDS_TTL_EXPIRED
Definition: resource.h:27
IN6_ADDR sin6_addr
Definition: ws2ipdef.h:182
#define IP_REQ_TIMED_OUT
Definition: ipexport.h:123
ICMPV6_ECHO_REPLY_LH * PICMPV6_ECHO_REPLY
Definition: ipexport.h:195
DWORD WINAPI Icmp6SendEcho2(_In_ HANDLE IcmpHandle, _In_opt_ HANDLE Event, _In_opt_ PIO_APC_ROUTINE ApcRoutine, _In_opt_ PVOID ApcContext, _In_ struct sockaddr_in6 *SourceAddress, _In_ struct sockaddr_in6 *DestinationAddress, _In_ LPVOID RequestData, _In_ WORD RequestSize, _In_ PIP_OPTION_INFORMATION RequestOptions, _Out_ LPVOID ReplyBuffer, _In_ DWORD ReplySize, _In_ DWORD Timeout)
Definition: icmp.c:77
#define IP_DEST_NET_UNREACHABLE
Definition: ipexport.h:115
#define CopyMemory
Definition: winbase.h:1646
unsigned long DWORD
Definition: ntddk_ex.h:95
int socklen_t
Definition: tcp.c:35
#define StdErr
Definition: stream.h:83
#define NI_MAXHOST
Definition: ws2def.h:359
DWORD WINAPI IcmpSendEcho2(_In_ HANDLE IcmpHandle, _In_opt_ HANDLE Event, _In_opt_ PIO_APC_ROUTINE ApcRoutine, _In_opt_ PVOID ApcContext, _In_ IPAddr DestinationAddress, _In_ LPVOID RequestData, _In_ WORD RequestSize, _In_opt_ PIP_OPTION_INFORMATION RequestOptions, _Out_ LPVOID ReplyBuffer, _In_ DWORD ReplySize, _In_ DWORD Timeout)
Definition: icmp.c:285
INT WSAAPI GetNameInfoW(IN CONST SOCKADDR *pSockaddr, IN socklen_t SockaddrLength, OUT PWCHAR pNodeBuffer, IN DWORD NodeBufferSize, OUT PWCHAR pServiceBuffer, IN DWORD ServiceBufferSize, IN INT Flags)
Definition: addrinfo.c:873
unsigned char Ttl
Definition: ipexport.h:33
ICMPV6_ECHO_REPLY_LH ICMPV6_ECHO_REPLY
Definition: ipexport.h:194
_Must_inspect_result_ _In_ PFLT_PORT _In_ ULONG _Out_writes_bytes_opt_ ReplyLength PVOID ReplyBuffer
Definition: fltkernel.h:1903
Status
Definition: gdiplustypes.h:24
IPV6_ADDRESS_EX Address
Definition: ipexport.h:189
static const WCHAR L[]
Definition: oid.c:1250
static ULONG RTTMin
Definition: ping.c:73
#define IDS_TRANSMIT_FAILED
Definition: resource.h:28
static IP_OPTION_INFORMATION IpOptions
Definition: ping.c:79
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
unsigned int RoundTripTime
Definition: ipexport.h:191
struct in_addr sin_addr
Definition: winsock.h:512
UINT16 DataSize
Definition: ipexport.h:87
static ULONG Timeout
Definition: ping.c:61
#define IDS_REPLY_BYTES
Definition: resource.h:19
#define SIZEOF_IO_STATUS_BLOCK
Definition: ping.c:50
#define SIZEOF_ICMP_ERROR
Definition: ping.c:49
unsigned short USHORT
Definition: pedump.c:61
#define IDS_REPLY_FROM
Definition: resource.h:18
struct sockaddr_in SOCKADDR_IN
Definition: winsock.h:487
struct sockaddr * ai_addr
Definition: ws2def.h:682
UINT32 Status
Definition: ipexport.h:85
SOCKADDR_IN6_LH SOCKADDR_IN6
Definition: ws2ipdef.h:199
#define IP_SUCCESS
Definition: ipexport.h:113
#define StdOut
Definition: stream.h:82
#define AF_INET
Definition: tcpip.h:117
#define malloc
Definition: debug_ros.c:4
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
void exit(int exitcode)
Definition: _exit.c:33
#define IP_DEST_HOST_UNREACHABLE
Definition: ipexport.h:116
struct icmp_echo_reply ICMP_ECHO_REPLY
short sin_family
Definition: winsock.h:510
USHORT sin6_addr[8]
Definition: ipexport.h:173
#define IDS_NO_RESOURCES
Definition: resource.h:6

Referenced by RunTraceRoute(), and wmain().

◆ PrintStats()

static void PrintStats ( void  )
static

Definition at line 658 of file ping.c.

659 {
660  ULONG EchosLost = EchosSent - EchosReceived;
661  ULONG PercentLost = (ULONG)((EchosLost / (double)EchosSent) * 100.0);
662 
663  ConResPrintf(StdOut, IDS_STATISTICS, Address, EchosSent, EchosReceived, EchosLost, PercentLost);
664 
665  if (EchosSuccessful > 0)
666  {
667  ULONG RTTAverage = RTTTotal / EchosSuccessful;
669  }
670 }
#define IDS_APPROXIMATE_RTT
Definition: resource.h:30
static ULONG EchosSuccessful
Definition: ping.c:77
static ULONG RTTMax
Definition: ping.c:72
static ULONG EchosSent
Definition: ping.c:75
#define IDS_STATISTICS
Definition: resource.h:29
static WCHAR Address[46]
Definition: ping.c:68
static ULONG EchosReceived
Definition: ping.c:76
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
static ULONG RTTTotal
Definition: ping.c:74
static ULONG RTTMin
Definition: ping.c:73
#define StdOut
Definition: stream.h:82
unsigned int ULONG
Definition: retypes.h:1

Referenced by ConsoleCtrlHandler(), and wmain().

◆ ResolveTarget()

static BOOL ResolveTarget ( PCWSTR  target)
static

Definition at line 377 of file ping.c.

378 {
380  int Status;
381 
382  ZeroMemory(&hints, sizeof(hints));
383  hints.ai_family = Family;
384  hints.ai_flags = AI_NUMERICHOST;
385 
387  if (Status != 0)
388  {
389  hints.ai_flags = AI_CANONNAME;
390 
392  if (Status != 0)
393  {
395  return FALSE;
396  }
397 
399  }
400  else if (ResolveAddress)
401  {
404  NULL, 0,
405  NI_NAMEREQD);
406  if (Status != 0)
407  {
408  DPRINT("GetNameInfoW failed: %d\n", WSAGetLastError());
409  }
410  }
411 
413 
414  return TRUE;
415 }
static WCHAR CanonName[NI_MAXHOST]
Definition: ping.c:69
namespace GUID const ADDRINFOEXW * hints
Definition: sock.c:80
#define NI_NAMEREQD
Definition: ws2def.h:355
#define AI_CANONNAME
Definition: ws2def.h:294
#define TRUE
Definition: types.h:120
#define ZeroMemory
Definition: winbase.h:1648
static PADDRINFOW Target
Definition: ping.c:66
static int Family
Definition: ping.c:62
#define FALSE
Definition: types.h:117
INT WSAAPI GetAddrInfoW(IN PCWSTR pszNodeName, IN PCWSTR pszServiceName, IN const ADDRINFOW *ptHints, OUT PADDRINFOW *pptResult)
Definition: addrinfo.c:509
int ai_family
Definition: ws2def.h:677
size_t ai_addrlen
Definition: ws2def.h:680
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
#define _countof(array)
Definition: sndvol32.h:68
#define IDS_UNKNOWN_HOST
Definition: resource.h:13
INT WSAAPI GetNameInfoW(IN CONST SOCKADDR *pSockaddr, IN socklen_t SockaddrLength, OUT PWCHAR pNodeBuffer, IN DWORD NodeBufferSize, OUT PWCHAR pServiceBuffer, IN DWORD ServiceBufferSize, IN INT Flags)
Definition: addrinfo.c:873
Status
Definition: gdiplustypes.h:24
#define AI_NUMERICHOST
Definition: ws2def.h:295
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
static BOOL ResolveAddress
Definition: ping.c:70
struct sockaddr * ai_addr
Definition: ws2def.h:682
#define StdOut
Definition: stream.h:82
GLenum target
Definition: glext.h:7315
PWSTR ai_canonname
Definition: ws2def.h:681
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by wmain().

◆ wmain()

int wmain ( int  argc,
WCHAR argv[] 
)

Definition at line 82 of file ping.c.

83 {
84  WSADATA wsaData;
85  ULONG i;
86  DWORD StrLen = 46;
87  int Status;
88 
89  /* Initialize the Console Standard Streams */
91 
92  IpOptions.Ttl = 128;
93 
94  if (!ParseCmdLine(argc, argv))
95  return 1;
96 
98  {
99  DPRINT("Failed to set control handler: %lu\n", GetLastError());
100  return 1;
101  }
102 
103  Status = WSAStartup(MAKEWORD(2, 2), &wsaData);
104  if (Status != 0)
105  {
107  return 1;
108  }
109 
111  {
112  WSACleanup();
113  return 1;
114  }
115 
117  {
118  DPRINT("WSAAddressToStringW failed: %d\n", WSAGetLastError());
120  WSACleanup();
121  return 1;
122  }
123 
124  if (Family == AF_INET6)
126  else
128 
129 
131  {
132  DPRINT("IcmpCreateFile failed: %lu\n", GetLastError());
134  WSACleanup();
135  return 1;
136  }
137 
138  if (*CanonName)
140  else
142 
144 
145  Ping();
146 
147  i = 1;
148  while (i < PingCount)
149  {
150  Sleep(1000);
151  Ping();
152 
153  if (!PingForever)
154  i++;
155  }
156 
157  PrintStats();
158 
161  WSACleanup();
162 
163  return 0;
164 }
static WCHAR CanonName[NI_MAXHOST]
Definition: ping.c:69
static int argc
Definition: ServiceArgs.c:12
#define IDS_PING_SIZE
Definition: resource.h:17
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
BOOL WINAPI IcmpCloseHandle(_In_ HANDLE IcmpHandle)
Definition: icmp.c:202
static ULONG RequestSize
Definition: ping.c:63
INT WSAAPI WSAAddressToStringW(IN LPSOCKADDR lpsaAddress, IN DWORD dwAddressLength, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, OUT LPWSTR lpszAddressString, IN OUT LPDWORD lpdwAddressStringLength)
Definition: rnr.c:128
#define MAKEWORD(a, b)
Definition: typedefs.h:248
#define TRUE
Definition: types.h:120
static BOOL ResolveTarget(PCWSTR target)
Definition: ping.c:377
static ULONG PingCount
Definition: ping.c:64
INT WSAAPI WSACleanup(VOID)
Definition: startup.c:60
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define IDS_PINGING_ADDRESS
Definition: resource.h:14
#define argv
Definition: mplay32.c:18
static BOOL ParseCmdLine(int argc, PWSTR argv[])
Definition: ping.c:168
static HANDLE hIcmpFile
Definition: ping.c:60
static PADDRINFOW Target
Definition: ping.c:66
static BOOL WINAPI ConsoleCtrlHandler(DWORD ControlType)
Definition: ping.c:675
static void Ping(void)
Definition: ping.c:419
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ConInitStdStreams()
Definition: stream.h:128
static int Family
Definition: ping.c:62
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add)
Definition: console.c:2111
size_t ai_addrlen
Definition: ws2def.h:680
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
#define AF_INET6
Definition: winsock.h:369
void DPRINT(...)
Definition: polytest.cpp:61
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
static void PrintStats(void)
Definition: ping.c:658
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
unsigned long DWORD
Definition: ntddk_ex.h:95
#define StdErr
Definition: stream.h:83
unsigned char Ttl
Definition: ipexport.h:33
Status
Definition: gdiplustypes.h:24
static IP_OPTION_INFORMATION IpOptions
Definition: ping.c:79
HANDLE WINAPI Icmp6CreateFile(void)
Definition: icmp.c:15
#define IDS_PINGING_HOSTNAME
Definition: resource.h:15
struct sockaddr * ai_addr
Definition: ws2def.h:682
WINSOCK_API_LINKAGE VOID WSAAPI FreeAddrInfoW(_In_opt_ PADDRINFOW pAddrInfo)
#define StdOut
Definition: stream.h:82
unsigned int ULONG
Definition: retypes.h:1
static BOOL PingForever
Definition: ping.c:65
HANDLE WINAPI IcmpCreateFile(void)
Definition: icmp.c:219
static PCWSTR TargetName
Definition: ping.c:67
#define IDS_WINSOCK_FAIL
Definition: resource.h:31

Variable Documentation

◆ Address

WCHAR Address[46]
static

Definition at line 68 of file ping.c.

Referenced by __invlpg(), _IRQL_requires_max_(), _MiAddressToPde(), _MiAddressToPte(), _Struct_size_bytes_(), A2S(), acpi_create_volatile_registry_tables(), AcpiCheckAddressRange(), AcpiEvAddressSpaceDispatch(), AcpiEvCreateGpeBlock(), AcpiEvInstallGpeHandler(), AcpiExDataTableSpaceHandler(), AcpiExPciConfigSpaceHandler(), AcpiExSystemIoSpaceHandler(), AcpiExSystemMemorySpaceHandler(), AcpiHwGetAccessBitWidth(), AcpiHwRead(), AcpiHwReadPort(), AcpiHwValidateIoRequest(), AcpiHwValidateRegister(), AcpiHwWrite(), AcpiHwWritePort(), AcpiInstallGpeHandler(), AcpiInstallGpeRawHandler(), AcpiInstallSciHandler(), AcpiInstallTable(), AcpiOsMapMemory(), AcpiOsReadMemory(), AcpiOsReadPort(), AcpiOsWriteMemory(), AcpiOsWritePort(), AcpiRemoveGpeHandler(), AcpiRemoveSciHandler(), AcpiTbAcquireTempTable(), AcpiTbInitGenericAddress(), AcpiTbInitTableDescriptor(), AcpiTbInstallAndLoadTable(), AcpiTbInstallStandardTable(), AcpiTbOverrideTable(), AcpiTbParseRootTable(), AcpiTbPrintTableHeader(), AcpiUtAddAddressRange(), AcpiUtCheckAddressRange(), AddIPAddress(), addIPAddress(), AddrBuildAddress(), AddrGetAddress(), AddrIsUnspecified(), AddrSearchFirst(), AfdBind(), AfdConnect(), AfdPacketSocketWriteData(), AfdSendTo(), AlignUp(), ARPTransmit(), AttachToConsoleInternal(), BlMmAllocatePhysicalPages(), BlMmFreePhysicalPages(), CdProcessToc(), CdTocSerial(), CheckForCurrentHostname(), ComPortTest1(), ComPortTest2(), ConvertStabs(), CopyPacketToBuffer(), CpDoesPortExist(), CpEnableFifo(), CpInitialize(), CpuExceptionFilter(), CreateUmaDescriptor(), CsrProbeForRead(), CsrProbeForWrite(), DECLARE_INTERFACE_(), DhcpStaticRefreshParams(), DispTdiQueryInformation(), Dns_Free(), Dns_Ip4AddressToReverseName_W(), Dns_Ip4ReverseNameToAddress_W(), Dns_Ip4StringToAddress_A(), Dns_Ip4StringToAddress_W(), Dns_Ip6StringToAddress_A(), Dns_Ip6StringToAddress_W(), Dns_StringToAddressEx(), Dns_StringToAddressW(), DnsAddr_BuildFromAtm(), DnsAddr_BuildFromIp4(), DnsAddr_BuildFromIp6(), DnsAddrArray_AddIp4(), DosBootsectorInitialize(), DosLoadDriver(), DosLoadExecutable(), doSymSearch(), DxDdCreateD3DBuffer(), E1000ReadEeprom(), E1000ReadUlong(), E1000WriteIoUlong(), E1000WriteUlong(), EmsReadMemory(), EmsWriteMemory(), EmulatorReadIo(), EmulatorReadMemory(), EmulatorWriteIo(), EmulatorWriteMemory(), EngSecureMem(), EngSecureMemForRead(), EthernetAddressType(), Ext2ReadDisk(), Ext2WriteDisk(), Fast486FpuLoadEnvironment(), Fast486FpuSaveEnvironment(), Fast486MemReadCallback(), Fast486MemWriteCallback(), FatMapUserBuffer(), FileOpenAddress(), find_and_print_offset(), find_offset(), FindEntry(), FindOnLinkInterface(), FsRtlAllocatePool(), FsRtlAllocatePoolWithQuota(), FsRtlAllocatePoolWithQuotaTag(), FsRtlAllocatePoolWithTag(), GetInterfaceIPv4Address(), GetNameInfoW(), GspFindSwBreakpoint(), GspGetRegisters(), GspHex2Long(), GspHex2Mem(), GspLoadBreakpoints(), GspLoadHwBreakpoint(), GspLoadSwBreakpoint(), GspLong2Hex(), GspMem2Hex(), GspReadMemSafe(), GspRemoveHwBreakpoint(), GspRemoveSwBreakpoint(), GspSetHwBreakpoint(), GspSetRegistersInTrapFrame(), GspSetSingleRegisterInTrapFrame(), GspSetSwBreakpoint(), GspUnloadBreakpoints(), GspWriteMem(), GspWriteMemSafe(), HackSecureVirtualMemory(), HalpAssignPCISlotResources(), HalpGetCmosData(), HalpIsValidPCIDevice(), HalpScatterGatherAdapterControl(), HalpSetCmosData(), HasPrefix(), HidClass_ReadCompleteIrp(), HvGetCellSize(), I2CRepStart(), I2CStart(), InbvPortEnableFifo(), InbvPortInitialize(), InfoTdiSetArptableMIB(), InfoTdiSetRoute(), InitRomRange(), intDdCreateSurfaceOrBuffer(), IoMapTransfer(), IPv4NToHl(), IsAligned(), KdbpCmdBackTrace(), KdbpCmdBreakPoint(), KdbpCmdBreakPointList(), KdbpCmdDisassembleX(), KdbpCmdMod(), KdbpDisassemble(), KdbpGetBreakPointInfo(), KdbpGetInstLength(), KdbpInsertBreakPoint(), KdbpIsBreakPointOurs(), KdbpOverwriteInstruction(), KdbpSymFindModule(), KdbpSymSearchModuleList(), KdbSymPrintAddress(), KdpAddBreakpoint(), KdpCopyMemoryChunks(), KdpDeleteBreakpointRange(), KdpGdbEnterDebuggerException(), KdpLowRestoreBreakpoint(), KdpLowWriteContent(), KdSetOwedBreakpoints(), KeArmInvalidateTlbEntry(), KeInvalidateTlbEntry(), KeRegisterInterruptHandler(), KeZeroPages(), KiDataAbortHandler(), KiDispatchException0Args(), KiDispatchException1Args(), KiDispatchException2Args(), KiDispatchExceptionFromTrapFrame(), KiMarkPageAsReadOnly(), KiPrefetchAbortHandler(), LanAdapterInfo(), LdrFindEntryForAddress(), LdrpGetShimEngineFunction(), LdrProcessRelocationBlock(), LdrProcessRelocationBlockLongLong(), LdrRelocateImageWithBias(), Local_Ip4AddresstoString(), Local_Ip6AddresstoString(), MemInstallFastMemoryHook(), MemRemoveFastMemoryHook(), MergeStabsAndCoffs(), MGetVdmPointer(), MI_IS_PHYSICAL_ADDRESS(), MiAddressToPdi(), MiAddressToPpe(), MiAddressToPti(), MiAddressToPxe(), MiAddressToPxi(), MiBalancerThread(), MiBuildPfnDatabaseFromPageTables(), MiCheckForUserStackOverflow(), MiCompleteProtoPteFault(), MiCowCacheSectionPage(), MiDecrementPageTableReferences(), MiDispatchFault(), MiEthernetCrc(), MiFlushTlb(), MiFlushTlbIpiRoutine(), MiGetFileObjectForSectionAddress(), MiGetPageEntryForProcess(), MiGetPageTableForProcess(), MiGetPteForProcess(), MiGetPteValueForProcess(), MiIncrementPageTableReferences(), MiIsHyperspaceAddress(), MiIsPdeForAddressValid(), MiIsUserPde(), MiIsUserPte(), MiLookupDataTableEntry(), MiQueryMemoryBasicInformation(), MiQueryPageTableReferences(), MiResolveDemandZeroFault(), MiResolveProtoPteFault(), MiSnapThunk(), MiUnmapPageInHyperSpace(), MmAccessFault(), MmAccessFaultCacheSection(), MmAccessFaultSectionView(), MmAlterViewAttributes(), MmArmAccessFault(), MmCreatePageFileMapping(), MmCreateVirtualMapping(), MmCreateVirtualMappingInternal(), MmCreateVirtualMappingUnsafe(), MmDbgCopyMemory(), MmDeletePageFileMapping(), MmDeleteProcessAddressSpace(), MmDeleteRmap(), MmDeleteVirtualMapping(), MmFindRegion(), MmFreeCacheSectionPage(), MmFreeMemoryArea(), MmFreePageTable(), MmFreeSectionPage(), MmGetFileNameForAddress(), MmGetPageEntryForProcess(), MmGetPageEntryForProcessForPAE(), MmGetPageFileMapping(), MmGetPageNumberFromAddress(), MmGetPageProtect(), MmGetPageTableForProcess(), MmGetPageTableForProcessForPAE(), MmGetPfnForProcess(), MmGetPhysicalAddress(), Mmi386MakeKernelPageTableGlobal(), MmInsertRmap(), MmIsDirtyPage(), MmIsDisabledPage(), MmIsPagePresent(), MmIsPageSwapEntry(), MmIsSessionAddress(), MmNotPresentFault(), MmNotPresentFaultCachePage(), MmNotPresentFaultCacheSection(), MmNotPresentFaultCacheSectionInner(), MmNotPresentFaultSectionView(), MmpAccessFault(), MmPageOutCacheSection(), MmPageOutDeleteMapping(), MmPageOutPhysicalAddress(), MmPageOutSectionView(), MmPapFreePages(), MmPapFreePhysicalPages(), MmPaReleaseSelfMapPages(), MmpPageOutPhysicalAddress(), MmProbeAndLockPages(), MmpSectionAccessFaultInner(), MmQuerySectionView(), MmSecureVirtualMemory(), MmSetCleanPage(), MmSetDirtyPage(), MmSetPageProtect(), MmWritePageSectionView(), ModPow2(), NBAddNeighbor(), NBFindOrCreateNeighbor(), NBLocateNeighbor(), NBResetNeighborTimeout(), NewAddrInfo(), NICTestAddress(), NtSetInformationThread(), Ping(), PrintHopInfo(), PrintStats(), ProbeForRead(), ProbeForWrite(), Query_Main(), READ_PORT_UCHAR(), ReadByte(), ReadfromSMBus(), ReadPage(), ReadPhysMem(), ReadWord(), rsym_parse(), RtlIpv4AddressToStringExA(), RtlIpv4AddressToStringExW(), RtlIpv4StringToAddressExA(), RtlIpv4StringToAddressExW(), RtlIpv6AddressToStringExA(), RtlIpv6AddressToStringExW(), RtlIpv6StringToAddressExA(), RtlIpv6StringToAddressExW(), RtlpFindAndCommitPages(), RtlpInsertUnCommittedPages(), ScsiPortConvertPhysicalAddressToUlong(), ScsiPortConvertUlongToPhysicalAddress(), Sim32pGetVDMPointer(), SMBusWriteByte(), START_TEST(), StorPortConvertPhysicalAddressToUlong(), StorPortConvertUlongToPhysicalAddress(), StuffStdHandle(), SymFromAddr(), SymFromAddrW(), SymGetSymFromAddr(), SymGetSymFromAddr64(), SymSearch(), SymSearchW(), TCPGetSockAddress(), TdiBuildConnectionInfo(), TdiBuildConnectionInfoInPlace(), TdiOpenAddressFile(), TdiOpenTransport(), TdiQueryAddress(), TdiReceiveDatagram(), TdiReceiveThread(), TdiSendDatagram(), test_address_list_query(), TestBind(), TiCreateFileObject(), TokenRingAddressType(), UmaDescReallocate(), UmaDescRelease(), UmaDescReserve(), UmaMgrInitialize(), UnlockBuffers(), USBSTOR_HandleDeviceControl(), VDDAllocMem(), VDDDeInstallMemoryHook(), VDDFreeMem(), VDDInstallMemoryHook(), VgaReadMemory(), VgaTranslateAddress(), VgaUpdateFramebuffer(), VgaWriteMemory(), ViComputeAddress(), VidBiosVideoService(), ViFillInTrackData(), WinLdrEnableFifo(), WinLdrPortInitialize(), wmain(), Write(), WRITE_PORT_UCHAR(), WriteAddress(), WriteByte(), WritePage(), WritePhysMem(), WriteToSMBus(), WSAAsyncGetHostByAddr(), WSNoteSuccessfulHostentLookup(), x86BiosReadMemory(), x86BiosWriteMemory(), x86MemRead(), x86MemWrite(), XmsBopProcedure(), and XmsLock().

◆ CanonName

WCHAR CanonName[NI_MAXHOST]
static

Definition at line 69 of file ping.c.

Referenced by ResolveTarget(), ScmConvertToBootPathName(), and wmain().

◆ EchosReceived

ULONG EchosReceived = 0
static

Definition at line 76 of file ping.c.

Referenced by Ping(), and PrintStats().

◆ EchosSent

ULONG EchosSent = 0
static

Definition at line 75 of file ping.c.

Referenced by Ping(), and PrintStats().

◆ EchosSuccessful

ULONG EchosSuccessful = 0
static

Definition at line 77 of file ping.c.

Referenced by Ping(), and PrintStats().

◆ Family

◆ hIcmpFile

HANDLE hIcmpFile = INVALID_HANDLE_VALUE
static

Definition at line 60 of file ping.c.

Referenced by Ping(), and wmain().

◆ IpOptions

IP_OPTION_INFORMATION IpOptions
static

Definition at line 79 of file ping.c.

Referenced by ParseCmdLine(), Ping(), and wmain().

◆ PingCount

ULONG PingCount = 4
static

Definition at line 64 of file ping.c.

Referenced by ParseCmdLine(), and wmain().

◆ PingForever

BOOL PingForever = FALSE
static

Definition at line 65 of file ping.c.

Referenced by ParseCmdLine(), and wmain().

◆ RequestSize

ULONG RequestSize = 32
static

Definition at line 63 of file ping.c.

Referenced by ParseCmdLine(), Ping(), and wmain().

◆ ResolveAddress

BOOL ResolveAddress = FALSE
static

Definition at line 70 of file ping.c.

Referenced by ParseCmdLine(), and ResolveTarget().

◆ RTTMax

ULONG RTTMax = 0
static

Definition at line 72 of file ping.c.

Referenced by Ping(), and PrintStats().

◆ RTTMin

ULONG RTTMin = 0
static

Definition at line 73 of file ping.c.

Referenced by Ping(), and PrintStats().

◆ RTTTotal

ULONG RTTTotal = 0
static

Definition at line 74 of file ping.c.

Referenced by Ping(), and PrintStats().

◆ Target

PADDRINFOW Target = NULL
static

Definition at line 66 of file ping.c.

Referenced by Ping(), ResolveTarget(), and wmain().

◆ TargetName

PCWSTR TargetName = NULL
static

Definition at line 67 of file ping.c.

Referenced by ParseCmdLine(), and wmain().

◆ Timeout

ULONG Timeout = 4000
static

Definition at line 61 of file ping.c.

Referenced by _IRQL_requires_max_(), AcpiAcquireGlobalLock(), AcpiAcquireMutex(), AcpiEvAcquireGlobalLock(), AcpiExAcquireMutexObject(), AcpiExSystemWaitMutex(), AcpiExSystemWaitSemaphore(), AcpiOsAcquireMutex(), AcpiOsWaitSemaphore(), BaseFormatTimeOut(), BatteryClassIoctl(), BmpGetSelectedBootEntry(), CmpArmDelayedCloseTimer(), CmpDelayDerefKeyControlBlock(), co_MsqSendMessage(), ConSrvConsoleCtrlEventTimeout(), CsrCaptureTimeout(), ddraw7_EvaluateMode(), DeviceInstallThread(), DoRebootCommand(), DoStopService(), EnableUserModePnpManager(), ExpWaitForResource(), ExpWorkerThreadBalanceManager(), ExpWorkerThreadEntryPoint(), Ext2bhReaperThread(), Ext2FcbReaperThread(), Ext2McbReaperThread(), Ext2Sleep(), ExTimedWaitForUnblockPushLock(), FlushConsoleInputBuffer(), GetMailslotInfo(), GetNextJobTimeout(), GetNtTimeout(), i8042MouDpcRoutine(), Icmp6SendEcho2(), IcmpSendEcho(), IcmpSendEcho2(), implicit_handle(), InternalWake(), IopRestartLogWorker(), KeRemoveQueue(), KeWaitForMultipleObjects(), KeWaitForSingleObject(), KmtEnsureServiceState(), KmtUserModeCallback(), LdrpInit(), LoadScreenSaverParameters(), LpcpDeletePort(), main(), MsfsRead(), NdisIPnPStartDevice(), NdisMSetPeriodicTimer(), NdisMSetTimer(), NdisSetTimer(), NdisWaitEvent(), NotifyTopLevelWindow(), NpCreateFcb(), NpWaitPipe(), NtRemoveIoCompletion(), NtReplyWaitReceivePortEx(), NtUserWaitForInputIdle(), NtWaitForDebugEvent(), ParseCmdLine(), PeekConsoleInput(), Phase1InitializationDiscard(), Ping(), ProgressCountdown(), PS2ControllerWait(), RasSecurityDialogReceive(), ReadMidiUartByte(), RpcCancelThreadEx(), RpcMgmtSetCancelTimeout(), RpcMgmtSetComTimeout(), RtlpInitializeThreadPool(), RtlpIoWorkerThreadProc(), RtlpStartWorkerThread(), RtlpWorkerThreadProc(), RWDetermineMediaType(), SbDsp4SetInputRate(), SbDsp4SetOutputRate(), SbDsp4WriteRate(), SbDspDisableSpeaker(), SbDspEnableSpeaker(), SbDspGetVersion(), SbDspIsSpeakerEnabled(), SbDspRead(), SbDspReset(), SbDspWaitToRead(), SbDspWaitToWrite(), SbDspWrite(), ScreenSaverThreadMain(), SetMailslotInfo(), SetRecoveryTimeout(), SetTimeout(), SleepConditionVariableCS(), SleepConditionVariableSRW(), SmpApiLoop(), SmpLoadSubSystem(), SmpLoadSubSystemsForMuSession(), StartThread(), TCPDisconnect(), TcpipWaitForSingleObject(), TdiSendThread(), TestCreateNamedPipe(), TestFastMutexConcurrent(), TestGuardedMutexConcurrent(), TestResourceWithThreads(), USBH_SyncResetPort(), UserpMessageBox(), UserServerHardError(), VideoPortWaitForSingleObject(), WaitForBusy(), WaitForControllerInterrupt(), WaitForDebugEvent(), WaitForFlags(), WaitForFlagsOr(), WaitForKeyboard(), WaitForMidiUartStatus(), WaitForRemoteDatabaseSemaphore(), WaitForWork(), WaitNoPendingInstallEvents(), WlxSetTimeout(), WorkerThread(), WriteMidiUartByte(), WriteMidiUartMulti(), WSPAccept(), WSPSelect(), WTSSendMessageA(), and WTSSendMessageW().