【发布时间】:2015-11-20 20:57:45
【问题描述】:
我正在尝试从 WIX 中的 C# ca 运行一些非托管代码。我有一个 CryptProtectData 函数的包装器,如果从管理员提示符运行,此代码可以正常工作。我已将 ca 安排为延迟,希望它能在提升的会话期间运行,但在这种情况下它会失败。
时间安排如下:
<CustomAction Id="SetCustomActionDataValue" Property="EncryptValues" Value="foo=bar;...;" />
<CustomAction Id="EncryptValues" BinaryKey="InstallerCustomAction.CA.dll" DllEntry="EncryptValues" Execute="deferred" Impersonate="no" HideTarget="no" Return="check" />
<InstallExecuteSequence>
<Custom Action="SetCustomActionDataValue" After="InstallFiles" />
<Custom Action="EncryptValues" After="SetCustomActionDataValue" />
</InstallExecuteSequence>
在安装过程中,最好是在文件和注册表项被提交到系统之后,需要做什么才能允许这样的事情运行?
【问题讨论】:
-
检查 ORCA 中的执行顺序,并在 InstallFinlize 之前的最后一个自定义操作之后运行您的 CA。 InstallFinilize 是最后一个以延迟方式运行的 customAction。
-
这似乎没有帮助。显然,Windows 安装程序环境在立即和延迟阶段都有一些东西会阻止 DPAPI 代码运行。当从普通控制台应用程序调用时,相同的代码运行良好。
标签: wix custom-action wix3.5