使用CAQuietExec的WiX自定义操作失败,命令行错误无效

ski*_*oup 7 service custom-action wix

我有一个需要提升权限的自定义操作.此自定义操作的目的是运行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>
Run Code Online (Sandbox Code Playgroud)

我在这里跟踪了延迟执行的示例: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
Run Code Online (Sandbox Code Playgroud)

显然做错了什么.任何帮助,将不胜感激.

Ili*_*irB 10

由于您在延迟中运行CA,因此需要使用类型51自定义操作而不是使用Property发送CustomActionData.

试试这个,看它是否有效:

<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>
Run Code Online (Sandbox Code Playgroud)

  • 由于官方文档似乎不是最新的,我在哪里可以找到有关使用什么的更多信息。 (2认同)