RE: MmGetSystemAddressForMdlSafe(..) is MmUnmapLockedPage s(..) needed?

Thanks, glad to here that. :slight_smile:

Best Regards
Michael

----- Original Message -----
From: “Roddy, Mark”
To: “NT Developers Interest List”
Sent: Monday, June 23, 2003 4:58 PM
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is MmUnmapLockedPage
s(…) needed?

> No.
>
> -----Original Message-----
> From: Michael Kurz [mailto:xxxxx@sonymusic.com]
> Sent: Monday, June 23, 2003 10:39 AM
> To: NT Developers Interest List
> Subject: [ntdev] MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPages(…)
> needed?
>
>
> Hello,
>
> I am accessing a data buffer described by a MDL (pIrp->MdlAddress) with
> MmGetSystemAddressForMdlSafe(…).
> Do I need to call MmUnmapLockedPages(…) afterwards?
>
> Best Regards
> Michael
>
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@stratus.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@sonydadc.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

you should understand why the answer is no.

MmUnlockPages will undo the system address mapping automatically. So if
you create the MDL yourself you must at least unlock it.

if the MDL is the one associated with the IRP then the IO system
provided you with a locked MDL so it takes the responsibility of
unlocking it. This is only for the MDL in the IRP (which you show
below).

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michael Kurz
Sent: Monday, June 23, 2003 8:14 AM
To: NT Developers Interest List
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage s(…) needed?

Thanks, glad to here that. :slight_smile:

Best Regards
Michael

----- Original Message -----
From: “Roddy, Mark”
To: “NT Developers Interest List”
Sent: Monday, June 23, 2003 4:58 PM
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage
s(…) needed?

> No.
>
> -----Original Message-----
> From: Michael Kurz [mailto:xxxxx@sonymusic.com]
> Sent: Monday, June 23, 2003 10:39 AM
> To: NT Developers Interest List
> Subject: [ntdev] MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPages(…)
> needed?
>
>
> Hello,
>
> I am accessing a data buffer described by a MDL (pIrp->MdlAddress)
> with MmGetSystemAddressForMdlSafe(…).
> Do I need to call MmUnmapLockedPages(…) afterwards?
>
> Best Regards
> Michael
>
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@stratus.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@sonydadc.com To

> unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

Hi Peter,

----- Original Message -----
From: “Peter Wieland”
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is MmUnmapLockedPage
s(…) needed?

>you should understand why the answer is no.
>MmUnlockPages will undo the system address mapping automatically.

That was exactly the thing I was not sure about. Although I have to admit,
that a memory still
mapped without being locked anymore does not make that much sense. :slight_smile:

Best Regards
Michael

Peter,
MmLockPages and MmUnlockPages, do they have any counts? What
would
Happen if you Lock, Lock, and Unlock… Are the pages still locked?

-Srin.

-----Original Message-----
From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
Sent: Monday, June 23, 2003 8:53 AM
To: NT Developers Interest List
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage
s(…) needed?

you should understand why the answer is no.

MmUnlockPages will undo the system address mapping automatically. So
if
you create the MDL yourself you must at least unlock it.

if the MDL is the one associated with the IRP then the IO system
provided you with a locked MDL so it takes the responsibility of
unlocking it. This is only for the MDL in the IRP (which you show
below).

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michael Kurz
Sent: Monday, June 23, 2003 8:14 AM
To: NT Developers Interest List
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage s(…) needed?

Thanks, glad to here that. :slight_smile:

Best Regards
Michael

----- Original Message -----
From: “Roddy, Mark”
> To: “NT Developers Interest List”
> Sent: Monday, June 23, 2003 4:58 PM
> Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> MmUnmapLockedPage
> s(…) needed?
>
>
> > No.
> >
> > -----Original Message-----
> > From: Michael Kurz [mailto:xxxxx@sonymusic.com]
> > Sent: Monday, June 23, 2003 10:39 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] MmGetSystemAddressForMdlSafe(…) is
> MmUnmapLockedPages(…)
> > needed?
> >
> >
> > Hello,
> >
> > I am accessing a data buffer described by a MDL (pIrp->MdlAddress)
> > with MmGetSystemAddressForMdlSafe(…).
> > Do I need to call MmUnmapLockedPages(…) afterwards?
> >
> > Best Regards
> > Michael
> >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@stratus.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@sonydadc.com
To
>
> > unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nai.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

if you use the same MDL then I suspect the second Lock will assert.

but yes, each page has a lock count associated with it. If you lock,
lock and unlock the same page using two MDLs (for example) the page will
remain locked.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@NAI.com
Sent: Tuesday, June 24, 2003 12:11 PM
To: NT Developers Interest List
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage s(…) needed?

