gpt4 book ai didi

installation - Inno Setup 驱动程序安装

转载 作者:行者123 更新时间:2023-12-04 05:17:23 24 4
gpt4 key购买 nike

我找不到 Inno Setup 安装驱动程序的方法。

我在这里检查了这些问题:
Inno setup: install drivers with rundll32 or dpinst?
How to run a file before setup with Inno SetupHow to install DirectX redistributable from Inno-setup? .

我的代码是这样的:

[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) 现在我的安装程序崩溃了,因为它在提取临时文件时找不到驱动程序\dpinst64.exe。

2)在此之前,我尝试在 [run] 中简单地运行 .exe,但什么也没发生。运行 .exe 时,运行持续了 5 毫秒,然后我得到了 -2147483648 返回码。 Exec(ExpandConstant('{win}\notepad.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) 在 InitializeSetup 中运行得很好。

这里可能是什么问题?在安装程序完成工作之前,是否有另一种更好的方法来启动驱动程序安装?

最佳答案

如果你试试这个,会发生什么?

安装dpinst64.exe的参数是什么?根据您的尝试,它看起来像这样(假设 {tmp} 最终是 Windows %TEMP%):

%TEMP%\dpinst64.exe -install "%TEMP%"

安装 dpinst64.exe 是否正确?
[Files]
Source: "drivers\dpinst64.exe"; DestDir: "{tmp}"; Check: Is64BitInstallMode; Components: drivers;

[Code]
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
ResultCode: Integer;
begin

if IsWin64 then begin
ExtractTemporaryFile('dpinst64.exe');
Exec(ExpandConstant('{tmp}\dpinst64.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;

end;

我假设驱动程序 dpinst64.exe 是源驱动程序文件夹中唯一需要在安装程序中分发的文件。如果不是这种情况,则应键入以下内容:
[Files]
Source: "drivers\*"; DestDir: "{tmp}"; Check: Is64BitInstallMode; Components: drivers;

关于installation - Inno Setup 驱动程序安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9262689/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com