"Hao Nguyen" <howser56...yahoo.com> wrote in message
news:2453ba04.0408262224.3af2dd2a...posting.google.com...
> I've got a thread that processes IRP_MJ_READ/WRITEs. From the code
> that follows, if I use pReadBuffer with ZwReadFile then everything is
> smooth but if I simply use pCurrentAddress then my whole system slows
> to a crawl after a few hundred megs. Can anyone shed some light?
> Writes don't seem to be affected if I use pCurrentAddress.
This is not related to your problem, but why are you wasting your time clearing
the buffer before the read?
You're not calling MmGetSystemAddressForMdlSafe more than once for the same
buffer, are you? In fact, why are you calling MmGetSystemAddressForMdlSafe, at
all? Unless you're not in the requesting process's context, it is not needed;
just use IRP->UserBuffer
-Brian
Brian Catlin, Sannas Consulting 310-944-9492
Windows Network, Video, WDM Device Driver Training & Consulting
See WWW.AZIUS.COM.bad for courses and scheduling
REMOVE .BAD FROM EMAIL AND WEB ADDRESS
> -Hao
> pCurrentAddress = MmGetSystemAddressForMdlSafe(pIrp->MdlAddress,
> HighPagePriority);
> pReadBuffer = ExAllocatePool(PagedPool,
> pIrpStack->Parameters.Read.Length);
> if(pReadBuffer == NULL)
> {
> pIrp->IoStatus.Information = 0;
> pIrp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
> IoCompleteRequest(pIrp, IO_NO_INCREMENT);
> }
> RtlZeroMemory(pReadBuffer, pIrpStack->Parameters.Read.Length);
> ZwReadFile(FileHandle, NULL, NULL, NULL, &IoStatusBlock,
> pReadBuffer, pIrpStack->Parameters.Read.Length,
> &pIrpStack->Parameters.Read.ByteOffset, NULL);
> RtlCopyMemory(pCurrentAddress, pReadBuffer,
> IoStatusBlock.Information);
> ExFreePool(pReadBuffer);