Peter,
MmLockPages and MmUnlockPages, do they have any counts? What
would Happen if you Lock, Lock, and Unlock… Are the pages still locked?

-Srin.

-----Original Message-----
From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
Sent: Monday, June 23, 2003 8:53 AM
To: NT Developers Interest List
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage
s(…) needed?

you should understand why the answer is no.

MmUnlockPages will undo the system address mapping automatically. So
if
you create the MDL yourself you must at least unlock it.

if the MDL is the one associated with the IRP then the IO system
provided you with a locked MDL so it takes the responsibility of
unlocking it. This is only for the MDL in the IRP (which you show
below).

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michael Kurz
Sent: Monday, June 23, 2003 8:14 AM
To: NT Developers Interest List
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage s(…) needed?

Thanks, glad to here that. :slight_smile:

Best Regards
Michael

----- Original Message -----
From: “Roddy, Mark”
> To: “NT Developers Interest List”
> Sent: Monday, June 23, 2003 4:58 PM
> Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> MmUnmapLockedPage
> s(…) needed?
>
>
> > No.
> >
> > -----Original Message-----
> > From: Michael Kurz [mailto:xxxxx@sonymusic.com]
> > Sent: Monday, June 23, 2003 10:39 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] MmGetSystemAddressForMdlSafe(…) is
> MmUnmapLockedPages(…)
> > needed?
> >
> >
> > Hello,
> >
> > I am accessing a data buffer described by a MDL (pIrp->MdlAddress)
> > with MmGetSystemAddressForMdlSafe(…).
> > Do I need to call MmUnmapLockedPages(…) afterwards?
> >
> > Best Regards
> > Michael
> >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@stratus.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@sonydadc.com
To
>
> > unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nai.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

I was referring to the same MDL.

-----Original Message-----
From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
Sent: Tuesday, June 24, 2003 12:26 PM
To: NT Developers Interest List
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage
s(…) needed?

if you use the same MDL then I suspect the second Lock will assert.

but yes, each page has a lock count associated with it. If you lock,
lock and unlock the same page using two MDLs (for example) the page
will
remain locked.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@NAI.com
Sent: Tuesday, June 24, 2003 12:11 PM
To: NT Developers Interest List
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage s(…) needed?

Peter,
MmLockPages and MmUnlockPages, do they have any counts? What
would Happen if you Lock, Lock, and Unlock… Are the pages still
locked?

-Srin.

> -----Original Message-----
> From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
> Sent: Monday, June 23, 2003 8:53 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage
> s(…) needed?
>
> you should understand why the answer is no.
>
> MmUnlockPages will undo the system address mapping automatically.
So
if
> you create the MDL yourself you must at least unlock it.
>
> if the MDL is the one associated with the IRP then the IO system
> provided you with a locked MDL so it takes the responsibility of
> unlocking it. This is only for the MDL in the IRP (which you show
> below).
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Michael Kurz
> Sent: Monday, June 23, 2003 8:14 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> MmUnmapLockedPage s(…) needed?
>
> Thanks, glad to here that. :slight_smile:
>
> Best Regards
> Michael
>
>
> ----- Original Message -----
> From: “Roddy, Mark”
> > To: “NT Developers Interest List”
> > Sent: Monday, June 23, 2003 4:58 PM
> > Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> > MmUnmapLockedPage
> > s(…) needed?
> >
> >
> > > No.
> > >
> > > -----Original Message-----
> > > From: Michael Kurz [mailto:xxxxx@sonymusic.com]
> > > Sent: Monday, June 23, 2003 10:39 AM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] MmGetSystemAddressForMdlSafe(…) is
> > MmUnmapLockedPages(…)
> > > needed?
> > >
> > >
> > > Hello,
> > >
> > > I am accessing a data buffer described by a MDL (pIrp->MdlAddress)
> > > with MmGetSystemAddressForMdlSafe(…).
> > > Do I need to call MmUnmapLockedPages(…) afterwards?
> > >
> > > Best Regards
> > > Michael
> > >
> > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@stratus.com
To
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as:
xxxxx@sonydadc.com
> To
> >
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nai.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nai.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

it’s illegal to call MmProbeAndLockPages on an MDL which has already
been locked, so that’s a moot point. Try it on a checked kernel some
time and you’ll get an assertion.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@NAI.com
Sent: Tuesday, June 24, 2003 12:45 PM
To: NT Developers Interest List
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage s(…) needed?

I was referring to the same MDL.

-----Original Message-----
From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
Sent: Tuesday, June 24, 2003 12:26 PM
To: NT Developers Interest List
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage
s(…) needed?

