Before compiling the project, ensure that you have the following prerequisites installed:
- Windows operating system
- x64 architecture
- C++17 compatible compiler
- Windows Driver Kit (WDK) for the "driver" target
- xmake: A cross-platform build utility
To compile the project, follow these steps:
-
Clone the project repository to your local machine.
-
Open a command prompt or terminal and navigate to the project directory.
-
Make sure you have xmake installed on your system. If not, you can install it by following the instructions provided here.
-
Run the following command to compile the project:
xmakeThis command will read the xmake.lua file and build the project according to the specified configurations.
-
After the compilation process completes successfully, the compiled binaries will be located in the
build/Binariesdirectory. The exact path depends on the selected build mode (debug or release).
-
driver: Represents a driver component. It compiles C files from the
dependencies/driverdirectory and C++ files and resource files from the current directory. It sets the necessary defines and includes, links withntoskrnl, and applies specific compiler and linker flags for kernel mode development. -
gatekeeper: Represents a binary component. It compiles C++ files from the current directory, sets the necessary defines and includes, links with
ntdll, and applies specific compiler and linker flags. -
testdrv: Represents a driver component for testing purposes. It compiles C++ files from the current directory, sets the necessary defines and includes, links with
ntoskrnl, and applies specific compiler and linker flags for kernel mode development.
-
debug: This mode sets the
_DEBUGdefine, disables optimizations (-O0), and generates debug symbols (-g). -
release: This mode sets the
_RELEASEdefine, enables optimizations (-O2), and generates a release build without debug symbols. -
releasedbg: This mode sets both
_RELEASEand_RELEASEDBGdefines. It disables optimizations (-O0) and generates debug symbols (-g).
This project includes various compiler and linker flags to customize the build process. Here are some notable flags:
-
Compiler flags:
-Wno-macro-redefined,-Wno-unused-value: Suppress specific warning messages.-MTd,-MT: Specify the runtime library for the debug or release mode, respectively.-fno-stack-protector,-fno-stack-check,-fno-rtti: Disable stack protector, stack checks, and RTTI (Run-Time Type Information).
-
Linker flags:
-Wl: Pass additional arguments to the linker./emittoolversioninfo:no,/emitpogophaseinfo: Control the emission of tool version information and pogophase information.
%localappdata%\Microsoft\WIndowsApps\WinDbgX.exe -k <connect command >
Guest:
bcdedit /dbgsettings NET HOSTIP:1.2.3.4 PORT:55555
bcdedit /debug on
KDNET ignores HOSTIP and PORT variable under virt env in favor of VMBus
xmake check clang.tidy -f 'src/*.c:src/**.cpp'