Inno Setup 驱动程序安装
我找不到 Inno Setup 安装驱动程序的方法。
我在这里检查了这些问题: Inno setup:使用 rundll32 或 dpinst 安装驱动程序? 如何在使用 Inno Setup 进行设置之前运行文件 和 如何安装 DirectX 可再发行组件创新设置?。
我的代码是这样的:
[Files]
Source: "drivers\dpinst64.exe"; DestDir: "{app}\drivers"; Check: Is64BitInstallMode; Components: drivers;
[code]
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
ResultCode: Integer;
begin
if IsWin64 then begin
ExtractTemporaryFile('drivers\dpinst64.exe');
Exec(ExpandConstant('{tmp}\dpinst64.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
end;
1)现在我的安装程序崩溃了,因为在提取临时文件时找不到 drivers\dpinst64.exe 。
2)在此之前,我尝试简单地在[run]中运行.exe,但没有任何反应。当.exe运行时,运行持续了5毫秒,然后我得到了-2147483648返回码。 Exec(ExpandConstant('{win}\notepad.exe'), '', '', SW_SHOW, ewWaitUntilTermulated, ResultCode) 在InitializeSetup中运行得很好。
这里可能有什么问题?在安装程序完成工作之前是否有另一种更好的方法来启动驱动程序安装?
I cannot find a way for Inno Setup to install drivers.
I have checked these questions here:
Inno setup: install drivers with rundll32 or dpinst?
How to run a file before setup with Inno Setup and How to install DirectX redistributable from Inno-setup?.
My code is like this:
[Files]
Source: "drivers\dpinst64.exe"; DestDir: "{app}\drivers"; Check: Is64BitInstallMode; Components: drivers;
[code]
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
ResultCode: Integer;
begin
if IsWin64 then begin
ExtractTemporaryFile('drivers\dpinst64.exe');
Exec(ExpandConstant('{tmp}\dpinst64.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
end;
1) Right now my installer crashes because it cannot find drivers\dpinst64.exe when extracting the temporary file.
2) Before this i tried simply running the .exe in [run] but nothing happened. When the .exe was run, the run lasted 5 miliseconds and then I got the -2147483648 return code. Exec(ExpandConstant('{win}\notepad.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) runs just fine in InitializeSetup.
What could be the problem here? Is there another better way to initiate driver instalation right before the installer finishes its work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果你尝试这样做,会发生什么?
安装dpinst64.exe的参数是什么?从您的尝试来看,它看起来像这样(假设 {tmp} 最终成为 Windows %TEMP%):
安装 dpinst64.exe 的说法正确吗?
我假设驱动程序 dpinst64.exe 是源驱动程序文件夹中唯一需要在安装程序中分发的文件。如果不是这种情况,那么您应该输入以下内容:
If you try this, what will happen?
What is the parameter to install dpinst64.exe? From your attempt, it looks like this (assuming that {tmp} ends up being Windows %TEMP%):
Is it the correct statement to install dpinst64.exe?
I assume that the driver dpinst64.exe is the only file in the drivers folder of your source that needs to be distributed in your installer. If it is not the case, then you should type as follows:
回答您的问题:
1. 您应该使用
ExtractTemporaryFile('dpinst64.exe');
而不是ExtractTemporaryFile('drivers\dpinst64.exe');
。2. 如果无法运行 DPINST64.EXE,您可能需要将驱动程序的 INF、SYS 和任何其他依赖项提取到 DPINST64.EXE 所在的目录中。您将需要多个 ExtractTemporaryFile 语句来提取多个文件。
To answer your questions:
1. You should use
ExtractTemporaryFile('dpinst64.exe');
instead ofExtractTemporaryFile('drivers\dpinst64.exe');
.2. For the failure to run the DPINST64.EXE, you might need to extract the INF, SYS, and any other dependencies for the driver into the directory where DPINST64.EXE. You would need multiple ExtractTemporaryFile statements to extract multiple files.
请记住,dpinst 首先是软件,这意味着在插入设备之前它不会实际安装设备。
keep in mind that dpinst is software first meaning it doesn't actually install the device until it is plugged in.