Technical Document #103

Technical Document #103
Can I write to disk files during an interrupt routine?

Yes. WinDriver enables you to implement your interrupt service routine (ISR) in the user mode, thereby allowing you to perform all library function calls from within your ISR. Just remember to keep it short, so you don't miss the next interrupt.

If you select to implement your ISR in the kernel, using WinDriver's Kernel PlugIn feature (described in the WinDriver User's Manual), you will not be able to use the standard user mode file I/O functions. You can either leave the file I/O handling in the user-mode ISR, and implement your interrupt code so that the user-mode interrupt routine is executed only once every several interrupts. (You can refer to the generated DriverWizard Kernel PlugIn code and/or to the generic WinDriver Kernel PlugIn sample — WinDriver/samples/pci_diag/kp_pci/kp_pci.c (v7.0.0 and above) / WinDriver/kerplug/kermode/kptest.c (v6.2.3 and below) — for an example of monitoring the interrupt count); or replace the user-mode file I/O code with calls to OS-specific functions, which can be called at the kernel level (for example, the WDK ZwCreateFile(), ZwWriteFile() and ZwReadFile() functions). Please note, however, that this will diminish your driver's cross-platform portability.