From: Mohit Gupta on
How can I write to file if my interrupt function is fired? I know can't write
to file from an interrupt function because it's running at DIRQL. What's the
way around?

This is what I want to do:

Whenever an interrupt is fired, I want to log the event to a file in my own
format (for debugging and testing purposes).
From: x64 on
> How can I write to file if my interrupt function is fired? I know can't write
> to file from an interrupt function because it's running at DIRQL. What's the
> way around?

Use dedicated thread in conjunction with non-paged buffer for data
which you want to write.
From: Mohit Gupta on
If I use dedicated thread which will perform write operations at
PASSIVE_LEVEL, then following problem can arise:

While dedicated thread is reading from a dedicated non-paged memory, it may
get interrupted again by the same interrupt. Interrupt routine can then
overwrite data in dedicated memory. When thread execution is restored it
could end-up writing inconsistent data in the file, that is data from 2nd
interrupt rather than 1st.

If KeSynchronizeInterrupt routiune is used to synchronise read/write
operation, thread IRQL will raise to DISPATCH_LEVEL, but that would cause
another problem becasue file operations can't be performed at DISPATCH_LEVEL.

More help required :)


"x64" wrote:

> > How can I write to file if my interrupt function is fired? I know can't write
> > to file from an interrupt function because it's running at DIRQL. What's the
> > way around?
>
> Use dedicated thread in conjunction with non-paged buffer for data
> which you want to write.
> .
>
From: Tim Roberts on
Mohit Gupta <MohitGupta(a)discussions.microsoft.com> wrote:
>
>How can I write to file if my interrupt function is fired? I know can't write
>to file from an interrupt function because it's running at DIRQL. What's the
>way around?
>
>This is what I want to do:
>
>Whenever an interrupt is fired, I want to log the event to a file in my own
>format (for debugging and testing purposes).

The RIGHT way to do this is to use KdPrint or DbgPrint to send the message
to the kernel debug buffer. Then, you can use the DebugView tool to
capture the messages to memory or log them to file.
--
Tim Roberts, timr(a)probo.com
Providenza & Boekelheide, Inc.
From: Mohit Gupta on
Thanks Tim.

KdPrint or DbgPrint is definitely a better option, however, my requirement
at this moment is to write it to file :)


"Tim Roberts" wrote:

> Mohit Gupta <MohitGupta(a)discussions.microsoft.com> wrote:
> >
> >How can I write to file if my interrupt function is fired? I know can't write
> >to file from an interrupt function because it's running at DIRQL. What's the
> >way around?
> >
> >This is what I want to do:
> >
> >Whenever an interrupt is fired, I want to log the event to a file in my own
> >format (for debugging and testing purposes).
>
> The RIGHT way to do this is to use KdPrint or DbgPrint to send the message
> to the kernel debug buffer. Then, you can use the DebugView tool to
> capture the messages to memory or log them to file.
> --
> Tim Roberts, timr(a)probo.com
> Providenza & Boekelheide, Inc.
> .
>