Re: Writing data out before the system dies by Doron
Doron
Tue May 23 01:25:28 CDT 2006
note that if a bugcheck occurs after your work, there is no guarantee it is
written to disk correctly.
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.
"PB" <PB@discussions.microsoft.com> wrote in message
news:B2CB45B4-F56C-4803-BBCB-ED8F5EC5F660@microsoft.com...
> Doron,
>
> It all works fine - thanks for the help.
>
> PB
>
> "Doron Holan [MS]" wrote:
>
>> the callback is invoked before any system irps are sent to any device.
>> that
>> means that paging may still occur and things that create page faults
>> (like
>> registry access) can still occur w/out deadlocks. how is this different
>> then processing a Dx power irp? well, if you are not power pagable
>> (DeviceObject->Flags does not have DO_POWER_PAGABLE set) you cannot incur
>> page faults in your power routines. i think an ndis device is not power
>> pagable (this is controlled by ndis(
>>
>> 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.
>>
>>
>> "PB" <PB@discussions.microsoft.com> wrote in message
>> news:6126AC19-FD37-41D0-AC68-45EA980C988B@microsoft.com...
>> > Thanks for that Doron,
>> >
>> > I'll give it a go first thing in the morning....
>> >
>> > One question though - how does registering for a PowerState Callback
>> > differ
>> > from waiting for the IRP_MJ_POWER IRP and processing it there?
>> > Is it called before the I/O Manager sends out the IRP_MJ_POWERs ?
>> >
>> > "Doron Holan [MS]" wrote:
>> >
>> >> look at ExCreateCallback and ExREgisterCallback for
>> >> \Callback\PowerState.
>> >>
>> >> you can't do any post portem in a bugcheck callback or thunk to
>> >> passive.
>> >> the system is dead. any further analysis can lead to a 2ndary
>> >> bughceck
>> >> which will render any dump file useless.
>> >>
>> >> 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.
>> >>
>> >>
>> >> "PB" <PB@discussions.microsoft.com> wrote in message
>> >> news:33152C6C-8317-491B-8C99-81D734C4B5BA@microsoft.com...
>> >> > Hi,
>> >> >
>> >> > I have a problem where a floppy filter driver (2K onwards) needs to
>> >> > write
>> >> > something (best place I think is) to the registry towards the end of
>> >> > it's
>> >> > cycle.
>> >> >
>> >> > I can't use unload (corect me if I'm wrong) as that only gets called
>> >> > for
>> >> > unloading and not for system shutdown.
>> >> >
>> >> > Thye driver needs to write some data when the system is shutting
>> >> > down
>> >> > or I
>> >> > guess if the box falls over (maybe via 3rd party software)*
>> >> >
>> >> > Firstly I tried looking for IRP_MJ_SHUTDOWN
>> >> > (IoRegisterShutdownNotification)
>> >> > but that IRP doesn't make it's way down the floppy stack.
>> >> > Next I thought I'd catch a power IRP IRP_MN_SET_POWER and write it
>> >> > then
>> >> > but
>> >> > it's too late by then (even thought the function call "succeeded"),
>> >> > I
>> >> > thought
>> >> > about IRP_MN_QUERY_POWER but that didn't get called either. (Both
>> >> > these
>> >> > scenarios are for the normal shutdown)
>> >> > Finally I tried setting a BugCheck call back. Now whilst this gets
>> >> > caught
>> >> > I'm at too high an IRQL (29 supprisingly) to use any RtlXxx registry
>> >> > routines.
>> >> >
>> >> > I don't mind which case I run with with (BSoD/regular shutdown both
>> >> > would
>> >> > be
>> >> > nice) I just need to make a write "somewhere" and as I said
>> >> > previously,
>> >> > the
>> >> > best place is registry (as I'll check this data on system boot up)
>> >> >
>> >> > By using the bugcheck call back, can anyone tell me if I'd be able
>> >> > to
>> >> > get
>> >> > back to PASSIVE (maybe through a DPC queing a WorkItem?) so that I
>> >> > could
>> >> > make
>> >> > this call or am I going to have to do something messy like
>> >> > manipulate
>> >> > the
>> >> > registry by getting the address of the key and modifying the memory
>> >> > directly?
>> >> > (which I'd rather steer clear of - last thing I want is a grumpy
>> >> > customer)
>> >> >
>> >> > Any ideas would be welcomed,
>> >> >
>> >> > *P.S. What's the best way of identifying the likely cause of a BSoD
>> >> > on
>> >> > a
>> >> > live (well a just-Blue-Screened system without a debugger attached.
>> >> >
>> >> > Thanks,
>> >>
>> >>
>> >>
>>
>>
>>