2014-03-24 82 views
3

我需要通過我的安裝程序設置dcom安全性,並且想知道在WiX中是否有本地方式來執行此操作。我期待授予我創建在安裝時訪問和啓動用戶,並通過下面的對話框激活權限:在WiX中設置DCom安全設置

enter image description here

我轉到控制面板 - >管理工具 - >組件服務訪問這個。右鍵單擊我的電腦 - >屬性,然後進入COM安全選項卡。

我必須創建一個自定義操作才能做到這一點嗎?

+0

我看過C++代碼在dll中這樣做 - 它非常複雜,我懷疑它存在於Wix中。添加這個解決方法很不錯。感謝與社區分享。 –

回答

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++ redistributable軟件包才能使用此工具。見下面的截圖就如何做到這一點 enter image description here
  5. 創建內維克斯自定義操作運行以下兩個命令(ExactaMobile是我的用戶名):
    dcomperm.exe -dl設置ExactaMobile許可證
    dcomperm.exe - 天設置ExactaMobile允許

以下的自定義操作是什麼,我加入到維克斯:

<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 

希望有人認爲這很有用,考慮到我有一個困難的時間確切地跟蹤如何做到這一點。