Windows Driver - Save and reload IRQ_LEVEL
In many driver developments, i was used to to change the IRQ_LEVEL or called a function, wich is changing th IRQ_LEVEL.
A simple method to store and reload the IRQ_LEVEL, is this:
KIRQL OldIrql; // Storage of current IRQ_LEVEL
IoAcquireCancelSpinLock(&OldIrql); // Save current IRQ_LEVEL
// IRQ Changing code ...
IoReleaseCancelSpinLock(&OldIrql); // Reload stored IRQ_LEVEL
This will also solve the Code Analyzer warning C28167.