From f3fa809e50fbe5e38be03923f30e8e982f42dbcc Mon Sep 17 00:00:00 2001 From: Marko Hauptvogel Date: Sun, 7 Sep 2014 19:03:20 +0200 Subject: [PATCH] iphlpapi: Implement icmpv6 create function. --- dlls/iphlpapi/icmp.c | 31 +++++++++++++++++++++++++++++++ dlls/iphlpapi/iphlpapi.spec | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/dlls/iphlpapi/icmp.c b/dlls/iphlpapi/icmp.c index abd8ddca22b..5ce758b0a20 100644 --- a/dlls/iphlpapi/icmp.c +++ b/dlls/iphlpapi/icmp.c @@ -147,6 +147,37 @@ static int in_cksum(u_short *addr, int len) * Exported Routines. */ +/*********************************************************************** + * Icmp6CreateFile (IPHLPAPI.@) + */ +HANDLE WINAPI Icmp6CreateFile(VOID) +{ + icmp_t* icp; + + int sid=socket(AF_INET6,SOCK_RAW,IPPROTO_ICMPV6); + if (sid < 0) + { + /* Mac OS X supports non-privileged ICMP via SOCK_DGRAM type. */ + sid=socket(AF_INET6,SOCK_DGRAM,IPPROTO_ICMPV6); + } + if (sid < 0) { + ERR_(winediag)("Failed to use ICMPV6 (network ping), this requires special permissions.\n"); + SetLastError(ERROR_ACCESS_DENIED); + return INVALID_HANDLE_VALUE; + } + + icp=HeapAlloc(GetProcessHeap(), 0, sizeof(*icp)); + if (icp==NULL) { + close(sid); + SetLastError(IP_NO_RESOURCES); + return INVALID_HANDLE_VALUE; + } + icp->sid=sid; + icp->default_opts.OptionsSize=IP_OPTS_UNKNOWN; + return (HANDLE)icp; +} + + /*********************************************************************** * IcmpCreateFile (IPHLPAPI.@) */ diff --git a/dlls/iphlpapi/iphlpapi.spec b/dlls/iphlpapi/iphlpapi.spec index 9e66d67474e..9fb8adaae51 100644 --- a/dlls/iphlpapi/iphlpapi.spec +++ b/dlls/iphlpapi/iphlpapi.spec @@ -150,7 +150,7 @@ #@ stub GetUnicastIpAddressEntry #@ stub GetUnicastIpAddressTable @ stdcall GetUniDirectionalAdapterInfo( ptr ptr ) -#@ stub Icmp6CreateFile +@ stdcall Icmp6CreateFile() #@ stub Icmp6ParseReplies #@ stub Icmp6SendEcho2 @ stdcall IcmpCloseHandle(ptr)