All,
I register shutdown handler using IoRegisterShutdownNotification. In my
IRP_MJ_SHUTDOWN handler, I set a value in registry. I clear this registry in
next boot. The problem i am having is this value is being set during a
bugcheck. Is it possible that IRP_MJ_SHUTDOWN handler is called during BSOD

Thanks

Re: shutdown handler by Mark

Mark
Tue Jan 31 12:43:05 CST 2006

needhelp wrote:
> All,
> I register shutdown handler using IoRegisterShutdownNotification. In my
> IRP_MJ_SHUTDOWN handler, I set a value in registry. I clear this registry in
> next boot. The problem i am having is this value is being set during a
> bugcheck. Is it possible that IRP_MJ_SHUTDOWN handler is called during BSOD
>
> Thanks


Only if the bugcheck occurs during shutdown after you have seen your
notification. The answer is 'yes'.

See also IoRegisterLastChanceShutdownNotification as this will give you
a later shutdown notification. However, you can still bugcheck even
after this notification. What if some other driver has also registered
for notification and it runs after your driver and causes a bugcheck?

Whatever you are doing at this point in time has to be correct even if
the system fails after your shutdown notification has run.

I think it is rather unlikely though that your registry write is being
record in the bugcheck scenario you describe. It can happen, it just
isn't very likely. Perhaps you have some other bug?

Re: shutdown handler by Doron

Doron
Tue Jan 31 21:38:19 CST 2006

instead of doing this, why not create the key which holds your registry
value as a volatile key. that way, nomatter what, it will not be present on
next boot. also be aware that if you register for a last chance shutdown
notification, you cannot cause paging i/o and registry access will cause
paging i/o, so you can't touch the registry in that function.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"needhelp" <needhelp@discussions.microsoft.com> wrote in message
news:E149AE0D-AFE8-4500-A672-ACFFD40D6E0D@microsoft.com...
> All,
> I register shutdown handler using IoRegisterShutdownNotification. In my
> IRP_MJ_SHUTDOWN handler, I set a value in registry. I clear this registry
> in
> next boot. The problem i am having is this value is being set during a
> bugcheck. Is it possible that IRP_MJ_SHUTDOWN handler is called during
> BSOD
>
> Thanks



Re: shutdown handler by Alexander

Alexander
Tue Jan 31 21:58:43 CST 2006

Isn't IRP_MJ_SHUTDOWN called before FS are unmounted?

"Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
news:O4vAzDuJGHA.3444@tk2msftngp13.phx.gbl...
> instead of doing this, why not create the key which holds your registry
> value as a volatile key. that way, nomatter what, it will not be present
> on next boot. also be aware that if you register for a last chance
> shutdown notification, you cannot cause paging i/o and registry access
> will cause paging i/o, so you can't touch the registry in that function.
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> "needhelp" <needhelp@discussions.microsoft.com> wrote in message
> news:E149AE0D-AFE8-4500-A672-ACFFD40D6E0D@microsoft.com...
>> All,
>> I register shutdown handler using IoRegisterShutdownNotification. In my
>> IRP_MJ_SHUTDOWN handler, I set a value in registry. I clear this registry
>> in
>> next boot. The problem i am having is this value is being set during a
>> bugcheck. Is it possible that IRP_MJ_SHUTDOWN handler is called during
>> BSOD
>>
>> Thanks
>
>



Re: shutdown handler by Doron

Doron
Wed Feb 01 00:04:19 CST 2006

depends on which shutdown you register for. IoRegisterShutdownNotification
is before. IoRegisterLastChanceShutdownNotificaiton is after.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:%237FG3OuJGHA.2088@TK2MSFTNGP11.phx.gbl...
> Isn't IRP_MJ_SHUTDOWN called before FS are unmounted?
>
> "Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
> news:O4vAzDuJGHA.3444@tk2msftngp13.phx.gbl...
>> instead of doing this, why not create the key which holds your registry
>> value as a volatile key. that way, nomatter what, it will not be present
>> on next boot. also be aware that if you register for a last chance
>> shutdown notification, you cannot cause paging i/o and registry access
>> will cause paging i/o, so you can't touch the registry in that function.
>>
>> d
>>
>> --
>> Please do not send e-mail directly to this alias. this alias is for
>> newsgroup purposes only.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> "needhelp" <needhelp@discussions.microsoft.com> wrote in message
>> news:E149AE0D-AFE8-4500-A672-ACFFD40D6E0D@microsoft.com...
>>> All,
>>> I register shutdown handler using IoRegisterShutdownNotification. In my
>>> IRP_MJ_SHUTDOWN handler, I set a value in registry. I clear this
>>> registry in
>>> next boot. The problem i am having is this value is being set during a
>>> bugcheck. Is it possible that IRP_MJ_SHUTDOWN handler is called during
>>> BSOD
>>>
>>> Thanks
>>
>>
>
>



