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/


IO control read buffer update not reflecting in user space after ioctl call is finished

Rocky_MarcianoRocky_Marciano Member Posts: 5

Hi,

In my driver IO control code use METHOD_OUT_DIRECT with FILE_READ_ACCESS | FILE_WRITE_ACCESS.
My usecase is readbuffer passed from user space needs to be updated by driver before ioctl is complete

In ioctl handler WdfRequestRetrieveInputBuffer is used to retrieve input buffer. It is received properly. This buffer is sent to pcie device and response from pcie device needs to be copied in same input buffer. From windbg I can see buffer returned by WdfRequestRetrieveInputBuffer is properly updated before wdfrequestcomplete but in user space input buffer is reading the same values.

Please let me know if I am missing something here.

Comments

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,563

    If you want a two-way buffer, use the second buffer in the ioctl call and use "WdfRequestRetrieveOutputBuffer". The first ioctl buffer is copied into kernel mode, but the second buffer is mapped, so the bytes you write are the same bytes the user app sees.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Rocky_MarcianoRocky_Marciano Member Posts: 5

    Thanks Tim. That worked like a charm.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

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 19-23 June 2023 Live, Online
Writing WDF Drivers 10-14 July 2023 Live, Online
Kernel Debugging 16-20 October 2023 Live, Online
Developing Minifilters 13-17 November 2023 Live, Online