From 6e6bbd6377d12ae67553922a26723575e6db35a0 Mon Sep 17 00:00:00 2001 From: ManOnTheMountainTech Date: Sun, 24 Mar 2024 21:21:59 -0700 Subject: [PATCH] Log failure of send to target. Restore driver.cpp to have unload routine. --- TailLight/SetTaillightBlack.cpp | 1 + TailLight/driver.cpp | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/TailLight/SetTaillightBlack.cpp b/TailLight/SetTaillightBlack.cpp index 6166f59..f7b7bf8 100644 --- a/TailLight/SetTaillightBlack.cpp +++ b/TailLight/SetTaillightBlack.cpp @@ -265,6 +265,7 @@ NTSTATUS SetBlackAsync(WDFDEVICE device, WdfObjectDelete(request); request = 0; status = STATUS_UNSUCCESSFUL; + KdPrint(("TailLight: Request not delivered to HIDUSB.\n")); } } diff --git a/TailLight/driver.cpp b/TailLight/driver.cpp index 148bd45..f4e0da1 100644 --- a/TailLight/driver.cpp +++ b/TailLight/driver.cpp @@ -5,20 +5,20 @@ NTSTATUS DriverEntry( _In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath - ) +) { KdPrint(("TailLight: DriverEntry - WDF version built on %s %s\n", __DATE__, __TIME__)); WDF_DRIVER_CONFIG params = {}; WDF_DRIVER_CONFIG_INIT(/*out*/¶ms, EvtDriverDeviceAdd); - params.DriverPoolTag = POOL_TAG; + params.EvtDriverUnload = EvtDriverUnload; // Create the framework WDFDRIVER object, with the handle to it returned in Driver. - NTSTATUS status = WdfDriverCreate(DriverObject, - RegistryPath, - WDF_NO_OBJECT_ATTRIBUTES, - ¶ms, - WDF_NO_HANDLE); // [out] + NTSTATUS status = WdfDriverCreate(DriverObject, + RegistryPath, + WDF_NO_OBJECT_ATTRIBUTES, + ¶ms, + WDF_NO_HANDLE); // [out] if (!NT_SUCCESS(status)) { // Framework will automatically cleanup on error Status return KdPrint(("TailLight: Error Creating WDFDRIVER 0x%x\n", status)); @@ -27,3 +27,13 @@ NTSTATUS DriverEntry( return status; } + +/** Driver unload callback. + Used to perform operations that must take place before the driver is unloaded. */ +VOID EvtDriverUnload( + _In_ WDFDRIVER Driver +) +{ + UNREFERENCED_PARAMETER(Driver); + KdPrint(("TailLight: DriverUnload.\n")); +}