Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如果ExecWait命令获取特定的返回代码,则NSIS回滚安装程序_Nsis - Fatal编程技术网

如果ExecWait命令获取特定的返回代码,则NSIS回滚安装程序

如果ExecWait命令获取特定的返回代码,则NSIS回滚安装程序,nsis,Nsis,我目前正在使用以下脚本随应用程序一起安装驱动程序: !macro customInstall ExecWait '"$INSTDIR\resources\DPInst.exe" /sw' !macroend 但是,如果DPInst返回>=0x80010000,这意味着一个或多个驱动程序安装失败,因此我需要回滚安装并退出。知道我该怎么做吗?ExecWait可以将进程退出代码存储在第二个参数中。要将其回滚,您可以做的不多,最好在安装阶段的早期执行: !include LogicLib.nsh

我目前正在使用以下脚本随应用程序一起安装驱动程序:

!macro customInstall
  ExecWait '"$INSTDIR\resources\DPInst.exe" /sw'
!macroend

但是,如果
DPInst
返回
>=0x80010000
,这意味着一个或多个驱动程序安装失败,因此我需要回滚安装并退出。知道我该怎么做吗?

ExecWait可以将进程退出代码存储在第二个参数中。要将其回滚,您可以做的不多,最好在安装阶段的早期执行:

!include LogicLib.nsh
Section
SetOutPath "$instdir\resources"
File "whatever\DPInst.exe"
ExecWait '"$INSTDIR\resources\DPInst.exe" /sw' $0
${If} $0 U>= 0x80010000
  Delete "$INSTDIR\resources\DPInst.exe"
  RMDir $instdir\resources
  RMDir $instdir
  MessageBox mb_iconstop "Error blah blah"
  Abort
${EndIf}
SectionEnd

这是可行的,但由于没有简单的方法可以回滚我的设置,我决定在应用程序中解析
PnPUtil
的输出,以检查驱动程序是否已安装,如果缺少,则重新提示安装驱动程序。