1
2include_directories(include)
3
4#
5# subdirectories containing special-purpose drivers
6#
7add_subdirectory(example)
8add_subdirectory(fltmgr)
9add_subdirectory(hidparse)
10add_subdirectory(kernel32)
11add_subdirectory(ntos_cc)
12add_subdirectory(ntos_io)
13add_subdirectory(ntos_mm)
14add_subdirectory(ntos_po)
15add_subdirectory(tcpip)
16
17list(APPEND COMMON_SOURCE
18    example/GuardedMemory.c
19    rtl/RtlAvlTree.c
20    rtl/RtlException.c
21    ../apitests/rtl/RtlIntSafe.c
22    rtl/RtlMemory.c
23    rtl/RtlRegistry.c
24    rtl/RtlSplayTree.c
25    rtl/RtlStack.c
26    rtl/RtlStrSafe.c
27    rtl/RtlUnicodeString.c)
28
29if(ARCH STREQUAL "i386")
30
31elseif(ARCH STREQUAL "amd64")
32    add_asm_files(kmtest_common_asm ../apitests/rtl/amd64/RtlCaptureContext-asm.s)
33    list(APPEND COMMON_SOURCE
34        ../apitests/rtl/amd64/RtlCaptureContext.c
35        ${kmtest_common_asm}
36    )
37endif()
38
39#
40# kmtest_drv.sys driver
41#
42list(APPEND KMTEST_DRV_SOURCE
43    kmtest_drv/guid.c
44    kmtest_drv/kmtest_drv.c
45    kmtest_drv/structs.c
46    kmtest_drv/testlist.c
47
48    example/Example.c
49    example/KernelType.c
50    hal/HalSystemInfo.c
51    npfs/NpfsConnect.c
52    npfs/NpfsCreate.c
53    npfs/NpfsFileInfo.c
54    npfs/NpfsHelpers.c
55    npfs/NpfsReadWrite.c
56    npfs/NpfsVolumeInfo.c
57    novp_fsrtl/FsRtlRemoveDotsFromPath.c
58    ntos_cm/CmSecurity.c
59    ntos_ex/ExCallback.c
60    ntos_ex/ExDoubleList.c
61    ntos_ex/ExFastMutex.c
62    ntos_ex/ExHardError.c
63    ntos_ex/ExInterlocked.c
64    ntos_ex/ExPools.c
65    ntos_ex/ExResource.c
66    ntos_ex/ExSequencedList.c
67    ntos_ex/ExSingleList.c
68    ntos_ex/ExTimer.c
69    ntos_ex/ExUuid.c
70    ntos_fsrtl/FsRtlDissect.c
71    ntos_fsrtl/FsRtlExpression.c
72    ntos_fsrtl/FsRtlLegal.c
73    ntos_fsrtl/FsRtlMcb.c
74    ntos_fsrtl/FsRtlTunnel.c
75    ntos_io/IoCreateFile.c
76    ntos_io/IoDeviceInterface.c
77    ntos_io/IoEvent.c
78    ntos_io/IoFilesystem.c
79    ntos_io/IoInterrupt.c
80    ntos_io/IoIrp.c
81    ntos_io/IoMdl.c
82    ntos_io/IoVolume.c
83    ntos_ke/KeApc.c
84    ntos_ke/KeDevQueue.c
85    ntos_ke/KeDpc.c
86    ntos_ke/KeEvent.c
87    ntos_ke/KeFloatPointState.c
88    ntos_ke/KeGuardedMutex.c
89    ntos_ke/KeIrql.c
90    ntos_ke/KeMutex.c
91    ntos_ke/KeProcessor.c
92    ntos_ke/KeSpinLock.c
93    ntos_ke/KeTimer.c
94    ntos_mm/MmMdl.c
95    ntos_mm/MmReservedMapping.c
96    ntos_mm/MmSection.c
97    ntos_mm/ZwAllocateVirtualMemory.c
98    ntos_mm/ZwCreateSection.c
99    ntos_mm/ZwMapViewOfSection.c
100    ntos_ob/ObHandle.c
101    ntos_ob/ObQuery.c
102    ntos_ob/ObReference.c
103    ntos_ob/ObSecurity.c
104    ntos_ob/ObSymbolicLink.c
105    ntos_ob/ObType.c
106    ntos_ob/ObTypes.c
107    ntos_ob/ObWait.c
108    ntos_ps/PsNotify.c
109    ntos_ps/PsQuota.c
110    ntos_se/SeHelpers.c
111    ntos_se/SeInheritance.c
112    ntos_se/SeLogonSession.c
113    ntos_se/SeQueryInfoToken.c
114    ntos_se/SeTokenFiltering.c
115    rtl/RtlIsValidOemCharacter.c
116    rtl/RtlRangeList.c
117    ${COMMON_SOURCE}
118
119    kmtest_drv/kmtest_drv.rc)
120
121add_library(kmtest_drv MODULE ${KMTEST_DRV_SOURCE})
122set_module_type(kmtest_drv kernelmodedriver)
123target_link_libraries(kmtest_drv kmtest_printf chkstk memcmp ntoskrnl_vista ${PSEH_LIB})
124add_importlibs(kmtest_drv ntoskrnl hal)
125add_dependencies(kmtest_drv bugcodes xdk)
126target_compile_definitions(kmtest_drv PRIVATE KMT_KERNEL_MODE NTDDI_VERSION=NTDDI_WS03SP1)
127#add_pch(kmtest_drv include/kmt_test.h)
128add_rostests_file(TARGET kmtest_drv)
129
130add_library(kmtest_printf
131    kmtest_drv/printf_stubs.c
132    ${REACTOS_SOURCE_DIR}/sdk/lib/crt/string/strnlen.c
133    ${REACTOS_SOURCE_DIR}/sdk/lib/crt/string/wcsnlen.c
134    ${REACTOS_SOURCE_DIR}/sdk/lib/crt/printf/streamout.c)
135target_compile_definitions(kmtest_printf PRIVATE _LIBCNT_ _USER32_WSPRINTF wctomb=KmtWcToMb)
136target_include_directories(kmtest_printf PRIVATE ${REACTOS_SOURCE_DIR}/sdk/lib/crt/include)
137
138#
139# kmtest.exe loader application
140#
141
142list(APPEND KMTEST_SOURCE
143    kmtest/filter.c
144    kmtest/fltsupport.c
145    kmtest/kmtest.c
146    kmtest/service.c
147    kmtest/support.c
148    kmtest/testlist.c
149
150    example/Example_user.c
151
152    fltmgr/fltmgr_load/fltmgr_user.c
153    fltmgr/fltmgr_register/fltmgr_reg_user.c
154
155    hidparse/HidP_user.c
156    kernel32/FileAttributes_user.c
157    kernel32/FindFile_user.c
158    ntos_cc/CcCopyRead_user.c
159    ntos_cc/CcCopyWrite_user.c
160    ntos_cc/CcMapData_user.c
161    ntos_cc/CcPinMappedData_user.c
162    ntos_cc/CcPinRead_user.c
163    ntos_cc/CcSetFileSizes_user.c
164    ntos_io/IoCreateFile_user.c
165    ntos_io/IoDeviceObject_user.c
166    ntos_io/IoReadWrite_user.c
167    ntos_mm/MmMapLockedPagesSpecifyCache_user.c
168    ntos_mm/NtCreateSection_user.c
169    ntos_po/PoIrp_user.c
170    tcpip/TcpIp_user.c
171    ${COMMON_SOURCE}
172
173    kmtest/kmtest.rc)
174
175add_executable(kmtest ${KMTEST_SOURCE})
176set_module_type(kmtest win32cui)
177target_link_libraries(kmtest ${PSEH_LIB})
178add_importlibs(kmtest fltlib advapi32 ws2_32 msvcrt kernel32 ntdll)
179target_compile_definitions(kmtest PRIVATE KMT_USER_MODE NTDDI_VERSION=NTDDI_WS03SP1)
180#add_pch(kmtest include/kmt_test.h)
181set_target_properties(kmtest PROPERTIES OUTPUT_NAME "kmtest_")
182add_rostests_file(TARGET kmtest)
183
184#
185# Group targets
186#
187add_custom_target(kmtest_drivers)
188add_dependencies(kmtest_drivers
189    kmtest_drv
190    example_drv
191    hidp_drv
192    iocreatefile_drv
193    iodeviceobject_drv
194    iohelper_drv
195    ioreadwrite_drv
196    kernel32_drv
197    mmmaplockedpagesspecifycache_drv
198    ntcreatesection_drv
199    poirp_drv
200    tcpip_drv
201    cccopyread_drv
202    ccmapdata_drv)
203
204add_custom_target(kmtest_all)
205add_dependencies(kmtest_all kmtest_drivers kmtest)
206