IRP_MJ_READ and Irp->MdlAddress->Next

Hi,

I am using scatter/gather DMA from a device, with the DO_DIRECT_IO flag set.

I (correctly) receive - and can use - the MdlAddress.

The problem I’m struggling with is that MdlAddress->Next is always NULL.

  • I’d expect that, of course, if the transfer is less than PAGE_SIZE.

But it is also the case when the transfer is > PAGE_SIZE - I would expect the transfer to continue with more than one MDL.

NB, I receive the correct transfer size in stack->Parameters.Read.Length.

What am I missing?

Many thanks in advance.

No, the MDL will have multiple pages in it for the buffer. The Next field
is for “chained MDL’s” only used in some special cases in some device
stacks.

Don Burn
Windows Driver Consulting
Website: http://www.windrvr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Monday, March 19, 2018 3:08 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] IRP_MJ_READ and Irp->MdlAddress->Next

Hi,

I am using scatter/gather DMA from a device, with the DO_DIRECT_IO flag set.

I (correctly) receive - and can use - the MdlAddress.

The problem I’m struggling with is that MdlAddress->Next is always NULL.
- I’d expect that, of course, if the transfer is less than PAGE_SIZE.

But it is also the case when the transfer is > PAGE_SIZE - I would expect
the transfer to continue with more than one MDL.

NB, I receive the correct transfer size in stack->Parameters.Read.Length.

What am I missing?

Many thanks in advance.


NTDEV is sponsored by OSR

Visit the list online at:
http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software
drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at
http:</http:></http:></http:>

Well, it depends on the stack you’re in… but as a rule, yes.

Why is that? An MDL describes a virtually contiguous buffer, which can be any length up to 2GB. Each entry in the MDL can be up to one PAGE_SIZE, because each entry references a specific relative page.

If you are directly accessing the MDL, you’re doing something very wrong. There are Windows DMA APIs that will build your Scatter/Gather list for you… I assume that’s what you’re trying to do?

Peter
OSR
@OSRDrivers

Thank you for your help with this.

I have understood my mistake, and my driver is working correctly.

I am sorry for the newbie misunderstanding.

[quote]
I am sorry for the newbie misunderstanding.

[quote]

We were all newbies once. Being a newbie means misunderstandings. No need for apologies.

Glad we got you going!

Peter
OSR
@OSRDrivers

> We were all newbies once.



Oh dear…

IIRC, someone (I cannot immediately recall this poster’s name but I think it rhymes with
“Jim Floberts”) is so incredibly fond of saying it - he repeats it over and over and over again…

In terms of frequency of use, his mantra about “everyone having been inexperienced once” seems to be comparable with some other poster’s (I cannot recall his name either but somehow it brings up certain associations with "Friggin’ in the riggin’ " song, at least in my mind) one about denying Admin privilege level to the users …

Anton Bassov

>

IIRC, this is one of your favorite tags… but you seem to be misusing the term.

You know, I’ve been evaluating potential new platforms to replace the venerable Lyris and this lovely custom-written forum interface that we’ve all come to love so well.

One of the top contenders has a “troll mode” in which, when the mods label someone a troll, THEY (that is, the troll) can see their posts (even new threads they start) but NOBODY ELSE can. A terrific feature, don’t you think?


Not that I could POSSIBLY think of anyone on THIS list that I’d like to use this feature on. Not at ALL. Of COURSE not!


(that’s a proper example of irony, by the way… you could also consider it sarcasm, but let’s not quibble)

Peter
OSR
@OSRDrivers

OK, let me try doing it properly



But surely it cannot be a well-behaved and contributing individual like Mr.Bassov who is generally known for his impeccable posting style and model behavior, helpfulness, politeness and friendliness, endless promotion of good practices like using KMDF and inverted calls, as well as faithful adoration of MSFT and Windows NT, can it

Anton Bassov

Both are sarcasm and not irony. Irony would be if “a well-behaved and contributing individual like Mr.Bassov” threw up his hands and left the list right before Peter adopted this new system with troll mode specifically for the purposes of tagging Mr.Bassov.

