From 0bdca09a857dcaae920ddf19bdd84d80ff3063c0 Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Sat, 9 Feb 2019 13:23:47 +0100 Subject: [PATCH] [IPHLPAPI] Preserve decoration in exported symbols CORE-8462 CORE-15665 --- dll/win32/iphlpapi/CMakeLists.txt | 2 + dll/win32/iphlpapi/iphlpapi.spec | 53 +++++++---- dll/win32/iphlpapi/iphlpapi_fakestubs.c | 120 ++++++++++++++++++++++++ 3 files changed, 159 insertions(+), 16 deletions(-) create mode 100644 dll/win32/iphlpapi/iphlpapi_fakestubs.c diff --git a/dll/win32/iphlpapi/CMakeLists.txt b/dll/win32/iphlpapi/CMakeLists.txt index 2b47c616296..3bdcb1f71e1 100644 --- a/dll/win32/iphlpapi/CMakeLists.txt +++ b/dll/win32/iphlpapi/CMakeLists.txt @@ -25,6 +25,8 @@ list(APPEND SOURCE add_library(iphlpapi SHARED ${SOURCE} iphlpapi.rc + iphlpapi_fakestubs.c + iphlpapi.spec ${CMAKE_CURRENT_BINARY_DIR}/iphlpapi.def) set_module_type(iphlpapi win32dll UNICODE) diff --git a/dll/win32/iphlpapi/iphlpapi.spec b/dll/win32/iphlpapi/iphlpapi.spec index 9c9c25bac6d..d9a20667939 100644 --- a/dll/win32/iphlpapi/iphlpapi.spec +++ b/dll/win32/iphlpapi/iphlpapi.spec @@ -136,22 +136,43 @@ @ stdcall SetTcpEntry( ptr ) @ stub SetTcpEntryToStack @ stdcall UnenableRouter( ptr ptr ) -@ stub _PfAddFiltersToInterface@24 -@ stub _PfAddGlobalFilterToInterface@8 -@ stub _PfBindInterfaceToIPAddress@12 -@ stub _PfBindInterfaceToIndex@16 -@ stub _PfCreateInterface@24 -@ stub _PfDeleteInterface@4 -@ stub _PfDeleteLog@0 -@ stub _PfGetInterfaceStatistics@16 -@ stub _PfMakeLog@4 -@ stub _PfRebindFilters@8 -@ stub _PfRemoveFilterHandles@12 -@ stub _PfRemoveFiltersFromInterface@20 -@ stub _PfRemoveGlobalFilterFromInterface@8 -@ stub _PfSetLogBuffer@28 -@ stub _PfTestPacket@20 -@ stub _PfUnBindInterface@4 + +# These are actually stubs, but we need to forward them to preserve the decoration. +@ stdcall -arch=i386 _PfAddFiltersToInterface@24() _PfAddFiltersToInterface@24 +@ stdcall -arch=i386 _PfAddGlobalFilterToInterface@8() _PfAddGlobalFilterToInterface@8 +@ stdcall -arch=i386 _PfBindInterfaceToIPAddress@12() _PfBindInterfaceToIPAddress@12 +@ stdcall -arch=i386 _PfBindInterfaceToIndex@16() _PfBindInterfaceToIndex@16 +@ stdcall -arch=i386 _PfCreateInterface@24() _PfCreateInterface@24 +@ stdcall -arch=i386 _PfDeleteInterface@4() _PfDeleteInterface@4 +@ stdcall -arch=i386 _PfDeleteLog@0() _PfDeleteLog@0 +@ stdcall -arch=i386 _PfGetInterfaceStatistics@16() _PfGetInterfaceStatistics@16 +@ stdcall -arch=i386 _PfMakeLog@4() _PfMakeLog@4 +@ stdcall -arch=i386 _PfRebindFilters@8() _PfRebindFilters@8 +@ stdcall -arch=i386 _PfRemoveFilterHandles@12() _PfRemoveFilterHandles@12 +@ stdcall -arch=i386 _PfRemoveFiltersFromInterface@20() _PfRemoveFiltersFromInterface@20 +@ stdcall -arch=i386 _PfRemoveGlobalFilterFromInterface@8() _PfRemoveGlobalFilterFromInterface@8 +@ stdcall -arch=i386 _PfSetLogBuffer@28() _PfSetLogBuffer@28 +@ stdcall -arch=i386 _PfTestPacket@20() _PfTestPacket@20 +@ stdcall -arch=i386 _PfUnBindInterface@4() _PfUnBindInterface@4 + +# x64 does not use decoration in these names +@ stdcall -arch=x86_64 _PfAddFiltersToInterface@24() +@ stdcall -arch=x86_64 _PfAddGlobalFilterToInterface@8() +@ stdcall -arch=x86_64 _PfBindInterfaceToIPAddress@12() +@ stdcall -arch=x86_64 _PfBindInterfaceToIndex@16() +@ stdcall -arch=x86_64 _PfCreateInterface@24() +@ stdcall -arch=x86_64 _PfDeleteInterface@4() +@ stdcall -arch=x86_64 _PfDeleteLog@0() +@ stdcall -arch=x86_64 _PfGetInterfaceStatistics@16() +@ stdcall -arch=x86_64 _PfMakeLog@4() +@ stdcall -arch=x86_64 _PfRebindFilters@8() +@ stdcall -arch=x86_64 _PfRemoveFilterHandles@12() +@ stdcall -arch=x86_64 _PfRemoveFiltersFromInterface@20() +@ stdcall -arch=x86_64 _PfRemoveGlobalFilterFromInterface@8() +@ stdcall -arch=x86_64 _PfSetLogBuffer@28() +@ stdcall -arch=x86_64 _PfTestPacket@20() +@ stdcall -arch=x86_64 _PfUnBindInterface@4() + @ stub do_echo_rep @ stub do_echo_req @ stub register_icmp diff --git a/dll/win32/iphlpapi/iphlpapi_fakestubs.c b/dll/win32/iphlpapi/iphlpapi_fakestubs.c new file mode 100644 index 00000000000..8304b33ffc8 --- /dev/null +++ b/dll/win32/iphlpapi/iphlpapi_fakestubs.c @@ -0,0 +1,120 @@ +#include + +// These are here so we can forward the decorated export functions. +// Without forwarding, we'll lose the decoration +// See: +// https://jira.reactos.org/browse/CORE-8462 +// https://jira.reactos.org/browse/CORE-15665 + +int __stdcall PfAddFiltersToInterface(long a0, long a1, long a2, long a3, long a4, long a5) +{ + DbgPrint("WARNING: calling stub PfAddFiltersToInterface(0x%lx,0x%lx,0x%lx,0x%lx,0x%lx,0x%lx)\n", (long)a0, (long)a1, (long)a2, (long)a3, (long)a4, (long)a5); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfAddGlobalFilterToInterface(long a0, long a1) +{ + DbgPrint("WARNING: calling stub PfAddGlobalFilterToInterface(0x%lx,0x%lx)\n", (long)a0, (long)a1); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfBindInterfaceToIPAddress(long a0, long a1, long a2) +{ + DbgPrint("WARNING: calling stub PfBindInterfaceToIPAddress(0x%lx,0x%lx,0x%lx)\n", (long)a0, (long)a1, (long)a2); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfBindInterfaceToIndex(long a0, long a1, long a2, long a3) +{ + DbgPrint("WARNING: calling stub PfBindInterfaceToIndex(0x%lx,0x%lx,0x%lx,0x%lx)\n", (long)a0, (long)a1, (long)a2, (long)a3); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfCreateInterface(long a0, long a1, long a2, long a3, long a4, long a5) +{ + DbgPrint("WARNING: calling stub PfCreateInterface(0x%lx,0x%lx,0x%lx,0x%lx,0x%lx,0x%lx)\n", (long)a0, (long)a1, (long)a2, (long)a3, (long)a4, (long)a5); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfDeleteInterface(long a0) +{ + DbgPrint("WARNING: calling stub PfDeleteInterface(0x%lx)\n", (long)a0); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfDeleteLog() +{ + DbgPrint("WARNING: calling stub PfDeleteLog()\n"); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfGetInterfaceStatistics(long a0, long a1, long a2, long a3) +{ + DbgPrint("WARNING: calling stub PfGetInterfaceStatistics(0x%lx,0x%lx,0x%lx,0x%lx)\n", (long)a0, (long)a1, (long)a2, (long)a3); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfMakeLog(long a0) +{ + DbgPrint("WARNING: calling stub PfMakeLog(0x%lx)\n", (long)a0); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfRebindFilters(long a0, long a1) +{ + DbgPrint("WARNING: calling stub PfRebindFilters(0x%lx,0x%lx)\n", (long)a0, (long)a1); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfRemoveFilterHandles(long a0, long a1, long a2) +{ + DbgPrint("WARNING: calling stub PfRemoveFilterHandles(0x%lx,0x%lx,0x%lx)\n", (long)a0, (long)a1, (long)a2); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfRemoveFiltersFromInterface(long a0, long a1, long a2, long a3, long a4) +{ + DbgPrint("WARNING: calling stub PfRemoveFiltersFromInterface(0x%lx,0x%lx,0x%lx,0x%lx,0x%lx)\n", (long)a0, (long)a1, (long)a2, (long)a3, (long)a4); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfRemoveGlobalFilterFromInterface(long a0, long a1) +{ + DbgPrint("WARNING: calling stub PfRemoveGlobalFilterFromInterface(0x%lx,0x%lx)\n", (long)a0, (long)a1); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfSetLogBuffer(long a0, long a1, long a2, long a3, long a4, long a5, long a6) +{ + DbgPrint("WARNING: calling stub PfSetLogBuffer(0x%lx,0x%lx,0x%lx,0x%lx,0x%lx,0x%lx,0x%lx)\n", (long)a0, (long)a1, (long)a2, (long)a3, (long)a4, (long)a5, (long)a6); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfTestPacket(long a0, long a1, long a2, long a3, long a4) +{ + DbgPrint("WARNING: calling stub PfTestPacket(0x%lx,0x%lx,0x%lx,0x%lx,0x%lx)\n", (long)a0, (long)a1, (long)a2, (long)a3, (long)a4); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} + +int __stdcall PfUnBindInterface(long a0) +{ + DbgPrint("WARNING: calling stub PfUnBindInterface(0x%lx)\n", (long)a0); + __wine_spec_unimplemented_stub("iphlpapi.dll", __FUNCTION__); + return 0; +} +