Burn .exe 'output format' is 'opaque'? - wix

Disclaimer: I'm fairly new to burn...
The .exe files created by WiX Burn bundles are some type of self extracting zip archives, however they seem fairly opaque in structure and I cant find any documentation on them. For example in 7zip a Burn .exe looks like this:
Whereas a traditional .vdproj bundle (and other bootstrappers I have seen) include the bundled files verbatum in a traditional file system.
QUESTIONS:
Is the output format documented anywhere?
Is there any way to
recover the contents without installing? EDIT it seems dark.exe can do this, so 2a. is there anything outside the WiX toolkit...
Is there any way to
change the output format?
Thank you.
NB The reason I ask is that there are many circumstances (corporate IT departments say) where people extract the .msi files out of traditional bootstrappers to wrap into their own logic / examine the bootstrapper contents as part of an approval process.

No, the format for an attached container is undocumented (intentionally, so we can change it later). Today, in WiX v3.10, it's a .cab file attached to the .exe.
(a) It's possible but there are no such tools today (that I know of) other than Dark.exe.
No, not today. Obviously, you could use external payloads so they're not attached to the .exe.

Related

What is different between .dll and .DLL

I'm using MSI to create a setup, it's all fine but I have a question that I got this:
Why do we get .dll and .DLL file? And what is the difference between them.
Thanks
There's no difference between them, just that the creator of the name and extension chose to name them that way. The Operating system considers them the same types of files. Same thing happens with .EXE and .exe, .AVI, .... Some organizations may consider it a naming convention.
On a Windows filesystem, there is absolutely no difference as file names are case insensitive.
The only time you will notice a problem is when accessing the filesystem through a file sharing protocol that is case sensitive.
That screenshot is Visual Studio Deployment Projects view and it appears it isn't smart enough to realize those are the same DLL's. I'd build the MSI and look at it in ORCA and see if it actually tried to package it twice and create a component rule violation in the process. It wouldn't surprise me at all but this isn't one of well known issues that I can recall at the moment.
In addition to Windows being case aware but case insensitive, fill extensions don't really matter that much either. A Windows dynamically loaded library (PE format) can be any extension as the LoadLibrary() function doesn't really care. Common extensions are .DLL, .SYS, .OCX and .DRV.

Wix generate single component id for entire tree

I am someone with little to no experience with wix and I am trying to support Windows also for the component I am responsible for. I am trying to create merge module for a set of files that my product generates. These files exist in numerous sub directories. I was wondering how I can create a single component ID for all the files in the entire tree. I am not worried about minor upgrades as that is something I am not going to be doing. I am trying to avoid generating numerous GUIDs for each of the file.
Also is there any way I can change the name of the root directory I want the files to be installed. Currently, in our build system the files I want to install end up in a directory name "install". In the wxs file generated by heat it comes up as install. I was wondering if I could change it to the actual product name instead of "install".
Use one file per component - this avoids all sorts of problems (except .NET assemblies spanning multiple files). See the following thread: One file per component or several files per component?
Wix is a great framework for creating installers, but it has a steep learning curve. I strongly recommend you read a few sections of this great, online tutorial: https://www.firegiant.com/wix/tutorial/
If you are a "sample based tinkerer", you can find an even quicker, sample based tour in this article: http://www.codeproject.com/Tips/105638/A-quick-introduction-Create-an-MSI-installer-with
Wix is hands-on. Just focus on the samples, and focus on getting the components created and a major upgrade set up:
How to implement WiX installer upgrade? (modern, convenience way)
How to get WiX major upgrade working? (legacy way - more flexible, less convenient)
http://wixtoolset.org/documentation/manual/v3/howtos/updates/major_upgrade.html
Once you got that running the rest of the details fall into place by reading the documentation for whatever feature you need. Using Visual Studio / Votive with intellisense ensures that you can learn as you go with features such as shortcuts, ini files, xml files, dialogs, etc...
Another top tip is to use dark.exe (part of the Wix toolkit) to decompile existing MSI files. This yields Wix XML with code you can copy and paste into your own Wix files. I use other MSI tools to compile such MSI files, and then copy the sections I need into my Wix file - just to speed up the process of creating the Wix XML. Studying the decompiled XML is very educational - a real time saver.
UPDATE, May 2021: Some more links:
WiX Quick Start - Very long version
WiX Quick Start - Short version
If all the files are going to the same destination folder, then you can create one single COMPONENT with all the FILE within it. There is nothing stopping you to do that. You can then just create one GUID for that component. Also read these answers which talks about the advantages vs disadvantages of one component vs multiple components before you implement it: Answer1 Answer2. To Summarize:
You will have trouble with minor upgrades/repairs. If a component is
being updated, only the file designated as the KEYPATH is checked to see if
it is out of date: if it is up to date, all the others are ignored.
You'll also have difficulty if you want to add or remove files from each
component. Once released, a component is immutable (in terms of what files
are in it). The only way to update it without breaking component rules would
be to effectively remove and install the a new version of the MSI.
Understanding the component rules is key in Windows Installer and one file
per component makes the component rules easier to work with, which is why it
is the recommendation of many people here.
LINK
The root directory name can be changed by modifying the "Name" property for the DIRECTORY element.

Wix: Handling files greater than 2 GB

