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;
}