1
2add_subdirectory(load_notifications)
3
4include_directories($<TARGET_FILE_DIR:load_notifications>)
5include_directories(${REACTOS_SOURCE_DIR}/ntoskrnl/include)
6spec2def(ntdll_apitest.exe ntdll_apitest.spec)
7
8list(APPEND SOURCE
9    LdrEnumResources.c
10    load_notifications.c
11    locale.c
12    NtAcceptConnectPort.c
13    NtAccessCheck.c
14    NtAccessCheckByType.c
15    NtAccessCheckByTypeResultList.c
16    NtAdjustGroupsToken.c
17    NtAdjustPrivilegesToken.c
18    NtAllocateVirtualMemory.c
19    NtApphelpCacheControl.c
20    NtCompareTokens.c
21    NtContinue.c
22    NtCreateFile.c
23    NtCreateKey.c
24    NtCreateThread.c
25    NtDeleteKey.c
26    NtDuplicateObject.c
27    NtDuplicateToken.c
28    NtFilterToken.c
29    NtFreeVirtualMemory.c
30    NtImpersonateAnonymousToken.c
31    NtLoadUnloadKey.c
32    NtMapViewOfSection.c
33    NtMutant.c
34    NtOpenKey.c
35    NtOpenProcessToken.c
36    NtOpenThreadToken.c
37    NtProtectVirtualMemory.c
38    NtQueryInformationFile.c
39    NtQueryInformationProcess.c
40    NtQueryInformationThread.c
41    NtQueryInformationToken.c
42    NtQueryKey.c
43    NtQueryOpenSubKeys.c
44    NtQuerySystemEnvironmentValue.c
45    NtQuerySystemInformation.c
46    NtQueryValueKey.c
47    NtQueryVolumeInformationFile.c
48    NtReadFile.c
49    NtSaveKey.c
50    NtSetDefaultLocale.c
51    NtSetInformationFile.c
52    NtSetInformationProcess.c
53    NtSetInformationThread.c
54    NtSetInformationToken.c
55    NtSetValueKey.c
56    NtSetVolumeInformationFile.c
57    NtUnloadDriver.c
58    NtWriteFile.c
59    probelib.c
60    RtlAllocateHeap.c
61    RtlBitmap.c
62    RtlComputePrivatizedDllName_U.c
63    RtlCopyMappedMemory.c
64    RtlCriticalSection.c
65    RtlDebugInformation.c
66    RtlDeleteAce.c
67    RtlDetermineDosPathNameType.c
68    RtlDoesFileExists.c
69    RtlDosApplyFileIsolationRedirection_Ustr.c
70    RtlDosPathNameToNtPathName_U.c
71    RtlDosSearchPath_U.c
72    RtlDosSearchPath_Ustr.c
73    RtlFirstFreeAce.c
74    RtlGenerate8dot3Name.c
75    RtlGetFullPathName_U.c
76    RtlGetFullPathName_Ustr.c
77    RtlGetFullPathName_UstrEx.c
78    RtlGetLengthWithoutLastFullDosOrNtPathElement.c
79    RtlGetLengthWithoutTrailingPathSeperators.c
80    RtlGetLongestNtPathLength.c
81    RtlGetNtProductType.c
82    RtlGetUnloadEventTrace.c
83    RtlHandle.c
84    RtlImageDirectoryEntryToData.c
85    RtlImageRvaToVa.c
86    RtlIsNameLegalDOS8Dot3.c
87    RtlMemoryStream.c
88    RtlMultipleAllocateHeap.c
89    RtlNtPathNameToDosPathName.c
90    RtlpApplyLengthFunction.c
91    RtlpEnsureBufferSize.c
92    RtlQueryTimeZoneInfo.c
93    RtlReAllocateHeap.c
94    RtlRemovePrivileges.c
95    RtlUnicodeStringToAnsiString.c
96    RtlUnicodeStringToCountedOemString.c
97    RtlUnicodeToOemN.c
98    RtlUpcaseUnicodeStringToCountedOemString.c
99    RtlValidateUnicodeString.c
100    RtlxUnicodeStringToAnsiSize.c
101    RtlxUnicodeStringToOemSize.c
102    StackOverflow.c
103    SystemInfo.c
104    UserModeException.c
105    Timer.c
106    precomp.h)
107
108if(ARCH STREQUAL "i386")
109    add_asm_files(ntdll_apitest_asm i386/NtContinue.S)
110elseif(ARCH STREQUAL "amd64")
111    add_asm_files(ntdll_apitest_asm amd64/NtContinue.S)
112endif()
113
114list(APPEND PCH_SKIP_SOURCE
115    testlist.c)
116
117add_rc_deps(testdata.rc ${CMAKE_CURRENT_BINARY_DIR}/load_notifications/load_notifications.dll)
118
119add_executable(ntdll_apitest
120    ${SOURCE}
121    ${ntdll_apitest_asm}
122    ${PCH_SKIP_SOURCE}
123    testdata.rc
124    ${CMAKE_CURRENT_BINARY_DIR}/ntdll_apitest.def)
125
126set_target_properties(ntdll_apitest
127    PROPERTIES
128    ENABLE_EXPORTS TRUE
129    DEFINE_SYMBOL "")
130
131target_link_libraries(ntdll_apitest rtl_test_lib wine uuid ${PSEH_LIB})
132set_module_type(ntdll_apitest win32cui)
133add_importlibs(ntdll_apitest msvcrt advapi32 kernel32 ntdll)
134add_pch(ntdll_apitest precomp.h "${PCH_SKIP_SOURCE}")
135add_dependencies(ntdll_apitest load_notifications)
136
137if(NOT MSVC)
138    set_source_files_properties(RtlGetFullPathName_UstrEx.c PROPERTIES COMPILE_FLAGS "-Wno-format")
139
140    # Avoid "universal character names are only valid in C++ and C99" error.
141    set_property(TARGET ntdll_apitest PROPERTY C_STANDARD 99)
142endif()
143
144add_rostests_file(TARGET ntdll_apitest)
145add_rostests_file(TARGET ntdll_apitest SUBDIR testdata)
146# These are empty files
147add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/ntdll_apitest.exe.local" SUBDIR testdata)
148add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/shell32.dll" SUBDIR testdata)
149# add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/test.dll" SUBDIR testdata)
150add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/ntdlltest.manifest" SUBDIR testdata)
151add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/fil1.txt" SUBDIR testdata)
152
153# Convenience target for running from IDE
154if(MSVC_IDE)
155    set(NTDLL_APITEST_DATADIR $<TARGET_FILE_DIR:ntdll_apitest>/testdata/)
156    add_custom_command(TARGET ntdll_apitest
157                       POST_BUILD
158                       COMMAND "${CMAKE_COMMAND}" -E make_directory ${NTDLL_APITEST_DATADIR}
159                       COMMAND "${CMAKE_COMMAND}" -E copy $<TARGET_FILE:ntdll_apitest> ${NTDLL_APITEST_DATADIR}
160                       COMMAND "${CMAKE_COMMAND}" -E copy ntdll_apitest.exe.local ${NTDLL_APITEST_DATADIR}
161                       COMMAND "${CMAKE_COMMAND}" -E copy shell32.dll ${NTDLL_APITEST_DATADIR}
162                       COMMAND "${CMAKE_COMMAND}" -E copy test.dll ${NTDLL_APITEST_DATADIR}
163                       COMMAND "${CMAKE_COMMAND}" -E copy ntdlltest.manifest ${NTDLL_APITEST_DATADIR}
164                       COMMAND "${CMAKE_COMMAND}" -E copy fil1.txt ${NTDLL_APITEST_DATADIR}
165                       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
166endif()
167