Hi.
Following my first message, the original question was:
«Is it possible/wise to use ZwWriteFile() from a callback routine
- registered with KeRegisterBugCheck() - in order to save some
“user-defined” information into a simple log (text) file?»
Maxim S. Shatskih (Max) answered clearly and said no (thank
you, Max). He pointed out that I could rely on the kernel’s
memory dump facility, by having the system creating the
small/kernel/complete memory dump (.dmp) file.
But let’s assume I need to log some extra, “user-defined”
information (say, something quite simple like a descriptive text
to a non-technical user or some binary information adapted to
an hipotetical application which reads that log file and produces
a kind of “diagnostic” in a human readable form).
I understand that at the moment the system crashes, it might be
unstable and though there are few guarantees the log file would
be created at all.
However, let’s assume a “best-effort” approach to produce
such a file. Using ZwWriteFile() from the callback routine is not
possible/recommended at all (as Max correctly stated; btw, I
tried it and the call returned assertion errors reporting that the
code was running at the wrong IRQL - which makes a lot of
sense, anyway).
Now, Rob Green said:
The system passes to the callback a buffer you can write
data to. You can then access the data via windbg, or maybe
open the file and search for it.
Thank you, Rob. You’re right, and I know that. At present
stage I could manage to pass and view that buffer from
WinDbg (actually, the buffer contents are nothing less than
the stuff I need to store into the log file. But, as I mentioned
above, I need to produce that log file and not just implement
the debug facility through WinDbg.
Finally, Satish K.S. said:
Why dont u try with ROM Bios File operation functions?
This will be available after Dead of OS also.
Thank you, Satish. Yes, I was planning to move in to that
step if nothing else works. But that implies using Assembly,
and I’d prefer to stuck with plain C for now, if possible. Not
that I have something against the topic, but I was willing to
find out a “well-behaved” way to achieve this goal without
going much deeper into the hardware. However, I realize
that if such way does not exist at all, I’ll have to proceed as
you suggest.
Hmmm… I just received another mail. Let’s see what Max
says about this:
There is NO BIOS functions for working with files. Only
with low-level sectors - and only for IDE drives (SCSI
drive is supported by BIOS only if it is bootable one).Also - I have great doubts NT performs return to real
mode at bugcheck, so, it is not guaranteed that BIOS
functions will be available at this moment.Max
Well pointed, Max. What do you suggest, then? I would
mostly appreciate your tips (or anyone else’s tips, btw…
Thank you all in advance (again),
Miguel Monteiro
xxxxx@criticalsoftware.com
www.criticalsoftware.com
«Humour and love are God’s answers
to Human weaknesses»
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com