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