【问题标题】:Wix installer custom action for running dism failing用于运行 dism 失败的 Wix 安装程序自定义操作
【发布时间】:2019-11-08 17:52:39
【问题描述】:

所以这个安装程序可以正常工作,直到我添加以下内容,奇怪的部分是在它回滚安装后由于错误我通过 dism.exe 添加的功能实际上像我想要的那样打开。很想添加一些东西来忽略错误,但我宁愿不必将其破解。

相关的xml

<CustomAction Id="SetEnableWindowsFeatures" Property="BatchFeatures" Value="&quot;[System64Folder]Dism.exe&quot; /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.

【问题讨论】:

    标签: windows wix wix3 dism


    【解决方案1】:

    总结:在 Dism.exe 运行后,您似乎需要重新启动(0x80070bc2ERROR_SUCCESS_REBOOT_REQUIRED)。但还有更多……


    需要重启错误The error 0x80070bc2 means ERROR_SUCCESS_REBOOT_REQUIRED(链接到幻数数据库 - some details on error lookup,使用什么工具)。换句话说,安装看起来不错,但自定义操作返回代码指示需要重新启动,并且您已设置自定义操作以检查退出代码。 Can you just flush the error? You can. I wouldn't. What else is there? 我想你可以刷新错误并检查之后安装了哪些功能?也不是很好。

    DISM API:您可以通过 C++ API (Win32) 访问 DISM。由于对返回值、错误代码和整体代码流的增强控制,我会诚实地尝试而不是命令行工具。一旦运行 C++ 代码也很容易调试 (just attach debugger):

    C#:似乎有人创建了C# wrapper for dism.exe pushing command lines(未测试)。

    安全和 Windows 更新:控制已安装的 Windows 功能在包中不一定是一件好事。一方面,我会在之后立即运行 Windows 更新,以检查是否存在任何新的安全漏洞。

    Active Directory?:我认为这个 Windows 功能安装最好通过 Active Directory(所有工作站的集中控制)进行控制,但是我也不太熟悉这个过程。只是想提一下。从表面上看,这可能是针对 SOE 环境的企业包?如果是这样,我会与高级系统管理员聊天吗?如果有部门的话,还有保安人员吗? (审计)。有时他们会自己索要这样的包裹……


    链接

    【讨论】:

    • 所以这是很好的信息。不想这么说,但我们采取了廉价的方式,只是让 CAQuiteExec 操作返回 =“忽略”。 AD 不是一个选项,因为这是通过云部署系统仅安装客户端系统的产品的一部分,其中系统既不受我们控制,也不受我们的 AD 以任何方式连接。作为参考,这是使用 shell 启动器将安装设置为在单用户 kiosk 模式下运行的第一步。
    • 看起来除了可执行文件和 Win32 / C++ API 之外什么都没有,而后者涉及到很多,所以我想这很好。我猜你可以在安装后查询系统,看看是否所有功能都使用简单的 C++。
    • 我有一些用于测试 Windows 功能状态的 C++ 代码,如果您需要,我可以在明天查看 github.com。通过这种方式,您可以检查该功能是否成功 - 或者发现新问题:-)。或者您可以使用dism.exe 进行测试,我猜(控制较少)。
    • DismBasicFeatureCheck(以管理员身份运行)。
    • 我实际上找到了一个 c# 版本,看起来基本上是这样的(隐藏在所有地方的在线 powershell 脚本中),它更适合我们的支持配置文件,但感谢您的努力/帮助。现在把它放在积压的工作上。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多