You’re embarrassing yourselves. Stop.

-peter
(silently listening under the bridge for travelers with cookies)

-----Original Message-----
From: xxxxx@lists.osr.com On Behalf Of xxxxx@hotmail.com
Sent: Wednesday, March 21, 2018 9:37 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] IRP_MJ_READ and Irp->MdlAddress->Next



OK, let me try doing it properly



But surely it cannot be a well-behaved and contributing individual like Mr.Bassov who is generally known for his impeccable posting style and model behavior, helpfulness, politeness and friendliness, endless promotion of good practices like using KMDF and inverted calls, as well as faithful adoration of MSFT and Windows NT, can it



Anton Bassov


NTDEV is sponsored by OSR

Visit the list online at: https:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at https:

To unsubscribe, visit the List Server section of OSR Online at https:</https:></https:></https:>

>Both are sarcasm and not irony

Not really. Both are sarcasm *and* irony. Sarcasm *includes* irony, according to me and Google:

sar?casm
?s?r?kaz?m
(noun) The use of irony to mock or convey contempt.

If I could post a picture of the definition, I would. AND I *will* be able to, once we’ve moved to the system that includes Troll Mode.

Peter
OSR
@OSRDrivers

Let’s see what the dictionary says on the subject. Let’s start with the “irony”

http://www.dictionary.com/browse/irony

Now let’s check the “sarcasm”

http://www.dictionary.com/browse/sarcasm

In other words, the history seems to be repeating itself again and again, Mr.Wieland.
IIRC,we have had quite a few clashes on this list, and they all followed more or less the same pattern. You were launching personal attacks against me and assumed self-righteous, condescending and moralising tone…but still somehow always managed to make a fool out of yourself, because all the statements that you were making were revealing your educational gaps in general and lack of profound knowledge on the topic of a discussion in particular.

As it turns out, your educational gaps are not limited to the technical topics- your knowledge of English language does not really seem to be “continuous” (in terms of function analysis, of course) either, so that some gaps very obviously have to be filled. The irony (both pun and sarcasm are intended) of the situation is that it is supposed to be your mother tongue, while someone who actually points out these gaps to you is not supposed to know it that well…

You’re embarrassing yourselves.

The only thing that gets into my head when I see a statement like that in this context lies somewhere along “the irony of the situation is…xxxxx” lines. Furthermore, it makes me think and speak sarcastically…

Anton Bassov

Hmm. It seems that I omitted the trailing :slight_smile: (Or perhaps the system dropped it out because my editor inserted a complicated emoji character … hopefully the new system will support them).

This was intended as a joke, but clearly was not seen as such. My apologies for that.

-p

-----Original Message-----
From: xxxxx@lists.osr.com On Behalf Of xxxxx@hotmail.com
Sent: Wednesday, March 21, 2018 6:31 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] IRP_MJ_READ and Irp->MdlAddress->Next



Let’s see what the dictionary says on the subject. Let’s start with the “irony”

https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.dictionary.com%2Fbrowse%2Firony&amp;data=04|01|peterwie%40microsoft.com|6fdcc5e18f214614cb6208d58f94b2e6|72f988bf86f141af91ab2d7cd011db47|1|0|636572791177669347|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D|-1&amp;sdata=SVfqVIOMtqN6z4nZoiHtMjqRPqCodME%2BMn4CsvcYA98%3D&amp;reserved=0



Now let’s check the “sarcasm”

https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.dictionary.com%2Fbrowse%2Fsarcasm&amp;data=04|01|peterwie%40microsoft.com|6fdcc5e18f214614cb6208d58f94b2e6|72f988bf86f141af91ab2d7cd011db47|1|0|636572791177669347|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D|-1&amp;sdata=L1zGDNmv0vKbKbZsCcxKYoTO6WyYNf2Q7gRnV7Z850Y%3D&amp;reserved=0



