以编程方式禁用设备管理器中的设备(Vista x64)

时间:2022-09-01 11:24:15

Is there any way to programmaticly disable a device? (preferably in .net, win32, or batch).

有没有办法以编程方式禁用设备? (最好是.net,win32或批处理)。

Most hits on google suggest using devcon but it does not seem to be working on Windows Vista/7 64bit.

谷歌上的大多数点击建议使用devcon但它似乎不适用于Windows Vista / 7 64位。

How do I disable a system device? has a solution using SetupDiSetClassInstallParams but it also doesn't work for Vista64.

如何禁用系统设备?有一个使用SetupDiSetClassInstallParams的解决方案,但它也不适用于Vista64。

1 个解决方案

#1


The 32-bit version of devcon doesn't completely work in WoW64 emulation; I've seen it fail to disable devices as well. The Windows Driver Kit includes a 64-bit version of devcon, which works. It also includes the source code to devcon, so you can see that devcon is just a wrapper for the Setup API.

32位版本的devcon在WoW64仿真中并不完全有效;我已经看到它也无法禁用设备。 Windows驱动程序工具包包含64位版本的devcon,可以使用。它还包括devcon的源代码,因此您可以看到devcon只是Setup API的包装器。

When you tried calling into the Setup API directly, was it from a 32-bit or 64-bit process? Based on experiences using devcon, I suspect that you need to call into the Setup API from a 64-bit process.

当您尝试直接调用Setup API时,它是来自32位还是64位进程?根据使用devcon的经验,我怀疑您需要从64位进程调用Setup API。

#1


The 32-bit version of devcon doesn't completely work in WoW64 emulation; I've seen it fail to disable devices as well. The Windows Driver Kit includes a 64-bit version of devcon, which works. It also includes the source code to devcon, so you can see that devcon is just a wrapper for the Setup API.

32位版本的devcon在WoW64仿真中并不完全有效;我已经看到它也无法禁用设备。 Windows驱动程序工具包包含64位版本的devcon,可以使用。它还包括devcon的源代码,因此您可以看到devcon只是Setup API的包装器。

When you tried calling into the Setup API directly, was it from a 32-bit or 64-bit process? Based on experiences using devcon, I suspect that you need to call into the Setup API from a 64-bit process.

当您尝试直接调用Setup API时,它是来自32位还是64位进程?根据使用devcon的经验,我怀疑您需要从64位进程调用Setup API。