阅读:657回复:2
我写的一个驱动,在应用程序向驱动发送消息的时候,总是提示一次错误。
我的驱动部分是这样写的:
DriverObject->MajorFunction[IRP_MJ_CREATE] = MydrvDispatch; DriverObject->MajorFunction[IRP_MJ_CLOSE] = MydrvDispatch; DriverObject->MajorFunction[IRP_MJ_CLEANUP] = MydrvDispatch; static NTSTATUS MydrvDispatch (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { NTSTATUS status; PIO_STACK_LOCATION irpSp; UNREFERENCED_PARAMETER(DeviceObject); irpSp = IoGetCurrentIrpStackLocation( Irp ); switch (irpSp->MajorFunction) { case IRP_MJ_CREATE: DbgPrint(\"IRP_MJ_CREATE\\n\"); Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = 0L; break; case IRP_MJ_CLOSE: DbgPrint(\"IRP_MJ_CLOSE\\n\"); Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = 0L; break; case IRP_MJ_CLEANUP: DbgPrint(\"IRP_MJ_CLEANUP\\n\"); Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = 0L; break; } IoCompleteRequest(Irp, 0); return STATUS_SUCCESS; } 请问各位大虾我这样写对吗?? |
|
沙发#
发布于:2004-04-20 10:30
看起来好象没什么问题啊。。。。。
|
|
|
板凳#
发布于:2004-04-20 10:32
不过为什么要用static来申明函数???
|
|
|