In other words, the history seems to be repeating itself again and again, Mr.Wieland.
IIRC,we have had quite a few clashes on this list, and they all followed more or less the same pattern. You were launching personal attacks against me and assumed self-righteous, condescending and moralising tone…but still somehow always managed to make a fool out of yourself, because all the statements that you were making were revealing your educational gaps in general and lack of profound knowledge on the topic of a discussion in particular.

As it turns out, your educational gaps are not limited to the technical topics- your knowledge of English language does not really seem to be “continuous” (in terms of function analysis, of course) either, so that some gaps very obviously have to be filled. The irony (both pun and sarcasm are intended) of the situation is that it is supposed to be your mother tongue, while someone who actually points out these gaps to you is not supposed to know it that well…

> You’re embarrassing yourselves.

The only thing that gets into my head when I see a statement like that in this context lies somewhere along “the irony of the situation is…xxxxx” lines. Furthermore, it makes me think and speak sarcastically…

Anton Bassov


NTDEV is sponsored by OSR

Visit the list online at: https:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at https:

To unsubscribe, visit the List Server section of OSR Online at https:</https:></https:></https:>

God, what happened you dude !!!

-prokash

On Mar 21, 2018, at 6:31 PM, xxxxx@hotmail.com wrote:
>
>


>
>
> Let’s see what the dictionary says on the subject. Let’s start with the “irony”
>
> http://www.dictionary.com/browse/irony
>
>


>
>
> Now let’s check the “sarcasm”
>
> http://www.dictionary.com/browse/sarcasm
>
>
>
>


>
>
> In other words, the history seems to be repeating itself again and again, Mr.Wieland.
> IIRC,we have had quite a few clashes on this list, and they all followed more or less the same pattern. You were launching personal attacks against me and assumed self-righteous, condescending and moralising tone…but still somehow always managed to make a fool out of yourself, because all the statements that you were making were revealing your educational gaps in general and lack of profound knowledge on the topic of a discussion in particular.
>
>
> As it turns out, your educational gaps are not limited to the technical topics- your knowledge of English language does not really seem to be “continuous” (in terms of function analysis, of course) either, so that some gaps very obviously have to be filled. The irony (both pun and sarcasm are intended) of the situation is that it is supposed to be your mother tongue, while someone who actually points out these gaps to you is not supposed to know it that well…
>
>
>> You’re embarrassing yourselves.
>
> The only thing that gets into my head when I see a statement like that in this context lies somewhere along “the irony of the situation is…xxxxx” lines. Furthermore, it makes me think and speak sarcastically…
>
>
>
>
> Anton Bassov
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

> God, what happened you dude !!!

Well, Pro, I have to admit that I had hijacked yet another thread and and fucked it up for no reason
whatsoever…

My apologies,guys

Anton Bassov

Sorry to see you like this Anton !

There are times when - you get to pin point the error or wrong assumptions of OP, and there are times you turn out to be like this.

I’ve seen some others do that too, but perhaps not to this extent - Like MFC is a piece of crap :slight_smile:

I concur to understand these mindsets - and ask myself “What would our grand kids would say about us ? “ NO, I don’t want to look at theasurus and drops all the derogatory words here …

-Pro

On Mar 23, 2018, at 11:20 PM, xxxxx@hotmail.com wrote:
>
>
>> God, what happened you dude !!!
>
> Well, Pro, I have to admit that I had hijacked yet another thread and and fucked it up for no reason
> whatsoever…
>
>
> My apologies,guys
>
>
>
> Anton Bassov
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

So,e day Anton will learn that drunken posting is never a good idea.

Peter
OSR
@OSRDrivers

>So,e day Anton will learn that drunken posting is never a good idea.

…apart from the fact that I don’t drink…

What normally happens (this thread is a typical example of such scenario) is that I try to be “funny”
at someone’s expense, effectively taking the “target” thread to a totally different direction. Then I look at the “result”, and see that this is DEFINITELY not what I expected to happen. At this point I already start feeling stupid, because at this point I already see that my "funny"post was not needed at all. Therefore,I apologise…

Anton Bassov