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

Home NTDEV

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/


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

Order of Remove Irps in Win2k Drivers !!

OSR_Community_UserOSR_Community_User Member Posts: 110,217
When I try to delete a partition, the Pnp manager sends an IRP_MN_SURPRISE_REMOVAL followed by an IRP_MN_REMOVE_DEVICE. Are there any exceptions to this because for a partition with open handles I just get an IRP_MN_SURPRISE_REMOVAL and no IRP_MJ_REMOVE_DEVICE?


Thanks,
Anima

Comments

  • Eliyas_YakubEliyas_Yakub Member Posts: 229
    There are no exceptions. In general the PnP manager will not send a
    IRP_MN_REMOVE_DEVICE followed by either IRP_MN_QUERY_REMOVE (in the case of
    graceful remove) or IRP_MN_SURPRISE_REMOVE so long as there is an handle to
    the device open.

    -Eliyas


    -----Original Message-----
    From: anima [mailto:[email protected]]
    Sent: Tuesday, March 21, 2000 1:53 AM
    To: NT Developers Interest List
    Subject: [ntdev] Order of Remove Irps in Win2k Drivers !!



    When I try to delete a partition, the Pnp manager sends an
    IRP_MN_SURPRISE_REMOVAL followed by an IRP_MN_REMOVE_DEVICE. Are there any
    exceptions to this because for a partition with open handles I just get an
    IRP_MN_SURPRISE_REMOVAL and no IRP_MJ_REMOVE_DEVICE?


    Thanks,
    Anima
  • I've tried to parse your sentence several times but my sematic module must
    be out of rev. Are you saying that surprise will never follow remove (which
    I think is true) or are you saying that surprise will sometimes follow
    remove?



    =
    Mark Roddy

    Windows 2000/Windows NT Consulting:

    [email protected]
    www.hollistech.com

    =


    -----Original Message-----
    From: [email protected]
    [mailto:[email protected]]On Behalf Of Eliyas Yakub
    Sent: Tuesday, March 21, 2000 1:22 PM
    To: NT Developers Interest List
    Subject: [ntdev] RE: Order of Remove Irps in Win2k Drivers !!


    There are no exceptions. In general the PnP manager will not send a
    IRP_MN_REMOVE_DEVICE followed by either IRP_MN_QUERY_REMOVE (in the case of
    graceful remove) or IRP_MN_SURPRISE_REMOVE so long as there is an handle to
    the device open.

    -Eliyas

    -----Original Message-----
    From: anima [mailto:[email protected]]
    Sent: Tuesday, March 21, 2000 1:53 AM
    To: NT Developers Interest List
    Subject: [ntdev] Order of Remove Irps in Win2k Drivers !!



    When I try to delete a partition, the Pnp manager sends an
    IRP_MN_SURPRISE_REMOVAL followed by an IRP_MN_REMOVE_DEVICE. Are there any
    exceptions to this because for a partition with open handles I just get an
    IRP_MN_SURPRISE_REMOVAL and no IRP_MJ_REMOVE_DEVICE?


    Thanks,
    Anima
  • Eliyas_YakubEliyas_Yakub Member Posts: 229
    I meant IRP_MN_REMOVE_DEVICE device will be sent after either
    IRP_MN_QUERY_REMOVE or IRP_MN_SURPRISE_REMOVE only if there are no handles
    to the device open.

    During graceful remove (disable/uninstall/eject), the system sends
    QUERY_REMOVE to the device stack and if:

    a) Nobody in the driver stack fails the request
    b) All the usermode component (applications & services) and drivers that
    have handle to the device okays QUERY_REMOVE device change notification and
    close the handle

    the system sends REMOVE, otherwise it sends CANCEL_REMOVE and aborts the
    removal.

    During surprise remove, the system sends SURPRISE_REMOVE IRP, and if all the
    user apps and drivers close the handle, it sends REMOVE. No driver should
    fail the SURPRISE_REMOVE IRP sent to the device stack.

    I hope this is clear.

    -Eliyas

    -----Original Message-----
    From: Mark Roddy [mailto:[email protected]]
    Sent: Tuesday, March 21, 2000 4:16 PM
    To: NT Developers Interest List
    Subject: [ntdev] RE: Order of Remove Irps in Win2k Drivers !!



    I've tried to parse your sentence several times but my sematic module must
    be out of rev. Are you saying that surprise will never follow remove (which
    I think is true) or are you saying that surprise will sometimes follow
    remove?



    =
    Mark Roddy

    Windows 2000/Windows NT Consulting:

    [email protected]
    www.hollistech.com

    =


    -----Original Message-----
    From: [email protected]
    [mailto:[email protected]]On Behalf Of Eliyas Yakub
    Sent: Tuesday, March 21, 2000 1:22 PM
    To: NT Developers Interest List
    Subject: [ntdev] RE: Order of Remove Irps in Win2k Drivers !!


    There are no exceptions. In general the PnP manager will not send a
    IRP_MN_REMOVE_DEVICE followed by either IRP_MN_QUERY_REMOVE (in the case of
    graceful remove) or IRP_MN_SURPRISE_REMOVE so long as there is an handle to
    the device open.

    -Eliyas


    -----Original Message-----
    From: anima [mailto:[email protected]]
    Sent: Tuesday, March 21, 2000 1:53 AM
    To: NT Developers Interest List
    Subject: [ntdev] Order of Remove Irps in Win2k Drivers !!



    When I try to delete a partition, the Pnp manager sends an
    IRP_MN_SURPRISE_REMOVAL followed by an IRP_MN_REMOVE_DEVICE. Are there any
    exceptions to this because for a partition with open handles I just get an
    IRP_MN_SURPRISE_REMOVAL and no IRP_MJ_REMOVE_DEVICE?


    Thanks,
    Anima
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 24 January 2022 Live, Online
Internals & Software Drivers 7 February 2022 Live, Online
Kernel Debugging 21 March 2022 Live, Online
Developing Minifilters 23 May 2022 Live, Online