From 8ed8eec17cff57e43a6effa6cf5e0df350fc0241 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 17 Dec 2017 13:31:22 +0100 Subject: [PATCH] [SHELL32_APITEST] Improve the existing PCH and make use of it. Convert AddCommas.c to c++ in order to have it benefit from the PCH. --- .../shell32/{AddCommas.c => AddCommas.cpp} | 7 ++-- .../rostests/apitests/shell32/CFSFolder.cpp | 3 -- .../rostests/apitests/shell32/CMakeLists.txt | 14 +++++--- .../rostests/apitests/shell32/CMyComputer.cpp | 3 -- .../apitests/shell32/CShellDesktop.cpp | 8 +---- .../rostests/apitests/shell32/CShellLink.cpp | 4 --- .../apitests/shell32/Control_RunDLLW.cpp | 3 ++ .../rostests/apitests/shell32/PathResolve.cpp | 1 + .../shell32/SHCreateFileExtractIconW.cpp | 7 ++-- .../apitests/shell32/SHParseDisplayName.cpp | 3 -- .../apitests/shell32/ShellExecuteEx.cpp | 3 -- modules/rostests/apitests/shell32/menu.cpp | 7 ++++ .../rostests/apitests/shell32/shelltest.cpp | 3 -- modules/rostests/apitests/shell32/shelltest.h | 36 ++++++------------- 14 files changed, 39 insertions(+), 63 deletions(-) rename modules/rostests/apitests/shell32/{AddCommas.c => AddCommas.cpp} (94%) diff --git a/modules/rostests/apitests/shell32/AddCommas.c b/modules/rostests/apitests/shell32/AddCommas.cpp similarity index 94% rename from modules/rostests/apitests/shell32/AddCommas.c rename to modules/rostests/apitests/shell32/AddCommas.cpp index 4bc7cd0d94f..69ac99021fd 100644 --- a/modules/rostests/apitests/shell32/AddCommas.c +++ b/modules/rostests/apitests/shell32/AddCommas.cpp @@ -5,14 +5,13 @@ * PROGRAMMER: Thomas Faber */ -#include -#include +#include "shelltest.h" + #include #include -#include #include -DECLSPEC_IMPORT LPWSTR WINAPI AddCommasW(DWORD lValue, LPWSTR lpNumber); +extern "C" DECLSPEC_IMPORT LPWSTR WINAPI AddCommasW(DWORD lValue, LPWSTR lpNumber); START_TEST(AddCommas) { diff --git a/modules/rostests/apitests/shell32/CFSFolder.cpp b/modules/rostests/apitests/shell32/CFSFolder.cpp index 6a68078b959..57c015b3511 100644 --- a/modules/rostests/apitests/shell32/CFSFolder.cpp +++ b/modules/rostests/apitests/shell32/CFSFolder.cpp @@ -6,9 +6,6 @@ */ #include "shelltest.h" -#include -#include -#include #define NDEBUG #include diff --git a/modules/rostests/apitests/shell32/CMakeLists.txt b/modules/rostests/apitests/shell32/CMakeLists.txt index 48c41820c97..a30f8db8865 100644 --- a/modules/rostests/apitests/shell32/CMakeLists.txt +++ b/modules/rostests/apitests/shell32/CMakeLists.txt @@ -1,12 +1,12 @@ -spec2def(shell32_apitest.exe shell32_apitest.spec) - set_cpp(WITH_RUNTIME) +spec2def(shell32_apitest.exe shell32_apitest.spec) + include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl) -add_executable(shell32_apitest - AddCommas.c +list(APPEND SOURCE + AddCommas.cpp Control_RunDLLW.cpp CFSFolder.cpp CMyComputer.cpp @@ -18,10 +18,16 @@ add_executable(shell32_apitest ShellExecuteEx.cpp shelltest.cpp SHParseDisplayName.cpp + shelltest.h) + +add_executable(shell32_apitest + ${SOURCE} testlist.c resource.rc ${CMAKE_CURRENT_BINARY_DIR}/shell32_apitest.def) + target_link_libraries(shell32_apitest wine uuid ${PSEH_LIB}) set_module_type(shell32_apitest win32cui) add_importlibs(shell32_apitest user32 gdi32 shell32 ole32 oleaut32 advapi32 shlwapi msvcrt kernel32 ntdll) +add_pch(shell32_apitest shelltest.h SOURCE) add_rostests_file(TARGET shell32_apitest) diff --git a/modules/rostests/apitests/shell32/CMyComputer.cpp b/modules/rostests/apitests/shell32/CMyComputer.cpp index 06341b56067..712cf4dcd08 100644 --- a/modules/rostests/apitests/shell32/CMyComputer.cpp +++ b/modules/rostests/apitests/shell32/CMyComputer.cpp @@ -6,9 +6,6 @@ */ #include "shelltest.h" -#include -#include -#include #define NDEBUG #include diff --git a/modules/rostests/apitests/shell32/CShellDesktop.cpp b/modules/rostests/apitests/shell32/CShellDesktop.cpp index 61a462d57a3..7b1fd34adb6 100644 --- a/modules/rostests/apitests/shell32/CShellDesktop.cpp +++ b/modules/rostests/apitests/shell32/CShellDesktop.cpp @@ -7,16 +7,10 @@ */ #include "shelltest.h" -#include -#include -#include -#include -#define NDEBUG -#include +#include #include - // We would normally use S_LESSTHAN and S_GREATERTHAN, but w2k3 returns numbers like 3 and -3... // So instead we check on the sign bit (compare result is the low word of the hresult). #define SHORT_SIGN_BIT 0x8000 diff --git a/modules/rostests/apitests/shell32/CShellLink.cpp b/modules/rostests/apitests/shell32/CShellLink.cpp index ff69dd4772a..0e5cd532695 100644 --- a/modules/rostests/apitests/shell32/CShellLink.cpp +++ b/modules/rostests/apitests/shell32/CShellLink.cpp @@ -6,10 +6,6 @@ */ #include "shelltest.h" -#include -#include -#include -#include #define NDEBUG #include diff --git a/modules/rostests/apitests/shell32/Control_RunDLLW.cpp b/modules/rostests/apitests/shell32/Control_RunDLLW.cpp index d3d189eac18..d68d48fa5b2 100644 --- a/modules/rostests/apitests/shell32/Control_RunDLLW.cpp +++ b/modules/rostests/apitests/shell32/Control_RunDLLW.cpp @@ -6,7 +6,10 @@ */ #include "shelltest.h" + #include +#include + #define NDEBUG #include diff --git a/modules/rostests/apitests/shell32/PathResolve.cpp b/modules/rostests/apitests/shell32/PathResolve.cpp index 2a527e958e9..122f1d083b4 100644 --- a/modules/rostests/apitests/shell32/PathResolve.cpp +++ b/modules/rostests/apitests/shell32/PathResolve.cpp @@ -6,6 +6,7 @@ */ #include "shelltest.h" + #include /* diff --git a/modules/rostests/apitests/shell32/SHCreateFileExtractIconW.cpp b/modules/rostests/apitests/shell32/SHCreateFileExtractIconW.cpp index 38247dabe3d..e6103385d03 100644 --- a/modules/rostests/apitests/shell32/SHCreateFileExtractIconW.cpp +++ b/modules/rostests/apitests/shell32/SHCreateFileExtractIconW.cpp @@ -6,13 +6,12 @@ */ #include "shelltest.h" -#include -#include -ULONG DbgPrint(PCH Format,...); -#include + #include #include +ULONG DbgPrint(PCH Format,...); +#include HRESULT (STDAPICALLTYPE *pSHCreateFileExtractIconW)(LPCWSTR pszFile, DWORD dwFileAttributes, REFIID riid, void **ppv); diff --git a/modules/rostests/apitests/shell32/SHParseDisplayName.cpp b/modules/rostests/apitests/shell32/SHParseDisplayName.cpp index cc495dc8114..ad9c94d2892 100644 --- a/modules/rostests/apitests/shell32/SHParseDisplayName.cpp +++ b/modules/rostests/apitests/shell32/SHParseDisplayName.cpp @@ -6,9 +6,6 @@ */ #include "shelltest.h" -#include "apitest.h" -#include -#include /* Version masks */ #define T_ALL 0x0 diff --git a/modules/rostests/apitests/shell32/ShellExecuteEx.cpp b/modules/rostests/apitests/shell32/ShellExecuteEx.cpp index aa7bbc72ae2..73afcd1e2e5 100644 --- a/modules/rostests/apitests/shell32/ShellExecuteEx.cpp +++ b/modules/rostests/apitests/shell32/ShellExecuteEx.cpp @@ -5,11 +5,8 @@ * PROGRAMMER: Yaroslav Veremenko */ - #include "shelltest.h" - - #define ok_ShellExecuteEx (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : TestShellExecuteEx static diff --git a/modules/rostests/apitests/shell32/menu.cpp b/modules/rostests/apitests/shell32/menu.cpp index 09e8a2bb15b..b10fef00135 100644 --- a/modules/rostests/apitests/shell32/menu.cpp +++ b/modules/rostests/apitests/shell32/menu.cpp @@ -7,6 +7,13 @@ #include "shelltest.h" +#include +#include +#include + +#define test_S_OK(hres, message) ok(hres == S_OK, "%s (0x%lx instead of S_OK)\n",message, hResult); +#define test_HRES(hres, hresExpected, message) ok(hres == hresExpected, "%s (0x%lx instead of 0x%lx)\n",message, hResult,hresExpected); + BOOL CheckWindowClass(HWND hwnd, PCWSTR className) { ULONG size = (wcslen(className) + 1)* sizeof(WCHAR); diff --git a/modules/rostests/apitests/shell32/shelltest.cpp b/modules/rostests/apitests/shell32/shelltest.cpp index 8f362c304ef..65f0d42eeff 100644 --- a/modules/rostests/apitests/shell32/shelltest.cpp +++ b/modules/rostests/apitests/shell32/shelltest.cpp @@ -1,7 +1,4 @@ #include "shelltest.h" -#include -#include - // + Adapted from https://blogs.msdn.microsoft.com/oldnewthing/20130503-00/?p=4463/ // In short: We want to create an IDLIST from an item that does not exist, diff --git a/modules/rostests/apitests/shell32/shelltest.h b/modules/rostests/apitests/shell32/shelltest.h index f24e54fa2ae..75951cbac47 100644 --- a/modules/rostests/apitests/shell32/shelltest.h +++ b/modules/rostests/apitests/shell32/shelltest.h @@ -1,32 +1,18 @@ -#define WIN32_NO_STATUS +#ifndef _SHELLTEST_H_ +#define _SHELLTEST_H_ + #define _INC_WINDOWS #define COM_NO_WINDOWS_H -#include -#include - - -#include +#include +#define WIN32_NO_STATUS +#include #include - -#include -#include #include -#include - -#include -#include -#include -#include -#include - -#include - -#define test_S_OK(hres, message) ok(hres == S_OK, "%s (0x%lx instead of S_OK)\n",message, hResult); -#define test_HRES(hres, hresExpected, message) ok(hres == hresExpected, "%s (0x%lx instead of 0x%lx)\n",message, hResult,hresExpected); - -DEFINE_GUID(CLSID_MenuBandSite, 0xE13EF4E4, 0xD2F2, 0x11D0, 0x98, 0x16, 0x00, 0xC0, 0x4F, 0xD9, 0x19, 0x72); - -#include "unknownbase.h" +#include +#include +#include VOID PathToIDList(LPCWSTR pszPath, ITEMIDLIST** ppidl); + +#endif /* !_SHELLTEST_H_ */ -- 2.17.1