2011-02-12 91 views
0

我正在嘗試安裝只能由特定用戶訪問的註冊表項。安裝程序的每個其他部分都工作(安裝服務並註冊一個組件)。這是片段。Wix RegistryKey權限

<Component Id="cmpXXX" Guid="{YYY}"> 
    <RegistryKey Root="HKLM" Key="Software\ZZZ" Action="createAndRemoveOnUninstall"> 
     <RegistryKey Key="Machine" Action="createAndRemoveOnUninstall"> 
      <Permission User="Administrators" GenericAll="yes" /> 
      <RegistryValue Type="string" Name="ID" Value="SecretID" /> 
      <RegistryValue Type="string" Name="Key" Value="SecretKey" /> 
     </RegistryKey> 
    </RegistryKey> 
</Component> 

安裝程序完成後,所有用戶都可以讀取密鑰(而不僅僅是管理員)。我的命令行安裝是這樣的:

msiexec /i installer.msi /l*v installlog.txt 

日誌沒有提到有關權限。 當我在Orca中打開數據庫時,LockPermissions表顯示權限行,它看起來很好。

我在做什麼錯?

回答

7

在向每個RegistryValue添加權限條目後,它似乎開始工作。

<Component Id="cmpXXX" Guid="{YYY}"> 
    <RegistryKey Root="HKLM" Key="Software\ZZZ" Action="createAndRemoveOnUninstall"> 
     <RegistryKey Key="Machine" Action="createAndRemoveOnUninstall"> 
      <Permission User="Administrators" GenericAll="yes" /> 
      <RegistryValue Type="string" Name="ID" Value="SecretID"> 
       <Permission User="Administrators" GenericAll="yes" /> 
      </RegistryValue> 
      <RegistryValue Type="string" Name="Key" Value="SecretKey"> 
       <Permission User="Administrators" GenericAll="yes" /> 
      </RegistryValue> 
     </RegistryKey> 
    </RegistryKey> 
</Component> 

但它有鎖定整個Software \ ZZZ鍵的副作用。不太理想,但我可以解決這個問題。

0

如果您在多個組件中創建值,或者創建中間鍵(Software \ XXX和Software \ XXX \ YYY),請確保所有子元素都具有子元素。