https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b09a63709bc5f5ed4859ec...
commit b09a63709bc5f5ed4859ec84e84edd79109d3f6a Author: Amine Khaldi amine.khaldi@reactos.org AuthorDate: Thu Dec 21 13:36:04 2017 +0100
[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 1538e291fb..cd63545a38 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 083d2cca3f..6d784f1e16 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 <apitest.h> - -#include <stdio.h> -#include <windows.h> -#include <winsock2.h> +#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 2e1f72273f..5f98c017b1 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 <apitest.h> +#include "ws2_32.h"
-#include <stdio.h> -#include "ws2tcpip.h" -#include "iphlpapi.h" +#include <iphlpapi.h>
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 051a1ce9f9..4a076b2f96 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 <apitest.h> - -#include <stdio.h> -#include <ntstatus.h> -#include <wine/winternl.h> #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 92edb42bdc..11e731a805 100644 --- a/modules/rostests/apitests/ws2_32/WSAStartup.c +++ b/modules/rostests/apitests/ws2_32/WSAStartup.c @@ -5,15 +5,7 @@ * PROGRAMMER: Thomas Faber thomas.faber@reactos.org */
-#include <apitest.h> - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include <windef.h> -#include <winsock2.h> -#include <ndk/rtlfuncs.h> -#include <ndk/mmfuncs.h> +#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 1e8c393aa4..bf9069d169 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 <apitest.h> - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include <stdarg.h> -#include <windef.h> -#include <winbase.h> -#include <ws2tcpip.h> -#include <ndk/umtypes.h> +#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 624571bd41..8701a3cb73 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 <apitest.h> - -#include <stdio.h> -#include <ntstatus.h> -#include <wine/winternl.h> #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 b9b3ab534a..369c5b3e69 100644 --- a/modules/rostests/apitests/ws2_32/getaddrinfo.c +++ b/modules/rostests/apitests/ws2_32/getaddrinfo.c @@ -5,16 +5,7 @@ * PROGRAMMER: Thomas Faber thomas.faber@reactos.org */
-#include <apitest.h> - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include <stdarg.h> -#include <windef.h> -#include <winbase.h> -#include <ws2tcpip.h> -#include <ndk/umtypes.h> +#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 294259be08..f8dbafc4a2 100644 --- a/modules/rostests/apitests/ws2_32/getnameinfo.c +++ b/modules/rostests/apitests/ws2_32/getnameinfo.c @@ -5,16 +5,7 @@ * PROGRAMMER: Thomas Faber thomas.faber@reactos.org */
-#include <apitest.h> - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include <stdarg.h> -#include <windef.h> -#include <winbase.h> -#include <ws2tcpip.h> -#include <ndk/umtypes.h> +#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 bfb0f0f335..fcfef097d7 100644 --- a/modules/rostests/apitests/ws2_32/getservbyname.c +++ b/modules/rostests/apitests/ws2_32/getservbyname.c @@ -5,15 +5,7 @@ * PROGRAMMER: Thomas Faber thomas.faber@reactos.org */
-#include <apitest.h> - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include <stdarg.h> -#include <windef.h> -#include <winbase.h> -#include <ws2tcpip.h> +#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 acf48de6f2..0e069044e6 100644 --- a/modules/rostests/apitests/ws2_32/getservbyport.c +++ b/modules/rostests/apitests/ws2_32/getservbyport.c @@ -5,15 +5,7 @@ * PROGRAMMER: Thomas Faber thomas.faber@reactos.org */
-#include <apitest.h> - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H -#include <stdarg.h> -#include <windef.h> -#include <winbase.h> -#include <ws2tcpip.h> +#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 7048696133..702ac3654a 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 mail@colinfinck.de */
-#include <apitest.h> - -#include <stdio.h> #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 90398b3956..2667f6c3a3 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 <apitest.h> - -#include <stdio.h> #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 328f823d3a..29e6e38ac1 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 <apitest.h> - -#include <stdio.h> -#include <windows.h> -#include <winsock2.h> +#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 2449d8839b..28b0a9c175 100644 --- a/modules/rostests/apitests/ws2_32/nostartup.c +++ b/modules/rostests/apitests/ws2_32/nostartup.c @@ -5,16 +5,7 @@ * PROGRAMMER: Sylvain Petreolle sylvain.petreolle@reactos.org */
-#include <apitest.h> - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - -#include <windef.h> -#include <winsock2.h> -#include <ndk/rtlfuncs.h> -#include <ndk/mmfuncs.h> +#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 55982ce622..9721280b7a 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 <apitest.h> - -#include <stdio.h> -#include <ntstatus.h> -#include <wine/winternl.h> #include "ws2_32.h"
+#include <ndk/exfuncs.h> +#include <ndk/iofuncs.h> +#include <ndk/obfuncs.h> + #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 5e702239e9..d8a149c1a6 100644 --- a/modules/rostests/apitests/ws2_32/send.c +++ b/modules/rostests/apitests/ws2_32/send.c @@ -5,12 +5,7 @@ * PROGRAMMER: Thomas Faber thomas.faber@reactos.org */
-#include <apitest.h> -#include <winsock2.h> - -#define WIN32_NO_STATUS -#include <ndk/mmfuncs.h> -#include <ndk/rtlfuncs.h> +#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 b8415bf102..35a3d4e33e 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 <ntstatus.h> +#include <stdio.h> + #define WIN32_NO_STATUS #define _INC_WINDOWS #define COM_NO_WINDOWS_H -#include <winsock2.h> + +#include <apitest.h> +#include <ws2tcpip.h> +#include <ndk/rtlfuncs.h> +#include <ndk/mmfuncs.h>
/* 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 */