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