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