阅读:1041回复:3
救救我!
我现在正在做给笔记本的PCMCIA的Sram卡写驱动程序,遇到了一个非常奇怪的问题,请大家帮帮忙
1、我的inf文件的Class是MTD。 2、在AddDevice的时候没有错误返回。 3、在进行DispatchPnp处理IRP_MN_START_DEVICE的时候,一调用IoCallDriver的时候,笔记本就发出鸣叫声,然后返回的错误是STATUS_INSUFFICIENT_RESOURCES。 我真的不知道是哪里错了,希望大家帮帮我,我的分数最多就只能给20。 NTSTATUS DispatchPnp(PDEVICE_OBJECT fdo, PIRP Irp) { // DispatchPnp NTSTATUS stat; PDEVICE_EXTENSION pDe=(PDEVICE_EXTENSION)fdo->DeviceExtension; PIO_STACK_LOCATION pIrpStk=IoGetCurrentIrpStackLocation(Irp); KEVENT event; stat = IoAcquireRemoveLock(&pDe->RemoveLock,NULL); if( !NT_SUCCESS(stat) ) return CompleteRequest(Irp,stat,0); switch( pIrpStk->MinorFunction ) { case IRP_MN_START_DEVICE: IoCopyCurrentIrpStackLocationToNext(Irp); KeInitializeEvent(&event,NotificationEvent,FALSE); IoSetCompletionRoutine(Irp, (PIO_COMPLETION_ROUTINE)CompletionRoutine,&event, TRUE,TRUE,TRUE); //stat = PnpDefaHand(fdo,Irp); stat = IoCallDriver(pDe->LowerDeviceObject,Irp); if( stat==STATUS_PENDING ) { KeWaitForSingleObject(&event,Executive,KernelMode,FALSE,NULL); stat = Irp->IoStatus.Status; } if( !NT_SUCCESS(stat) ) { stat = CompleteRequest(Irp,stat,Irp->IoStatus.Information); break; } stat = StartDevice(fdo,pIrpStk); if( NT_SUCCESS(stat) ) IoSetDeviceInterfaceState(&pDe->ifname,TRUE); stat = CompleteRequest(Irp,stat,0); break; case IRP_MN_QUERY_STOP_DEVICE: Irp->IoStatus.Status = STATUS_SUCCESS; stat = PnpDefaHand(fdo,Irp); break; case IRP_MN_QUERY_REMOVE_DEVICE: Irp->IoStatus.Status = STATUS_SUCCESS; stat = PnpDefaHand(fdo,Irp); break; case IRP_MN_SURPRISE_REMOVAL: RemoveDevice(Irp,pDe); Irp->IoStatus.Status = STATUS_SUCCESS; stat = PnpDefaHand(fdo,Irp); break; case IRP_MN_REMOVE_DEVICE: IoReleaseRemoveLockAndWait(&pDe->RemoveLock,Irp); RemoveDevice(Irp,pDe); Irp->IoStatus.Status = STATUS_SUCCESS; stat = PnpDefaHand(fdo,Irp); IoSetDeviceInterfaceState(&pDe->ifname,FALSE); RtlFreeUnicodeString(&pDe->ifname); IoDetachDevice(pDe->LowerDeviceObject); IoDeleteDevice(fdo); return stat; case IRP_MN_STOP_DEVICE: RemoveDevice(Irp,pDe); Irp->IoStatus.Status = STATUS_SUCCESS; stat = PnpDefaHand(fdo,Irp); break; case IRP_MN_CANCEL_REMOVE_DEVICE: case IRP_MN_CANCEL_STOP_DEVICE: Irp->IoStatus.Status = STATUS_SUCCESS; stat = PnpDefaHand(fdo,Irp); break; /*case IRP_MN_QUERY_INTERFACE: stat = IoCallDriver(pDe->LowerDeviceObject,Irp); if( stat==STATUS_PENDING ) { KeWaitForSingleObject(&event,Executive,KernelMode,FALSE,NULL); stat = Irp->IoStatus.Status; } if( !NT_SUCCESS(stat) ) { stat = CompleteRequest(Irp,stat,Irp->IoStatus.Information); } break;*/ case 0x18: break; default: stat = PnpDefaHand(fdo,Irp); } if( !NT_SUCCESS(stat) ) { stat = stat; } IoReleaseRemoveLock(&pDe->RemoveLock,NULL); return stat; } |
|
沙发#
发布于:2003-04-25 08:40
为什么没有人回答呢? 我就这点分了,
|
|
板凳#
发布于:2003-04-25 08:41
如果需要源程序我可以给发过去
|
|
地板#
发布于:2003-04-25 14:26
为什么没有人回答我的问题,兄弟们,救命啊!!!!
|
|