阅读:555回复:0
谁能帮帮我
我WDM新手上路,对以下语句似懂非懂,哪位大侠帮我点通一下,在语句后写一些简明注释,感激不尽,(摘自Microsoft RamDisk,由于被自动换行,可将其复制到记事本,编辑好后再复制回来,先谢了!祝大侠前程似锦!)
NTSTATUS RamDiskDispatchPnp(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp) { PIO_STACK_LOCATION irpStack; PDEVICE_EXTENSION devExt; KEVENT event; NTSTATUS status = STATUS_SUCCESS; BOOLEAN lockHeld = TRUE; irpStack = IoGetCurrentIrpStackLocation( Irp ); devExt = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension; status = IoAcquireRemoveLock(&devExt->RemoveLock, Irp); ...... switch (irpStack->MinorFunction) { case IRP_MN_START_DEVICE: { KeInitializeEvent( &event, NotificationEvent, FALSE); IoCopyCurrentIrpStackLocationToNext( Irp ); IoSetCompletionRoutine( Irp, (PIO_COMPLETION_ROUTINE) RamDiskIoCompletionRoutine, (PVOID) &event, TRUE, TRUE, TRUE ); status = IoCallDriver( devExt->LowerDeviceObject, Irp ); if (status == STATUS_PENDING) { KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL ); } ...... Irp->IoStatus.Status = status; Irp->IoStatus.Information = 0; IoCompleteRequest(Irp, IO_NO_INCREMENT); break; } ...... case IRP_MN_SURPRISE_REMOVAL: { ...... break; } ...... default: { IoSkipCurrentIrpStackLocation( Irp ); status = IoCallDriver( devExt->LowerDeviceObject, Irp ); break; } } ...... return status; } |
|
|