Hello All,
I am facing a problem in making my own requests aganist a kernel request. Consider e.g. that I want to make two write requests aganist one kernel write request. What length should I choose for my own IRPs.
One way to calculate the length is this
myStack = IoGetCurrentIrpStackLocation(OsIrp)
Length = myStack->Parameters.Write.Length // e.g. 1024
or this one
Length = MmGetMdlByteCount(OsIrp->MdlAddress) // e.g. 4096
Which length is correct to use.
Thanks,
Uzair Lakhani
xxxxx@yahoo.com wrote:
I am facing a problem in making my own requests aganist a kernel request. Consider e.g. that I want to make two write requests aganist one kernel write request. What length should I choose for my own IRPs.
One way to calculate the length is this
myStack = IoGetCurrentIrpStackLocation(OsIrp)
Length = myStack->Parameters.Write.Length // e.g. 1024
or this one
Length = MmGetMdlByteCount(OsIrp->MdlAddress) // e.g. 4096
Which length is correct to use.
Well, no one can really answer your question, because we don’t know
exactly what you’re trying to accomplish. However, based on my
assumption, you want to use Parameters.Write.Length. The MDL tells you
how large the chunk of buffer memory is. The IRP Parameters tells you
how much is supposed to be transferred during this request.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
> Length = MmGetMdlByteCount(OsIrp->MdlAddress) // e.g. 4096
Please note that the above applies only when you use METHOD_DIRECT - if you rely upon METHOD_BUFFERED OsIrp->MdlAddress will be NULL. In any case, even if you use METHOD_DIRECT, ‘Parameters.Write.Length’ is the only thing that matters, as far as a given request is concerned - it tells you how much data you have to transfer. Even if MDL in itself is larger than that, it may have nothing to do with this particular request, so that you should not be bothered about it…
Anton Bassov