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


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:

FltCbdqInsertIo: Query about return value

Sujay_UpasaniSujay_Upasani Member Posts: 14


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?



  • Sergey_PisarevSergey_Pisarev Member - All Emails Posts: 284

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

  • rod_widdowsonrod_widdowson Member - All Emails Posts: 1,226

    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: 284

    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,996

    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 Viscarola

  • Sujay_UpasaniSujay_Upasani Member Posts: 14
    edited September 2020

    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?


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

    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).


  • Sujay_UpasaniSujay_Upasani Member Posts: 14

    Hello Scott, thanks for the suggestion.

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!
Writing WDF Drivers 12 September 2022 Live, Online
Internals & Software Drivers 23 October 2022 Live, Online
Kernel Debugging 14 November 2022 Live, Online
Developing Minifilters 5 December 2022 Live, Online