I am using Wix Toolset v3.7 to create an MSI package for an application.
The problem is that one of the files to be packaged has a size more than 4 GB.
As a result the MSI generation fails with this error:
some_file.dat" is too large, file size must be less than 2147483648.
I have searched for a solution to this problem but haven't got any specific pointers yet. Does anybody know how to approach this using Wix? Any way a file can be specified to be split into cabs and remerged on unpacking?
Per File Table (Windows)
The FileSize column is a DoubleInteger which can only represent –2,147,483,647 to +2,147,483,647 bytes. There are also other limitations in the size of a CAB and size of an MSI. These are someone annoying limitations but it is pretty rare an installer needs to ship a file larger then 2GB.
WiX is built on Windows Installer so you are kinda stuck. Is your installer distributed via media? You might want to use a custom action copy the file manually. Another thought would be to split the file into pieces and then use a custom action to join them. Tough choices.
1) You could split the file with a common zip/package tool before the msi build, and use that tool as a custom action to put them together. Of course you can write such a tool on your own too. Then the parts of that file are handled in a standard way by MSI (before your final merge action comes).
2) If you don't need all the msi stuff for that file you could just avoid putting the big file in the msi and just use a tool to build a selfextracting .exe. This could start the msi and copy the file itself by a script. Maybe the easiest way.
3) With the DuplicateFiles table in MSI you can try to copy the file as a custom action in MSI itself. With or without the selfextracting .exe idea. Without means that the big file stays uncompressed besides the .msi. With means you have all compressed in that .exe.

How to create a Wix patch in combination with Heat?

I'm developer on a big system (>100 Projects in Solution, >100 000 LOC, > 10 Services, ...) and did the installation of this system in the past with wix and it worked fine. Now I need a way to patch (Minor Upgrade) parts of the system and run into several issues.
My Current Wix Setup is as following:
I have VS2010 and Wix3.6 Toolset and TFS2012 to Build the whole thing and get an installer
I'm using a Setup Library Project Type per Service
I'm using exactly one Setup Project to bundle things together and get one installer for the whole system.
It's not possible to change this setup.
The Setup Library Projects are set up as following:
I use the heat-directory msbuild task to generate the components and files and I'm using preprocessor variables to modify the file paths.
I need to modify the file paths because it must be possible to build an installer on the local developer system and to build the installer on the tfs build system which is different in folder structures.
The TFS uses always the same directory to compile subsequent versions of the software and moves the output after successful compilation to a unique folder structure.
Now I need a patch.
I created the Patch.wxs and called candle and light for it. I called torch to get the difference file. And finally want to create the patch with pyro.
Everything worked fine with a simple testproject, but on the big system
Pyro has the problem that it can't find the files to install.
Through my setup (see above), I must use preprocessor variables and have a full qualified path in my wix output (for example: C:\builds\myproduct\prodct.exe as file source). After moving the TFS output to another location this path is not valid anymore. I tried to use -bt and -bu switches for pyro, but this does only work for relative paths or for named bindpaths.
Now I wanted to change my wix project setup to use named bindpaths rather than preprocessor variables, but it seems that this is not possible.
heat can only use preprocessor variables or wixvariables but it seems not to be possible to use bindpath variables. heat provides a switch -wixvar which should create binder variables instead of preprocessor variables but I does exactly nothing.
Now I tried do use no wix and no preprocessor variables in heat and tell light per -bu -bt switches where to find the files. But if I do not set a preprocessor variable the resulting files look like Sources\product.exe. I can't get rid of this Sources. I know that I can transform all the xml with xslt and remove the Sources but thats a workaround which I would only implement if no other solution is possible. This would also mean that there is a problem in the wix toolchain.
It looks like pyro does only support bindpath variables and heat does only support preprocessor and wix variables. This seems to be really crazy, because how should they work together?
How can I create a patch if I use lit, light, candle, heat, torch and pyro and if the original build paths have changed (which is very common on a build system) and the file paths are created with heat and therefore be fixed or preprocessor or wix variables?
As you've found heat wasn't designed to be used in the patching scenario. It was only in recent versions of the WiX toolset that the generated GUIDs got to a point where there was even a chance that heat could successfully build output that would be patchable. Still need to do work there to make patching where heat is used work well.
Ultimately, I believe the answer is to simplify the "original source" problem. It is challenging to get all the bindpaths set up correctly and that makes patching, which is a hard problem, even harder. We've kicked around a few ideas but nothing has come together yet.
You could always use admin image based patching. It's slower but can be easier to get the "original source" and "target" laid out. That path does lose filtering though.
Basically, we need to do a bit more work in patching scenarios to make it much easier.
PS: "Source" in the path for a File/#Source attribute is an alias for the "default bindpath". You can use bindpaths there.

How are self-extracting executables made?

There are many programs out there that will allow you to pack a few files together and generate an executable that has the necessary code to extract them. Somehow, those files are residing inside the executable. I am interested in doing the same thing; how is this done?
FYI, I'm interested primarily in Windows .exe files, if it makes a difference.
Look at this: Article
You could probably save a file/files in a resource, compile it into the exe then use some code in the exe to extract it out to a file.
ie:
http://www.codeproject.com/KB/winsdk/binaryresources.aspx
Self extracting .exe files are usually archive files (zip, rar, tar, etc) concatenated together with a small program that does the extraction then executes the program that was extracted from the archive.
A really sophisticated one could extract the archive into memory and then jump to the extracted code and run it, but back in the old days, that sort of thing was easier to do.
If you wanted to write your own in Windows, you would create a small console application that did the extraction, and you would include the 'real' program in the console programs' resources.
There are also products like pkzip and winzip which do it for you. If your time is worth anything, those would be more efficient.
UPX is a well known packer for Windows .EXE which can be found here on WikiPedia. And here is the main site on sourceforge for UPX.
Hope this helps,
Best regards,
Tom.