UMDF- lock device in application level
I'm writing a simple USB driver for our device using UMDF over WinUsb. The driver can be used by multiple application concurrently. I need to achieve a custom locking system that the WdfDeviceLevel\WdfObjectLevel doesn't give me: I want an atomic write-read function:
- obtain a lock on the device
- write a value
- read a value
- release the lock
How can I implement such a function? I could not find how to expose custom function on top of the the interface's functions. In addition to this particular atomic function, it woul开发者_开发问答d be nice if I could give each application the ability to obtain a lock that will block all other applications from accessing the device.
As the driver we are using can only be accessed via a dedicated dll, I added mutex locks in the dll level to imitate an atomic function.
精彩评论