Q: Dispatch functions behavior during user mode crash.

Discussion in 'Windows Vista Drivers' started by Nir Aides, Jun 15, 2005.

  1. Nir Aides

    Nir Aides Guest


    I have a user mode thread call my driver with DeviceIoControl.
    I understand that the thread doing the dispatch code for that IO control
    call is the user mode process thread.

    1. It seems to me that if the user mode app hits a breakpoint while
    being debugged the kernel code of the dispatch function is also halted.
    Is this true?

    2. What happens if the user mode app crashes while a thread is doing the
    DeviceIoControl? Will the dispatch function finish? Or is it just thrown
    away in the middle of whatever it was it was doing? How do I handle this

    Nir Aides, Jun 15, 2005
    1. Advertisements

  2. Nir Aides

    Don Burn Guest

    Comments inline:
    Well I assume you mean a different thread in the same application, since the
    only way a breakpoint would be hit in your dispatch routine is if you code
    it or someone is debugging your driver. Assuming that is the case, the
    thread in the driver is not impacted until it tries to return to user space
    (even this is dependant on the particular debugger).
    Once your dispatch function gets the IRP, it is under yout drivers control.
    So the thread for the application is in the driver, the driver will
    complete. If you have pended the IRP you will get a cancel request for the
    IRP which you should hanlde.
    Don Burn, Jun 15, 2005
    1. Advertisements

  3. 2. What happens if the user mode app crashes while a thread is doing the
    Crashing the app means - terminating all its threads, and the thread cannot be
    terminated while in the kernel - only on return to user.

    So, the dispatch function will run to completion, and only then the thread will
    Maxim S. Shatskih, Jun 15, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.