先上代码溜溜:
#include <ntddk.h>
void testUnload(IN PDRIVER_OBJECT DriverObject)
{
}
NTSTATUS testDefaultHandler(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Irp->IoStatus.Status;
}
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
{
ULONG i;
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
DriverObject->MajorFunction[i] = testDefaultHandler;
DriverObject->DriverUnload = testUnload;
return STATUS_SUCCESS;
}
驱动卸载时,函数调用如下: