|
Prev: 1394 camera suspend/resume - question about IRP_MN_SET_POWER
Next: returning DCR_HALFTONE from DrvDitherColor
From: hitesh on 29 Apr 2008 10:12 Hi all, i am writing the file system driver. There is a problem with non-cached read. here is the sample code, whenever the call reaches to keWaitForSingleObject() it hangs (waits) there infinitely? can anyone please tell me what could be the problem? i am using my own buffer ( allocated paged memory ). is it the case that i have to lock the buffer? i have tried with locking the buffer also. this problem occurs only in Windows XP not in Vista. is there any specific thing we need to take care? please help me, thanks hitesh ughreja here is the sample code. KEVENT Event; PIRP Irp; IO_STATUS_BLOCK IoStatus; NTSTATUS Status; KeInitializeEvent(&Event, SynchronizationEvent, FALSE); Irp = IoBuildSynchronousFsdRequest( IRP_MJ_READ, TargetDeviceObject, Buffer, Length, (PLARGE_INTEGER)(&Offset), &Event, &IoStatus ); if (!Irp) { Status = STATUS_INSUFFICIENT_RESOURCES; } Status = IoCallDriver(TargetDeviceObject, Irp); if (Status == STATUS_PENDING) { KeWaitForSingleObject( &Event, Executive, KernelMode, FALSE, NULL ); Status = IoStatus.Status; } if(!NT_SUCCESS(Status)) { DbgPrint("Read disk failure\n"); return Status; }
From: Vladimir Zinin on 30 Apr 2008 13:57 Perhaps irql > PASSIVE_LEVEL (or at least special kernel APCs are disabled). Use IoBuildAsynchronousFsdRequest instead. You can see how to use it here: http://support.microsoft.com/kb/326315 -- Best regards, Vladimir Zinin hitesh wrote: > Hi all, > i am writing the file system driver. > There is a problem with non-cached read. > here is the sample code, > whenever the call reaches to keWaitForSingleObject() it hangs (waits) > there infinitely? > can anyone please tell me what could be the problem? > i am using my own buffer ( allocated paged memory ). > is it the case that i have to lock the buffer? > i have tried with locking the buffer also. > this problem occurs only in Windows XP not in Vista. > is there any specific thing we need to take care? > > please help me, > thanks > hitesh ughreja > > here is the sample code. > > KEVENT Event; > PIRP Irp; > IO_STATUS_BLOCK IoStatus; > NTSTATUS Status; > > KeInitializeEvent(&Event, SynchronizationEvent, FALSE); > > Irp = IoBuildSynchronousFsdRequest( > IRP_MJ_READ, > TargetDeviceObject, > Buffer, > Length, > (PLARGE_INTEGER)(&Offset), > &Event, > &IoStatus > ); > > if (!Irp) > { > Status = STATUS_INSUFFICIENT_RESOURCES; > } > > Status = IoCallDriver(TargetDeviceObject, Irp); > > if (Status == STATUS_PENDING) > { > KeWaitForSingleObject( > &Event, > Executive, > KernelMode, > FALSE, > NULL > ); > > Status = IoStatus.Status; > } > > if(!NT_SUCCESS(Status)) > { > DbgPrint("Read disk failure\n"); > return Status; > }
From: Maxim S. Shatskih on 1 May 2008 05:13
> Irp = IoBuildSynchronousFsdRequest( > IRP_MJ_READ, > TargetDeviceObject, > Buffer, > Length, > (PLARGE_INTEGER)(&Offset), > &Event, > &IoStatus > ); Use IoAllocateIrp and the completion routine which will KeSetEvent for the event instead of IoBuildSynchronousFsdRequest. -- Maxim Shatskih, Windows DDK MVP StorageCraft Corporation maxim(a)storagecraft.com http://www.storagecraft.com |