service - 使用CAQuietExec的WiX自定义操作因无效的命令行错误而失败

标签 service wix custom-action

我有一个需要提升特权的自定义操作。此自定义操作的目的是运行sc.exe并删除Windows(w32time)附带的服务的服务触发器。

以下是重要的摘要:

<Property
     Id="removeW32TimeTrigger"
     Value="&quot;[SystemFolder]sc.exe&quot; triggerinfo w32time delete"
/>

<CustomAction
     Id="removeW32TimeTrigger"
     BinaryKey="WixCA"
     DllEntry="CAQuietExec"
     Execute="deferred"
     Return="ignore"
     Impersonate="no"
/>

<InstallExecuteSequence>
     <Custom Action="removeW32TimeTrigger" After="InstallInitialize" />
</InstallExecuteSequence>

我在这里遵循了延迟执行的示例:
http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html

日志中的错误似乎困扰着我在哪里可以找到sc.exe的语法。
Action 11:36:48: removeW32TimeTrigger. 
CAQuietExec:  Command string must begin with quoted application name.
CAQuietExec:  Error 0x80070057: invalid command line property value
CAQuietExec:  Error 0x80070057: failed to get Command Line

很明显做错了事。任何帮助,将不胜感激。

最佳答案

由于您是以延迟方式运行CA的,因此您需要发送类型为51的自定义操作的CustomActionData而不是使用Property。

试试看,看看是否可行:

<CustomAction Id='removeW32TimeTrigger_set'
              Property='removeW32TimeTrigger'
              Value='"[SystemFolder]sc.exe" triggerinfo w32time delete'
              Execute='immediate'/>

<CustomAction
     Id="removeW32TimeTrigger"
     BinaryKey="WixCA"
     DllEntry="CAQuietExec"
     Execute="deferred"
     Return="ignore"
     Impersonate="no"
/>

<InstallExecuteSequence>
     <Custom Action="removeW32TimeTrigger_set" After="CostFinalize" />
     <Custom Action="removeW32TimeTrigger" After="InstallInitialize" />
</InstallExecuteSequence>

关于service - 使用CAQuietExec的WiX自定义操作因无效的命令行错误而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21635123/

相关文章:

Delphi服务无法启动

c++ - 如何从延迟的 CustomAction (c++ dll) 设置 WiX 属性

WiX 3.8 - 调试自定义刻录 Bootstrap

wix - 安装文件会自动注册吗?

visual-studio - Wix MajorUpgrade 不会检测产品版本的最后位置

调试自定义操作

Python:仅使用原始字符串发送 POST 请求

wcf - 在服务层 (WCF) 中使用 MEF

.net - 在 .NET Windows 服务中解析 HTML 和获取资源

android - 如何获取正在运行的服务并从 Activity 中手动停止它?