如何使用 C++ 安装硬件驱动程序在 Win32 上?

发布于 2024-08-21 09:25:45 字数 84 浏览 11 评论 0原文

如何使用 C++ 安装硬件驱动程序(inf 文件)?

平台:Win32

How do I install a hardware driver (inf file) using C++?

Platform : Win32

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

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

发布评论

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

评论(2

墨离汐 2024-08-28 09:25:45

该过程通常称为“预安装”。 (正常安装过程是由硬件设备到达触发的。)

相关函数可以在DDK的中找到。您可能想要调用DriverPackageInstall()。预期返回值为 ERROR_NO_SUCH_DEVINST [原文如此],因为目前还没有这样的设备。

有一些 64 位的时髦之处:您无法从 Win32 应用程序安装 64 位驱动程序(至少在 XP/Vista/Windows7/2003/2008 中不能)。因此,您的 Win32 安装程序必须检查 DriverPackageInstall() 是否返回 ERROR_IN_WOW64,然后调用 CreateProcess 来启动您的 64 位安装程序。

The process is usually called pre-installation. (The normal install process is triggered by the arrival of an hardware device.)

The relevant functions can be found in <DIFxAPI.h> from the DDK. You probably want to call DriverPackageInstall(). The expected return value is ERROR_NO_SUCH_DEVINST [sic] as there won't be such a device yet.

There's some 64 bit funkyness: you can't install a 64 bits driver from a Win32 app (at least not in XP/Vista/Windows7/2003/2008). Hence, your Win32 installer must check if DriverPackageInstall() returns ERROR_IN_WOW64 and then call CreateProcess to start your 64 bits installer.

青瓷清茶倾城歌 2024-08-28 09:25:45

我会考虑使用 setupapi.dll 中的 InstallHinfSection 函数。以下是相关文档:

http://msdn.microsoft .com/en-us/library/aa376957%28VS.85%29.aspx

I would look at using the InstallHinfSection function, in the setupapi.dll. Here's the related docs:

http://msdn.microsoft.com/en-us/library/aa376957%28VS.85%29.aspx

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