3

When using RegistrySearch to find the path to the common documents folder (e.g. 'C:\Users\Public\Documents\') it works on most computers but on some computers it failed. I have no idea why it fails or what security setting might be set.

Here is the code for the registry search:

<Property Id="COMMONDOCUMENTSPATH">
<RegistrySearch Id="RegSearchCommonDoc" Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" Name="Common Documents" Type="directory" />
</Property>

On my developer pc I'm getting the content of the registry lookup and the msi log file contains the following lines:

Action start 14:17:04: AppSearch.
AppSearch: Property: COMMONDOCUMENTSPATH, Signature: RegSearchCommonDoc
MSI (c) (E8:70) [14:17:04:157]: Note: 1: 2262 2: Signature 3: -2147287038 
MSI (c) (E8:70) [14:17:04:157]: PROPERTY CHANGE: Adding COMMONDOCUMENTSPATH property. Its value is 'C:\Users\Public\Documents\'.
Action ended 14:17:04: AppSearch. Return value 1.

On the customers pc the registry lookup failed and the msi log file looks like this:

    Action start 12:45:49: AppSearch.
AppSearch: Property: COMMONDOCUMENTSPATH, Signature: RegSearchCommonDoc
MSI (c) (8C:80) [12:45:49:120]: Note: 1: 2262 2: Signature 3: -2147287038 
Action ended 12:45:49: AppSearch. Return value 1.

The customers pc is a Windows 7 Enterprise (x64) system. My system is a Windows 7 Pro (x64). The MSI package is Intel (x86).

The customer's user has adminstrator rights on his machine. Here an extract from the msi log:

MSI (c) (8C:80) [12:45:49:020]: Product installation will be elevated because user is admin and product is being installed per-machine.
MSI (c) (8C:80) [12:45:49:020]: Running product '{D7C625A6-20E0-48EF-A372-19569FF9BFBF}' with elevated privileges: Product is assigned.

Any ideas or suggestions how to fix this problem? Or is there another way to determine the Common Documents folder?

Thanks for your help in advance!

4

1 回答 1

3

一般来说,最好使用API从操作系统而不是注册表中获取信息。WiX 创建了OSInfo 自定义操作,为许多尚未由 Windows Installer 设置的特殊文件夹设置属性。

你想要的是WIX_DIR_COMMON_DOCUMENTS. 要使用它,请参考WixUtilExtension扩展并设置它

<PropertyRef Id="WIX_DIR_COMMON_DOCUMENTS" />
于 2013-07-06T21:06:02.083 回答