Using Mutex and Events in UMDF

I am just going through the OSR page https://www.osr.com/nt-insider/2011-issue2/basics-wdf-queues/

I read that “you can’t touch pagable memory or use Dispatcher Objects (such as mutexes and events) for synchronization within these callbacks” from below paragraph. Does the statement hold true for UMDf driver as well? Because, I am having UMDF Virtual Serial Driver and i am using Mutex and Events for synchronization and it is working (from with in the event callbacks).


It is extremely important to note that the EvtIoXxx Event Processing callbacks to your driver occur in an arbitrary process and thread context, and (by default) at an IRQL less than or equal to IRQL DISPATCH_LEVEL. That means you can’t know in advance what thread is running when one of your EvtIoXxx callbacks gets called, and also that (by default) you can’t touch pagable memory or use Dispatcher Objects (such as mutexes and events) for synchronization within these callbacks.

Does the statement hold true for UMDF driver as well?

Nope.

When you’re running in user-mode, you’re always at IRQL DISPATCH_LEVEL in your driver. So, you should be fine.

For good measure, you might want to set a ExecutionLevel constraint of WdfExecutionLevelPassive…

Peter

1 Like

When running in user mode you are always at PASSIVE_LEVEL, never above.

1 Like

Thanks!