From da753e9668a7ee651a124f60feb56f9b45c1463f Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Sun, 31 Mar 2024 17:31:50 +0800 Subject: [PATCH] Add version info on startup --- Makefile | 6 ++++++ even.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c4a9c05..f9b8f8a 100644 --- a/Makefile +++ b/Makefile @@ -13,12 +13,18 @@ DRVNAME = even INCLUDES = -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/ddk INCLUDES += + # We could in fact just add -DEVEN_DRIVER_NAME=\"$(DRVNAME)\" to CFLAGS, # but we'd have to be careful to "make clean" after changing # the driver name here in the makefile... #CFLAGS = -Wall $(INCLUDES) -DEVEN_DRIVER_NAME=\"$(DRVNAME)\" CFLAGS = -Wall -Wpedantic -DNDEBUG $(INCLUDES) +ifneq ($(RELEASE),) +VERSION = $(shell git describe --tags --always --dirty) +CFLAGS += -DEVEN_VERSION=\"$(VERSION)\" +endif + # Kernel-mode libs: # libntoskrnl = basic kernel-mode environment # libhal = WRITE_PORT_UCHAR et al. diff --git a/even.c b/even.c index b4fed9a..365a4c4 100644 --- a/even.c +++ b/even.c @@ -403,7 +403,9 @@ NTSTATUS __stdcall DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRIN DbgPrint("even.sys" #ifdef EVEN_VERSION - " (" EVEN_VERSION ") " + " (" + EVEN_VERSION + ") " #else " " #endif