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.
Merge pull request #18 from rankynbass/wine-xiv-9-pr
Changes for 9.0-staging (no wayland)
- Loading branch information
Showing
4 changed files
with
89 additions
and
18 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
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
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
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
From f5c17d210899d60d6ce716840b3b328f8373823e 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. | ||
|
||
--- | ||
dlls/iphlpapi/iphlpapi_main.c | 55 ++++++++++++++++++++++++++++++----- | ||
1 file changed, 47 insertions(+), 8 deletions(-) | ||
|
||
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c | ||
index e9c57ada7..404166e68 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 | ||
* RETURNS | ||
* Success: TRUE | ||
* Failure: FALSE | ||
- * | ||
- * FIXME | ||
- * Stub, returns FALSE. | ||
*/ | ||
-BOOL WINAPI GetRTTAndHopCount(IPAddr DestIpAddress, PULONG HopCount, ULONG MaxHops, PULONG RTT) | ||
-{ | ||
- FIXME("(DestIpAddress 0x%08lx, HopCount %p, MaxHops %ld, RTT %p): stub\n", | ||
- 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; | ||
+ DWORD replies; | ||
+ 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) )) | ||
+ return FALSE; | ||
+ | ||
+ if ((icmp_handle = IcmpCreateFile()) == INVALID_HANDLE_VALUE) | ||
+ return FALSE; | ||
+ | ||
+ 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 (GetLastError() == IP_TTL_EXPIRED_TRANSIT) continue; | ||
+ if (GetLastError() == IP_REQ_TIMED_OUT) continue; | ||
+ break; | ||
+ } | ||
+ | ||
+ reply = (PICMP_ECHO_REPLY)receive_buffer; | ||
+ | ||
+ if (reply->Status == IP_SUCCESS) | ||
+ { | ||
+ *HopCount = send_options.Ttl; | ||
+ *RTT = reply->RoundTripTime; | ||
+ IcmpCloseHandle( icmp_handle ); | ||
+ return TRUE; | ||
+ } | ||
+ } | ||
+ | ||
+ IcmpCloseHandle( icmp_handle ); | ||
+ return FALSE; | ||
} | ||
|
||
/****************************************************************** |