Skip to content

Commit

Permalink
[TRACERT] Rewrite tracert
Browse files Browse the repository at this point in the history
- Full rewrite. This commit replaces the old utility.
- Use the new ICMP APIs instead of manually crafting ping requests using raw sockets.
- Add support for additional languages (the previous utility was hardcoded)
- Add support for IPv6
- Make the icmpapi header C++ compatible. (we don't appear to sync this with wine anymore.)
- Now runs on Win10, is much more reliable, and brings the code somewhat into the 21st century.
(It's currently missing source routing (-j), but as most routers disable this anyway, I'm not sure that it's worth adding)
  • Loading branch information
gedmurphy committed Jan 2, 2018
1 parent 8d436d9 commit 344f367
Show file tree
Hide file tree
Showing 23 changed files with 1,164 additions and 749 deletions.
12 changes: 3 additions & 9 deletions base/applications/network/tracert/CMakeLists.txt
@@ -1,11 +1,5 @@

add_definitions(-D__USE_W32_SOCKETS)
add_executable(tracert tracert.c tracert.rc)
set_module_type(tracert win32cui)
add_importlibs(tracert ws2_32 msvcrt kernel32)

if(MSVC)
add_importlibs(tracert ntdll)
endif()

add_executable(tracert tracert.cpp tracert.rc)
set_module_type(tracert win32cui UNICODE)
add_importlibs(tracert ws2_32 iphlpapi user32 msvcrt kernel32 ntdll)
add_cd_file(TARGET tracert DESTINATION reactos/system32 FOR all)
32 changes: 32 additions & 0 deletions base/applications/network/tracert/lang/bg-BG.rc
@@ -0,0 +1,32 @@

LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT

STRINGTABLE
BEGIN
IDS_USAGE "\r\n\
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name \r\n\r\n\
Options:\r\n\
-d Do not resolve addresses to hostnames.\r\n\
-h maximum_hops Maximum number of hops to search for target.\r\n\
-j host-list Loose source route along host-list.\r\n\
-w timeout Wait timeout milliseconds for each reply.\r\n\
-4 Force using IPv4.\r\n\
-6 Force using IPv6.\r\n\
\r\n"

IDS_INVALID_OPTION "%1 is not a valid command option.\r\n"
IDS_TRACE_INFO "\r\nTracing route to %1 [%2]\r\nover a maximum of %3!u! hops:\r\n\r\n"
IDS_TRACE_COMPLETE "\r\nTrace complete.\r\n"
IDS_UNABLE_RESOLVE "Unable to resolve target system name %1.\r\n"

IDS_GEN_FAILURE "General failure.\r\n"

IDS_HOP_COUNT "%1!3lu! %0\r\n"
IDS_HOP_TIME "%1!4lu! ms %0\r\n"
IDS_HOP_ZERO, " <1 ms %0\r\n"
IDS_TIMEOUT " * %0\r\n"
IDS_HOP_RES_INFO "%1 [%2]\r\n"
IDS_HOP_IP_INFO "%1\r\n"
IDS_REQ_TIMED_OUT "Request timed out.\r\n"

END
32 changes: 32 additions & 0 deletions base/applications/network/tracert/lang/cs-CZ.rc
@@ -0,0 +1,32 @@

LANGUAGE LANG_CZECH, SUBLANG_DEFAULT

STRINGTABLE
BEGIN
IDS_USAGE "\r\n\
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name \r\n\r\n\
Options:\r\n\
-d Do not resolve addresses to hostnames.\r\n\
-h maximum_hops Maximum number of hops to search for target.\r\n\
-j host-list Loose source route along host-list.\r\n\
-w timeout Wait timeout milliseconds for each reply.\r\n\
-4 Force using IPv4.\r\n\
-6 Force using IPv6.\r\n\
\r\n"

IDS_INVALID_OPTION "%1 is not a valid command option.\r\n"
IDS_TRACE_INFO "\r\nTracing route to %1 [%2]\r\nover a maximum of %3!u! hops:\r\n\r\n"
IDS_TRACE_COMPLETE "\r\nTrace complete.\r\n"
IDS_UNABLE_RESOLVE "Unable to resolve target system name %1.\r\n"

IDS_GEN_FAILURE "General failure.\r\n"

IDS_HOP_COUNT "%1!3lu! %0\r\n"
IDS_HOP_TIME "%1!4lu! ms %0\r\n"
IDS_HOP_ZERO, " <1 ms %0\r\n"
IDS_TIMEOUT " * %0\r\n"
IDS_HOP_RES_INFO "%1 [%2]\r\n"
IDS_HOP_IP_INFO "%1\r\n"
IDS_REQ_TIMED_OUT "Request timed out.\r\n"

END
32 changes: 32 additions & 0 deletions base/applications/network/tracert/lang/de-DE.rc
@@ -0,0 +1,32 @@

LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL

STRINGTABLE
BEGIN
IDS_USAGE "\r\n\
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name \r\n\r\n\
Options:\r\n\
-d Do not resolve addresses to hostnames.\r\n\
-h maximum_hops Maximum number of hops to search for target.\r\n\
-j host-list Loose source route along host-list.\r\n\
-w timeout Wait timeout milliseconds for each reply.\r\n\
-4 Force using IPv4.\r\n\
-6 Force using IPv6.\r\n\
\r\n"

IDS_INVALID_OPTION "%1 is not a valid command option.\r\n"
IDS_TRACE_INFO "\r\nTracing route to %1 [%2]\r\nover a maximum of %3!u! hops:\r\n\r\n"
IDS_TRACE_COMPLETE "\r\nTrace complete.\r\n"
IDS_UNABLE_RESOLVE "Unable to resolve target system name %1.\r\n"

IDS_GEN_FAILURE "General failure.\r\n"

IDS_HOP_COUNT "%1!3lu! %0\r\n"
IDS_HOP_TIME "%1!4lu! ms %0\r\n"
IDS_HOP_ZERO, " <1 ms %0\r\n"
IDS_TIMEOUT " * %0\r\n"
IDS_HOP_RES_INFO "%1 [%2]\r\n"
IDS_HOP_IP_INFO "%1\r\n"
IDS_REQ_TIMED_OUT "Request timed out.\r\n"

END
32 changes: 32 additions & 0 deletions base/applications/network/tracert/lang/en-US.rc
@@ -0,0 +1,32 @@

LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

STRINGTABLE
BEGIN
IDS_USAGE "\r\n\
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name \r\n\r\n\
Options:\r\n\
-d Do not resolve addresses to hostnames.\r\n\
-h maximum_hops Maximum number of hops to search for target.\r\n\
-j host-list Loose source route along host-list.\r\n\
-w timeout Wait timeout milliseconds for each reply.\r\n\
-4 Force using IPv4.\r\n\
-6 Force using IPv6.\r\n\
\r\n"

IDS_INVALID_OPTION "%1 is not a valid command option.\r\n"
IDS_TRACE_INFO "\r\nTracing route to %1 [%2]\r\nover a maximum of %3!u! hops:\r\n\r\n"
IDS_TRACE_COMPLETE "\r\nTrace complete.\r\n"
IDS_UNABLE_RESOLVE "Unable to resolve target system name %1.\r\n"

IDS_GEN_FAILURE "General failure.\r\n"

IDS_HOP_COUNT "%1!3lu! %0\r\n"
IDS_HOP_TIME "%1!4lu! ms %0\r\n"
IDS_HOP_ZERO, " <1 ms %0\r\n"
IDS_TIMEOUT " * %0\r\n"
IDS_HOP_RES_INFO "%1 [%2]\r\n"
IDS_HOP_IP_INFO "%1\r\n"
IDS_REQ_TIMED_OUT "Request timed out.\r\n"

END
32 changes: 32 additions & 0 deletions base/applications/network/tracert/lang/es-ES.rc
@@ -0,0 +1,32 @@

LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL

STRINGTABLE
BEGIN
IDS_USAGE "\r\n\
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name \r\n\r\n\
Options:\r\n\
-d Do not resolve addresses to hostnames.\r\n\
-h maximum_hops Maximum number of hops to search for target.\r\n\
-j host-list Loose source route along host-list.\r\n\
-w timeout Wait timeout milliseconds for each reply.\r\n\
-4 Force using IPv4.\r\n\
-6 Force using IPv6.\r\n\
\r\n"

IDS_INVALID_OPTION "%1 is not a valid command option.\r\n"
IDS_TRACE_INFO "\r\nTracing route to %1 [%2]\r\nover a maximum of %3!u! hops:\r\n\r\n"
IDS_TRACE_COMPLETE "\r\nTrace complete.\r\n"
IDS_UNABLE_RESOLVE "Unable to resolve target system name %1.\r\n"

IDS_GEN_FAILURE "General failure.\r\n"

IDS_HOP_COUNT "%1!3lu! %0\r\n"
IDS_HOP_TIME "%1!4lu! ms %0\r\n"
IDS_HOP_ZERO, " <1 ms %0\r\n"
IDS_TIMEOUT " * %0\r\n"
IDS_HOP_RES_INFO "%1 [%2]\r\n"
IDS_HOP_IP_INFO "%1\r\n"
IDS_REQ_TIMED_OUT "Request timed out.\r\n"

END
32 changes: 32 additions & 0 deletions base/applications/network/tracert/lang/fr-FR.rc
@@ -0,0 +1,32 @@

LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL

STRINGTABLE
BEGIN
IDS_USAGE "\r\n\
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name \r\n\r\n\
Options:\r\n\
-d Do not resolve addresses to hostnames.\r\n\
-h maximum_hops Maximum number of hops to search for target.\r\n\
-j host-list Loose source route along host-list.\r\n\
-w timeout Wait timeout milliseconds for each reply.\r\n\
-4 Force using IPv4.\r\n\
-6 Force using IPv6.\r\n\
\r\n"

IDS_INVALID_OPTION "%1 is not a valid command option.\r\n"
IDS_TRACE_INFO "\r\nTracing route to %1 [%2]\r\nover a maximum of %3!u! hops:\r\n\r\n"
IDS_TRACE_COMPLETE "\r\nTrace complete.\r\n"
IDS_UNABLE_RESOLVE "Unable to resolve target system name %1.\r\n"

IDS_GEN_FAILURE "General failure.\r\n"

IDS_HOP_COUNT "%1!3lu! %0\r\n"
IDS_HOP_TIME "%1!4lu! ms %0\r\n"
IDS_HOP_ZERO, " <1 ms %0\r\n"
IDS_TIMEOUT " * %0\r\n"
IDS_HOP_RES_INFO "%1 [%2]\r\n"
IDS_HOP_IP_INFO "%1\r\n"
IDS_REQ_TIMED_OUT "Request timed out.\r\n"

END
32 changes: 32 additions & 0 deletions base/applications/network/tracert/lang/it-IT.rc
@@ -0,0 +1,32 @@

LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL

STRINGTABLE
BEGIN
IDS_USAGE "\r\n\
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name \r\n\r\n\
Options:\r\n\
-d Do not resolve addresses to hostnames.\r\n\
-h maximum_hops Maximum number of hops to search for target.\r\n\
-j host-list Loose source route along host-list.\r\n\
-w timeout Wait timeout milliseconds for each reply.\r\n\
-4 Force using IPv4.\r\n\
-6 Force using IPv6.\r\n\
\r\n"

IDS_INVALID_OPTION "%1 is not a valid command option.\r\n"
IDS_TRACE_INFO "\r\nTracing route to %1 [%2]\r\nover a maximum of %3!u! hops:\r\n\r\n"
IDS_TRACE_COMPLETE "\r\nTrace complete.\r\n"
IDS_UNABLE_RESOLVE "Unable to resolve target system name %1.\r\n"

IDS_GEN_FAILURE "General failure.\r\n"

IDS_HOP_COUNT "%1!3lu! %0\r\n"
IDS_HOP_TIME "%1!4lu! ms %0\r\n"
IDS_HOP_ZERO, " <1 ms %0\r\n"
IDS_TIMEOUT " * %0\r\n"
IDS_HOP_RES_INFO "%1 [%2]\r\n"
IDS_HOP_IP_INFO "%1\r\n"
IDS_REQ_TIMED_OUT "Request timed out.\r\n"

END
32 changes: 32 additions & 0 deletions base/applications/network/tracert/lang/pl-PL.rc
@@ -0,0 +1,32 @@

LANGUAGE LANG_POLISH, SUBLANG_DEFAULT

STRINGTABLE
BEGIN
IDS_USAGE "\r\n\
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name \r\n\r\n\
Options:\r\n\
-d Do not resolve addresses to hostnames.\r\n\
-h maximum_hops Maximum number of hops to search for target.\r\n\
-j host-list Loose source route along host-list.\r\n\
-w timeout Wait timeout milliseconds for each reply.\r\n\
-4 Force using IPv4.\r\n\
-6 Force using IPv6.\r\n\
\r\n"

IDS_INVALID_OPTION "%1 is not a valid command option.\r\n"
IDS_TRACE_INFO "\r\nTracing route to %1 [%2]\r\nover a maximum of %3!u! hops:\r\n\r\n"
IDS_TRACE_COMPLETE "\r\nTrace complete.\r\n"
IDS_UNABLE_RESOLVE "Unable to resolve target system name %1.\r\n"

IDS_GEN_FAILURE "General failure.\r\n"

IDS_HOP_COUNT "%1!3lu! %0\r\n"
IDS_HOP_TIME "%1!4lu! ms %0\r\n"
IDS_HOP_ZERO, " <1 ms %0\r\n"
IDS_TIMEOUT " * %0\r\n"
IDS_HOP_RES_INFO "%1 [%2]\r\n"
IDS_HOP_IP_INFO "%1\r\n"
IDS_REQ_TIMED_OUT "Request timed out.\r\n"

END
32 changes: 32 additions & 0 deletions base/applications/network/tracert/lang/ro-RO.rc
@@ -0,0 +1,32 @@

LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL

STRINGTABLE
BEGIN
IDS_USAGE "\r\n\
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name \r\n\r\n\
Options:\r\n\
-d Do not resolve addresses to hostnames.\r\n\
-h maximum_hops Maximum number of hops to search for target.\r\n\
-j host-list Loose source route along host-list.\r\n\
-w timeout Wait timeout milliseconds for each reply.\r\n\
-4 Force using IPv4.\r\n\
-6 Force using IPv6.\r\n\
\r\n"

IDS_INVALID_OPTION "%1 is not a valid command option.\r\n"
IDS_TRACE_INFO "\r\nTracing route to %1 [%2]\r\nover a maximum of %3!u! hops:\r\n\r\n"
IDS_TRACE_COMPLETE "\r\nTrace complete.\r\n"
IDS_UNABLE_RESOLVE "Unable to resolve target system name %1.\r\n"

IDS_GEN_FAILURE "General failure.\r\n"

IDS_HOP_COUNT "%1!3lu! %0\r\n"
IDS_HOP_TIME "%1!4lu! ms %0\r\n"
IDS_HOP_ZERO, " <1 ms %0\r\n"
IDS_TIMEOUT " * %0\r\n"
IDS_HOP_RES_INFO "%1 [%2]\r\n"
IDS_HOP_IP_INFO "%1\r\n"
IDS_REQ_TIMED_OUT "Request timed out.\r\n"

END
32 changes: 32 additions & 0 deletions base/applications/network/tracert/lang/ru-RU.rc
@@ -0,0 +1,32 @@

LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT

STRINGTABLE
BEGIN
IDS_USAGE "\r\n\
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name \r\n\r\n\
Options:\r\n\
-d Do not resolve addresses to hostnames.\r\n\
-h maximum_hops Maximum number of hops to search for target.\r\n\
-j host-list Loose source route along host-list.\r\n\
-w timeout Wait timeout milliseconds for each reply.\r\n\
-4 Force using IPv4.\r\n\
-6 Force using IPv6.\r\n\
\r\n"

IDS_INVALID_OPTION "%1 is not a valid command option.\r\n"
IDS_TRACE_INFO "\r\nTracing route to %1 [%2]\r\nover a maximum of %3!u! hops:\r\n\r\n"
IDS_TRACE_COMPLETE "\r\nTrace complete.\r\n"
IDS_UNABLE_RESOLVE "Unable to resolve target system name %1.\r\n"

IDS_GEN_FAILURE "General failure.\r\n"

IDS_HOP_COUNT "%1!3lu! %0\r\n"
IDS_HOP_TIME "%1!4lu! ms %0\r\n"
IDS_HOP_ZERO, " <1 ms %0\r\n"
IDS_TIMEOUT " * %0\r\n"
IDS_HOP_RES_INFO "%1 [%2]\r\n"
IDS_HOP_IP_INFO "%1\r\n"
IDS_REQ_TIMED_OUT "Request timed out.\r\n"

END
32 changes: 32 additions & 0 deletions base/applications/network/tracert/lang/sq-AL.rc
@@ -0,0 +1,32 @@

LANGUAGE LANG_ALBANIAN, SUBLANG_NEUTRAL

STRINGTABLE
BEGIN
IDS_USAGE "\r\n\
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name \r\n\r\n\
Options:\r\n\
-d Do not resolve addresses to hostnames.\r\n\
-h maximum_hops Maximum number of hops to search for target.\r\n\
-j host-list Loose source route along host-list.\r\n\
-w timeout Wait timeout milliseconds for each reply.\r\n\
-4 Force using IPv4.\r\n\
-6 Force using IPv6.\r\n\
\r\n"

IDS_INVALID_OPTION "%1 is not a valid command option.\r\n"
IDS_TRACE_INFO "\r\nTracing route to %1 [%2]\r\nover a maximum of %3!u! hops:\r\n\r\n"
IDS_TRACE_COMPLETE "\r\nTrace complete.\r\n"
IDS_UNABLE_RESOLVE "Unable to resolve target system name %1.\r\n"

IDS_GEN_FAILURE "General failure.\r\n"

IDS_HOP_COUNT "%1!3lu! %0\r\n"
IDS_HOP_TIME "%1!4lu! ms %0\r\n"
IDS_HOP_ZERO, " <1 ms %0\r\n"
IDS_TIMEOUT " * %0\r\n"
IDS_HOP_RES_INFO "%1 [%2]\r\n"
IDS_HOP_IP_INFO "%1\r\n"
IDS_REQ_TIMED_OUT "Request timed out.\r\n"

END

2 comments on commit 344f367

@sskras
Copy link

@sskras sskras commented on 344f367 Jan 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gedmurphy, my two questions:

  • Make the icmpapi header C++ compatible.

Does it make the header incompatible with Wine?

(we don't appear to sync this with wine anymore.)

Can I know why, please?

@gedmurphy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. no
  2. why are we out of sync? I don't know for sure, but ours is more complete than Wine's, so either they aren't interested in our changes, or it they just haven't been sent upstream.

Please sign in to comment.