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

Home NTDEV
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/


WDFREQUEST buffer

OSR_Community_UserOSR_Community_User Member Posts: 110,217
How I can modify (resize) the buffer I get in write or read WDFREQUEST through WdfRequestRetrieveInputBuffer?

Rgrds,

Comments

  • Doron_HolanDoron_Holan Member - All Emails Posts: 10,519
    You can't make it bigger nor can you make any changes to the buffer's size that the caller will see. What you can do is modify the buffer's starting point and length (decreasing it) with a WDFMEMORY_OFFSET, http://msdn.microsoft.com/en-us/library/windows/hardware/ff548718(v=vs.85).aspx, for async io or using a WDF_MEMORY_DESCRIPTOR for sync io

    d

    -----Original Message-----
    From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
    Sent: Monday, November 28, 2011 11:21 AM
    To: Windows System Software Devs Interest List
    Subject: [ntdev] WDFREQUEST buffer

    How I can modify (resize) the buffer I get in write or read WDFREQUEST through WdfRequestRetrieveInputBuffer?

    Rgrds,

    ---
    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
    d
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Can I change then the WDFMEMORY I get through WdfRequestRetrieveInputMemory as to build a bigger buffer? BTW, I get the WDFREQUEST object from an upper filter driver, and would like to modify it before it goes to the next driver downstream.

    Regrds,
  • Doron_HolanDoron_Holan Member - All Emails Posts: 10,519
    Like I said, you can't make any changes so that the driver which sent you the request is going to see those changes, the sending driver will only see its buffer. When you send the request downstream, you can replace the WDFMEMORY with your own allocated WDFMEMORY, but growing the caller's buffer and putting it in your own WDFMEMORY is not possible. Instead of asking vague questions, how about you give the particular problem you are trying to solve in the specific device stack

    d

    -----Original Message-----
    From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
    Sent: Monday, November 28, 2011 11:58 AM
    To: Windows System Software Devs Interest List
    Subject: RE:[ntdev] WDFREQUEST buffer

    Can I change then the WDFMEMORY I get through WdfRequestRetrieveInputMemory as to build a bigger buffer? BTW, I get the WDFREQUEST object from an upper filter driver, and would like to modify it before it goes to the next driver downstream.

    Regrds,

    ---
    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
    d
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Here is the problem I am trying to solve: for each received WDFREQUEST, I would like to inspect the buffer, and and if smaller than a given size, increase its size to a preset size by appending specific data pattern before sending it downstream.

    Ok WDFMEMORY then is probably the way to go, how I can replace the existing WDFMEMORY associated with WDFREQUEST?
  • Doron_HolanDoron_Holan Member - All Emails Posts: 10,519
    OK, what happens when the request is completed back to you with the bigger buffer? Do you need to convey this extra data to the calling driver?

    -----Original Message-----
    From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
    Sent: Monday, November 28, 2011 12:53 PM
    To: Windows System Software Devs Interest List
    Subject: RE:[ntdev] WDFREQUEST buffer

    Here is the problem I am trying to solve: for each received WDFREQUEST, I would like to inspect the buffer, and and if smaller than a given size, increase its size to a preset size by appending specific data pattern before sending it downstream.

    Ok WDFMEMORY then is probably the way to go, how I can replace the existing WDFMEMORY associated with WDFREQUEST?




    ---
    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
    d
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    No, the driver upstream does not need to know anything about the new bigger buffer
  • Doron_HolanDoron_Holan Member - All Emails Posts: 10,519
    Then all you need to do is allocate a WDFMEMORY with the new expanded size, for a write operation copy the caller's buffer content into the new buffer, format the request with your WDFMEMORY and adjusted size, and send the request down the stack. For a read operation, you would need to copy back to the caller's buffer in the completion routine

    d

    -----Original Message-----
    From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
    Sent: Monday, November 28, 2011 4:05 PM
    To: Windows System Software Devs Interest List
    Subject: RE:[ntdev] WDFREQUEST buffer

    No, the driver upstream does not need to know anything about the new bigger buffer

    ---
    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
    d
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Very clear. Many thanks!
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!
Internals & Software Drivers 30 Nov 2020 LIVE ONLINE
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Developing Minifilters Early 2021 LIVE ONLINE