C28166

warning C28166: The function does not restore the IRQL to the value that was current at function entry and is required to do so.

This warning indicates that a function has the _IRQL_requires_same_ annotation and there is at least one path through the function that does not, by function exit, restore the IRQL to the IRQL at which the driver was running at function entry.

Typically, the _IRQL_requires_same_ annotation is used on callback functions.

To avoid this warning, the driver must properly save the initial IRQL value and restore the same IRQL value at function exit, which is what the _IRQL_requires_same_ annotation asserts.