运行 dism 失败的 Wix 安装程序自定义操作
Wix installer custom action for running dism failing
所以这个安装程序工作正常,直到我添加以下内容,奇怪的部分是在它由于错误回滚安装之后,我通过 dism.exe 添加的功能实际上像我想要的那样打开。很想添加一些东西来忽略错误,但我宁愿不必将其破解。
相关xml
<CustomAction Id="SetEnableWindowsFeatures" Property="BatchFeatures" Value=""[System64Folder]Dism.exe" /norestart /quiet /online /enable-feature /featureName:Client-DeviceLockdown /featurename:Client-EmbeddedShellLauncher /featurename:Client-KeyboardFilter" />
<CustomAction Id="BatchFeatures" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="SetEnableWindowsFeatures" Before="BatchFeatures">NOT Installed</Custom>
<Custom Action="BatchFeatures" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>
Error generated
Executing op: ActionStart(Name=BatchFeatures,,)
Action 11:16:48: BatchFeatures.
MSI (s) (24:2C) [11:16:48:829]: Executing op: CustomActionSchedule(Action=BatchFeatures,ActionType=3073,Source=BinaryData,Target=CAQuietExec,CustomActionData="C:\WINDOWS\system32\Dism.exe" /norestart /quiet /online /enable-feature /featureName:Client-DeviceLockdown /featurename:Client-EmbeddedShellLauncher /featurename:Client-KeyboardFilter)
MSI (s) (24:2C) [11:16:48:831]: Creating MSIHANDLE (131) of type 790536 for thread 24108
MSI (s) (24:A4) [11:16:48:832]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSIC518.tmp, Entrypoint: CAQuietExec
MSI (s) (24!D0) [11:16:50:676]: Creating MSIHANDLE (132) of type 790531 for thread 29392
CAQuietExec: Error 0x80070bc2: Command line returned an error.
MSI (s) (24!D0) [11:16:50:676]: Closing MSIHANDLE (132) of type 790531 for thread 29392
MSI (s) (24!D0) [11:16:50:676]: Creating MSIHANDLE (133) of type 790531 for thread 29392
CAQuietExec: Error 0x80070bc2: QuietExec Failed
MSI (s) (24!D0) [11:16:50:676]: Closing MSIHANDLE (133) of type 790531 for thread 29392
MSI (s) (24!D0) [11:16:50:676]: Creating MSIHANDLE (134) of type 790531 for thread 29392
CAQuietExec: Error 0x80070bc2: Failed in ExecCommon method
MSI (s) (24!D0) [11:16:50:677]: Closing MSIHANDLE (134) of type 790531 for thread 29392
CustomAction BatchFeatures returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (24:A4) [11:16:50:678]: Closing MSIHANDLE (131) of type 790536 for thread 24108
Action ended 11:16:50: InstallFinalize. Return value 3.
Summary: Looks like you need a reboot after Dism.exe
has run (0x80070bc2
: ERROR_SUCCESS_REBOOT_REQUIRED
). But there is more...
错误需要重启:The error 0x80070bc2 means ERROR_SUCCESS_REBOOT_REQUIRED
(link to Magic Number database - ,用什么工具)。换句话说,看起来安装很好,但自定义操作 return 代码指示需要重新启动,并且您已将自定义操作设置为检查退出代码。 Can you just flush the error? You can. I wouldn't. What else is there?
我想您可以刷新错误并检查之后安装了哪些功能?也不是很好
DISM API:您可以通过 C++ APIs (Win32) 访问 DISM。由于对 return 值、错误代码和整体代码流的增强控制,我会诚实地尝试使用它而不是命令行工具。一旦 运行ning C++ 代码也很容易调试 ():
- Basic DISM API Sample (Microsoft)
- A github.com search yielded this: Dism.cpp (looks like high quality, check it please. I did not test it yet)
C#:好像有人创建了一个C# wrapper for dism.exe pushing command lines(未测试)。
安全和Windows更新:控制已安装的Windows功能不一定是好事在一个包中做。一方面,我会 运行 Windows 更新 之后立即检查是否有任何可能已经打开的新安全漏洞。
Active Directory?:我认为这个 Windows 功能安装最好从 Active 控制Directory(所有工作站的集中控制),但我也不太熟悉那个过程。只是想提一下。从外观上看,这可能是针对 SOE 环境的企业包?如果是这样,我会和高级系统管理员聊天吗?如果有专门的部门,还有保安人员吗? (审计)。有时他们自己要这样的包裹...
链接:
- On the use of unattended.xml(要传递给 dism.exe 的 XML 文件)
- WiX links and tips(推荐)
所以这个安装程序工作正常,直到我添加以下内容,奇怪的部分是在它由于错误回滚安装之后,我通过 dism.exe 添加的功能实际上像我想要的那样打开。很想添加一些东西来忽略错误,但我宁愿不必将其破解。
相关xml
<CustomAction Id="SetEnableWindowsFeatures" Property="BatchFeatures" Value=""[System64Folder]Dism.exe" /norestart /quiet /online /enable-feature /featureName:Client-DeviceLockdown /featurename:Client-EmbeddedShellLauncher /featurename:Client-KeyboardFilter" />
<CustomAction Id="BatchFeatures" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="SetEnableWindowsFeatures" Before="BatchFeatures">NOT Installed</Custom>
<Custom Action="BatchFeatures" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>
Error generated
Executing op: ActionStart(Name=BatchFeatures,,)
Action 11:16:48: BatchFeatures.
MSI (s) (24:2C) [11:16:48:829]: Executing op: CustomActionSchedule(Action=BatchFeatures,ActionType=3073,Source=BinaryData,Target=CAQuietExec,CustomActionData="C:\WINDOWS\system32\Dism.exe" /norestart /quiet /online /enable-feature /featureName:Client-DeviceLockdown /featurename:Client-EmbeddedShellLauncher /featurename:Client-KeyboardFilter)
MSI (s) (24:2C) [11:16:48:831]: Creating MSIHANDLE (131) of type 790536 for thread 24108
MSI (s) (24:A4) [11:16:48:832]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSIC518.tmp, Entrypoint: CAQuietExec
MSI (s) (24!D0) [11:16:50:676]: Creating MSIHANDLE (132) of type 790531 for thread 29392
CAQuietExec: Error 0x80070bc2: Command line returned an error.
MSI (s) (24!D0) [11:16:50:676]: Closing MSIHANDLE (132) of type 790531 for thread 29392
MSI (s) (24!D0) [11:16:50:676]: Creating MSIHANDLE (133) of type 790531 for thread 29392
CAQuietExec: Error 0x80070bc2: QuietExec Failed
MSI (s) (24!D0) [11:16:50:676]: Closing MSIHANDLE (133) of type 790531 for thread 29392
MSI (s) (24!D0) [11:16:50:676]: Creating MSIHANDLE (134) of type 790531 for thread 29392
CAQuietExec: Error 0x80070bc2: Failed in ExecCommon method
MSI (s) (24!D0) [11:16:50:677]: Closing MSIHANDLE (134) of type 790531 for thread 29392
CustomAction BatchFeatures returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (24:A4) [11:16:50:678]: Closing MSIHANDLE (131) of type 790536 for thread 24108
Action ended 11:16:50: InstallFinalize. Return value 3.
Summary: Looks like you need a reboot after
Dism.exe
has run (0x80070bc2
:ERROR_SUCCESS_REBOOT_REQUIRED
). But there is more...
错误需要重启:The error 0x80070bc2 means ERROR_SUCCESS_REBOOT_REQUIRED
(link to Magic Number database - Can you just flush the error? You can. I wouldn't. What else is there?
我想您可以刷新错误并检查之后安装了哪些功能?也不是很好
DISM API:您可以通过 C++ APIs (Win32) 访问 DISM。由于对 return 值、错误代码和整体代码流的增强控制,我会诚实地尝试使用它而不是命令行工具。一旦 运行ning C++ 代码也很容易调试 (
- Basic DISM API Sample (Microsoft)
- A github.com search yielded this: Dism.cpp (looks like high quality, check it please. I did not test it yet)
C#:好像有人创建了一个C# wrapper for dism.exe pushing command lines(未测试)。
安全和Windows更新:控制已安装的Windows功能不一定是好事在一个包中做。一方面,我会 运行 Windows 更新 之后立即检查是否有任何可能已经打开的新安全漏洞。
Active Directory?:我认为这个 Windows 功能安装最好从 Active 控制Directory(所有工作站的集中控制),但我也不太熟悉那个过程。只是想提一下。从外观上看,这可能是针对 SOE 环境的企业包?如果是这样,我会和高级系统管理员聊天吗?如果有专门的部门,还有保安人员吗? (审计)。有时他们自己要这样的包裹...
链接:
- On the use of unattended.xml(要传递给 dism.exe 的 XML 文件)
- WiX links and tips(推荐)