开发者

UMDF- lock device in application level

开发者 https://www.devze.com 2023-01-25 04:35 出处:网络
I\'m writing a simple USB driver for our device using UMDF over WinUsb. The driver can be used by multiple application concurrently.

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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号