The ability of an MSI packaged application to heal itself if files or registry keys are corrupted or missing has always been a major advantage to adopting MSI packaging.
The process by which a package actually achieves this is known as Advertising.
Entry Points
Remember that with traditional methods for running an application we would quite often create a shortcut that would directly run a file.
The image above shows a standard shortcut that will directly run a Target (in this case Microsoft Word).
If we look at the same shortcut that comes when Office is installed we can see that it’s slightly different in the fact that we don’t have a “target” to directly run.
The difference is that with an Advertised shortcut (shown above) the shortcut isn’t directly running our application. The shortcut is actually calling the Windows Installer subsystem and Windows installer is actually calling the specific executable within our package (in this case WinWord.exe).
In the case of an advertised shortcut for Word, the shortcut was see is known as an Entry Point for the package… it’s a way to actually enter the contained MSI package and invoke executables or processes contained inside.
Shortcuts are the most commonly used entry point with MSI packaging but entry points may also be represented as File Extension Associations within a package or even advertised COM (this will be talked about at length later) or MIME type association
Because the Windows Installer process is activated before the executable is run it allow the subsystem to carry out a series of checks on the entire package before the executable is called, this allows Windows Installer to check that everything is in place and ready for the application to run. If something is missing or corrupted, the package may be repaired before the application starts. This is the concept of Advertising.
Key-Paths
Windows Installer checks every internal resource marked as a component key-path every time an application begins.
A keypath is associated with a package component. A component may only have one keypath and that may either be a registry key or file.
The component table above shows a series of files that are key-paths for the four components that exist. When entry points for this package are activated, each of the key-paths for these components will be checked to ensure that it is present. For this reason, MSI installers are designed for each functional file (such as a dll, ocx or executable) to occupy its own component.
With the example of Microsoft Word, we know that Word.exe is a key-path for the Office program. We can scratch a little deeper and see exactly how Windows Installer works to check that the key path is present.
If we open an advertised shortcut with a Hex editor we find what appears to be a strange collection of characters embedded in the file.
The strange looking string is also replicated in the registry in the normal places you would expect to find information about running Microsoft Word.
This string is called a Darwin Descriptor and we will discuss how to decode it in the next section.
- Log in to post comments