Author: akhaldi
Date: Tue Sep 27 18:37:45 2016
New Revision: 72831
URL:
http://svn.reactos.org/svn/reactos?rev=72831&view=rev
Log:
[PING] Minor fixes by Tim Crawford. Please see CORE-12022 for the list of changes.
Modified:
trunk/reactos/base/applications/network/ping/lang/bg-BG.rc
trunk/reactos/base/applications/network/ping/lang/cs-CZ.rc
trunk/reactos/base/applications/network/ping/lang/de-DE.rc
trunk/reactos/base/applications/network/ping/lang/en-US.rc
trunk/reactos/base/applications/network/ping/lang/es-ES.rc
trunk/reactos/base/applications/network/ping/lang/fr-FR.rc
trunk/reactos/base/applications/network/ping/lang/it-IT.rc
trunk/reactos/base/applications/network/ping/lang/pl-PL.rc
trunk/reactos/base/applications/network/ping/lang/ro-RO.rc
trunk/reactos/base/applications/network/ping/lang/ru-RU.rc
trunk/reactos/base/applications/network/ping/lang/sq-AL.rc
trunk/reactos/base/applications/network/ping/lang/sv-SE.rc
trunk/reactos/base/applications/network/ping/lang/tr-TR.rc
trunk/reactos/base/applications/network/ping/lang/uk-UA.rc
trunk/reactos/base/applications/network/ping/lang/zh-CN.rc
trunk/reactos/base/applications/network/ping/lang/zh-TW.rc
trunk/reactos/base/applications/network/ping/ping.c
trunk/reactos/base/applications/network/ping/resource.h
Modified: trunk/reactos/base/applications/network/ping/lang/bg-BG.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/bg-BG.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/bg-BG.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "Approximate round-trip time in milliseconds:\n\
Minimum = %1!u!ms, Maximum = %2!u!ms, Average = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/cs-CZ.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/cs-CZ.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/cs-CZ.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "PÅibližná doba do pÅijetà odezvy v milisekundách:\n\
Minimum = %1!u!ms, Maximum = %2!u!ms, PrůmÄr = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/de-DE.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "Durchschnittliche Antwortzeit in Millisekunden:\n\
Minimum = %1!u!ms, Maximum = %2!u!ms, Durchschnitt = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/en-US.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "Approximate round-trip time in milliseconds:\n\
Minimum = %1!u!ms, Maximum = %2!u!ms, Average = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/es-ES.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/es-ES.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/es-ES.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "Tiempos aproximados de ida y vuelta en milisegundos:\n\
MÃnimo = %1!u!ms, Máximo = %2!u!ms, Media = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/fr-FR.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/fr-FR.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "Délai approximatif de réponse en millisecondes :\n\
Minimum = %1!u!ms, Maximum = %2!u!ms, Moyenne = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/it-IT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/it-IT.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/it-IT.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "Tempo approssimato di andata e ritorno in
milli-secondi:\n\
Minimo = %1!u!ms, Massimo = %2!u!ms, Media = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/pl-PL.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/pl-PL.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "CaÅkowity, przybliżony czas podróży pakietu w
millisekundach:\n\
Minimum = %1!u!ms, Maksimum = %2!u!ms, UÅredniony = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/ro-RO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/ro-RO.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/ro-RO.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "timpul aproximativ de tur-retur, in milisecunde:\n\
minim = %1!u!ms, maxim = %2!u!ms, mediu = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/ru-RU.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/ru-RU.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "ÐÑиблизиÑелÑное вÑемÑ
пÑиема-пеÑедаÑи в мÑ:\n\
ÐинималÑное = %1!u!ms, ÐакÑималÑное = %2!u!ms, СÑеднее
= %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/sq-AL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/sq-AL.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/sq-AL.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "Afersisht koha e matjes në mili-sekonda:\n\
Minimum = %1!u!ms, Maximum = %2!u!ms, Mesatar = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/sv-SE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/sv-SE.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/sv-SE.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "Ungefärliga slingtider i millisekunder:\n\
Minimum = %1!u!ms, Maximum = %2!u!ms, Genomsnittlig = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/tr-TR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/tr-TR.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/tr-TR.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "Mili sâniye olarak yaklaÅık gidiÅ geliÅ süreleri:\n\
En Az = %1!u!ms, En Ãok = %2!u!ms, Ortalama = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/uk-UA.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/uk-UA.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "Approximate round-trip time in milliseconds:\n\
Minimum = %1!u!ms, Maximum = %2!u!ms, Average = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/zh-CN.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/zh-CN.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/zh-CN.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "Approximate round-trip time in milliseconds:\n\
Minimum = %1!u!ms, Maximum = %2!u!ms, Average = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/lang/zh-TW.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/lang/zh-TW.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/lang/zh-TW.rc [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -61,4 +61,6 @@
IDS_APPROXIMATE_RTT "Approximate round-trip time in milliseconds:\n\
Minimum = %1!u!ms, Maximum = %2!u!ms, Average = %3!u!ms\n"
+
+ IDS_WINSOCK_FAIL "Failed to initialize WinSock: %1!d!\n"
END
Modified: trunk/reactos/base/applications/network/ping/ping.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/ping.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/ping.c [iso-8859-1] Tue Sep 27 18:37:45
2016
@@ -55,6 +55,7 @@
static BOOL WINAPI ConsoleCtrlHandler(DWORD ControlType);
static void PrintString(UINT id, ...);
+static HANDLE hStdOut;
static HANDLE hIcmpFile = INVALID_HANDLE_VALUE;
static ULONG Timeout = 4000;
static int Family = AF_UNSPEC;
@@ -82,9 +83,12 @@
WSADATA wsaData;
ULONG i;
DWORD StrLen = 46;
+ int Status;
IpOptions.Ttl = 128;
+ hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
+
if (!ParseCmdLine(argc, argv))
{
return 1;
@@ -92,14 +96,15 @@
if (!SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE))
{
- DPRINT1("Failed to set control handler: %lu\n", GetLastError());
+ DPRINT("Failed to set control handler: %lu\n", GetLastError());
return 1;
}
- if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
- {
- DPRINT1("WSAStartup failed\n");
+ Status = WSAStartup(MAKEWORD(2, 2), &wsaData);
+ if (Status != 0)
+ {
+ PrintString(IDS_WINSOCK_FAIL, Status);
return 1;
}
@@ -113,7 +118,7 @@
if (WSAAddressToStringW(Target->ai_addr, (DWORD)Target->ai_addrlen, NULL,
Address, &StrLen) != 0)
{
- DPRINT1("WSAAddressToStringW failed: %d\n", WSAGetLastError());
+ DPRINT("WSAAddressToStringW failed: %d\n", WSAGetLastError());
FreeAddrInfoW(Target);
WSACleanup();
@@ -132,7 +137,7 @@
if (hIcmpFile == INVALID_HANDLE_VALUE)
{
- DPRINT1("IcmpCreateFile failed: %lu\n", GetLastError());
+ DPRINT("IcmpCreateFile failed: %lu\n", GetLastError());
FreeAddrInfoW(Target);
WSACleanup();
@@ -177,12 +182,12 @@
{
WCHAR Format[1024];
WCHAR Msg[1024];
- DWORD Len;
+ DWORD Len, written;
va_list args;
if (!LoadStringW(GetModuleHandleW(NULL), id, Format, _countof(Format)))
{
- DPRINT1("LoadStringW failed: %lu\n", GetLastError());
+ DPRINT("LoadStringW failed: %lu\n", GetLastError());
return;
}
@@ -196,13 +201,14 @@
if (Len == 0)
{
- DPRINT1("FormatMessageW failed: %lu\n", GetLastError());
+ DPRINT("FormatMessageW failed: %lu\n", GetLastError());
va_end(args);
return;
}
- wprintf(L"%s", Msg);
+ // TODO: Handle writing to file.
+ WriteConsole(hStdOut, Msg, Len, &written, NULL);
va_end(args);
}
@@ -468,9 +474,7 @@
if (Status != 0)
{
- DPRINT1("GetNameInfoW failed: %d\n", Status);
-
- return FALSE;
+ DPRINT("GetNameInfoW failed: %d\n", WSAGetLastError());
}
}
@@ -605,6 +609,8 @@
RTTMax = pEchoReply->RoundTripTime;
}
+ wprintf(L"\n");
+
RTTTotal += pEchoReply->RoundTripTime;
break;
Modified: trunk/reactos/base/applications/network/ping/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ping/resource.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ping/resource.h [iso-8859-1] Tue Sep 27
18:37:45 2016
@@ -28,3 +28,4 @@
#define IDS_TRANSMIT_FAILED 125
#define IDS_STATISTICS 126
#define IDS_APPROXIMATE_RTT 127
+#define IDS_WINSOCK_FAIL 128