我使用Inno Setup 6.0.3创建了一个安装程序,该安装程序要求最终自动重新启动Windows 2019 Server。
但是,如果UAC设置如下设置- 用户帐户控制设置:仅当应用尝试更改我的计算机时才通知我(默认)
然后用户通过双击在Windows资源管理器中的安装文件开始安装,然后选择“是,立即重新启动计算机”,然后出现以下错误- “安装程序无法重新启动计算机。请手动执行此操作”
我已包含必需的[Setup]指令PrivilegesRequired和AlwaysRestart
[Setup]
PrivilegesRequired=admin
ChangesEnvironment=yes
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName=test\MyProduct
AlwaysRestart=yes
安装日志确实显示了用于重启Windows的Inno安装代码。
2019-11-25 01:28:22.755 Process exit code: 1
2019-11-25 01:28:22.976 Need to restart Windows? Yes
2019-11-25 01:28:25.083 Deinitializing Setup.
2019-11-25 01:28:25.087 Restarting Windows.
2019-11-25 01:28:25.098 Log closed.
但是,由于Inno安装程序无法提升权限,因此API ExitWindows失败,因此Windows无法启动,并且显示上述错误消息。
注意:
这是一个已知问题,还是我在[Setup]指令中缺少某些内容?
完整日志失败:
2019-11-25 01:28:19.079 Log opened. (Time zone: UTC-08:00)
2019-11-25 01:28:19.079 Setup version: Inno Setup version 6.0.3 (u)
2019-11-25 01:28:19.079 Original Setup EXE: C:\viren\Output\mysetup.exe
2019-11-25 01:28:19.079 Setup command line: /SL5="$5065A,721408,721408,C:\viren\Output\mysetup.exe" /SPAWNWND=$C0662 /NOTIFYWND=$3A0222 /ALLUSERS
2019-11-25 01:28:19.080 Compatibility mode: Yes (Installer)
2019-11-25 01:28:19.080 Windows version: 10.0.17763 (NT platform: Yes)
2019-11-25 01:28:19.080 64-bit Windows: Yes
2019-11-25 01:28:19.080 Processor architecture: x64
2019-11-25 01:28:19.080 User privileges: Administrative
2019-11-25 01:28:19.082 Administrative install mode: Yes
2019-11-25 01:28:19.083 Install mode root key: HKEY_LOCAL_MACHINE
2019-11-25 01:28:19.083 64-bit install mode: No
2019-11-25 01:28:19.087 Created temporary directory: C:\Users\ADMINI~1\AppData\Local\Temp\is-7REUJ.tmp
2019-11-25 01:28:21.790 Calling RestartManager's RmGetList.
2019-11-25 01:28:21.800 RmGetList finished successfully.
2019-11-25 01:28:21.800 RestartManager found no applications using one of our files.
2019-11-25 01:28:21.820 Starting the installation process.
2019-11-25 01:28:21.829 Directory for uninstall files: C:\Program Files (x86)\MyOrg
2019-11-25 01:28:21.839 Will append to existing uninstall log: C:\Program Files (x86)\MyOrg\unins000.dat
2019-11-25 01:28:21.880 -- File entry --
2019-11-25 01:28:21.881 Dest filename: C:\Program Files (x86)\MyOrg\unins000.exe
2019-11-25 01:28:21.884 Time stamp of our file: 2019-11-25 01:28:18.741
2019-11-25 01:28:21.884 Dest file exists.
2019-11-25 01:28:21.884 Time stamp of existing file: 2019-11-25 01:25:14.078
2019-11-25 01:28:21.885 Version of our file: 51.1052.0.0
2019-11-25 01:28:22.111 Version of existing file: 51.1052.0.0
2019-11-25 01:28:22.111 Installing the file.
2019-11-25 01:28:22.203 Leaving temporary file in place for now.
2019-11-25 01:28:22.205 Saving uninstall information.
2019-11-25 01:28:22.205 Renaming uninstaller.
2019-11-25 01:28:22.207 Deleting uninstall key left over from previous administrative 32-bit install.
2019-11-25 01:28:22.207 Creating new uninstall key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{0940EFBB-D1FC-4C6F-91E0-996D9E40B2A5}_is1
2019-11-25 01:28:22.208 Writing uninstall key values.
2019-11-25 01:28:22.210 Detected previous non administrative install? No
2019-11-25 01:28:22.210 Detected previous administrative 64-bit install? No
2019-11-25 01:28:22.216 Installation process succeeded.
2019-11-25 01:28:22.230 -- Run entry --
2019-11-25 01:28:22.230 Run as: Current user
2019-11-25 01:28:22.230 Type: Exec
2019-11-25 01:28:22.230 Filename: certutil
2019-11-25 01:28:22.230 Parameters: -f -p xyz -importpfx "C:\MyOrg\NMX\CertFiles\Some-Certificate.pfx"
2019-11-25 01:28:22.462 Process exit code: 0
2019-11-25 01:28:22.463 -- Run entry --
2019-11-25 01:28:22.463 Run as: Current user
2019-11-25 01:28:22.463 Type: Exec
2019-11-25 01:28:22.463 Filename: netsh
2019-11-25 01:28:22.463 Parameters: http add sslcert ipport=0.0.0.0:443 certhash=458A6AXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx84059B8 appid={7CE058D3-892A-4318-9D3C-41FA3D8C6CE2}
2019-11-25 01:28:22.755 Process exit code: 1
2019-11-25 01:28:22.976 Need to restart Windows? Yes
2019-11-25 01:28:25.083 Deinitializing Setup.
2019-11-25 01:28:25.087 Restarting Windows.
2019-11-25 01:28:25.098 Log closed.
完成日志工作
2019-11-25 05:08:50.911 Log opened. (Time zone: UTC-08:00)
2019-11-25 05:08:50.911 Setup version: Inno Setup version 6.0.3 (u)
2019-11-25 05:08:50.911 Original Setup EXE: C:\viren\Output\mysetup.exe
2019-11-25 05:08:50.911 Setup command line: /SL5="$22031A,721408,721408,C:\viren\Output\mysetup.exe"
2019-11-25 05:08:50.912 Compatibility mode: Yes (Installer)
2019-11-25 05:08:50.912 Windows version: 10.0.17763 (NT platform: Yes)
2019-11-25 05:08:50.912 64-bit Windows: Yes
2019-11-25 05:08:50.912 Processor architecture: x64
2019-11-25 05:08:50.912 User privileges: Administrative
2019-11-25 05:08:50.913 Administrative install mode: Yes
2019-11-25 05:08:50.913 Install mode root key: HKEY_LOCAL_MACHINE
2019-11-25 05:08:50.913 64-bit install mode: No
2019-11-25 05:08:50.917 Created temporary directory: C:\Users\ADMINI~1\AppData\Local\Temp\is-9VKDA.tmp
2019-11-25 05:08:53.798 Calling RestartManager's RmGetList.
2019-11-25 05:08:53.810 RmGetList finished successfully.
2019-11-25 05:08:53.810 RestartManager found no applications using one of our files.
2019-11-25 05:08:53.833 Starting the installation process.
2019-11-25 05:08:53.840 Directory for uninstall files: C:\Program Files (x86)\MyOrg
2019-11-25 05:08:53.856 Will append to existing uninstall log: C:\Program Files (x86)\MyOrg\unins000.dat
2019-11-25 05:08:53.861 -- File entry --
2019-11-25 05:08:53.862 Dest filename: C:\Program Files (x86)\MyOrg\unins000.exe
2019-11-25 05:08:53.865 Time stamp of our file: 2019-11-25 05:08:50.653
2019-11-25 05:08:53.865 Dest file exists.
2019-11-25 05:08:53.865 Time stamp of existing file: 2019-11-25 01:28:18.741
2019-11-25 05:08:53.865 Version of our file: 51.1052.0.0
2019-11-25 05:08:54.165 Version of existing file: 51.1052.0.0
2019-11-25 05:08:54.166 Installing the file.
2019-11-25 05:08:54.305 Leaving temporary file in place for now.
2019-11-25 05:08:54.309 Saving uninstall information.
2019-11-25 05:08:54.309 Renaming uninstaller.
2019-11-25 05:08:54.313 Deleting uninstall key left over from previous administrative 32-bit install.
2019-11-25 05:08:54.314 Creating new uninstall key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{0940EFBB-D1FC-4C6F-91E0-996D9E40B2A5}_is1
2019-11-25 05:08:54.315 Writing uninstall key values.
2019-11-25 05:08:54.316 Detected previous non administrative install? No
2019-11-25 05:08:54.316 Detected previous administrative 64-bit install? No
2019-11-25 05:08:54.325 Installation process succeeded.
2019-11-25 05:08:54.347 -- Run entry --
2019-11-25 05:08:54.347 Run as: Current user
2019-11-25 05:08:54.347 Type: Exec
2019-11-25 05:08:54.347 Filename: certutil
2019-11-25 05:08:54.347 Parameters: -f -p xyz -importpfx "C:\MyOrg\NMX\CertFiles\Some-Certificate.pfx"
2019-11-25 05:08:54.542 Process exit code: 2147942402
2019-11-25 05:08:54.544 -- Run entry --
2019-11-25 05:08:54.544 Run as: Current user
2019-11-25 05:08:54.544 Type: Exec
2019-11-25 05:08:54.545 Filename: netsh
2019-11-25 05:08:54.545 Parameters: http add sslcert ipport=0.0.0.0:443 certhash=xxxxxxxxdffdsafdsfdsafsafsdafsa appid={7CE058D3-892A-4318-9D3C-41FA3D8C6CE2}
2019-11-25 05:08:55.150 Process exit code: 1
2019-11-25 05:08:55.365 Need to restart Windows? Yes
2019-11-25 05:08:57.032 Deinitializing Setup.
2019-11-25 05:08:57.037 Restarting Windows.
2019-11-25 05:08:57.050 Log closed.