From b09a63709bc5f5ed4859ec84e84edd79109d3f6a Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Thu, 21 Dec 2017 13:36:04 +0100 Subject: [PATCH] [WS2_32_APITEST] Improve the existing PCH and make use of it. --- modules/rostests/apitests/ws2_32/CMakeLists.txt | 5 +++-- modules/rostests/apitests/ws2_32/WSAAsync.c | 6 +----- modules/rostests/apitests/ws2_32/WSAIoctl.c | 6 ++---- modules/rostests/apitests/ws2_32/WSARecv.c | 5 ----- modules/rostests/apitests/ws2_32/WSAStartup.c | 10 +--------- modules/rostests/apitests/ws2_32/bind.c | 11 +---------- modules/rostests/apitests/ws2_32/close.c | 5 ----- modules/rostests/apitests/ws2_32/getaddrinfo.c | 11 +---------- modules/rostests/apitests/ws2_32/getnameinfo.c | 11 +---------- modules/rostests/apitests/ws2_32/getservbyname.c | 10 +--------- modules/rostests/apitests/ws2_32/getservbyport.c | 10 +--------- modules/rostests/apitests/ws2_32/helpers.c | 3 --- modules/rostests/apitests/ws2_32/ioctlsocket.c | 3 --- modules/rostests/apitests/ws2_32/nonblocking.c | 6 +----- modules/rostests/apitests/ws2_32/nostartup.c | 11 +---------- modules/rostests/apitests/ws2_32/recv.c | 9 ++++----- modules/rostests/apitests/ws2_32/send.c | 7 +------ modules/rostests/apitests/ws2_32/ws2_32.h | 11 +++++++++-- 18 files changed, 28 insertions(+), 112 deletions(-) diff --git a/modules/rostests/apitests/ws2_32/CMakeLists.txt b/modules/rostests/apitests/ws2_32/CMakeLists.txt index 1538e291fb8..cd63545a38f 100644 --- a/modules/rostests/apitests/ws2_32/CMakeLists.txt +++ b/modules/rostests/apitests/ws2_32/CMakeLists.txt @@ -16,10 +16,11 @@ list(APPEND SOURCE WSAIoctl.c WSARecv.c WSAStartup.c - testlist.c) + ws2_32.h) -add_executable(ws2_32_apitest ${SOURCE}) +add_executable(ws2_32_apitest ${SOURCE} testlist.c) target_link_libraries(ws2_32_apitest wine ${PSEH_LIB}) set_module_type(ws2_32_apitest win32cui) add_importlibs(ws2_32_apitest ws2_32 msvcrt iphlpapi kernel32 ntdll) +add_pch(ws2_32_apitest ws2_32.h SOURCE) add_rostests_file(TARGET ws2_32_apitest) diff --git a/modules/rostests/apitests/ws2_32/WSAAsync.c b/modules/rostests/apitests/ws2_32/WSAAsync.c index 083d2cca3f9..6d784f1e167 100644 --- a/modules/rostests/apitests/ws2_32/WSAAsync.c +++ b/modules/rostests/apitests/ws2_32/WSAAsync.c @@ -5,11 +5,7 @@ * PROGRAMMERS: Miroslav Mastny */ -#include - -#include -#include -#include +#include "ws2_32.h" #define SVR_PORT 5000 #define WAIT_TIMEOUT_ 10000 diff --git a/modules/rostests/apitests/ws2_32/WSAIoctl.c b/modules/rostests/apitests/ws2_32/WSAIoctl.c index 2e1f72273f3..5f98c017b16 100644 --- a/modules/rostests/apitests/ws2_32/WSAIoctl.c +++ b/modules/rostests/apitests/ws2_32/WSAIoctl.c @@ -6,11 +6,9 @@ * PROGRAMMERS: Andreas Maier */ -#include +#include "ws2_32.h" -#include -#include "ws2tcpip.h" -#include "iphlpapi.h" +#include void traceaddr(char* txt, sockaddr_gen a) { diff --git a/modules/rostests/apitests/ws2_32/WSARecv.c b/modules/rostests/apitests/ws2_32/WSARecv.c index 051a1ce9f97..4a076b2f96e 100644 --- a/modules/rostests/apitests/ws2_32/WSARecv.c +++ b/modules/rostests/apitests/ws2_32/WSARecv.c @@ -5,11 +5,6 @@ * PROGRAMMERS: Peter Hater */ -#include - -#include -#include -#include #include "ws2_32.h" #define RECV_BUF 4 diff --git a/modules/rostests/apitests/ws2_32/WSAStartup.c b/modules/rostests/apitests/ws2_32/WSAStartup.c index 92edb42bdcb..11e731a805e 100644 --- a/modules/rostests/apitests/ws2_32/WSAStartup.c +++ b/modules/rostests/apitests/ws2_32/WSAStartup.c @@ -5,15 +5,7 @@ * PROGRAMMER: Thomas Faber */ -#include - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include -#include -#include -#include +#include "ws2_32.h" static PVOID diff --git a/modules/rostests/apitests/ws2_32/bind.c b/modules/rostests/apitests/ws2_32/bind.c index 1e8c393aa4b..bf9069d1697 100644 --- a/modules/rostests/apitests/ws2_32/bind.c +++ b/modules/rostests/apitests/ws2_32/bind.c @@ -5,16 +5,7 @@ * PROGRAMMER: Peter Hater */ -#include - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include -#include -#include -#include -#include +#include "ws2_32.h" CHAR LocalAddress[sizeof("255.255.255.255")]; #define PORT 58888 diff --git a/modules/rostests/apitests/ws2_32/close.c b/modules/rostests/apitests/ws2_32/close.c index 624571bd41d..8701a3cb733 100644 --- a/modules/rostests/apitests/ws2_32/close.c +++ b/modules/rostests/apitests/ws2_32/close.c @@ -5,11 +5,6 @@ * PROGRAMMERS: Peter Hater */ -#include - -#include -#include -#include #include "ws2_32.h" void Test_CloseDuplicatedSocket() diff --git a/modules/rostests/apitests/ws2_32/getaddrinfo.c b/modules/rostests/apitests/ws2_32/getaddrinfo.c index b9b3ab534a6..369c5b3e694 100644 --- a/modules/rostests/apitests/ws2_32/getaddrinfo.c +++ b/modules/rostests/apitests/ws2_32/getaddrinfo.c @@ -5,16 +5,7 @@ * PROGRAMMER: Thomas Faber */ -#include - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include -#include -#include -#include -#include +#include "ws2_32.h" #define ok_addrinfo(ai, flags, family, socktype, protocol, addrlen) do \ { \ diff --git a/modules/rostests/apitests/ws2_32/getnameinfo.c b/modules/rostests/apitests/ws2_32/getnameinfo.c index 294259be083..f8dbafc4a2d 100644 --- a/modules/rostests/apitests/ws2_32/getnameinfo.c +++ b/modules/rostests/apitests/ws2_32/getnameinfo.c @@ -5,16 +5,7 @@ * PROGRAMMER: Thomas Faber */ -#include - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include -#include -#include -#include -#include +#include "ws2_32.h" START_TEST(getnameinfo) { diff --git a/modules/rostests/apitests/ws2_32/getservbyname.c b/modules/rostests/apitests/ws2_32/getservbyname.c index bfb0f0f3356..fcfef097d74 100644 --- a/modules/rostests/apitests/ws2_32/getservbyname.c +++ b/modules/rostests/apitests/ws2_32/getservbyname.c @@ -5,15 +5,7 @@ * PROGRAMMER: Thomas Faber */ -#include - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include -#include -#include -#include +#include "ws2_32.h" START_TEST(getservbyname) { diff --git a/modules/rostests/apitests/ws2_32/getservbyport.c b/modules/rostests/apitests/ws2_32/getservbyport.c index acf48de6f27..0e069044e63 100644 --- a/modules/rostests/apitests/ws2_32/getservbyport.c +++ b/modules/rostests/apitests/ws2_32/getservbyport.c @@ -5,15 +5,7 @@ * PROGRAMMER: Thomas Faber */ -#include - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include -#include -#include -#include +#include "ws2_32.h" START_TEST(getservbyport) { diff --git a/modules/rostests/apitests/ws2_32/helpers.c b/modules/rostests/apitests/ws2_32/helpers.c index 70486961337..702ac3654a7 100644 --- a/modules/rostests/apitests/ws2_32/helpers.c +++ b/modules/rostests/apitests/ws2_32/helpers.c @@ -6,9 +6,6 @@ * COPYRIGHT: Copyright 2008 Colin Finck */ -#include - -#include #include "ws2_32.h" int CreateSocket(SOCKET* psck) diff --git a/modules/rostests/apitests/ws2_32/ioctlsocket.c b/modules/rostests/apitests/ws2_32/ioctlsocket.c index 90398b39569..2667f6c3a3a 100644 --- a/modules/rostests/apitests/ws2_32/ioctlsocket.c +++ b/modules/rostests/apitests/ws2_32/ioctlsocket.c @@ -5,9 +5,6 @@ * PROGRAMMERS: Colin Finck */ -#include - -#include #include "ws2_32.h" int Test_ioctlsocket() diff --git a/modules/rostests/apitests/ws2_32/nonblocking.c b/modules/rostests/apitests/ws2_32/nonblocking.c index 328f823d3a8..29e6e38ac12 100644 --- a/modules/rostests/apitests/ws2_32/nonblocking.c +++ b/modules/rostests/apitests/ws2_32/nonblocking.c @@ -5,11 +5,7 @@ * PROGRAMMERS: Peter Hater */ -#include - -#include -#include -#include +#include "ws2_32.h" #define SVR_PORT 5000 #define WAIT_TIMEOUT_ 10000 diff --git a/modules/rostests/apitests/ws2_32/nostartup.c b/modules/rostests/apitests/ws2_32/nostartup.c index 2449d8839b3..28b0a9c1753 100644 --- a/modules/rostests/apitests/ws2_32/nostartup.c +++ b/modules/rostests/apitests/ws2_32/nostartup.c @@ -5,16 +5,7 @@ * PROGRAMMER: Sylvain Petreolle */ -#include - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - -#include -#include -#include -#include +#include "ws2_32.h" // This test depends on WSAStartup not having been called START_TEST(nostartup) diff --git a/modules/rostests/apitests/ws2_32/recv.c b/modules/rostests/apitests/ws2_32/recv.c index 55982ce6227..9721280b7a3 100644 --- a/modules/rostests/apitests/ws2_32/recv.c +++ b/modules/rostests/apitests/ws2_32/recv.c @@ -5,13 +5,12 @@ * PROGRAMMERS: Colin Finck */ -#include - -#include -#include -#include #include "ws2_32.h" +#include +#include +#include + #define RECV_BUF 4 /* For valid test results, the ReactOS Website needs to return at least 8 bytes on a "GET / HTTP/1.0" request. diff --git a/modules/rostests/apitests/ws2_32/send.c b/modules/rostests/apitests/ws2_32/send.c index 5e702239e94..d8a149c1a6a 100644 --- a/modules/rostests/apitests/ws2_32/send.c +++ b/modules/rostests/apitests/ws2_32/send.c @@ -5,12 +5,7 @@ * PROGRAMMER: Thomas Faber */ -#include -#include - -#define WIN32_NO_STATUS -#include -#include +#include "ws2_32.h" static PVOID diff --git a/modules/rostests/apitests/ws2_32/ws2_32.h b/modules/rostests/apitests/ws2_32/ws2_32.h index b8415bf1025..35a3d4e33e7 100644 --- a/modules/rostests/apitests/ws2_32/ws2_32.h +++ b/modules/rostests/apitests/ws2_32/ws2_32.h @@ -9,10 +9,17 @@ #ifndef _WS2_32_APITESTS_H #define _WS2_32_APITESTS_H +#include +#include + #define WIN32_NO_STATUS #define _INC_WINDOWS #define COM_NO_WINDOWS_H -#include + +#include +#include +#include +#include /* Simple macro for executing a socket command and doing cleanup operations in case of a failure */ #define SCKTEST(_cmd_) \ @@ -34,4 +41,4 @@ int GetRequestAndWait(SOCKET sck); /* ws2_32.c */ extern HANDLE g_hHeap; -#endif +#endif /* !_WS2_32_APITESTS_H */