Antwort: Re: Mdl -> Userbuffer access in completion routine.

Hi Bill,

Thanks for your fast reply.

Why do you feel you need to create your own MDL for this user buffer? Why
not use a DIRECT buffering method with the request (read/write/ioclt) and
have the I/O manager create an MDL for you and let the I/O manager worry
about the cleanup? There are cases where this needs to be done, but I am
curious if this is one of those cases.

Actually I’m using directIO with my IOCTL, but I want to be able to write
to multiple buffers at once.

The MDL will be safe to access in your completion routine. Completion
routines are called in an arbitrary thread context at <=DISPATCH_LEVEL
IRQL,
(typically at DISPATCH_LEVEL).

Thank you, that’s excatly what I wanted to be sure about.

Regards

Michael

> Actually I’m using directIO with my IOCTL, but I want to be able to write

to multiple buffers at once.

Will multiple IOCTL requests not work?

BTW, take a look at IoBuildPartialMdl() for splitting up MDLs.


Bill McKenzie
Compuware Corporation
Watch your IRPs/IRBs/URBs/NDIS pkts with our free WDMSniffer tool:
http://frontline.compuware.com/nashua/patches/utility.htm

wrote in message news:xxxxx@ntdev…
>
>
> Hi Bill,
>
> Thanks for your fast reply.
>
>
> >Why do you feel you need to create your own MDL for this user buffer?
Why
> >not use a DIRECT buffering method with the request (read/write/ioclt) and
> >have the I/O manager create an MDL for you and let the I/O manager worry
> >about the cleanup? There are cases where this needs to be done, but I am
> >curious if this is one of those cases.
>
> Actually I’m using directIO with my IOCTL, but I want to be able to write
> to multiple buffers at once.
>
>
>
> >The MDL will be safe to access in your completion routine. Completion
> >routines are called in an arbitrary thread context at <=DISPATCH_LEVEL
> IRQL,
> >(typically at DISPATCH_LEVEL).
>
> Thank you, that’s excatly what I wanted to be sure about.
>
>
>
>
>
> Regards
>
> Michael
>
>
>
>
>
>
>
>
>
>

No - your driver’s completion routine should never get called at >
DISPATCH_LEVEL since it’s invalid for anyone to call IoCompleteRequest
at > DISPATCH_LEVEL

-p

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@sonydadc.com [mailto:xxxxx@sonydadc.com]
Sent: Friday, May 02, 2003 5:40 AM
To: NT Developers Interest List

Hi,

I’m transfering the a user mode address to my driver with an IOCTL code.
In the driver I create a Mdl for accessing this memory address:
IoAllocateMdl(…)
MmProbeAndLockPages(…)
MmMapLockedPages(…)

Everything is working as expected but I want to access this user mode
address in my completion routine as well.
So I pass the Mdl, and the mapped system address via the context to the
completion routine and free it there.
MmUnmapLockedPages(…)
MmUnlockPages(…)
IoFreeMdl(…)

Everything is working again, but all these functions need to be called
in an IRQL<= DISPATCH_LEVEL, is it possible that a completion routine is
called in an IRQL > DISPATCH_LEVEL ?
If so where should the Mdl be released then?

Best Regards
Michael


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

> an IRQL<= DISPATCH_LEVEL, is it possible that a completion routine
is

called
in an IRQL > DISPATCH_LEVEL ?

No.

Max