https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8ba4b11a33ccf792b7f97181637d940a8a44e699

commit 8ba4b11a33ccf792b7f97181637d940a8a44e699
Author:     Serge Gautherie <[email protected]>
AuthorDate: Fri May 4 23:25:24 2018 +0200
Commit:     Mark Jansen <[email protected]>
CommitDate: Sat Aug 17 17:48:21 2019 +0200

    [IPHLPAPI] icmp.c: Complete sync with Wine Staging 1.7.55
    
    - Restore a missing brace.
    - Mark all our differences (at that time). Please inspect them.
    
    CORE-10536
---
 dll/win32/iphlpapi/icmp.c | 28 ++++++++++++++++++++++++++++
 media/doc/README.WINE     |  2 +-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/dll/win32/iphlpapi/icmp.c b/dll/win32/iphlpapi/icmp.c
index 95fbe1bdca3..2dcf4bbafc5 100644
--- a/dll/win32/iphlpapi/icmp.c
+++ b/dll/win32/iphlpapi/icmp.c
@@ -603,6 +603,7 @@ DWORD WINAPI IcmpSendEcho(
         WARN("using system ping command since SOCK_RAW was not supported.\n");
         return system_icmp(DestinationAddress, RequestData, RequestSize,
                            RequestOptions, ReplyBuffer, ReplySize, Timeout);
+    }
 #endif
 
     /* Prepare the request */
@@ -702,7 +703,11 @@ DWORD WINAPI IcmpSendEcho(
 #endif
 
     send_time = GetTickCount();
+#ifdef __REACTOS__
     res=sendto(icp->sid, (const char*)reqbuf, reqsize, 0, (struct 
sockaddr*)&addr, sizeof(addr));
+#else
+    res=sendto(icp->sid, reqbuf, reqsize, 0, (struct sockaddr*)&addr, 
sizeof(addr));
+#endif
     HeapFree(GetProcessHeap (), 0, reqbuf);
     if (res<0) {
         DWORD dwBestIfIndex;
@@ -716,6 +721,7 @@ DWORD WINAPI IcmpSendEcho(
             memcpy(&ier->Address, &IP4Addr, sizeof(IP4Addr));
         }
 
+#ifdef __REACTOS__
         if (WSAGetLastError()==WSAEMSGSIZE)
             ier->Status = IP_PACKET_TOO_BIG;
         else {
@@ -733,6 +739,24 @@ DWORD WINAPI IcmpSendEcho(
             }
         }
         return 1;
+#else
+        if (errno==EMSGSIZE)
+            SetLastError(IP_PACKET_TOO_BIG);
+        else {
+            switch (errno) {
+            case ENETUNREACH:
+                SetLastError(IP_DEST_NET_UNREACHABLE);
+                break;
+            case EHOSTUNREACH:
+                SetLastError(IP_DEST_HOST_UNREACHABLE);
+                break;
+            default:
+                TRACE("unknown error: errno=%d\n",errno);
+                SetLastError(IP_GENERAL_FAILURE);
+            }
+        }
+        return 0;
+#endif
     }
 
     /* Get the reply */
@@ -744,7 +768,11 @@ DWORD WINAPI IcmpSendEcho(
     while (poll(&fdr,1,Timeout)>0) {
 #endif
         recv_time = GetTickCount();
+#ifdef __REACTOS__
         res=recvfrom(icp->sid, (char*)ip_header, maxlen, 0, (struct 
sockaddr*)&addr,(int*)&addrlen);
+#else
+        res=recvfrom(icp->sid, (char*)ip_header, maxlen, 0, (struct 
sockaddr*)&addr,&addrlen);
+#endif
         TRACE("received %d bytes from %s\n",res, inet_ntoa(addr.sin_addr));
         ier->Status=IP_REQ_TIMED_OUT;
         if (res < 0)
diff --git a/media/doc/README.WINE b/media/doc/README.WINE
index ebd0f73d913..195f9543d68 100644
--- a/media/doc/README.WINE
+++ b/media/doc/README.WINE
@@ -269,7 +269,7 @@ gdi32 -
   reactos/dll/win32/gdi32/objects/linedda.c     # Synced at 20090410
 
 iphlpapi -
-  reactos/dll/win32/iphlpapi/icmp.c # Partially synced to WineStaging-1.7.55
+  reactos/dll/win32/iphlpapi/icmp.c # Synced to WineStaging-1.7.55
 
 kernel32 -
   reactos/dll/win32/kernel32/wine/actctx.c               # Partly synced with 
Wine 1.7.55

Reply via email to