mirror of
https://dev.lirent.ru/Vatrog/vm-introspection-engine.git
synced 2026-06-18 02:06:36 +03:00
b3441dd6f6
CORE (src/core): vmie_mem — guest-physical substrate with a data-driven segment map (replaces the hardcoded 4 GiB PCI-hole topology). ENGINE (src/engine): x86-64 paging + Windows bring-up; produces the generic memory model. HANDLERS (src/handlers): the signature/value/pointer scanners, which now consume an OS-agnostic contract. Keystone: gva_ctx is split into vmie_mem (core) + vmie (engine); the generic access functions take vmie_mem* + cr3 and no longer compile in the Windows offset table. New public contract include/memmodel.h (vmie_mem, mem_view_t, vregion, task, range, the gva_* access); win32 surface in include/vmie.h. Leak relocations: the PE parser, UTF-16 decode and CR3-recovery heuristics move engine-side; the matcher stays a pure, source-agnostic handler, and the pointer scanner takes a generic range[] instead of reaching into the process enumerator.
49 lines
2.1 KiB
CMake
49 lines
2.1 KiB
CMake
cmake_minimum_required(VERSION 3.18) # find_program(... REQUIRED)
|
|
project(vmi-engine C)
|
|
|
|
set(CMAKE_C_STANDARD 17) # generation B uses no C23 feature
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
set(CMAKE_C_EXTENSIONS ON) # deliberate: strnlen (POSIX) + void* arithmetic (GNU)
|
|
|
|
option(VMIE_LTO "Enable LTO" OFF) # build-only; shipped default is -O2, no LTO
|
|
|
|
# ---- host: VMI core as a static library ---------------------------------
|
|
add_library(vmie STATIC
|
|
src/core/gpa.c
|
|
src/engine/gva.c
|
|
src/engine/host.c
|
|
src/engine/pe.c
|
|
src/engine/proc.c
|
|
src/engine/profile.c
|
|
src/engine/text.c
|
|
src/handlers/scan.c
|
|
src/handlers/sigscan.c)
|
|
target_include_directories(vmie
|
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include # public API: include/*.h
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/core/include # private: core.h
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/engine/include) # private: engine.h, contract.h
|
|
target_compile_options(vmie PRIVATE -O2 -Wall -Wextra)
|
|
if(VMIE_LTO)
|
|
target_compile_options(vmie PRIVATE -flto)
|
|
target_link_options(vmie PRIVATE -flto)
|
|
endif()
|
|
|
|
# ---- host: CLI demonstrator over the library ----------------------------
|
|
add_executable(vmie_cli src/cli.c)
|
|
target_link_libraries(vmie_cli PRIVATE vmie) # public include/ comes via vmie (PUBLIC)
|
|
target_compile_options(vmie_cli PRIVATE -Wall -Wextra)
|
|
|
|
# ---- guest: cross-compile to Windows x86-64 via mingw-w64 ---------------
|
|
find_program(MINGW_CC NAMES x86_64-w64-mingw32-gcc REQUIRED)
|
|
set(VMIE_STARTUP ${CMAKE_CURRENT_BINARY_DIR}/vmie-startup.exe)
|
|
add_custom_command(
|
|
OUTPUT ${VMIE_STARTUP}
|
|
COMMAND ${MINGW_CC} -O2 -Wall -Wextra -static -s
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/src/engine/include
|
|
-o ${VMIE_STARTUP} ${CMAKE_CURRENT_SOURCE_DIR}/src/engine/guest.c
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/engine/guest.c
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/engine/include/contract.h
|
|
COMMENT "Cross-compiling vmie-startup.exe (mingw-w64, x86-64)"
|
|
VERBATIM)
|
|
add_custom_target(vmie-startup ALL DEPENDS ${VMIE_STARTUP})
|