How to include a mutable free file in WiX burn?

I have an installation package including an uncompressed file.

<DirectoryRef Id="INSTALLLOCATION"> <Component Id="LocationConfig"> <File Id="LocationConfigFile" Source="LooseFile.Config" DiskId="2" Vital="no" Compressed="no" /> </Component> </DirectoryRef> 

The purpose of this file is to be free, so it can be edited before installation. It works as desired.

I have a write chain indicating that a free file is included as an unsecured file along with the bootloader. Also note the use of SuppressLooseFilePayloadGeneration to provide a manual specification of the file as a free payload.

 <Chain> <MsiPackage SourceFile="MyInstaller.msi" Visible="yes" Vital="no" SuppressLooseFilePayloadGeneration="yes"> <Payload Compressed="no" SourceFile="LooseFile.Config" /> </MsiPackage> </Chain> 

The logbook is as follows:

 [3860:38D8][2013-04-26T16:42:48]e000: Error 0x80091007: Hash mismatch for path: C:\ProgramData\Package Cache\.unverified\payAC32431CF002C09E2F0B537A32ACA259 [3860:38D8][2013-04-26T16:42:48]e000: Error 0x80091007: Failed to verify hash of payload: payAC32431CF002C09E2F0B537A32ACA259 [3860:38D8][2013-04-26T16:42:48]e310: Failed to verify payload: payAC32431CF002C09E2F0B537A32ACA259 at path: C:\ProgramData\Package Cache\.unverified\payAC32431CF002C09E2F0B537A32ACA259, error: 0x80091007. Deleting file. [3860:38D8][2013-04-26T16:42:48]e000: Error 0x80091007: Failed to cache payload: payAC32431CF002C09E2F0B537A32ACA259 [33FC:3A54][2013-04-26T16:42:48]e314: Failed to cache payload: payAC32431CF002C09E2F0B537A32ACA259 from working path: C:\Users\Snixtor\AppData\Local\Temp\{c887e0cf-5038-4e15-95b1-8510d8c96b88}\payAC32431CF002C09E2F0B537A32ACA259, error: 0x80091007. payAC32431CF002C09E2F0B537A32ACA259 at path: C: \ ProgramData \ Package Cache \ .unverified \ payAC32431CF002C09E2F0B537A32ACA259, error: 0x80091007. [3860:38D8][2013-04-26T16:42:48]e000: Error 0x80091007: Hash mismatch for path: C:\ProgramData\Package Cache\.unverified\payAC32431CF002C09E2F0B537A32ACA259 [3860:38D8][2013-04-26T16:42:48]e000: Error 0x80091007: Failed to verify hash of payload: payAC32431CF002C09E2F0B537A32ACA259 [3860:38D8][2013-04-26T16:42:48]e310: Failed to verify payload: payAC32431CF002C09E2F0B537A32ACA259 at path: C:\ProgramData\Package Cache\.unverified\payAC32431CF002C09E2F0B537A32ACA259, error: 0x80091007. Deleting file. [3860:38D8][2013-04-26T16:42:48]e000: Error 0x80091007: Failed to cache payload: payAC32431CF002C09E2F0B537A32ACA259 [33FC:3A54][2013-04-26T16:42:48]e314: Failed to cache payload: payAC32431CF002C09E2F0B537A32ACA259 from working path: C:\Users\Snixtor\AppData\Local\Temp\{c887e0cf-5038-4e15-95b1-8510d8c96b88}\payAC32431CF002C09E2F0B537A32ACA259, error: 0x80091007. 

OK, the hash does not work because the file has changed. But ... I want to allow the user to modify the file. I can easily do this with the standard installation package, so what hoops do I need to jump to make it behave with the bootloader?

I found this discussion on the WiX users mailing list. Rob's answer β€œIt should just work” sounds promising, but then the discussion seems to be moving forward to suggest that this might be a mistake? If the author has ever raised a bug report, I cannot find it.

An alternative that I considered is to exclude the file from the boot payload, and then manually copy it to the MSI cache path during installation so that MSI can find it, although the burn will never check it. But two troubles that I see there:

  • I cannot find out how to find the caching path in my boot file.
  • Even if I knew the path, I would need to raise the bootloader to copy the file. It may not be a demonstrator, but I have a suspicious suspicion that this may be difficult.
+6
source share
2 answers

This is not supported today. Burn checks everything before putting it in the cache for security reasons. What you can do is read the external file in your custom Bootstrapper Application and save the results as saved Variables . This will be more work, but Burn simply will not trust files that do not match the security hashes / signatures inserted during build.

+5
source

I worked on the same problem, discarding the current directory property that sets the boot loader, and using it with a copyfile element like this:

  <Component Id="SettingsFile" Guid="..."> <CopyFile Id="Copy" Delete="no" DestinationDirectory="INSTALLFOLDER" SourceName="LooseSettings.xml" SourceProperty="CURRENTDIRECTORY" /> <RemoveFile Id="Remove" On="uninstall" Directory="INSTALLFOLDER" Name="LooseSettings.xml" /> </Component> 

There may be some problems with this, but I'm writing the installer to someone else, and it seems to work

+2
source

Source: https://habr.com/ru/post/943678/


All Articles