TdiCopyMdlToBuffer() never copies more than the (destination) buffer size.
So if you buffer size was allocated to be SendLength, it seems to me that
you must be mistaken about either that statement or the statement that
“BytesCopied is larger than SendLength”.
In either event, the result STATUS_BUFFER_OVERFLOW is really not an ‘error’
per-se but simply that more data is described by the MDLChain than could fit
in the buffer. You decide if that is a bad thing or not.
Regarding TDI_SEND requests:
The data starts at the first byte mapped by the MDL (chain).
The length of the data to be sent is specified in SendLength (in the IrpSp
Parameters).
The implication is that the MDL (chain) might map more data than is being
sent. That is not ‘illegal’. Thus STATUS_BUFFER_OVERFLOW in such a case
would be ‘normal’.
I’m not saying that is your situation. You might have other problems. But
keep it in mind. You might find it useful to calculate and dump in debug
output the entire buffer mapped by the MDL chain or at least its natural
length so get a better understanding of your specific situation.
Good Luck,
Dave Cattley
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Monday, January 18, 2010 5:38 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Question about TdiCopyMdlToBuffer
Hello everyone,
I’m working with TDI Filter, when I filter TDI_SEND, I got the total data
length in MDL from
((PTDI_REQUEST_KERNEL_SEND)IrpSp->Parameters)->SendLength, so I allcate my
own buffer and its length is SendLength. But when I called
TdiCopyMdlToBuffer, I found that BytesCopied is larger than SendLength, and
this function return STATUS_BUFFER_OVERFLOW.
I’m confused about this function.
I know that TdiCopyMdlToBuffer has a parameter SourceOffset, maybe I should
get this SourceOffset first?
But where can I get this SourceOffset? from Irp?or IrpSp?or somewhere else?
Waiting for your reply, thanks a lot!
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer