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