如何使用 Inno Setup 安装驱动程序?

发布于 2024-12-04 04:02:34 字数 117 浏览 1 评论 0原文

我想使用 Inno Setup 安装串行端口驱动程序。我有 inf 文件,我可以通过设备管理器手动安装驱动程序,但我希望能够将驱动程序包含在我的安装程序中,以便用户不必通过自己安装驱动比较麻烦。

I'd like to install a driver for a serial port using Inno Setup. I have the inf file, and I can install the driver manually through device manager, but I'd like to be able to include the driver in my installer so that users don't have to go through the trouble of installing the driver themselves.

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

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

发布评论

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

评论(3

小苏打饼 2024-12-11 04:02:34

请参阅 InstallHinfSection微软文档。该文档还提到了如何通过调用 Rundll32.exe 来调用安装。可能您最终会得到这样的结果:

[Files]
..
Source: "driver\my_x86driver.inf"; DestDir: {app}\driver;
Source: "driver\my_x86driver.sys"; DestDir: {app}\driver;

[Run]
..
Filename: {sys}\rundll32.exe; \
    Parameters: "setupapi,InstallHinfSection DefaultInstall 128 {app}\driver\my_x86driver.inf"; \
    WorkingDir: {app}\driver; Flags: 32bit;

请注意,您可能需要在 64 位系统中以 64 位模式运行安装程序才能安装驱动程序:

[Setup]
..
ArchitecturesInstallIn64BitMode=x64 

另外您还可以检查运行 .inf 的版本 文件取决于机器架构(例如Check: Is64BitInstallMode)。

See InstallHinfSection in Microsoft documentation. The documentation also mentions how to invoke an installation by calling Rundll32.exe. Probably you'll end up with something like this:

[Files]
..
Source: "driver\my_x86driver.inf"; DestDir: {app}\driver;
Source: "driver\my_x86driver.sys"; DestDir: {app}\driver;

[Run]
..
Filename: {sys}\rundll32.exe; \
    Parameters: "setupapi,InstallHinfSection DefaultInstall 128 {app}\driver\my_x86driver.inf"; \
    WorkingDir: {app}\driver; Flags: 32bit;

Note that you might need to run the setup in 64bit mode in 64bit systems to be able to install the driver:

[Setup]
..
ArchitecturesInstallIn64BitMode=x64 

Also you can put checks as to run the version of .inf file depending on machine architecture (e.g. Check: Is64BitInstallMode).

老娘不死你永远是小三 2024-12-11 04:02:34

我这样使用 dpinst:

 [Files]    
Source: "Source\dpinst\dpinst32.exe"; DestDir: "{app}\driver"; DestName: dpinst.exe; Check: not IsWin64; Flags: ignoreversion
Source: "Source\dpinst\dpinst64.exe"; DestDir: "{app}\driver"; DestName: dpinst.exe; Check: IsWin64; Flags: ignoreversion

[Run]
Filename: "{app}\driver\dpinst.exe"; Parameters: "/A /LM";

I used dpinst like this:

 [Files]    
Source: "Source\dpinst\dpinst32.exe"; DestDir: "{app}\driver"; DestName: dpinst.exe; Check: not IsWin64; Flags: ignoreversion
Source: "Source\dpinst\dpinst64.exe"; DestDir: "{app}\driver"; DestName: dpinst.exe; Check: IsWin64; Flags: ignoreversion

[Run]
Filename: "{app}\driver\dpinst.exe"; Parameters: "/A /LM";
迷荒 2024-12-11 04:02:34

这是一个更好的答案:Install drivers with rundll32 or dpinst in Inno设置?

在 Windows 7 及更高版本上使用 InstallHinfSection 似乎要么被破坏,要么充满困难。使其通过批处理文件工作很困难,使其通过 Inno Setup 工作则更加困难。 dpinst 似乎更可取,而且更简单。

This is a better answer: Install drivers with rundll32 or dpinst in Inno Setup?

Using InstallHinfSection on Windows 7 and beyond seems to be either broken or fraught with difficulty. Making it work from a batch file is difficult, making it work from Inno Setup is even more difficult. dpinst seems preferable, and is simpler.

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