reactos/sdk/lib/cmlib/CMakeLists.txt
George Bișoc f33da480af
[SDK][CMLIB] Implement CmCheckRegistry and validation private helpers
CmCheckRegistry is a function that provides the necessary validation checks for a registry hive. This function usually comes into action when logs have been replayed for example, or when a registry hive internals have changed such as when saving a key, loading a key, etc.

This commit implements the whole Check Registry infrastructure (cmcheck.c) in CMLIB library for ease of usage and wide accessibility across parts of the OS. In addition, two more functions for registry checks are also implemented -- HvValidateHive and HvValidateBin.

Instead of having the CmCheckRegistry implementation in the kernel, it's better to have it in the Configuration Manager library instead (aka CMLIB). The benefits of having it in the library are the following:

- CmCheckRegistry can be used in FreeLdr to fix the SYSTEM hive
- It can be used on-demand in the kernel
- It can be used for offline registry repair tools
- It makes the underlying CmCheckRegistry implementation code debug-able in user mode

CORE-9195
CORE-6762
2023-11-19 20:44:27 +01:00

47 lines
1,022 B
CMake

add_definitions(
-D_NTSYSTEM_
-DNASSERT)
list(APPEND SOURCE
cmcheck.c
cminit.c
cmheal.c
cmindex.c
cmkeydel.c
cmname.c
cmse.c
cmvalue.c
hivebin.c
hivecell.c
hiveinit.c
hivesum.c
hivewrt.c
cmlib.h)
if(CMAKE_CROSSCOMPILING)
# CMLIB for NT bootloader
add_library(blcmlib ${SOURCE})
target_compile_definitions(blcmlib PRIVATE _BLDR_)
add_dependencies(blcmlib bugcodes xdk)
add_pch(blcmlib cmlib.h SOURCE)
# CMLIB for NT kernel
add_library(cmlib ${SOURCE})
add_dependencies(cmlib bugcodes xdk)
add_pch(cmlib cmlib.h SOURCE)
else()
# CMLIB for host-tools
add_definitions(
-D__NO_CTYPE_INLINES
-DCMLIB_HOST)
add_library(cmlibhost ${SOURCE})
target_include_directories(cmlibhost INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
if(NOT MSVC)
target_compile_options(cmlibhost PRIVATE -fshort-wchar -Wno-multichar)
endif()
target_link_libraries(cmlibhost PRIVATE host_includes)
endif()