UMDF-应用程序级别的锁定设备

发布于 2024-10-02 21:48:24 字数 335 浏览 1 评论 0原文

我正在通过 WinUsb 使用 UMDF 为我们的设备编写一个简单的 USB 驱动程序。该驱动程序可以被多个应用程序同时使用。 我需要实现 WdfDeviceLevel\WdfObjectLevel 没有提供的自定义锁定系统: 我想要一个原子写读功能:

  1. 获取设备上的锁
  2. 写入一个值
  3. 读取一个值
  4. 释放锁

我如何实现这样的功能?我找不到如何在界面函数之上公开自定义函数。 除了这个特定的原子函数之外,如果我能让每个应用程序都能够获取阻止所有其他应用程序访问该设备的锁,那就太好了。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

音盲 2024-10-09 21:48:24

由于我们使用的驱动程序只能通过专用的 dll 访问,因此我在 dll 级别添加了互斥锁来模拟原子函数。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文