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