ReactOS 0.4.16-dev-2613-g9533ad7
tracert.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS trace route utility
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Trace network paths through networks
5 * COPYRIGHT: Copyright 2018 Ged Murphy <gedmurphy@reactos.org>
6 * Copyright 2025 Curtis Wilson <LiquidFox1776@gmail.com>
7 */
8
9#include <stdarg.h>
10#include <stdlib.h>
11
12#include <windef.h>
13#include <winbase.h>
14#include <winuser.h>
15
16#include <ws2tcpip.h>
17#include <iphlpapi.h>
18#include <icmpapi.h>
19#include <winsock2.h>
20#include <conutils.h>
21
22#include <strsafe.h>
23
24#include "resource.h"
25
26#define SIZEOF_ICMP_ERROR 8
27#define SIZEOF_IO_STATUS_BLOCK 8
28#define PACKET_SIZE 32
29#define MAX_IPADDRESS 32
30#define NUM_OF_PINGS 3
31#define MIN_HOP_COUNT 1
32#define MAX_HOP_COUNT 255
33#define MIN_MILLISECONDS 1
34#define MAX_MILLISECONDS ULONG_MAX
35
37{
43 int Family;
44
47
48} Info = { 0 };
49
50
51#if 0
52static
53INT
56 ...)
57{
58 INT Len;
60
63 va_end(args);
64
65 return Len;
66}
67#else
68#define OutputText(uID, ...) ConResMsgPrintf(StdOut, 0, (uID), ##__VA_ARGS__)
69#endif
70
71static
72VOID
74{
76}
77
78static bool
82{
83 PWSTR StopString;
84
85 // Check input arguments
86 if (*String == UNICODE_NULL)
87 return false;
88
89 // Clear errno so we can use its value after
90 // the call to wcstoul to check for errors.
91 errno = 0;
92
93 // Try to convert String to ULONG
94 *Value = wcstoul(String, &StopString, 10);
95 if ((errno != ERANGE) && (errno != 0 || *StopString != UNICODE_NULL))
96 return false;
97 // The conversion was successful
98 return true;
99}
100
101static bool
103{
104 ADDRINFOW Hints;
105 ZeroMemory(&Hints, sizeof(Hints));
106 Hints.ai_family = Info.Family;
107 Hints.ai_flags = AI_CANONNAME;
108
109 int Status;
110 Status = GetAddrInfoW(Info.HostName,
111 NULL,
112 &Hints,
113 &Info.Target);
114 if (Status != 0)
115 return false;
116
117 Status = GetNameInfoW(Info.Target->ai_addr,
118 (socklen_t)Info.Target->ai_addrlen,
119 Info.TargetIP,
121 NULL,
122 0,
124 return (Status == 0);
125}
126
127static bool
129{
130 SOCKADDR_IN6 SockAddrIn6 = { 0 };
131 SOCKADDR_IN SockAddrIn = { 0 };
132 PSOCKADDR SockAddr;
134
135 if (Info.Family == AF_INET6)
136 {
138 SockAddrIn6.sin6_family = AF_INET6;
139 CopyMemory(SockAddrIn6.sin6_addr.u.Word, Ipv6Addr->sin6_addr, sizeof(SockAddrIn6.sin6_addr));
140 //SockAddrIn6.sin6_addr = Ipv6Addr->sin6_addr;
141 SockAddr = (PSOCKADDR)&SockAddrIn6;
142 Size = sizeof(SockAddrIn6);
143
144 }
145 else
146 {
148 SockAddrIn.sin_family = AF_INET;
149 SockAddrIn.sin_addr.S_un.S_addr = *Address;
150 SockAddr = (PSOCKADDR)&SockAddrIn;
151 Size = sizeof(SockAddrIn);
152 }
153
154 INT Status;
155 bool Resolved = false;
156 WCHAR HostName[NI_MAXHOST];
157 if (Info.ResolveAddresses)
158 {
159 Status = GetNameInfoW(SockAddr,
160 Size,
161 HostName,
163 NULL,
164 0,
166 if (Status == 0)
167 {
168 Resolved = true;
169 }
170 }
171
172 WCHAR IpAddress[MAX_IPADDRESS];
173 Status = GetNameInfoW(SockAddr,
174 Size,
175 IpAddress,
177 NULL,
178 0,
180 if (Status == 0)
181 {
182 if (Resolved)
183 {
184 OutputText(IDS_HOP_RES_INFO, HostName, IpAddress);
185 }
186 else
187 {
188 OutputText(IDS_HOP_IP_INFO, IpAddress);
189 }
190 }
191
192 return (Status == 0);
193}
194
195static ULONG
198 _Out_ ULONG& RoundTripTime,
199 _Out_ PVOID& AddressInfo
200)
201{
203
204 if (Info.Family == AF_INET6)
205 {
206 PICMPV6_ECHO_REPLY EchoReplyV6;
207 EchoReplyV6 = (PICMPV6_ECHO_REPLY)ReplyBuffer;
208 Status = EchoReplyV6->Status;
209 RoundTripTime = EchoReplyV6->RoundTripTime;
210 AddressInfo = &EchoReplyV6->Address;
211 }
212 else
213 {
214#ifdef _WIN64
215 PICMP_ECHO_REPLY32 EchoReplyV4;
216 EchoReplyV4 = (PICMP_ECHO_REPLY32)ReplyBuffer;
217#else
218 PICMP_ECHO_REPLY EchoReplyV4;
219 EchoReplyV4 = (PICMP_ECHO_REPLY)ReplyBuffer;
220#endif
221 Status = EchoReplyV4->Status;
222 RoundTripTime = EchoReplyV4->RoundTripTime;
223 AddressInfo = &EchoReplyV4->Address;
224 }
225
226 return Status;
227}
228
229static bool
232 _In_ PVOID LastGoodResponse,
233 _In_ bool OutputHopAddress,
234 _Out_ bool& GoodResponse,
235 _Out_ bool& FoundTarget
236)
237{
238 ULONG RoundTripTime;
239 PVOID AddressInfo;
240 ULONG Status = GetResponseStats(ReplyBuffer, RoundTripTime, AddressInfo);
241
242 switch (Status)
243 {
244 case IP_SUCCESS:
246 if (RoundTripTime)
247 {
248 OutputText(IDS_HOP_TIME, RoundTripTime);
249 }
250 else
251 {
253 }
254 GoodResponse = true;
255 break;
256
259 FoundTarget = true;
260 PrintHopInfo(AddressInfo);
263 {
265 }
267 {
269 }
270 return true;
271
272 case IP_REQ_TIMED_OUT:
274 break;
275
278 return false;
279
280 default:
282 return false;
283 }
284
285 if (OutputHopAddress)
286 {
287 if (Status == IP_REQ_TIMED_OUT && LastGoodResponse)
288 {
289 Status = GetResponseStats(LastGoodResponse, RoundTripTime, AddressInfo);
290 }
291 if (Status == IP_SUCCESS)
292 {
293 FoundTarget = true;
294 }
296 {
297 PrintHopInfo(AddressInfo);
299 }
300 else if (Status == IP_REQ_TIMED_OUT)
301 {
303 }
304 }
305
306 return true;
307}
308
309static bool
311{
312 bool Success = false;
313 PVOID ReplyBuffer = NULL, LastGoodResponse = NULL;
314 DWORD ReplySize;
315
317 bool Quit = false;
318 ULONG HopCount = 1;
319 bool FoundTarget = false;
320
322 if (!Success)
323 {
325 goto Cleanup;
326 }
327
329 if (Info.Family == AF_INET6)
330 {
331 ReplySize += sizeof(ICMPV6_ECHO_REPLY);
332 }
333 else
334 {
335#ifdef _WIN64
336 ReplySize += sizeof(ICMP_ECHO_REPLY32);
337#else
338 ReplySize += sizeof(ICMP_ECHO_REPLY);
339#endif
340 }
341
343 if (ReplyBuffer == NULL)
344 {
345 Success = false;
346 goto Cleanup;
347 }
348
349 if (Info.Family == AF_INET6)
350 {
351 Info.hIcmpFile = Icmp6CreateFile();
352 }
353 else
354 {
355 Info.hIcmpFile = IcmpCreateFile();
356 }
357 if (Info.hIcmpFile == INVALID_HANDLE_VALUE)
358 {
359 Success = false;
360 goto Cleanup;
361 }
362
363 OutputText(IDS_TRACE_INFO, Info.HostName, Info.TargetIP, Info.MaxHops);
364
365 IP_OPTION_INFORMATION IpOptionInfo;
366 ZeroMemory(&IpOptionInfo, sizeof(IpOptionInfo));
367
368 while ((HopCount <= Info.MaxHops) && (FoundTarget == false) && (Quit == false))
369 {
370 OutputText(IDS_HOP_COUNT, HopCount);
371
372 if (LastGoodResponse)
373 {
374 HeapFree(heap, 0, LastGoodResponse);
375 LastGoodResponse = NULL;
376 }
377
378 for (int Ping = 1; Ping <= NUM_OF_PINGS; Ping++)
379 {
380 BYTE SendBuffer[PACKET_SIZE];
381 bool GoodResponse = false;
382
383 IpOptionInfo.Ttl = static_cast<UCHAR>(HopCount);
384
385 if (Info.Family == AF_INET6)
386 {
387 struct sockaddr_in6 Source;
388
389 ZeroMemory(&Source, sizeof(Source));
390 Source.sin6_family = AF_INET6;
391
392 (void)Icmp6SendEcho2(Info.hIcmpFile,
393 NULL,
394 NULL,
395 NULL,
396 &Source,
397 (struct sockaddr_in6 *)Info.Target->ai_addr,
398 SendBuffer,
400 &IpOptionInfo,
402 ReplySize,
403 Info.Timeout);
404 }
405 else
406 {
407 (void)IcmpSendEcho2(Info.hIcmpFile,
408 NULL,
409 NULL,
410 NULL,
411 ((PSOCKADDR_IN)Info.Target->ai_addr)->sin_addr.s_addr,
412 SendBuffer,
414 &IpOptionInfo,
416 ReplySize,
417 Info.Timeout);
418 }
419
421 LastGoodResponse,
422 (Ping == NUM_OF_PINGS),
423 GoodResponse,
424 FoundTarget) == false)
425 {
426 Quit = true;
427 break;
428 }
429
430 if (FoundTarget)
431 {
432 Success = true;
433 break;
434 }
435
436 if (GoodResponse)
437 {
438 if (LastGoodResponse)
439 {
440 HeapFree(heap, 0, LastGoodResponse);
441 }
442 LastGoodResponse = HeapAlloc(heap, HEAP_ZERO_MEMORY, ReplySize);
443 if (LastGoodResponse == NULL)
444 {
445 Success = false;
446 goto Cleanup;
447 }
448 CopyMemory(LastGoodResponse, ReplyBuffer, ReplySize);
449 }
450 }
451
452 HopCount++;
453 Sleep(100);
454 }
455
457
458Cleanup:
459 if (ReplyBuffer)
460 {
462 }
463 if (LastGoodResponse)
464 {
465 HeapFree(heap, 0, LastGoodResponse);
466 }
467 if (Info.Target)
468 {
469 FreeAddrInfoW(Info.Target);
470 }
471 if (Info.hIcmpFile)
472 {
473 IcmpCloseHandle(Info.hIcmpFile);
474 }
475
476 return Success;
477}
478
479static bool
481 _In_ int argc,
482 _In_ wchar_t *argv[],
483 _Inout_ int *i,
485 _In_ ULONG MinimumValue,
486 _In_ ULONG MaximumValue)
487{
488 ULONG ParsedValue = 0;
489
490 // Check if we have enough values
491 if ((*i + 1) > (argc - 1))
492 {
494 return false;
495 }
496
497 (*i)++;
498
499 // Try to parse and convert the value as ULONG.
500 // Check if ParsedValue is within the specified range.
501 if (!GetULONG(argv[*i], &ParsedValue) ||
502 ((ParsedValue < MinimumValue) || (ParsedValue > MaximumValue)))
503 {
504 (*i)--;
506 return false;
507 }
508
509 *Value = ParsedValue;
510 return true;
511}
512
513static bool
514ParseCmdline(int argc, wchar_t *argv[])
515{
516 if (argc < 2)
517 {
518 Usage();
519 return false;
520 }
521
522 for (int i = 1; i < argc; i++)
523 {
524 if (argv[i][0] == '-' || argv[i][0] == '/')
525 {
526 switch (argv[i][1])
527 {
528 case 'd':
529 Info.ResolveAddresses = false;
530 break;
531
532 case 'h':
534 argv,
535 &i,
536 &Info.MaxHops,
539 {
540 return false;
541 }
542 break;
543
544 case 'j':
545 printf("-j is not yet implemented.\n");
546 return false;
547
548 case 'w':
550 argv,
551 &i,
552 &Info.Timeout,
555 {
556 return false;
557 }
558 break;
559
560 case '4':
561 Info.Family = AF_INET;
562 break;
563
564 case '6':
565 Info.Family = AF_INET6;
566 break;
567
568 default:
569 {
571 Usage();
572 return false;
573 }
574 }
575 }
576 else
577 {
578 // The host must be the last argument
579 if (i != (argc - 1))
580 {
581 Usage();
582 return false;
583 }
584
585 StringCchCopyW(Info.HostName, NI_MAXHOST, argv[i]);
586 break;
587 }
588 }
589
590 // Check for missing host
591 if (Info.HostName[0] == UNICODE_NULL)
592 {
594 Usage();
595 return false;
596 }
597 return true;
598}
599
601int wmain(int argc, wchar_t *argv[])
602{
603 /* Initialize the Console Standard Streams */
605
606 Info.ResolveAddresses = true;
607 Info.MaxHops = 30;
608 Info.Timeout = 4000;
609 Info.Family = AF_UNSPEC;
610
611 if (!ParseCmdline(argc, argv))
612 {
613 return 1;
614 }
615
616 WSADATA WsaData;
617 if (WSAStartup(MAKEWORD(2, 2), &WsaData))
618 {
619 return 1;
620 }
621
622 bool Success;
624
625 WSACleanup();
626
627 return Success ? 0 : 1;
628}
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
#define FreeAddrInfoW(a)
Definition: addrinfo.c:21
INT WSAAPI GetAddrInfoW(IN PCWSTR pszNodeName, IN PCWSTR pszServiceName, IN const ADDRINFOW *ptHints, OUT PADDRINFOW *pptResult)
Definition: addrinfo.c:509
#define IDS_USAGE
Definition: resource.h:3
#define IDS_INVALID_OPTION
Definition: resource.h:7
#define IDS_DEST_HOST_UNREACHABLE
Definition: resource.h:24
#define IDS_TRANSMIT_FAILED
Definition: resource.h:28
#define IDS_DEST_NET_UNREACHABLE
Definition: resource.h:25
#define IDS_UNABLE_RESOLVE
Definition: resource.h:7
#define IDS_MISSING_TARGET
Definition: resource.h:24
#define IDS_TRACE_COMPLETE
Definition: resource.h:6
#define IDS_HOP_COUNT
Definition: resource.h:11
#define IDS_BAD_OPTION_VALUE
Definition: resource.h:22
#define IDS_HOP_RES_INFO
Definition: resource.h:15
#define IDS_TIMEOUT
Definition: resource.h:14
#define IDS_HOP_TIME
Definition: resource.h:12
#define IDS_TRACE_INFO
Definition: resource.h:5
#define IDS_HOP_ZERO
Definition: resource.h:13
#define IDS_HOP_IP_INFO
Definition: resource.h:16
#define IDS_MISSING_OPTION_VALUE
Definition: resource.h:23
#define IDS_REQ_TIMED_OUT
Definition: resource.h:17
#define IDS_LINEBREAK
Definition: resource.h:18
#define IDS_HOP_RESPONSE
Definition: resource.h:19
#define IDS_GEN_FAILURE
Definition: resource.h:8
#define EXTERN_C
Definition: basetyps.h:12
Definition: bufpool.h:45
#define ConInitStdStreams()
Definition: conutils_noros.h:5
#define StdOut
Definition: conutils_noros.h:6
#define Len
Definition: deflate.h:82
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
BOOL WINAPI IcmpCloseHandle(_In_ HANDLE IcmpHandle)
Definition: icmp.c:202
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
HANDLE WINAPI Icmp6CreateFile(void)
Definition: icmp.c:15
HANDLE WINAPI IcmpCreateFile(void)
Definition: icmp.c:219
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
MonoAssembly int argc
Definition: metahost.c:107
_ACRTIMP __msvcrt_ulong __cdecl wcstoul(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2912
#define ERANGE
Definition: errno.h:55
#define errno
Definition: errno.h:120
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
static const WCHAR Cleanup[]
Definition: register.c:80
#define AF_INET
Definition: tcpip.h:117
@ Success
Definition: eventcreate.c:712
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_ PFLT_PORT _In_ ULONG _Out_writes_bytes_opt_ ReplyLength PVOID ReplyBuffer
Definition: fltkernel.h:1902
#define printf
Definition: freeldr.h:103
Status
Definition: gdiplustypes.h:25
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 IP_DEST_NET_UNREACHABLE
Definition: ipexport.h:115
ICMPV6_ECHO_REPLY_LH ICMPV6_ECHO_REPLY
Definition: ipexport.h:194
#define IP_DEST_HOST_UNREACHABLE
Definition: ipexport.h:116
struct _IPV6_ADDRESS_EX * PIPV6_ADDRESS_EX
struct icmp_echo_reply * PICMP_ECHO_REPLY
struct icmp_echo_reply ICMP_ECHO_REPLY
#define IP_GENERAL_FAILURE
Definition: ipexport.h:138
#define IP_REQ_TIMED_OUT
Definition: ipexport.h:123
#define IP_TTL_EXPIRED_TRANSIT
Definition: ipexport.h:126
#define IP_SUCCESS
Definition: ipexport.h:113
ICMPV6_ECHO_REPLY_LH * PICMPV6_ECHO_REPLY
Definition: ipexport.h:195
#define ZeroMemory
Definition: minwinbase.h:31
#define CopyMemory
Definition: minwinbase.h:29
int socklen_t
Definition: tcp.c:35
#define argv
Definition: mplay32.c:18
unsigned int UINT
Definition: ndis.h:50
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define UNICODE_NULL
INT ConResMsgPrintfV(IN PCON_STREAM Stream, IN DWORD dwFlags, IN UINT uID, IN va_list *Arguments OPTIONAL)
Definition: outstream.c:1327
short WCHAR
Definition: pedump.c:58
unsigned short USHORT
Definition: pedump.c:61
ULONG IPAddr
Definition: pfhook.h:35
static WCHAR Address[46]
Definition: ping.c:68
static void Ping(void)
Definition: ping.c:419
_In_ UINT uID
Definition: shlwapi.h:156
int wmain()
#define args
Definition: format.c:66
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
WCHAR HostName[NI_MAXHOST]
Definition: tracert.cpp:41
HANDLE hIcmpFile
Definition: tracert.cpp:45
ULONG Timeout
Definition: tracert.cpp:40
bool ResolveAddresses
Definition: tracert.cpp:38
ULONG MaxHops
Definition: tracert.cpp:39
int Family
Definition: tracert.cpp:43
PADDRINFOW Target
Definition: tracert.cpp:46
WCHAR TargetIP[MAX_IPADDRESS]
Definition: tracert.cpp:42
USHORT sin6_addr[8]
Definition: ipexport.h:173
int ai_flags
Definition: ws2def.h:682
int ai_family
Definition: ws2def.h:683
Definition: match.c:390
Definition: heap.c:86
IPV6_ADDRESS_EX Address
Definition: ipexport.h:189
unsigned int RoundTripTime
Definition: ipexport.h:191
union in6_addr::@3218 u
USHORT Word[8]
Definition: in6addr.h:6
unsigned char Ttl
Definition: ipexport.h:33
ADDRESS_FAMILY sin6_family
Definition: ws2ipdef.h:179
IN6_ADDR sin6_addr
Definition: ws2ipdef.h:182
struct in_addr sin_addr
Definition: winsock.h:506
short sin_family
Definition: winsock.h:504
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726
#define NUM_OF_PINGS
Definition: tracert.cpp:30
static bool RunTraceRoute()
Definition: tracert.cpp:310
static bool GetULONG(_In_ PCWSTR String, _Out_ PULONG Value)
Definition: tracert.cpp:79
static bool PrintHopInfo(_In_ PVOID Buffer)
Definition: tracert.cpp:128
#define SIZEOF_ICMP_ERROR
Definition: tracert.cpp:26
#define MAX_HOP_COUNT
Definition: tracert.cpp:32
static bool DecodeResponse(_In_ PVOID ReplyBuffer, _In_ PVOID LastGoodResponse, _In_ bool OutputHopAddress, _Out_ bool &GoodResponse, _Out_ bool &FoundTarget)
Definition: tracert.cpp:230
#define SIZEOF_IO_STATUS_BLOCK
Definition: tracert.cpp:27
static bool GetUlongOptionInRange(_In_ int argc, _In_ wchar_t *argv[], _Inout_ int *i, _Out_ ULONG *Value, _In_ ULONG MinimumValue, _In_ ULONG MaximumValue)
Definition: tracert.cpp:480
static ULONG GetResponseStats(_In_ PVOID ReplyBuffer, _Out_ ULONG &RoundTripTime, _Out_ PVOID &AddressInfo)
Definition: tracert.cpp:196
#define OutputText(uID,...)
Definition: tracert.cpp:68
#define MAX_IPADDRESS
Definition: tracert.cpp:29
#define MIN_HOP_COUNT
Definition: tracert.cpp:31
static bool ParseCmdline(int argc, wchar_t *argv[])
Definition: tracert.cpp:514
static bool ResolveTarget()
Definition: tracert.cpp:102
#define MAX_MILLISECONDS
Definition: tracert.cpp:34
#define PACKET_SIZE
Definition: tracert.cpp:28
#define MIN_MILLISECONDS
Definition: tracert.cpp:33
static VOID Usage()
Definition: tracert.cpp:73
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG
Definition: typedefs.h:59
const uint16_t * PCWSTR
Definition: typedefs.h:57
unsigned char UCHAR
Definition: typedefs.h:53
#define MAKEWORD(a, b)
Definition: typedefs.h:248
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2439
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
int PASCAL FAR WSACleanup(void)
Definition: startup.c:60
struct sockaddr * PSOCKADDR
Definition: winsock.h:479
#define AF_INET6
Definition: winsock.h:363
#define AF_UNSPEC
Definition: winsock.h:338
#define NI_NAMEREQD
Definition: ws2def.h:361
#define NI_NUMERICHOST
Definition: ws2def.h:360
#define AI_CANONNAME
Definition: ws2def.h:294
#define NI_MAXHOST
Definition: ws2def.h:365
unsigned char BYTE
Definition: xxhash.c:193