From 947c03e9483ba5e20cb083de519c463adf37643b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 15 Aug 2023 17:01:34 +0300 Subject: [PATCH] [WS2_32][WS2HELP] On Vista+ forward all ws2help to ws2_32 --- dll/win32/ws2_32/CMakeLists.txt | 3 ++ dll/win32/ws2_32/src/dllmain.c | 19 +++++++++ dll/win32/ws2_32/ws2_32.spec | 48 ++++++++++----------- dll/win32/ws2help/CMakeLists.txt | 8 +++- dll/win32/ws2help/dllmain.c | 7 ++-- dll/win32/ws2help/ws2help.spec | 71 +++++++++++++++++++++----------- 6 files changed, 105 insertions(+), 51 deletions(-) diff --git a/dll/win32/ws2_32/CMakeLists.txt b/dll/win32/ws2_32/CMakeLists.txt index d5a85ffb3fc..300549585b3 100644 --- a/dll/win32/ws2_32/CMakeLists.txt +++ b/dll/win32/ws2_32/CMakeLists.txt @@ -53,6 +53,9 @@ add_library(ws2_32 MODULE set_module_type(ws2_32 win32dll) target_link_libraries(ws2_32 ${PSEH_LIB}) +if(DLL_EXPORT_VERSION GREATER_EQUAL 0x600) + target_link_libraries(ws2_32 ws2help_static) +endif() add_importlibs(ws2_32 user32 advapi32 ws2help msvcrt kernel32 ntdll) add_pch(ws2_32 inc/ws2_32.h SOURCE) add_cd_file(TARGET ws2_32 DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/ws2_32/src/dllmain.c b/dll/win32/ws2_32/src/dllmain.c index 67d7c432fe1..31f82170b87 100644 --- a/dll/win32/ws2_32/src/dllmain.c +++ b/dll/win32/ws2_32/src/dllmain.c @@ -24,6 +24,15 @@ DWORD GlobalTlsIndex = TLS_OUT_OF_INDEXES; /* FUNCTIONS *****************************************************************/ +#if (DLL_EXPORT_VERSION >= _WIN32_WINNT_VISTA) +BOOL +APIENTRY +Ws2HelpDllMain( + HANDLE hModule, + DWORD dwReason, + LPVOID lpReserved); +#endif + BOOL APIENTRY DllMain(HANDLE hModule, @@ -32,6 +41,16 @@ DllMain(HANDLE hModule, { PWSPROCESS WsProcess; +#if (DLL_EXPORT_VERSION >= _WIN32_WINNT_VISTA) + /* Initialize ws2help */ + if (!Ws2HelpDllMain(hModule, dwReason, lpReserved)) + { + /* Should never happen */ + ASSERT(FALSE); + return FALSE; + } +#endif + /* Main Entrypoint */ switch (dwReason) { diff --git a/dll/win32/ws2_32/ws2_32.spec b/dll/win32/ws2_32/ws2_32.spec index c1c0340cbe2..3b935d35aef 100644 --- a/dll/win32/ws2_32/ws2_32.spec +++ b/dll/win32/ws2_32/ws2_32.spec @@ -156,30 +156,30 @@ @ stdcall -stub -arch=win64 WSCWriteNameSpaceOrder32(ptr long) @ stdcall WSCWriteProviderOrder(ptr long) @ stdcall -stub -arch=win64 WSCWriteProviderOrder32(ptr long) -@ stdcall -stub -version=0x600+ WahCloseApcHelper(long) -@ stdcall -stub -version=0x600+ WahCloseHandleHelper(long) -@ stdcall -stub -version=0x600+ WahCloseNotificationHandleHelper(long) -@ stdcall -stub -version=0x600+ WahCloseSocketHandle(long ptr) -@ stdcall -stub -version=0x600+ WahCloseThread(long ptr) -@ stdcall -stub -version=0x600+ WahCompleteRequest(long ptr ptr long long) -@ stdcall -stub -version=0x600+ WahCreateHandleContextTable(ptr) -@ stdcall -stub -version=0x600+ WahCreateNotificationHandle(long ptr) -@ stdcall -stub -version=0x600+ WahCreateSocketHandle(long ptr) -@ stdcall -stub -version=0x600+ WahDestroyHandleContextTable(ptr) -@ stdcall -stub -version=0x600+ WahDisableNonIFSHandleSupport() -@ stdcall -stub -version=0x600+ WahEnableNonIFSHandleSupport() -@ stdcall -stub -version=0x600+ WahEnumerateHandleContexts(ptr ptr ptr) -@ stdcall -stub -version=0x600+ WahInsertHandleContext(ptr ptr) -@ stdcall -stub -version=0x600+ WahNotifyAllProcesses(long) -@ stdcall -stub -version=0x600+ WahOpenApcHelper(ptr) -@ stdcall -stub -version=0x600+ WahOpenCurrentThread(long ptr) -@ stdcall -stub -version=0x600+ WahOpenHandleHelper(ptr) -@ stdcall -stub -version=0x600+ WahOpenNotificationHandleHelper(ptr) -@ stdcall -stub -version=0x600+ WahQueueUserApc(long ptr ptr ptr) -@ stdcall -stub -version=0x600+ WahReferenceContextByHandle(ptr long) -@ stdcall -stub -version=0x600+ WahRemoveHandleContext(ptr ptr) -@ stdcall -stub -version=0x600+ WahWaitForNotification(long long ptr ptr) -@ stub -version=0x600+ WahWriteLSPEvent +@ stdcall -version=0x600+ WahCloseApcHelper(long) +@ stdcall -version=0x600+ WahCloseHandleHelper(long) +@ stdcall -version=0x600+ WahCloseNotificationHandleHelper(long) +@ stdcall -version=0x600+ WahCloseSocketHandle(long ptr) +@ stdcall -version=0x600+ WahCloseThread(long ptr) +@ stdcall -version=0x600+ WahCompleteRequest(long ptr ptr long long) +@ stdcall -version=0x600+ WahCreateHandleContextTable(ptr) +@ stdcall -version=0x600+ WahCreateNotificationHandle(long ptr) +@ stdcall -version=0x600+ WahCreateSocketHandle(long ptr) +@ stdcall -version=0x600+ WahDestroyHandleContextTable(ptr) +@ stdcall -version=0x600+ WahDisableNonIFSHandleSupport() +@ stdcall -version=0x600+ WahEnableNonIFSHandleSupport() +@ stdcall -version=0x600+ WahEnumerateHandleContexts(ptr ptr ptr) +@ stdcall -version=0x600+ WahInsertHandleContext(ptr ptr) +@ stdcall -version=0x600+ WahNotifyAllProcesses(long) +@ stdcall -version=0x600+ WahOpenApcHelper(ptr) +@ stdcall -version=0x600+ WahOpenCurrentThread(long ptr) +@ stdcall -version=0x600+ WahOpenHandleHelper(ptr) +@ stdcall -version=0x600+ WahOpenNotificationHandleHelper(ptr) +@ stdcall -version=0x600+ WahQueueUserApc(long ptr ptr ptr) +@ stdcall -version=0x600+ WahReferenceContextByHandle(ptr long) +@ stdcall -version=0x600+ WahRemoveHandleContext(ptr ptr) +@ stdcall -version=0x600+ WahWaitForNotification(long long ptr ptr) +@ stdcall -stub -version=0x600+ WahWriteLSPEvent(ptr ptr) @ stdcall freeaddrinfo(ptr) @ stdcall getaddrinfo(str str ptr ptr) @ stdcall getnameinfo(ptr long ptr long ptr long long) diff --git a/dll/win32/ws2help/CMakeLists.txt b/dll/win32/ws2help/CMakeLists.txt index 15450e7c056..0cde56df448 100644 --- a/dll/win32/ws2help/CMakeLists.txt +++ b/dll/win32/ws2help/CMakeLists.txt @@ -10,12 +10,18 @@ list(APPEND SOURCE notify.c precomp.h) +add_library(ws2help_static ${SOURCE}) +add_dependencies(ws2help_static xdk) + add_library(ws2help MODULE - ${SOURCE} ws2help.rc ${CMAKE_CURRENT_BINARY_DIR}/ws2help.def) set_module_type(ws2help win32dll) +if(DLL_EXPORT_VERSION LESS 0x600) + target_link_libraries(ws2help ws2help_static) + set_entrypoint(ws2help Ws2HelpDllMain 12) +endif() add_importlibs(ws2help advapi32 ws2_32 msvcrt kernel32 ntdll) add_pch(ws2help precomp.h SOURCE) add_cd_file(TARGET ws2help DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/ws2help/dllmain.c b/dll/win32/ws2help/dllmain.c index 40db90be4d2..68a507c0af8 100644 --- a/dll/win32/ws2help/dllmain.c +++ b/dll/win32/ws2help/dllmain.c @@ -120,9 +120,10 @@ Ws2helpInitialize(VOID) BOOL APIENTRY -DllMain(HANDLE hModule, - DWORD dwReason, - LPVOID lpReserved) +Ws2HelpDllMain( + HANDLE hModule, + DWORD dwReason, + LPVOID lpReserved) { switch (dwReason) { diff --git a/dll/win32/ws2help/ws2help.spec b/dll/win32/ws2help/ws2help.spec index 6786484f375..2ce90b61aef 100644 --- a/dll/win32/ws2help/ws2help.spec +++ b/dll/win32/ws2help/ws2help.spec @@ -1,23 +1,48 @@ -@ stdcall WahCloseApcHelper(long) -@ stdcall WahCloseHandleHelper(long) -@ stdcall WahCloseNotificationHandleHelper(long) -@ stdcall WahCloseSocketHandle(long ptr) -@ stdcall WahCloseThread(long ptr) -@ stdcall WahCompleteRequest(long ptr ptr long long) -@ stdcall WahCreateHandleContextTable(ptr) -@ stdcall WahCreateNotificationHandle(long ptr) -@ stdcall WahCreateSocketHandle(long ptr) -@ stdcall WahDestroyHandleContextTable(ptr) -@ stdcall WahDisableNonIFSHandleSupport() -@ stdcall WahEnableNonIFSHandleSupport() -@ stdcall WahEnumerateHandleContexts(ptr ptr ptr) -@ stdcall WahInsertHandleContext(ptr ptr) -@ stdcall WahNotifyAllProcesses(long) -@ stdcall WahOpenApcHelper(ptr) -@ stdcall WahOpenCurrentThread(long ptr) -@ stdcall WahOpenHandleHelper(ptr) -@ stdcall WahOpenNotificationHandleHelper(ptr) -@ stdcall WahQueueUserApc(long ptr ptr ptr) -@ stdcall WahReferenceContextByHandle(ptr long) -@ stdcall WahRemoveHandleContext(ptr ptr) -@ stdcall WahWaitForNotification(long long ptr ptr) +@ stdcall -version=0x400-0x503 WahCloseApcHelper(long) +@ stdcall -version=0x400-0x503 WahCloseHandleHelper(long) +@ stdcall -version=0x400-0x503 WahCloseNotificationHandleHelper(long) +@ stdcall -version=0x400-0x503 WahCloseSocketHandle(long ptr) +@ stdcall -version=0x400-0x503 WahCloseThread(long ptr) +@ stdcall -version=0x400-0x503 WahCompleteRequest(long ptr ptr long long) +@ stdcall -version=0x400-0x503 WahCreateHandleContextTable(ptr) +@ stdcall -version=0x400-0x503 WahCreateNotificationHandle(long ptr) +@ stdcall -version=0x400-0x503 WahCreateSocketHandle(long ptr) +@ stdcall -version=0x400-0x503 WahDestroyHandleContextTable(ptr) +@ stdcall -version=0x400-0x503 WahDisableNonIFSHandleSupport() +@ stdcall -version=0x400-0x503 WahEnableNonIFSHandleSupport() +@ stdcall -version=0x400-0x503 WahEnumerateHandleContexts(ptr ptr ptr) +@ stdcall -version=0x400-0x503 WahInsertHandleContext(ptr ptr) +@ stdcall -version=0x400-0x503 WahNotifyAllProcesses(long) +@ stdcall -version=0x400-0x503 WahOpenApcHelper(ptr) +@ stdcall -version=0x400-0x503 WahOpenCurrentThread(long ptr) +@ stdcall -version=0x400-0x503 WahOpenHandleHelper(ptr) +@ stdcall -version=0x400-0x503 WahOpenNotificationHandleHelper(ptr) +@ stdcall -version=0x400-0x503 WahQueueUserApc(long ptr ptr ptr) +@ stdcall -version=0x400-0x503 WahReferenceContextByHandle(ptr long) +@ stdcall -version=0x400-0x503 WahRemoveHandleContext(ptr ptr) +@ stdcall -version=0x400-0x503 WahWaitForNotification(long long ptr ptr) + +@ stdcall -version=0x600+ WahCloseApcHelper(long) ws2_32.WahCloseApcHelper +@ stdcall -version=0x600+ WahCloseHandleHelper(long) ws2_32.WahCloseHandleHelper +@ stdcall -version=0x600+ WahCloseNotificationHandleHelper(long) ws2_32.WahCloseNotificationHandleHelper +@ stdcall -version=0x600+ WahCloseSocketHandle(long ptr) ws2_32.WahCloseSocketHandle +@ stdcall -version=0x600+ WahCloseThread(long ptr) ws2_32.WahCloseThread +@ stdcall -version=0x600+ WahCompleteRequest(long ptr ptr long long) ws2_32.WahCompleteRequest +@ stdcall -version=0x600+ WahCreateHandleContextTable(ptr) ws2_32.WahCreateHandleContextTable +@ stdcall -version=0x600+ WahCreateNotificationHandle(long ptr) ws2_32.WahCreateNotificationHandle +@ stdcall -version=0x600+ WahCreateSocketHandle(long ptr) ws2_32.WahCreateSocketHandle +@ stdcall -version=0x600+ WahDestroyHandleContextTable(ptr) ws2_32.WahDestroyHandleContextTable +@ stdcall -version=0x600+ WahDisableNonIFSHandleSupport() ws2_32.WahDisableNonIFSHandleSupport +@ stdcall -version=0x600+ WahEnableNonIFSHandleSupport() ws2_32.WahEnableNonIFSHandleSupport +@ stdcall -version=0x600+ WahEnumerateHandleContexts(ptr ptr ptr) ws2_32.WahEnumerateHandleContexts +@ stdcall -version=0x600+ WahInsertHandleContext(ptr ptr) ws2_32.WahInsertHandleContext +@ stdcall -version=0x600+ WahNotifyAllProcesses(long) ws2_32.WahNotifyAllProcesses +@ stdcall -version=0x600+ WahOpenApcHelper(ptr) ws2_32.WahOpenApcHelper +@ stdcall -version=0x600+ WahOpenCurrentThread(long ptr) ws2_32.WahOpenCurrentThread +@ stdcall -version=0x600+ WahOpenHandleHelper(ptr) ws2_32.WahOpenHandleHelper +@ stdcall -version=0x600+ WahOpenNotificationHandleHelper(ptr) ws2_32.WahOpenNotificationHandleHelper +@ stdcall -version=0x600+ WahQueueUserApc(long ptr ptr ptr) ws2_32.WahQueueUserApc +@ stdcall -version=0x600+ WahReferenceContextByHandle(ptr long) ws2_32.WahReferenceContextByHandle +@ stdcall -version=0x600+ WahRemoveHandleContext(ptr ptr) ws2_32.WahRemoveHandleContext +@ stdcall -version=0x600+ WahWaitForNotification(long long ptr ptr) ws2_32.WahWaitForNotification +#@ stdcall -version=0x600+ WahWriteLSPEvent(ptr ptr) ws2_32.WahWriteLSPEvent