From 28c16df7d20aa53b8e872e6a712e84b73649ac72 Mon Sep 17 00:00:00 2001 From: Vizzini Date: Tue, 10 Feb 2004 02:54:14 +0000 Subject: [PATCH] Added an unload handler for easier testing svn path=/trunk/; revision=8125 --- reactos/drivers/test/csqtest/csqtest.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/reactos/drivers/test/csqtest/csqtest.c b/reactos/drivers/test/csqtest/csqtest.c index c362561a0d9..4b6b22ec1ea 100644 --- a/reactos/drivers/test/csqtest/csqtest.c +++ b/reactos/drivers/test/csqtest/csqtest.c @@ -28,6 +28,9 @@ IO_CSQ Csq; LIST_ENTRY IrpQueue; KSPIN_LOCK IrpQueueLock; +/* Device object */ +PDEVICE_OBJECT DeviceObject; + /* * CSQ Callbacks */ @@ -155,7 +158,18 @@ NTSTATUS NTAPI DispatchIoctl(PDEVICE_OBJECT DeviceObject, PIRP Irp) } VOID NTAPI Unload(PDRIVER_OBJECT DriverObject) +/* + * Function: called by the OS to release resources before unload + */ { + UNICODE_STRING LinkName; + + RtlInitUnicodeString(&LinkName, DOS_DEVICE_NAME); + + IoDeleteSymbolicLink(&LinkName); + + if(DeviceObject) + IoDeleteDevice(DeviceObject); } /* @@ -167,7 +181,6 @@ NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING Registry NTSTATUS Status; UNICODE_STRING NtName; UNICODE_STRING DosName; - PDEVICE_OBJECT DeviceObject; DriverObject->MajorFunction[IRP_MJ_CREATE] = (PDRIVER_DISPATCH)DispatchCreateCloseCleanup; DriverObject->MajorFunction[IRP_MJ_CLOSE] = (PDRIVER_DISPATCH)DispatchCreateCloseCleanup;