Question

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:

  1. obtain a lock on the device
  2. write a value
  3. read a value
  4. 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 would be nice if I could give each application the ability to obtain a lock that will block all other applications from accessing the device.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top