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    NtQueryKey.c
30    NtQuerySystemEnvironmentValue.c
31    NtQuerySystemInformation.c
32    NtQueryVolumeInformationFile.c
33    NtReadFile.c
34    NtSaveKey.c
35    NtSetInformationFile.c
36    NtSetValueKey.c
37    NtSetVolumeInformationFile.c
38    NtWriteFile.c
39    RtlAllocateHeap.c
40    RtlBitmap.c
41    RtlComputePrivatizedDllName_U.c
42    RtlCopyMappedMemory.c
43    RtlDeleteAce.c
44    RtlDetermineDosPathNameType.c
45    RtlDoesFileExists.c
46    RtlDosApplyFileIsolationRedirection_Ustr.c
47    RtlDosPathNameToNtPathName_U.c
48    RtlDosSearchPath_U.c
49    RtlDosSearchPath_Ustr.c
50    RtlFirstFreeAce.c
51    RtlGenerate8dot3Name.c
52    RtlGetFullPathName_U.c
53    RtlGetFullPathName_Ustr.c
54    RtlGetFullPathName_UstrEx.c
55    RtlGetLengthWithoutTrailingPathSeperators.c
56    RtlGetLongestNtPathLength.c
57    RtlHandle.c
58    RtlImageRvaToVa.c
59    RtlInitializeBitMap.c
60    RtlIsNameLegalDOS8Dot3.c
61    RtlMemoryStream.c
62    RtlNtPathNameToDosPathName.c
63    RtlpEnsureBufferSize.c
64    RtlQueryTimeZoneInfo.c
65    RtlReAllocateHeap.c
66    RtlUnicodeStringToAnsiString.c
67    RtlUpcaseUnicodeStringToCountedOemString.c
68    StackOverflow.c
69    SystemInfo.c
70    Timer.c
71    precomp.h)
72
73if(ARCH STREQUAL "i386")
74    add_asm_files(ntdll_apitest_asm i386/NtContinue.S)
75endif()
76
77add_rc_deps(testdata.rc ${CMAKE_CURRENT_BINARY_DIR}/load_notifications/load_notifications.dll)
78add_executable(ntdll_apitest
79    ${SOURCE}
80    ${ntdll_apitest_asm}
81    testdata.rc
82    ${CMAKE_CURRENT_BINARY_DIR}/ntdll_apitest.def
83    testlist.c)
84target_link_libraries(ntdll_apitest wine uuid ${PSEH_LIB})
85set_module_type(ntdll_apitest win32cui)
86add_importlibs(ntdll_apitest msvcrt advapi32 kernel32 ntdll)
87add_pch(ntdll_apitest precomp.h SOURCE)
88
89if(NOT MSVC)
90    set_source_files_properties(RtlGetFullPathName_UstrEx.c PROPERTIES COMPILE_FLAGS "-Wno-format")
91
92    # Avoid "universal character names are only valid in C++ and C99" error.
93    set_property(TARGET ntdll_apitest PROPERTY C_STANDARD 99)
94endif()
95
96add_rostests_file(TARGET ntdll_apitest)
97add_rostests_file(TARGET ntdll_apitest SUBDIR testdata)
98# These are empty files
99add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/ntdll_apitest.exe.local" SUBDIR testdata)
100add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/shell32.dll" SUBDIR testdata)
101add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/test.dll" SUBDIR testdata)
102add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/ntdlltest.manifest" SUBDIR testdata)
103add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/fil1.txt" SUBDIR testdata)
104
105# Convenience target for running from IDE
106if(MSVC_IDE)
107    set(NTDLL_APITEST_DATADIR $<TARGET_FILE_DIR:ntdll_apitest>/testdata/)
108    add_custom_command(TARGET ntdll_apitest
109                       POST_BUILD
110                       COMMAND "${CMAKE_COMMAND}" -E make_directory ${NTDLL_APITEST_DATADIR}
111                       COMMAND "${CMAKE_COMMAND}" -E copy $<TARGET_FILE:ntdll_apitest> ${NTDLL_APITEST_DATADIR}
112                       COMMAND "${CMAKE_COMMAND}" -E copy ntdll_apitest.exe.local ${NTDLL_APITEST_DATADIR}
113                       COMMAND "${CMAKE_COMMAND}" -E copy shell32.dll ${NTDLL_APITEST_DATADIR}
114                       COMMAND "${CMAKE_COMMAND}" -E copy test.dll ${NTDLL_APITEST_DATADIR}
115                       COMMAND "${CMAKE_COMMAND}" -E copy ntdlltest.manifest ${NTDLL_APITEST_DATADIR}
116                       COMMAND "${CMAKE_COMMAND}" -E copy fil1.txt ${NTDLL_APITEST_DATADIR}
117                       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
118endif()
119