if you use the same MDL then I suspect the second Lock will assert.

but yes, each page has a lock count associated with it. If you lock,
lock and unlock the same page using two MDLs (for example) the page
will
remain locked.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@NAI.com
Sent: Tuesday, June 24, 2003 12:11 PM
To: NT Developers Interest List
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage s(…) needed?

Peter,
MmLockPages and MmUnlockPages, do they have any counts? What
would
Happen if you Lock, Lock, and Unlock… Are the pages still
locked?

-Srin.

> -----Original Message-----
> From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
> Sent: Monday, June 23, 2003 8:53 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage
> s(…) needed?
>
> you should understand why the answer is no.
>
> MmUnlockPages will undo the system address mapping automatically.
So
if
> you create the MDL yourself you must at least unlock it.
>
> if the MDL is the one associated with the IRP then the IO system
> provided you with a locked MDL so it takes the responsibility of
> unlocking it. This is only for the MDL in the IRP (which you show
> below).
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Michael Kurz
> Sent: Monday, June 23, 2003 8:14 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> MmUnmapLockedPage s(…) needed?
>
> Thanks, glad to here that. :slight_smile:
>
> Best Regards
> Michael
>
>
> ----- Original Message -----
> From: “Roddy, Mark”
> > To: “NT Developers Interest List”
> > Sent: Monday, June 23, 2003 4:58 PM
> > Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> > MmUnmapLockedPage
> > s(…) needed?
> >
> >
> > > No.
> > >
> > > -----Original Message-----
> > > From: Michael Kurz [mailto:xxxxx@sonymusic.com]
> > > Sent: Monday, June 23, 2003 10:39 AM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] MmGetSystemAddressForMdlSafe(…) is
> > MmUnmapLockedPages(…)
> > > needed?
> > >
> > >
> > > Hello,
> > >
> > > I am accessing a data buffer described by a MDL (pIrp->MdlAddress)

> > > with MmGetSystemAddressForMdlSafe(…).
> > > Do I need to call MmUnmapLockedPages(…) afterwards?
> > >
> > > Best Regards
> > > Michael
> > >
> > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@stratus.com
To
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as:
xxxxx@sonydadc.com
> To
> >
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nai.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nai.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

If I recall corectly, MmProbeAndLockPages() will only ASSERT on checked
builds, and not throw any error on free builds , so it might be possible to
missuse the same MDL in a free build.
The Pfn reference count basically represent the number of MDL based locks
for a page. Its incremented at each locking operation. The page will remain
locked as long the reference count is != 0.

----- Original Message -----
From:
To: “NT Developers Interest List”
Sent: Tuesday, June 24, 2003 10:44 PM
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is MmUnmapLockedPage
s(…) needed?

I was referring to the same MDL.

> -----Original Message-----
> From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
> Sent: Tuesday, June 24, 2003 12:26 PM
> To: NT Developers Interest List
> Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage
> s(…) needed?
>
> if you use the same MDL then I suspect the second Lock will assert.
>
> but yes, each page has a lock count associated with it. If you lock,
> lock and unlock the same page using two MDLs (for example) the page
will
> remain locked.
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@NAI.com
> Sent: Tuesday, June 24, 2003 12:11 PM
> To: NT Developers Interest List
> Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> MmUnmapLockedPage s(…) needed?
>
> Peter,
> MmLockPages and MmUnlockPages, do they have any counts? What
> would Happen if you Lock, Lock, and Unlock… Are the pages still
locked?
>
> -Srin.
>
> > -----Original Message-----
> > From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
> > Sent: Monday, June 23, 2003 8:53 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> MmUnmapLockedPage
> > s(…) needed?
> >
> > you should understand why the answer is no.
> >
> > MmUnlockPages will undo the system address mapping automatically.
So
> if
> > you create the MDL yourself you must at least unlock it.
> >
> > if the MDL is the one associated with the IRP then the IO system
> > provided you with a locked MDL so it takes the responsibility of
> > unlocking it. This is only for the MDL in the IRP (which you show
> > below).
> >
> > -p
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Michael Kurz
> > Sent: Monday, June 23, 2003 8:14 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> > MmUnmapLockedPage s(…) needed?
> >
> > Thanks, glad to here that. :slight_smile:
> >
> > Best Regards
> > Michael
> >
> >
> > ----- Original Message -----
> > From: “Roddy, Mark”
> > To: “NT Developers Interest List”
> > Sent: Monday, June 23, 2003 4:58 PM
> > Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> > MmUnmapLockedPage
> > s(…) needed?
> >
> >
> > > No.
> > >
> > > -----Original Message-----
> > > From: Michael Kurz [mailto:xxxxx@sonymusic.com]
> > > Sent: Monday, June 23, 2003 10:39 AM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] MmGetSystemAddressForMdlSafe(…) is
> > MmUnmapLockedPages(…)
> > > needed?
> > >
> > >
> > > Hello,
> > >
> > > I am accessing a data buffer described by a MDL (pIrp->MdlAddress)
> > > with MmGetSystemAddressForMdlSafe(…).
> > > Do I need to call MmUnmapLockedPages(…) afterwards?
> > >
> > > Best Regards
> > > Michael
> > >
> > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@stratus.com
To
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as:
xxxxx@sonydadc.com
> To
> >
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nai.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nai.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@rdsor.ro
To unsubscribe send a blank email to xxxxx@lists.osr.com

