Gabriel Ivăncescu : iphlpapi: Implement IcmpSendEcho and IcmpSendEcho2 via IcmpSendEcho2Ex.

Alexandre Julliard julliard at winehq.org
Thu Dec 3 15:35:59 CST 2020


Module: wine
Branch: master
Commit: 7eafc71416d5b5b9e0302e0859f988dfe534b937
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7eafc71416d5b5b9e0302e0859f988dfe534b937

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Mon Nov 23 15:47:42 2020 +0200

iphlpapi: Implement IcmpSendEcho and IcmpSendEcho2 via IcmpSendEcho2Ex.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/iphlpapi/icmp.c | 141 +++++++++++++++++++++++----------------------------
 1 file changed, 64 insertions(+), 77 deletions(-)

diff --git a/dlls/iphlpapi/icmp.c b/dlls/iphlpapi/icmp.c
index 1aeba1c463d..b6d2ffdbc13 100644
--- a/dlls/iphlpapi/icmp.c
+++ b/dlls/iphlpapi/icmp.c
@@ -442,6 +442,50 @@ DWORD WINAPI IcmpSendEcho(
     DWORD                    ReplySize,
     DWORD                    Timeout
     )
+{
+    return IcmpSendEcho2Ex(IcmpHandle, NULL, NULL, NULL, 0, DestinationAddress,
+            RequestData, RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
+}
+
+/***********************************************************************
+ *		IcmpSendEcho2 (IPHLPAPI.@)
+ */
+DWORD WINAPI IcmpSendEcho2(
+    HANDLE                   IcmpHandle,
+    HANDLE                   Event,
+    PIO_APC_ROUTINE          ApcRoutine,
+    PVOID                    ApcContext,
+    IPAddr                   DestinationAddress,
+    LPVOID                   RequestData,
+    WORD                     RequestSize,
+    PIP_OPTION_INFORMATION   RequestOptions,
+    LPVOID                   ReplyBuffer,
+    DWORD                    ReplySize,
+    DWORD                    Timeout
+    )
+{
+    return IcmpSendEcho2Ex(IcmpHandle, Event, ApcRoutine, ApcContext, 0,
+            DestinationAddress, RequestData, RequestSize, RequestOptions,
+            ReplyBuffer, ReplySize, Timeout);
+}
+
+/***********************************************************************
+ *		IcmpSendEcho2Ex (IPHLPAPI.@)
+ */
+DWORD WINAPI IcmpSendEcho2Ex(
+    HANDLE                   IcmpHandle,
+    HANDLE                   Event,
+    PIO_APC_ROUTINE          ApcRoutine,
+    PVOID                    ApcContext,
+    IPAddr                   SourceAddress,
+    IPAddr                   DestinationAddress,
+    LPVOID                   RequestData,
+    WORD                     RequestSize,
+    PIP_OPTION_INFORMATION   RequestOptions,
+    LPVOID                   ReplyBuffer,
+    DWORD                    ReplySize,
+    DWORD                    Timeout
+    )
 {
     icmp_t* icp=(icmp_t*)IcmpHandle;
     struct icmp* icmp_header;
@@ -451,6 +495,10 @@ DWORD WINAPI IcmpSendEcho(
     int reqsize, repsize;
     DWORD send_time;
 
+    TRACE("(%p, %p, %p, %p, %08x, %08x, %p, %d, %p, %p, %d, %d)\n", IcmpHandle,
+            Event, ApcRoutine, ApcContext, SourceAddress, DestinationAddress, RequestData,
+            RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
+
     if (IcmpHandle==INVALID_HANDLE_VALUE) {
         /* FIXME: in fact win98 seems to ignore the handle value !!! */
         SetLastError(ERROR_INVALID_PARAMETER);
@@ -473,6 +521,22 @@ DWORD WINAPI IcmpSendEcho(
         return 0;
     }
 
+    if (Event)
+    {
+        FIXME("unsupported for events\n");
+        return 0;
+    }
+    if (ApcRoutine)
+    {
+        FIXME("unsupported for APCs\n");
+        return 0;
+    }
+    if (SourceAddress)
+    {
+        FIXME("unsupported for source addresses\n");
+        return 0;
+    }
+
     /* Prepare the request */
     id=getpid() & 0xFFFF;
     seq=InterlockedIncrement(&icmp_sequence) & 0xFFFF;
@@ -571,83 +635,6 @@ DWORD WINAPI IcmpSendEcho(
     return icmp_get_reply(icp->sid, buffer, send_time, ReplyBuffer, ReplySize, Timeout);
 }
 
-/***********************************************************************
- *		IcmpSendEcho2 (IPHLPAPI.@)
- */
-DWORD WINAPI IcmpSendEcho2(
-    HANDLE                   IcmpHandle,
-    HANDLE                   Event,
-    PIO_APC_ROUTINE          ApcRoutine,
-    PVOID                    ApcContext,
-    IPAddr                   DestinationAddress,
-    LPVOID                   RequestData,
-    WORD                     RequestSize,
-    PIP_OPTION_INFORMATION   RequestOptions,
-    LPVOID                   ReplyBuffer,
-    DWORD                    ReplySize,
-    DWORD                    Timeout
-    )
-{
-    TRACE("(%p, %p, %p, %p, %08x, %p, %d, %p, %p, %d, %d): stub\n", IcmpHandle,
-            Event, ApcRoutine, ApcContext, DestinationAddress, RequestData,
-            RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
-
-    if (Event)
-    {
-        FIXME("unsupported for events\n");
-        return 0;
-    }
-    if (ApcRoutine)
-    {
-        FIXME("unsupported for APCs\n");
-        return 0;
-    }
-    return IcmpSendEcho(IcmpHandle, DestinationAddress, RequestData,
-            RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
-}
-
-/***********************************************************************
- *		IcmpSendEcho2Ex (IPHLPAPI.@)
- */
-DWORD WINAPI IcmpSendEcho2Ex(
-    HANDLE                   IcmpHandle,
-    HANDLE                   Event,
-    PIO_APC_ROUTINE          ApcRoutine,
-    PVOID                    ApcContext,
-    IPAddr                   SourceAddress,
-    IPAddr                   DestinationAddress,
-    LPVOID                   RequestData,
-    WORD                     RequestSize,
-    PIP_OPTION_INFORMATION   RequestOptions,
-    LPVOID                   ReplyBuffer,
-    DWORD                    ReplySize,
-    DWORD                    Timeout
-    )
-{
-    TRACE("(%p, %p, %p, %p, %08x, %08x, %p, %d, %p, %p, %d, %d): stub\n", IcmpHandle,
-            Event, ApcRoutine, ApcContext, SourceAddress, DestinationAddress, RequestData,
-            RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
-
-    if (Event)
-    {
-        FIXME("unsupported for events\n");
-        return 0;
-    }
-    if (ApcRoutine)
-    {
-        FIXME("unsupported for APCs\n");
-        return 0;
-    }
-    if (SourceAddress)
-    {
-        FIXME("unsupported for source addresses\n");
-        return 0;
-    }
-
-    return IcmpSendEcho(IcmpHandle, DestinationAddress, RequestData,
-            RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
-}
-
 /*
  * Copyright (c) 1989 The Regents of the University of California.
  * All rights reserved.




More information about the wine-cvs mailing list