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