Dan’s right. The DDK says simply that each Probe must be accompanied by
a matching Unlock.

Here’s a bit of trivia for you (for Win2K - haven’t tried this
“experiment” in later versions) :

After 2500 consecutive MmProbeAndLockPages() on the same page, it will
throw an exception of STATUS_WORKING_SET_QUOTA. Makes for painful
debugging.

-----Original Message-----
From: Dan Partelly [mailto:xxxxx@rdsor.ro]
Sent: Wednesday, June 25, 2003 6:38 AM
To: NT Developers Interest List
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage s(…) needed?

If I recall corectly, MmProbeAndLockPages() will only ASSERT on checked
builds, and not throw any error on free builds , so it might be possible
to
missuse the same MDL in a free build.
The Pfn reference count basically represent the number of MDL based
locks
for a page. Its incremented at each locking operation. The page will
remain
locked as long the reference count is != 0.

----- Original Message -----
From:
To: “NT Developers Interest List”
Sent: Tuesday, June 24, 2003 10:44 PM
Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage
s(…) needed?

I was referring to the same MDL.

> -----Original Message-----
> From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
> Sent: Tuesday, June 24, 2003 12:26 PM
> To: NT Developers Interest List
> Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
MmUnmapLockedPage
> s(…) needed?
>
> if you use the same MDL then I suspect the second Lock will assert.
>
> but yes, each page has a lock count associated with it. If you lock,
> lock and unlock the same page using two MDLs (for example) the page
will
> remain locked.
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@NAI.com
> Sent: Tuesday, June 24, 2003 12:11 PM
> To: NT Developers Interest List
> Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> MmUnmapLockedPage s(…) needed?
>
> Peter,
> MmLockPages and MmUnlockPages, do they have any counts? What
> would Happen if you Lock, Lock, and Unlock… Are the pages still
locked?
>
> -Srin.
>
> > -----Original Message-----
> > From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
> > Sent: Monday, June 23, 2003 8:53 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> MmUnmapLockedPage
> > s(…) needed?
> >
> > you should understand why the answer is no.
> >
> > MmUnlockPages will undo the system address mapping automatically.
So
> if
> > you create the MDL yourself you must at least unlock it.
> >
> > if the MDL is the one associated with the IRP then the IO system
> > provided you with a locked MDL so it takes the responsibility of
> > unlocking it. This is only for the MDL in the IRP (which you show
> > below).
> >
> > -p
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Michael Kurz
> > Sent: Monday, June 23, 2003 8:14 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> > MmUnmapLockedPage s(…) needed?
> >
> > Thanks, glad to here that. :slight_smile:
> >
> > Best Regards
> > Michael
> >
> >
> > ----- Original Message -----
> > From: “Roddy, Mark”
> > To: “NT Developers Interest List”
> > Sent: Monday, June 23, 2003 4:58 PM
> > Subject: [ntdev] RE: MmGetSystemAddressForMdlSafe(…) is
> > MmUnmapLockedPage
> > s(…) needed?
> >
> >
> > > No.
> > >
> > > -----Original Message-----
> > > From: Michael Kurz [mailto:xxxxx@sonymusic.com]
> > > Sent: Monday, June 23, 2003 10:39 AM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] MmGetSystemAddressForMdlSafe(…) is
> > MmUnmapLockedPages(…)
> > > needed?
> > >
> > >
> > > Hello,
> > >
> > > I am accessing a data buffer described by a MDL (pIrp->MdlAddress)
> > > with MmGetSystemAddressForMdlSafe(…).
> > > Do I need to call MmUnmapLockedPages(…) afterwards?
> > >
> > > Best Regards
> > > Michael
> > >
> > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@stratus.com
To
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as:
xxxxx@sonydadc.com
> To
> >
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nai.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nai.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@rdsor.ro
To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@softek.fujitsu.com
To unsubscribe send a blank email to xxxxx@lists.osr.com