我需要抑制大容量存储设备的自动播放。 这需要通过在后台运行的服务/守护程序以编程方式实现。
我知道可以通过打开窗口并处理windows发送的“queryCancelAutoPlay”消息的应用程序来完成。
这可以在没有GUI的情况下完成。我有需要禁用自动播放的设备的guid / pid / vid。
答案 0 :(得分:2)
不确定。您可以创建仅消息窗口。这给你一个HWND,没有那些烦人的WM_PAINT消息等。另一种方法是使用COM,IQueryCancelAutoplay
答案 1 :(得分:0)
有一个控制AutoRun的注册表项:
HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
可以将其设置为在technet:
上禁用特定设备类型的AutoRunNoDriveTypeAutoRun
Value Meaning
0x1 Disables Autoplay on drives of unknown type.
0x4 Disables Autoplay on removable drives.
0x8 Disables Autoplay on fixed drives.
0x10 Disables Autoplay on network drives.
0x20 Disables Autoplay on CD-ROM drives.
0x40 Disables Autoplay on RAM drives.
0x80 Disables Autoplay on drives of unknown type.
0xFF Disables Autoplay on all types of drives.