3

我需要通过我的安装程序设置 dcom 安全性,并且想知道在 WiX 中是否有本地方式来执行此操作。我希望通过以下对话框授予我在安装时创建的用户访问和启动和激活权限:

在此处输入图像描述

我通过转到控制面板-> 管理工具-> 组件服务来访问它。右键单击我的电脑-> 属性并转到 COM 安全选项卡。

我必须创建一个自定义操作来执行此操作吗?

4

1 回答 1

4

我最终使用了来自平台 sdk 的名为 dcomperm 的实用程序,并在 WiX 中使用自定义操作来执行此操作,因为我认为 WiX 中不存在此功能。它涉及几个步骤来执行此操作,因为实际下载已编译的工具似乎很困难。

我必须执行以下操作:

  1. 下载并安装平台sdk
  2. 在 Visual Studio 中创建一个新的空 C++ 项目(我使用的是 2010)
  3. 将 Program Files\Microsoft Platform SDK\Samples\Com\Fundamentals\DCom\DComPerm 中的所有文件添加到项目中。
  4. 将运行时库更改为 MT(多线程)。这很重要,因为它将在编译的 exe 中包含必要的文件。否则,您必须安装 vc++ 可再发行包才能使用此工具。请参阅下面有关如何执行此操作的屏幕截图 在此处输入图像描述
  5. 在 WiX 中创建自定义操作以运行以下两个命令(ExactaMobile 是我的用户名):
    dcomperm.exe -dl set ExactaMobile permit
    dcomperm.exe -da set ExactaMobile permit

以下自定义操作是我添加到 WiX 的:

<CustomAction Id='GrantDcomAccessPermissions' 
              Directory='ToolsFolder' 
              Execute='deferred' 
              ExeCommand='[ToolsFolder]dcomperm.exe -da set ExactaMobile permit' 
              Return='ignore'/>

<CustomAction Id='GrantDcomLaunchAndActivatePermissions'
              Directory='ToolsFolder'
              Execute='deferred'
              ExeCommand='[ToolsFolder]dcomperm.exe -dl set ExactaMobile permit'
              Return='ignore'/>

<InstallExecuteSequence>      
  <Custom Action="GrantDcomAccessPermissions" After="InstallFiles">NOT Installed</Custom>
  <Custom Action="GrantDcomLaunchAndActivatePermissions" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>

以下是 dcomperm 更完整的使用列表:

Syntax: dcomperm <option> [...]  
Options:  
   -da <"set" or "remove"> <Principal Name> ["permit" or "deny"]  
   -da list  
       Modify or list the default access permission list  

   -dl <"set" or "remove"> <Principal Name> ["permit" or "deny"]  
   -dl list  
       Modify or list the default launch permission list  

   -aa <AppID> <"set" or "remove"> <Principal Name> ["permit" or "deny"]  
   -aa <AppID> default  
   -aa <AppID> list  
       Modify or list the access permission list for a specific AppID  

   -al <AppID> <"set" or "remove"> <Principal Name> ["permit" or "deny"]  
   -al <AppID> default  
   -al <AppID> list  
       Modify or list the launch permission list for a specific AppID  

   -runas <AppID> <Principal Name> <Password>  
   -runas <AppID> "Interactive User"  
       Set the RunAs information for a specific AppID  

Examples:  
   dcomperm -da set redmond\t-miken permit  
   dcomperm -dl set redmond\jdoe deny  
   dcomperm -aa {12345678-1234-1234-1234-00aa00bbf7c7} list  
   dcomperm -al {12345678-1234-1234-1234-00aa00bbf7c7} remove redmond\t-miken  
   dcomperm -runas {12345678-1234-1234-1234-00aa00bbf7c7} redmond\jdoe password  

希望有人觉得这很有用,因为我很难准确地追踪到如何做到这一点。

于 2014-03-25T02:27:35.457 回答