【问题标题】:icacls run from Wix CAQuietExec behaving differently than when run from dos command lineicacls 从 Wix CAQuietExec 运行时的行为与从 dos 命令行运行时不同
【发布时间】:2012-05-04 13:40:15
【问题描述】:

在 Windows 2008 R2 x64 上使用 Wix 3.5
我以管理员身份运行它以避免任何权限问题。我创建了一个安装程序,它执行 icacls 命令以将用户添加到 c:\windows\system32\inetsrv\config\administration.config 文件的 ACL。这是wix代码

    <Property Id="QtExecExample" Value='"cmd" /c icacls "c:\windows\system32\inetsrv\config\administration.config" /Grant johndoe:M /T'/>
    <CustomAction Id="QtExecExample" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="no"/>

    <InstallExecuteSequence>
       <Custom Action="QtExecExample" Before='InstallFinalize' > NOT Installed</Custom>
    </InstallExecuteSequence>

以下是 msi 日志中的输出

MSI (s) (44:88) [07:51:46:872]:执行操作:CustomActionSchedule(Action=QtExecExample,ActionType=3073,Source=BinaryData,Target=CAQuietExec,CustomActionData="cmd " /c icacls "c:\windows\system32\inetsrv\config\administration.config" /Grant johndoe:M /T) MSI (s) (44:88) [07:51:46:872]:为线程 1928 创建类型为 790536 的 MSIHANDLE (795)
MSI (s) (44:38) [07:51:46:872]:调用远程自定义操作。 DLL:
C:\Windows\Installer\MSIFBCF.tmp,入口点:CAQuietExec
MSI (s) (44!68) [07:51:46:888]:为线程 2920 创建类型为 790531 的 MSIHANDLE (796)
CAQuietExec:成功处理 0 个文件;处理 0 个文件失败

如您所见,文件几乎没有被修改,就好像命令被忽略了一样。用户未添加到 ACL。我知道该命令有效,因为如果我从 dos 提示符运行该命令,我会得到以下信息。

C:\Users\Administrator\Desktop>cmd /c icacls "c:\windows\system32\inetsrv\config\administration.config" /Grant johndoe:M /T
已处理文件:c:\windows\system32\inetsrv\config\administration.config
成功处理了 1 个文件;处理 0 个文件失败

如果从 WIX 运行命令,似乎无法更改 inetsrv\config 下文件的 ACL,但不确定原因。如果命令通过命令行工作,那么它不应该通过 Wix CAQuietExec 工作吗?有谁知道我做错了什么或我错过了什么?

【问题讨论】:

    标签: wix windows-installer windows-server-2008-r2 wix3.5 cacls


    【解决方案1】:

    发现问题。 即使我的 msi 构建为 64 位二进制文​​件,正在运行的 icacls 命令也是 32 位版本。 inetsrv\config 下的文件只能由 64 位程序修改。无论如何,我需要在我的 wix 文件中进行以下两项更改
    1) 使用 64 位版本的 icacls 的完整路径,即。 c:\windows\system32\icacls
    2) 将 DllEntry="CAQuietExec" 更改为 DllEntry="CAQuietExec64"

    以上两个更改解决了该问题。即使这现在可行,我还是决定使用自定义操作来更改 ACL。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-03
      • 2013-06-07
      • 1970-01-01
      • 2014-06-29
      • 1970-01-01
      • 1970-01-01
      • 2016-06-17
      • 2015-04-12
      相关资源
      最近更新 更多