我们如何收到卷附加通知
当卷附加到文件系统时,在 Windows 上,
Window 资源管理器会检测音量并自动刷新。
我想知道这项技术。
程序(包括设备驱动程序)如何获取通知?
-当然,这并不意味着投票。我想要获取一个事件(或一条消息)。
我想在连接网络卷(如 SMB)时收到通知。
提前致谢。
When a volume is attached to file system, on Windows,
the Window explorer detects the volume and refreshes automatically.
I wonder the technique.
How do an program(include device driver) get the notification?
-Of course, it doesn’t mean a polling. I want to get an event(or a message).
I would like to get the notification when a network volume(like SMB) is attached.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须做一些研究,但基本上您只需要向 Windows IO 管理器注册,以便在连接设备时调用您的代码的某些部分。 RegisterDeviceNotification() 可能是一个不错的选择开始的地方。连接设备后,IO 管理器将向您发送一条消息,因此您应该确保对该消息进行了正确的回调设置。
阅读 Windows 设备服务不会有什么坏处 来自 Windows 系统 API。根据您正在执行的操作,您可能需要也可能不需要驱动程序,因为 Microsoft 提供的通用驱动程序通常就足够好了。对于驱动程序,请查看 Windows 驱动程序工具包,它包含一个优秀的示例驱动程序的集合,以及用于与驱动程序接口和使用硬件的 Win32 代码。
祝你好运!
You're going to have to do some research, but basically you just need to register with the Windows IO Manager so that when the device is connected, some part of your code is called. RegisterDeviceNotification() is probably a good place to get started. When the device is connected, the IO Manager will send you a message, so you should make sure you have a proper callback setup for the message.
It would not hurt to read up on Windows Devices Services from the Windows System API. Depending on what you are doing, you may or may not need a driver as the generic driver provided by Microsoft is often good enough. For drivers, check out the Windows Driver Kit, it contains an excellent collection of sample drivers, as well as Win32 code for interfacing with drivers and working with hardware.
Good luck!