forked from Frogging-Family/wine-tkg-git
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
From f5c17d210899d60d6ce716840b3b328f8373823e Mon Sep 17 00:00:00 2001 | ||
From 3f8a97e7485424ec6b2c6187cb118dcce66dac76 Mon Sep 17 00:00:00 2001 | ||
From: Marc-Aurel Zent <[email protected]> | ||
Date: Thu, 11 Jan 2024 23:54:49 +0100 | ||
Subject: [PATCH] iphlpapi: Implement GetRTTAndHopCount. | ||
Subject: [PATCH] iphlpapi: Implement GetRTTAndHopCount(). | ||
|
||
--- | ||
dlls/iphlpapi/iphlpapi_main.c | 55 ++++++++++++++++++++++++++++++----- | ||
1 file changed, 47 insertions(+), 8 deletions(-) | ||
dlls/iphlpapi/iphlpapi_main.c | 52 +++++++++++++++++++++++++++++------ | ||
1 file changed, 44 insertions(+), 8 deletions(-) | ||
|
||
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c | ||
index e9c57ada7..404166e68 100644 | ||
index 9c7582b71fb..1ee4942b57c 100644 | ||
--- a/dlls/iphlpapi/iphlpapi_main.c | ||
+++ b/dlls/iphlpapi/iphlpapi_main.c | ||
@@ -2766,15 +2766,54 @@ DWORD WINAPI GetPerAdapterInfo( ULONG index, IP_PER_ADAPTER_INFO *info, ULONG *s | ||
@@ -2781,15 +2781,51 @@ DWORD WINAPI GetPerAdapterInfo( ULONG index, IP_PER_ADAPTER_INFO *info, ULONG *s | ||
* RETURNS | ||
* Success: TRUE | ||
* Failure: FALSE | ||
|
@@ -25,33 +25,30 @@ index e9c57ada7..404166e68 100644 | |
- DestIpAddress, HopCount, MaxHops, RTT); | ||
- return FALSE; | ||
+BOOL WINAPI GetRTTAndHopCount( IPAddr DestIpAddress, PULONG HopCount, ULONG MaxHops, PULONG RTT ) | ||
+{ | ||
+ char send_buffer[0x20] = {0xDE, 0xAD, 0xBE, 0xEF}; | ||
+ char receive_buffer[0x1000]; | ||
+ const DWORD timeout = 3000; | ||
+{ | ||
+ char send_buffer[0x20] = { 0xDE, 0xAD, 0xBE, 0xEF }; | ||
+ char receive_buffer[sizeof(ICMP_ECHO_REPLY) + sizeof(send_buffer)]; | ||
+ const DWORD timeout = 5000; | ||
+ DWORD replies; | ||
+ IP_OPTION_INFORMATION send_options = {0}; | ||
+ IP_OPTION_INFORMATION send_options = { 0 }; | ||
+ PICMP_ECHO_REPLY reply; | ||
+ HANDLE icmp_handle; | ||
+ | ||
+ TRACE( "(DestIpAddress 0x%08lx, HopCount %p, MaxHops %ld, RTT %p)\n", | ||
+ DestIpAddress, HopCount, MaxHops, RTT ); | ||
+ | ||
+ if (!HopCount || !RTT || DestIpAddress == -1) | ||
+ return FALSE; | ||
+ | ||
+ if (IsBadWritePtr( HopCount, sizeof(ULONG) ) || IsBadWritePtr( RTT, sizeof(ULONG) )) | ||
+ if (!HopCount || !RTT || DestIpAddress == INADDR_NONE) | ||
+ return FALSE; | ||
+ | ||
+ if ((icmp_handle = IcmpCreateFile()) == INVALID_HANDLE_VALUE) | ||
+ return FALSE; | ||
+ | ||
+ for (send_options.Ttl = 1; send_options.Ttl <= MaxHops; send_options.Ttl++) | ||
+ for (send_options.Ttl = 1; send_options.Ttl <= MaxHops; send_options.Ttl++) | ||
+ { | ||
+ replies = IcmpSendEcho( icmp_handle, DestIpAddress, send_buffer, sizeof(send_buffer), | ||
+ &send_options, receive_buffer, sizeof(receive_buffer), timeout ); | ||
+ | ||
+ if (!replies) | ||
+ if (!replies) | ||
+ { | ||
+ if (GetLastError() == IP_TTL_EXPIRED_TRANSIT) continue; | ||
+ if (GetLastError() == IP_REQ_TIMED_OUT) continue; | ||
|
@@ -60,7 +57,7 @@ index e9c57ada7..404166e68 100644 | |
+ | ||
+ reply = (PICMP_ECHO_REPLY)receive_buffer; | ||
+ | ||
+ if (reply->Status == IP_SUCCESS) | ||
+ if (reply->Status == IP_SUCCESS) | ||
+ { | ||
+ *HopCount = send_options.Ttl; | ||
+ *RTT = reply->RoundTripTime; | ||
|
@@ -72,5 +69,8 @@ index e9c57ada7..404166e68 100644 | |
+ IcmpCloseHandle( icmp_handle ); | ||
+ return FALSE; | ||
} | ||
|
||
/****************************************************************** | ||
-- | ||
2.39.3 (Apple Git-145) | ||
|
||
/****************************************************************** |