https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8ed8eec17cff57e43a6effa6cf5e0df350fc0241

commit 8ed8eec17cff57e43a6effa6cf5e0df350fc0241
Author: Amine Khaldi <[email protected]>
AuthorDate: Sun Dec 17 13:31:22 2017 +0100

    [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 ++---
 modules/rostests/apitests/shell32/CFSFolder.cpp    |  3 --
 modules/rostests/apitests/shell32/CMakeLists.txt   | 14 ++++++---
 modules/rostests/apitests/shell32/CMyComputer.cpp  |  3 --
 .../rostests/apitests/shell32/CShellDesktop.cpp    |  8 +----
 modules/rostests/apitests/shell32/CShellLink.cpp   |  4 ---
 .../rostests/apitests/shell32/Control_RunDLLW.cpp  |  3 ++
 modules/rostests/apitests/shell32/PathResolve.cpp  |  1 +
 .../apitests/shell32/SHCreateFileExtractIconW.cpp  |  7 ++---
 .../apitests/shell32/SHParseDisplayName.cpp        |  3 --
 .../rostests/apitests/shell32/ShellExecuteEx.cpp   |  3 --
 modules/rostests/apitests/shell32/menu.cpp         |  7 +++++
 modules/rostests/apitests/shell32/shelltest.cpp    |  3 --
 modules/rostests/apitests/shell32/shelltest.h      | 36 +++++++---------------
 14 files changed, 39 insertions(+), 63 deletions(-)

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 4bc7cd0d94..69ac99021f 100644
--- a/modules/rostests/apitests/shell32/AddCommas.c
+++ b/modules/rostests/apitests/shell32/AddCommas.cpp
@@ -5,14 +5,13 @@
  * PROGRAMMER:      Thomas Faber <[email protected]>
  */
 
-#include <apitest.h>
-#include <windef.h>
+#include "shelltest.h"
+
 #include <winnls.h>
 #include <bcrypt.h>
-#include <ntstatus.h>
 #include <strsafe.h>
 
-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 6a68078b95..57c015b351 100644
--- a/modules/rostests/apitests/shell32/CFSFolder.cpp
+++ b/modules/rostests/apitests/shell32/CFSFolder.cpp
@@ -6,9 +6,6 @@
  */
 
 #include "shelltest.h"
-#include <atlbase.h>
-#include <atlcom.h>
-#include <strsafe.h>
 
 #define NDEBUG
 #include <debug.h>
diff --git a/modules/rostests/apitests/shell32/CMakeLists.txt 
b/modules/rostests/apitests/shell32/CMakeLists.txt
index 48c41820c9..a30f8db886 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 06341b5606..712cf4dcd0 100644
--- a/modules/rostests/apitests/shell32/CMyComputer.cpp
+++ b/modules/rostests/apitests/shell32/CMyComputer.cpp
@@ -6,9 +6,6 @@
  */
 
 #include "shelltest.h"
-#include <atlbase.h>
-#include <atlcom.h>
-#include <strsafe.h>
 
 #define NDEBUG
 #include <debug.h>
diff --git a/modules/rostests/apitests/shell32/CShellDesktop.cpp 
b/modules/rostests/apitests/shell32/CShellDesktop.cpp
index 61a462d57a..7b1fd34adb 100644
--- a/modules/rostests/apitests/shell32/CShellDesktop.cpp
+++ b/modules/rostests/apitests/shell32/CShellDesktop.cpp
@@ -7,16 +7,10 @@
  */
 
 #include "shelltest.h"
-#include <atlbase.h>
-#include <atlcom.h>
-#include <strsafe.h>
-#include <ndk/rtlfuncs.h>
 
-#define NDEBUG
-#include <debug.h>
+#include <ndk/rtlfuncs.h>
 #include <shellutils.h>
 
-
 // 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 ff69dd4772..0e5cd53269 100644
--- a/modules/rostests/apitests/shell32/CShellLink.cpp
+++ b/modules/rostests/apitests/shell32/CShellLink.cpp
@@ -6,10 +6,6 @@
  */
 
 #include "shelltest.h"
-#include <atlbase.h>
-#include <atlcom.h>
-#include <strsafe.h>
-#include <ndk/rtlfuncs.h>
 
 #define NDEBUG
 #include <debug.h>
diff --git a/modules/rostests/apitests/shell32/Control_RunDLLW.cpp 
b/modules/rostests/apitests/shell32/Control_RunDLLW.cpp
index d3d189eac1..d68d48fa5b 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 <cpl.h>
+#include <stdio.h>
+
 #define NDEBUG
 #include <debug.h>
 
diff --git a/modules/rostests/apitests/shell32/PathResolve.cpp 
b/modules/rostests/apitests/shell32/PathResolve.cpp
index 2a527e958e..122f1d083b 100644
--- a/modules/rostests/apitests/shell32/PathResolve.cpp
+++ b/modules/rostests/apitests/shell32/PathResolve.cpp
@@ -6,6 +6,7 @@
  */
 
 #include "shelltest.h"
+
 #include <assert.h>
 
 /*
diff --git a/modules/rostests/apitests/shell32/SHCreateFileExtractIconW.cpp 
b/modules/rostests/apitests/shell32/SHCreateFileExtractIconW.cpp
index 38247dabe3..e6103385d0 100644
--- a/modules/rostests/apitests/shell32/SHCreateFileExtractIconW.cpp
+++ b/modules/rostests/apitests/shell32/SHCreateFileExtractIconW.cpp
@@ -6,13 +6,12 @@
  */
 
 #include "shelltest.h"
-#include <atlbase.h>
-#include <atlcom.h>
-ULONG DbgPrint(PCH Format,...);
-#include <shellutils.h>
+
 #include <wincon.h>
 #include <wingdi.h>
 
+ULONG DbgPrint(PCH Format,...);
+#include <shellutils.h>
 
 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 cc495dc811..ad9c94d289 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 <ndk/umtypes.h>
-#include <strsafe.h>
 
 /* Version masks */
 #define T_ALL     0x0
diff --git a/modules/rostests/apitests/shell32/ShellExecuteEx.cpp 
b/modules/rostests/apitests/shell32/ShellExecuteEx.cpp
index aa7bbc72ae..73afcd1e2e 100644
--- a/modules/rostests/apitests/shell32/ShellExecuteEx.cpp
+++ b/modules/rostests/apitests/shell32/ShellExecuteEx.cpp
@@ -5,11 +5,8 @@
  * PROGRAMMER:      Yaroslav Veremenko <[email protected]>
  */
 
-
 #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 09e8a2bb15..b10fef0013 100644
--- a/modules/rostests/apitests/shell32/menu.cpp
+++ b/modules/rostests/apitests/shell32/menu.cpp
@@ -7,6 +7,13 @@
 
 #include "shelltest.h"
 
+#include <shlwapi.h>
+#include <unknownbase.h>
+#include <shlguid_undoc.h>
+
+#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 8f362c304e..65f0d42eef 100644
--- a/modules/rostests/apitests/shell32/shelltest.cpp
+++ b/modules/rostests/apitests/shell32/shelltest.cpp
@@ -1,7 +1,4 @@
 #include "shelltest.h"
-#include <atlbase.h>
-#include <atlcom.h>
-
 
 // + 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 f24e54fa2a..75951cbac4 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 <stdio.h>
-#include <wine/test.h>
-
-
-#include <winuser.h>
+#include <ntstatus.h>
+#define WIN32_NO_STATUS
+#include <apitest.h>
 #include <winreg.h>
-
-#include <commctrl.h>
-#include <shellapi.h>
 #include <shlobj.h>
-#include <shlwapi.h>
-
-#include <stdlib.h>
-#include <malloc.h>
-#include <memory.h>
-#include <string.h>
-#include <tchar.h>
-
-#include <initguid.h>
-
-#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 <shellapi.h>
+#include <atlbase.h>
+#include <atlcom.h>
 
 VOID PathToIDList(LPCWSTR pszPath, ITEMIDLIST** ppidl);
+
+#endif /* !_SHELLTEST_H_ */

Reply via email to