Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > Write to file on an interrupt

Reply
Thread Tools Display Modes

Write to file on an interrupt

 
 
Mohit Gupta
Guest
Posts: n/a

 
      06-16-2010
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).
 
Reply With Quote
 
 
 
 
Mohit Gupta
Guest
Posts: n/a

 
      06-16-2010
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.
> .
>

 
Reply With Quote
 
Tim Roberts
Guest
Posts: n/a

 
      06-16-2010
Mohit Gupta <> 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,
Providenza & Boekelheide, Inc.
 
Reply With Quote
 
Mohit Gupta
Guest
Posts: n/a

 
      06-16-2010
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 <> 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,
> Providenza & Boekelheide, Inc.
> .
>

 
Reply With Quote
 
Simon Richter
Guest
Posts: n/a

 
      06-16-2010
Hi,

On 2010年06月16日 05:44, Mohit Gupta wrote:

> While dedicated thread is reading from a dedicated non-paged memory, itmay
> get interrupted again by the same interrupt. Interrupt routine can then
> overwrite data in dedicated memory.


So use a buffer that has an appropriate amount of space for several entries.

If the buffer ever gets full, events will be lost, there is no way to
avoid that.

Simon

 
Reply With Quote
 
Doron Holan [MSFT]
Guest
Posts: n/a

 
      06-16-2010
a better option would be to use ETW. you fire the ETW event from your
DPCForIsr and then your user mode application can listen for the ETW event
and react any way it wants to it (log to a file, log to memory, send it over
the network)

d

"Mohit Gupta" wrote in message
news:8081FC51-E3A2-4230-ABF5-...

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 <> 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,
> Providenza & Boekelheide, Inc.
> .
>


 
Reply With Quote
 
Tim Roberts
Guest
Posts: n/a

 
      06-18-2010
Mohit Gupta <> wrote:
>
>KdPrint or DbgPrint is definitely a better option, however, my requirement
>at this moment is to write it to file


DebugView can write the DbgPrint logs to file. Use the tools that are at
your disposal.
--
Tim Roberts,
Providenza & Boekelheide, Inc.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy iPhone SMS to TXT file on computer? daren Windows Vista Music, Pictures and Video 0 05-19-2010 12:34 AM
Error number 80073712 naraku4656 Windows Update 51 02-18-2010 11:36 PM
Server 2003 update problem kc66 Windows Update 7 12-22-2009 04:09 PM
error code 0x8024D007 jenny Windows Update 10 11-23-2009 05:48 PM
Tag only some file types Phillip Windows Vista File Management 15 04-10-2007 02:23 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59