Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows bug check callback not called on 64 bit systems

We have ported our driver successfully to 64 bit systems a while ago.

But one thing is missing, which is not very important but it was a very handy debugging feature.

The callbacks registered with KeRegisterBugCheckReasonCallback is never called. The function returns a TRUE for success, but my callback is never called. I also tried different values for the parameter reason with no success. A try with the older KeRegisterBugCheckCallback also failed.

What I am doing wrong?

Did I missed something in the documentation?

like image 735
ConfusedSushi Avatar asked Jun 08 '11 12:06

ConfusedSushi


People also ask

What are Windows bug check Callback routines?

Many drivers supply bug check callback routines. When Windows issues a bug check, it calls these routines before shutting down the system. These routines can specify and write to areas of memory known as callback data and secondary callback data. Data written by this routine becomes part of callback data.

What is missing from keregisterbugcheckreasoncallback?

But one thing is missing, which is not very important but it was a very handy debugging feature. The callbacks registered with KeRegisterBugCheckReasonCallback is never called. The function returns a TRUE for success, but my callback is never called.

What happens if the callback routine causes a second bug check?

If the callback routine causes a second bug check, this new bug check will be processed first. However, Windows will not repeat certain parts of the Stop process—for example, it will not write a second crash dump file. The Stop code displayed on the blue screen will be the second bug check code.

How to implement kbugcheck_reason_callback_routine in a kernel-mode driver?

A kernel-mode driver can implement a KBUGCHECK_REASON_CALLBACK_ROUTINE callback function of type KbCallbackDumpIo to perform work each time data is written to the crash dump file. The system passes, in the ReasonSpecificData parameter, a pointer to a KBUGCHECK_DUMP_IO structure.


1 Answers

I found the problem.

Windows only calls the callbacks if corresponding KBUGCHECK_CALLBACK_RECORD is aligned to an 8 byte address.

For some reason mine where aligned to 4 byte addresses.

It is a bummer that KeRegisterBugCheckReasonCallback does not check this.

like image 56
ConfusedSushi Avatar answered Oct 19 '22 12:10

ConfusedSushi