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/


FltCbdqInsertIo: Query about return value

Sujay_UpasaniSujay_Upasani Member Posts: 13

Hello,

From MSDN documentation:
FltCbdqInsertIo returns STATUS_SUCCESS or an appropriate NTSTATUS value such as one of the following:

STATUS_PENDING: The callback data structure was inserted into the callback data queue.

From the documentation, it looks like STATUS_SUCCESS and STATUS_PENDING have the same meaning. Can somebody please clarify this?

Thanks.

Comments

  • Sergey_PisarevSergey_Pisarev Member - All Emails Posts: 259

    Check return status with nt_success macro.
    Success and pending both successful return statuses.

  • rod_widdowsonrod_widdowson Member - All Emails Posts: 1,152

    I would say that the documentation needs a case raised against it. But blindly speaking I would say that

    • STATUS_PENDING means that you do not own the CBD anymore (because it has been queued)
    • STATUS_SUCCESS means that some other condition means "it worked" but you do own the CBD

    I cannot imagine for a minute what could cause the second bullet - which is why I would say that the documentation is incorrect. At the very best it needs to be clarified. I have never used this API and if I ever did I would actually add an assert against STATUS_SUCCESS (because I think its a meaningless return status) and treat it like STATUS_PENDING

  • Sergey_PisarevSergey_Pisarev Member - All Emails Posts: 259

    It is interesting that cancelsafe sample checks directly for STATUS_SUCCESS and treats any over return status as failure

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,052

    I thought I could provide some insight into this. But the more I looked into it, the more confused I got.

    So, yeah... I've got nothin'

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • Sujay_UpasaniSujay_Upasani Member Posts: 13
    edited September 2

    Hello All,

    Thanks for the reply.

    If FltCbdqInsertIo succeeds, I will return FLT_PREOP_PENDING from pre-callback and later after processing of queue, FltCompletePendedPreOperation will be called to resume processing of an I/O.

    Till now, I found that FltCbdqInsertIo returning STATUS_SUCCESS(also, cancelsafe sample checks for STATUS_SUCCESS only). So if FltCbdqInsertIo returns STATUS_PENDING, can we consider it as a success(The callback data structure was inserted into the callback data queue) and return FLT_PREOP_PENDING from pre-callback or treat it as a failure like cancelsafe sample does?

    Thanks.

  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,343

    So confusing....

    FltCbdqInsertIo just calls IoCsqInsertIrpEx, which is documented to return either STATUS_SUCCESS or the result of the CsqInsertIrpEx callback. Presumably (though I have not confirmed) the latter would be the result of your insert callback specified in the call to FltCbdqInitialize.

    In the end, I would say the docs are misleading by suggesting STATUS_PENDING as a possible result and it's safe to just use NT_SUCCESS(status).

    -scott
    OSR

  • Sujay_UpasaniSujay_Upasani Member Posts: 13

    Hello Scott, thanks for the suggestion.

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