Re: shutdown handler by Maxim

Maxim
Wed Feb 01 07:28:33 CST 2006

They are not unmounted, they are shut down :) (IIRC any file access after
this is failed with STATUS_FILE_CLOSED or such), and send the MJ_SHUTDOWN IRP
down the volume/disk stacks after this (even without
IoRegisterShutdownNotification).

MJ_POWER comes much later.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:%237FG3OuJGHA.2088@TK2MSFTNGP11.phx.gbl...
> Isn't IRP_MJ_SHUTDOWN called before FS are unmounted?
>
> "Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
> news:O4vAzDuJGHA.3444@tk2msftngp13.phx.gbl...
> > instead of doing this, why not create the key which holds your registry
> > value as a volatile key. that way, nomatter what, it will not be present
> > on next boot. also be aware that if you register for a last chance
> > shutdown notification, you cannot cause paging i/o and registry access
> > will cause paging i/o, so you can't touch the registry in that function.
> >
> > d
> >
> > --
> > Please do not send e-mail directly to this alias. this alias is for
> > newsgroup purposes only.
> > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> >
> >
> > "needhelp" <needhelp@discussions.microsoft.com> wrote in message
> > news:E149AE0D-AFE8-4500-A672-ACFFD40D6E0D@microsoft.com...
> >> All,
> >> I register shutdown handler using IoRegisterShutdownNotification. In my
> >> IRP_MJ_SHUTDOWN handler, I set a value in registry. I clear this registry
> >> in
> >> next boot. The problem i am having is this value is being set during a
> >> bugcheck. Is it possible that IRP_MJ_SHUTDOWN handler is called during
> >> BSOD
> >>
> >> Thanks
> >
> >
>
>


Re: shutdown handler by Doron

Doron
Wed Feb 01 23:50:37 CST 2006

depends on the power pagability of the stack. device stacks that have
DO_POWER_PAGABLE are shutdown beforehand so that paging i/o can be
processed.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:%23Gy2bLzJGHA.2300@TK2MSFTNGP15.phx.gbl...
> They are not unmounted, they are shut down :) (IIRC any file access
> after
> this is failed with STATUS_FILE_CLOSED or such), and send the MJ_SHUTDOWN
> IRP
> down the volume/disk stacks after this (even without
> IoRegisterShutdownNotification).
>
> MJ_POWER comes much later.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
> "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
> news:%237FG3OuJGHA.2088@TK2MSFTNGP11.phx.gbl...
>> Isn't IRP_MJ_SHUTDOWN called before FS are unmounted?
>>
>> "Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
>> news:O4vAzDuJGHA.3444@tk2msftngp13.phx.gbl...
>> > instead of doing this, why not create the key which holds your registry
>> > value as a volatile key. that way, nomatter what, it will not be
>> > present
>> > on next boot. also be aware that if you register for a last chance
>> > shutdown notification, you cannot cause paging i/o and registry access
>> > will cause paging i/o, so you can't touch the registry in that
>> > function.
>> >
>> > d
>> >
>> > --
>> > Please do not send e-mail directly to this alias. this alias is for
>> > newsgroup purposes only.
>> > This posting is provided "AS IS" with no warranties, and confers no
>> > rights.
>> >
>> >
>> > "needhelp" <needhelp@discussions.microsoft.com> wrote in message
>> > news:E149AE0D-AFE8-4500-A672-ACFFD40D6E0D@microsoft.com...
>> >> All,
>> >> I register shutdown handler using IoRegisterShutdownNotification. In
>> >> my
>> >> IRP_MJ_SHUTDOWN handler, I set a value in registry. I clear this
>> >> registry
>> >> in
>> >> next boot. The problem i am having is this value is being set during
>> >> a
>> >> bugcheck. Is it possible that IRP_MJ_SHUTDOWN handler is called during
>> >> BSOD
>> >>
>> >> Thanks
>> >
>> >
>>
>>
>