Reactos

[ATL][ATLTEST] Adapt to RATL and improvements (#1501)

- Modify atldef.h for non-ReactOS environments.
- Update ATL testcase project files (from v120_xp to v140_xp).
- #define HAVE_APITEST and use it.
- s/NULL/0/

authored by

Katayama Hirofumi MZ and committed by
GitHub
c714b7fd 501116b6

+53 -45
+2
modules/rostests/CMakeLists.txt
··· 1 1 2 2 start_module_group(rostests) 3 3 4 + add_definitions(-DHAVE_APITEST) 5 + 4 6 if(MSVC_IDE) 5 7 add_definitions(-DWINETEST_MSVC_IDE_FORMATTING) 6 8 endif()
+2 -2
modules/rostests/apitests/atl/CAtlFileMapping.cpp
··· 7 7 8 8 #include <atlfile.h> 9 9 10 - #ifdef __REACTOS__ 10 + #ifdef HAVE_APITEST 11 11 #include <apitest.h> 12 12 #else 13 13 #include <stdlib.h> ··· 247 247 test_SharedMem(); 248 248 test_FileMapping(); 249 249 250 - #ifndef __REACTOS__ 250 + #ifndef HAVE_APITEST 251 251 printf("CAtlFile: %i tests executed (0 marked as todo, %i failures), %i skipped.\n", g_tests_executed, g_tests_failed, g_tests_skipped); 252 252 return g_tests_failed; 253 253 #endif
+2 -2
modules/rostests/apitests/atl/CComObject.cpp
··· 9 9 #include <atlbase.h> 10 10 #include <atlcom.h> 11 11 12 - #ifdef __REACTOS__ 12 + #ifdef HAVE_APITEST 13 13 #include <apitest.h> 14 14 #else 15 15 #include <stdlib.h> ··· 142 142 ok(g_BLIND == 1, "Expected 1, got %lu\n", g_BLIND); 143 143 } 144 144 145 - #ifndef __REACTOS__ 145 + #ifndef HAVE_APITEST 146 146 printf("CComObject: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed); 147 147 return g_tests_failed; 148 148 #endif
+4 -2
modules/rostests/apitests/atl/CComQIPtr.cpp
··· 8 8 #include <atlbase.h> 9 9 #include <atlcom.h> 10 10 11 - #ifdef __REACTOS__ 11 + #ifdef HAVE_APITEST 12 12 #include <apitest.h> 13 13 #else 14 14 #include <stdlib.h> ··· 98 98 // Yes this sucks, but we have to support GCC. (CORE-12710) 99 99 #ifdef __REACTOS__ 100 100 #define DECLARE_QIPTR(type) CComQIIDPtr<I_ID(type)> 101 + #elif defined(__GNUC__) 102 + #define DECLARE_QIPTR(type) CComQIIDPtr<I_ID(type)> 101 103 #else 102 104 #define DECLARE_QIPTR(type) CComQIPtr<type> 103 105 #endif ··· 153 155 ok(g_QI == 5, "Expected g_QI 5, got %lu\n", g_QI); 154 156 } 155 157 156 - #ifndef __REACTOS__ 158 + #ifndef HAVE_APITEST 157 159 printf("CComQIPtr: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed); 158 160 return g_tests_failed; 159 161 #endif
+2 -2
modules/rostests/apitests/atl/CImage.cpp
··· 8 8 #include <atlimage.h> 9 9 #include "resource.h" 10 10 11 - #ifdef __REACTOS__ 11 + #ifdef HAVE_APITEST 12 12 #include <apitest.h> 13 13 #else 14 14 #include <stdlib.h> ··· 332 332 "The exporter filter string is bad, was: %s\n", psz); 333 333 #endif 334 334 335 - #ifndef __REACTOS__ 335 + #ifndef HAVE_APITEST 336 336 printf("CImage: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed); 337 337 return g_tests_failed; 338 338 #endif
+2 -2
modules/rostests/apitests/atl/CSimpleArray.cpp
··· 5 5 * PROGRAMMER: Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com) 6 6 */ 7 7 8 - #ifdef __REACTOS__ 8 + #ifdef HAVE_APITEST 9 9 #include <apitest.h> 10 10 #else 11 11 #include <stdlib.h> ··· 179 179 ok(!!array1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n"); 180 180 ok(array1.GetSize() == 0, "Expected array1.GetSize() is 0, was: %d\n", array1.GetSize()); 181 181 182 - #ifndef __REACTOS__ 182 + #ifndef HAVE_APITEST 183 183 printf("CSimpleArray: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed); 184 184 return g_tests_failed; 185 185 #endif
+2 -2
modules/rostests/apitests/atl/CSimpleMap.cpp
··· 5 5 * PROGRAMMER: Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com) 6 6 */ 7 7 8 - #ifdef __REACTOS__ 8 + #ifdef HAVE_APITEST 9 9 #include <apitest.h> 10 10 #else 11 11 #include <stdlib.h> ··· 199 199 ok(!!map1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n"); 200 200 ok(map1.GetSize() == 0, "Expected map1's size is 0, was %d\n", map1.GetSize()); 201 201 202 - #ifndef __REACTOS__ 202 + #ifndef HAVE_APITEST 203 203 printf("CSimpleMap: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed); 204 204 return g_tests_failed; 205 205 #endif
+3 -3
modules/rostests/apitests/atl/CString.cpp
··· 9 9 #include <atlstr.h> 10 10 #include "resource.h" 11 11 12 - #ifdef __REACTOS__ 12 + #ifdef HAVE_APITEST 13 13 #include <apitest.h> 14 14 #else 15 15 #include <stdlib.h> ··· 171 171 172 172 // Allocation strategy seems to differ a bit between us and MS's atl. 173 173 // if someone cares enough to find out why, feel free to change the macro below. 174 - #ifdef __REACTOS__ 174 + #ifdef __GNUC__ 175 175 #define ALLOC_EXPECT(a, b) b 176 176 #else 177 177 #define ALLOC_EXPECT(a, b) a ··· 257 257 test_bstrW(); 258 258 test_bstrA(); 259 259 260 - #ifndef __REACTOS__ 260 + #ifndef HAVE_APITEST 261 261 printf("CString: %i tests executed (0 marked as todo, %i failures), %i skipped.\n", g_tests_executed, g_tests_failed, g_tests_skipped); 262 262 return g_tests_failed; 263 263 #endif
+4 -4
modules/rostests/apitests/atl/devenv/CComObject.vcxproj
··· 27 27 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> 28 28 <ConfigurationType>Application</ConfigurationType> 29 29 <UseDebugLibraries>true</UseDebugLibraries> 30 - <PlatformToolset>v120_xp</PlatformToolset> 30 + <PlatformToolset>v140_xp</PlatformToolset> 31 31 <CharacterSet>Unicode</CharacterSet> 32 32 </PropertyGroup> 33 33 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> 34 34 <ConfigurationType>Application</ConfigurationType> 35 35 <UseDebugLibraries>false</UseDebugLibraries> 36 - <PlatformToolset>v120_xp</PlatformToolset> 36 + <PlatformToolset>v140_xp</PlatformToolset> 37 37 <CharacterSet>Unicode</CharacterSet> 38 38 </PropertyGroup> 39 39 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> 40 40 <ConfigurationType>Application</ConfigurationType> 41 41 <UseDebugLibraries>true</UseDebugLibraries> 42 42 <CharacterSet>Unicode</CharacterSet> 43 - <PlatformToolset>v120_xp</PlatformToolset> 43 + <PlatformToolset>v140_xp</PlatformToolset> 44 44 </PropertyGroup> 45 45 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> 46 46 <ConfigurationType>Application</ConfigurationType> 47 47 <UseDebugLibraries>false</UseDebugLibraries> 48 - <PlatformToolset>v120_xp</PlatformToolset> 48 + <PlatformToolset>v140_xp</PlatformToolset> 49 49 <CharacterSet>Unicode</CharacterSet> 50 50 </PropertyGroup> 51 51 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+4 -4
modules/rostests/apitests/atl/devenv/CComQIPtr.vcxproj
··· 27 27 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> 28 28 <ConfigurationType>Application</ConfigurationType> 29 29 <UseDebugLibraries>true</UseDebugLibraries> 30 - <PlatformToolset>v120_xp</PlatformToolset> 30 + <PlatformToolset>v140_xp</PlatformToolset> 31 31 <CharacterSet>Unicode</CharacterSet> 32 32 </PropertyGroup> 33 33 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> 34 34 <ConfigurationType>Application</ConfigurationType> 35 35 <UseDebugLibraries>false</UseDebugLibraries> 36 - <PlatformToolset>v120_xp</PlatformToolset> 36 + <PlatformToolset>v140_xp</PlatformToolset> 37 37 <CharacterSet>Unicode</CharacterSet> 38 38 </PropertyGroup> 39 39 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> 40 40 <ConfigurationType>Application</ConfigurationType> 41 41 <UseDebugLibraries>true</UseDebugLibraries> 42 42 <CharacterSet>Unicode</CharacterSet> 43 - <PlatformToolset>v120_xp</PlatformToolset> 43 + <PlatformToolset>v140_xp</PlatformToolset> 44 44 </PropertyGroup> 45 45 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> 46 46 <ConfigurationType>Application</ConfigurationType> 47 47 <UseDebugLibraries>false</UseDebugLibraries> 48 - <PlatformToolset>v120_xp</PlatformToolset> 48 + <PlatformToolset>v140_xp</PlatformToolset> 49 49 <CharacterSet>Unicode</CharacterSet> 50 50 </PropertyGroup> 51 51 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+4 -4
modules/rostests/apitests/atl/devenv/CImage.vcxproj
··· 27 27 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> 28 28 <ConfigurationType>Application</ConfigurationType> 29 29 <UseDebugLibraries>true</UseDebugLibraries> 30 - <PlatformToolset>v120_xp</PlatformToolset> 30 + <PlatformToolset>v140_xp</PlatformToolset> 31 31 <CharacterSet>Unicode</CharacterSet> 32 32 </PropertyGroup> 33 33 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> 34 34 <ConfigurationType>Application</ConfigurationType> 35 35 <UseDebugLibraries>false</UseDebugLibraries> 36 - <PlatformToolset>v120_xp</PlatformToolset> 36 + <PlatformToolset>v140_xp</PlatformToolset> 37 37 <CharacterSet>Unicode</CharacterSet> 38 38 </PropertyGroup> 39 39 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> 40 40 <ConfigurationType>Application</ConfigurationType> 41 41 <UseDebugLibraries>true</UseDebugLibraries> 42 42 <CharacterSet>Unicode</CharacterSet> 43 - <PlatformToolset>v120_xp</PlatformToolset> 43 + <PlatformToolset>v140_xp</PlatformToolset> 44 44 </PropertyGroup> 45 45 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> 46 46 <ConfigurationType>Application</ConfigurationType> 47 47 <UseDebugLibraries>false</UseDebugLibraries> 48 - <PlatformToolset>v120_xp</PlatformToolset> 48 + <PlatformToolset>v140_xp</PlatformToolset> 49 49 <CharacterSet>Unicode</CharacterSet> 50 50 </PropertyGroup> 51 51 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+4 -4
modules/rostests/apitests/atl/devenv/CSimpleArray.vcxproj
··· 27 27 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> 28 28 <ConfigurationType>Application</ConfigurationType> 29 29 <UseDebugLibraries>true</UseDebugLibraries> 30 - <PlatformToolset>v120_xp</PlatformToolset> 30 + <PlatformToolset>v140_xp</PlatformToolset> 31 31 <CharacterSet>Unicode</CharacterSet> 32 32 </PropertyGroup> 33 33 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> 34 34 <ConfigurationType>Application</ConfigurationType> 35 35 <UseDebugLibraries>false</UseDebugLibraries> 36 - <PlatformToolset>v120_xp</PlatformToolset> 36 + <PlatformToolset>v140_xp</PlatformToolset> 37 37 <CharacterSet>Unicode</CharacterSet> 38 38 </PropertyGroup> 39 39 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> 40 40 <ConfigurationType>Application</ConfigurationType> 41 41 <UseDebugLibraries>true</UseDebugLibraries> 42 - <PlatformToolset>v120_xp</PlatformToolset> 42 + <PlatformToolset>v140_xp</PlatformToolset> 43 43 <CharacterSet>Unicode</CharacterSet> 44 44 </PropertyGroup> 45 45 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> 46 46 <ConfigurationType>Application</ConfigurationType> 47 47 <UseDebugLibraries>false</UseDebugLibraries> 48 - <PlatformToolset>v120_xp</PlatformToolset> 48 + <PlatformToolset>v140_xp</PlatformToolset> 49 49 <CharacterSet>Unicode</CharacterSet> 50 50 </PropertyGroup> 51 51 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+4 -4
modules/rostests/apitests/atl/devenv/CSimpleMap.vcxproj
··· 27 27 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> 28 28 <ConfigurationType>Application</ConfigurationType> 29 29 <UseDebugLibraries>true</UseDebugLibraries> 30 - <PlatformToolset>v120_xp</PlatformToolset> 30 + <PlatformToolset>v140_xp</PlatformToolset> 31 31 <CharacterSet>Unicode</CharacterSet> 32 32 </PropertyGroup> 33 33 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> 34 34 <ConfigurationType>Application</ConfigurationType> 35 35 <UseDebugLibraries>false</UseDebugLibraries> 36 - <PlatformToolset>v120_xp</PlatformToolset> 36 + <PlatformToolset>v140_xp</PlatformToolset> 37 37 <CharacterSet>Unicode</CharacterSet> 38 38 </PropertyGroup> 39 39 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> 40 40 <ConfigurationType>Application</ConfigurationType> 41 41 <UseDebugLibraries>true</UseDebugLibraries> 42 - <PlatformToolset>v120_xp</PlatformToolset> 42 + <PlatformToolset>v140_xp</PlatformToolset> 43 43 <CharacterSet>Unicode</CharacterSet> 44 44 </PropertyGroup> 45 45 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> 46 46 <ConfigurationType>Application</ConfigurationType> 47 47 <UseDebugLibraries>false</UseDebugLibraries> 48 - <PlatformToolset>v120_xp</PlatformToolset> 48 + <PlatformToolset>v140_xp</PlatformToolset> 49 49 <CharacterSet>Unicode</CharacterSet> 50 50 </PropertyGroup> 51 51 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+4 -4
modules/rostests/apitests/atl/devenv/CString.vcxproj
··· 27 27 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> 28 28 <ConfigurationType>Application</ConfigurationType> 29 29 <UseDebugLibraries>true</UseDebugLibraries> 30 - <PlatformToolset>v120_xp</PlatformToolset> 30 + <PlatformToolset>v140_xp</PlatformToolset> 31 31 <CharacterSet>Unicode</CharacterSet> 32 32 </PropertyGroup> 33 33 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> 34 34 <ConfigurationType>Application</ConfigurationType> 35 35 <UseDebugLibraries>false</UseDebugLibraries> 36 - <PlatformToolset>v120_xp</PlatformToolset> 36 + <PlatformToolset>v140_xp</PlatformToolset> 37 37 <CharacterSet>Unicode</CharacterSet> 38 38 </PropertyGroup> 39 39 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> 40 40 <ConfigurationType>Application</ConfigurationType> 41 41 <UseDebugLibraries>true</UseDebugLibraries> 42 - <PlatformToolset>v120_xp</PlatformToolset> 42 + <PlatformToolset>v140_xp</PlatformToolset> 43 43 <CharacterSet>Unicode</CharacterSet> 44 44 </PropertyGroup> 45 45 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> 46 46 <ConfigurationType>Application</ConfigurationType> 47 47 <UseDebugLibraries>false</UseDebugLibraries> 48 - <PlatformToolset>v120_xp</PlatformToolset> 48 + <PlatformToolset>v140_xp</PlatformToolset> 49 49 <CharacterSet>Unicode</CharacterSet> 50 50 </PropertyGroup> 51 51 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+5 -5
sdk/lib/atl/atlbase.h
··· 1074 1074 ATLASSERT(lpszKeyName); 1075 1075 1076 1076 HKEY hKey = NULL; 1077 - LONG lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, NULL, samDesired, &hKey); 1077 + LONG lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, 0, samDesired, &hKey); 1078 1078 if (lRes != ERROR_SUCCESS) 1079 1079 { 1080 1080 samDesired |= KEY_WOW64_64KEY; 1081 - lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, NULL, samDesired, &hKey); 1081 + lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, 0, samDesired, &hKey); 1082 1082 } 1083 1083 if (lRes == ERROR_SUCCESS) 1084 1084 { ··· 1099 1099 ATLASSERT(lpszKeyName); 1100 1100 1101 1101 HKEY hKey = NULL; 1102 - LONG lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, NULL, lpszClass, 1102 + LONG lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, 0, lpszClass, 1103 1103 dwOptions, samDesired, lpSecAttr, &hKey, 1104 1104 lpdwDisposition); 1105 1105 if (lRes != ERROR_SUCCESS) 1106 1106 { 1107 1107 samDesired |= KEY_WOW64_64KEY; 1108 - lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, NULL, lpszClass, 1108 + lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, 0, lpszClass, 1109 1109 dwOptions, samDesired, lpSecAttr, &hKey, 1110 1110 lpdwDisposition); 1111 1111 } ··· 1213 1213 LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void* pValue, ULONG nBytes) throw() 1214 1214 { 1215 1215 ATLASSERT(m_hKey); 1216 - return ::RegSetValueEx(m_hKey, pszValueName, NULL, dwType, (const BYTE*)pValue, nBytes); 1216 + return ::RegSetValueEx(m_hKey, pszValueName, 0, dwType, (const BYTE*)pValue, nBytes); 1217 1217 } 1218 1218 1219 1219 LONG SetDWORDValue(LPCTSTR pszValueName, DWORD dwValue) throw()
+4
sdk/lib/atl/atldef.h
··· 7 7 8 8 #pragma once 9 9 10 + #ifndef __REACTOS__ 11 + #include <cstddef> 12 + #include <pseh/pseh2.h> 13 + #endif 10 14 11 15 #define _ATL_PACKING 8 12 16
+1 -1
sdk/lib/atl/atlfile.h
··· 89 89 m_nOffset.QuadPart = orig.m_nOffset.QuadPart; 90 90 m_dwViewDesiredAccess = orig.m_dwViewDesiredAccess; 91 91 92 - if (::DuplicateHandle(GetCurrentProcess(), orig.m_hMapping, GetCurrentProcess(), &m_hMapping, NULL, TRUE, DUPLICATE_SAME_ACCESS)) 92 + if (::DuplicateHandle(GetCurrentProcess(), orig.m_hMapping, GetCurrentProcess(), &m_hMapping, 0, TRUE, DUPLICATE_SAME_ACCESS)) 93 93 { 94 94 m_pData = ::MapViewOfFile(m_hMapping, m_dwViewDesiredAccess, m_nOffset.HighPart, m_nOffset.LowPart, m_nMappingSize); 95 95 if (!m_pData)