From 2bfe95fb4e271d723a0aae537ec6c8732785442e Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Thu, 1 Apr 2021 21:35:13 -0400 Subject: check for safe mode before hooking into dev stack can't stop the driver from being loaded in safe mode, an early return here is the best we can do --- driver/driver.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'driver') diff --git a/driver/driver.cpp b/driver/driver.cpp index a7fe3b6..0c272e1 100644 --- a/driver/driver.cpp +++ b/driver/driver.cpp @@ -20,6 +20,8 @@ struct { ra::mouse_modifier modifier; } global = {}; +extern "C" PULONG InitSafeBootMode; + VOID RawaccelCallback( IN PDEVICE_OBJECT DeviceObject, @@ -433,13 +435,17 @@ Return Value: NTSTATUS status; WDFDEVICE hDevice; WDF_IO_QUEUE_CONFIG ioQueueConfig; - + UNREFERENCED_PARAMETER(Driver); PAGED_CODE(); DebugPrint(("Enter FilterEvtDeviceAdd \n")); + if (*InitSafeBootMode > 0) { + return STATUS_SUCCESS; + } + // // Tell the framework that you are filter driver. Framework // takes care of inherting all the device flags & characterstics -- cgit v1.2.3