Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTFSD
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


buffers at read/write completion routines

Neil_WeicherNeil_Weicher Member Posts: 409
I have a file system filter driver that implements read and write completion
routines. In these routines I need to look at the data being read or written.
According to the Nagar book I should be able to either use the buffer in
irp.AssociatedIrp.SystemBuffer or in Irp.MdlAddress. Is one of these "buffers"
going to be valid at the completion routine?

On a related note, the book says you must use
MmGetSystenAddressForMdl(irp.MdlAddress), but then a few sentences later says
to avoid MmGetSystenAddressForMdl. Can someone explain this?

Thanks.

Neil

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    irp.AssociatedIrp.SystemBuffer is used with Buffered I/O while
    Irp.MdlAddress is used with Direct I/O. however, file systems like NTFS
    implements Neither I/O so if you want to access the buffer, use
    Irp.UserBuffer instead. however, when you want to access this buffer in an
    arbitrary thread context, like in completion routines, you will have to
    allocate a Mdl for this buffer and lock the pages in this Mdl during the
    dispatch routine so that you can call MmGetSystemAddressForMdl with this
    Mdl.

    i hope this helps as i do not have the book with me now so am not able to
    know what exactly you wanted.

    Ho Mun Chuen
    @@ "Not everything that counts can be counted;
    <" )~ and not everything that can be counted counts"
    /\/\ ..... Albert Einstein
    ----- Original Message -----
    From: Neil Weicher <[email protected]>
    To: File Systems Developers <[email protected]>
    Sent: Sunday, May 14, 2000 4:46 AM
    Subject: [ntfsd] buffers at read/write completion routines


    I have a file system filter driver that implements read and write completion
    routines. In these routines I need to look at the data being read or
    written.
    According to the Nagar book I should be able to either use the buffer in
    irp.AssociatedIrp.SystemBuffer or in Irp.MdlAddress. Is one of these
    "buffers"
    going to be valid at the completion routine?

    On a related note, the book says you must use
    MmGetSystenAddressForMdl(irp.MdlAddress), but then a few sentences later
    says
    to avoid MmGetSystenAddressForMdl. Can someone explain this?

    Thanks.

    Neil



    ---
    You are currently subscribed to ntfsd as: [email protected]
    To unsubscribe send a blank email to $subst('Email.Unsub')
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters 8 March 2021 LIVE ONLINE