Best Practices How-to Microsoft

Darwin Descriptors in Windows Registry – Cryptic Strings

The most common method of ensuring applications remain highly available is through Windows Installer file associations. This mechanism operates very much the same way as Windows Installer shortcuts, but instead of directly linking to an application’s executable file, the association is made by a registered file type.

As you can see in Figure below, Windows Installer file associations are defined using the same mechanism that standard file associations use, with one exception. Notice that an extra value is listed under the typical “shell\Open\command” registry key. The extra value (also named “command”) is where Windows Installer looks any time you double-click on a file from within the Windows shell. This cryptic-looking string, sometimes referred to as a “Darwin Descriptor” is actually an encoded representation of a specific product, component, and feature. If this extra value exists, Windows Installer will decode the data, and use it to perform checks against that product and component. If the component is found to be missing or corrupt, Windows Installer will launch a repair to restore the missing file or data, and finally launch the referenced application as normal, passing the appropriate command-line options to it.

Cryptic-looking string - Darwin Descriptors

Viewing a “Darwin Descriptor” for a file association

Cryptic-looking string - Darwin Descriptors

Viewing a “Darwin Descriptor” for a COM Server

The Darwin Descriptor for COM Advertising is stored as the InProcServer32 registry value. The advertised shortcut’s TargetPath is a combination of the ProductCode & Darwin Descriptor + some tags. Open the shortcut using ex. notepad and find the descriptor. A Darwin Descriptor is an encoded string and when decoded produces a combination of the ProductCode, Feature & ComponentId(s).As the Darwin Descriptor is stored as a “REG_MULTI_SZ” entry it can contain more then one descriptor where other packages may have installed same component. We can find Darwin Descriptors under the following locations

HKCR\Installer\Assemblies and HKCR\Installer\Components

Cryptic-looking string - Darwin Descriptors


Cryptic-looking string - Darwin Descriptors


Cryptic-looking string - Darwin Descriptors

While Packaging, we can use snapshot with advertising (not registry as-is) as it gives some extra entrypoints (Darwin Descriptors) to trigger a potential repair if required. If there are some problems for the application to call any COM component/ActiveX functions then Advertsing setting “Retain Registry Information as-is” works better.

Thanks to AngelD, who shared this information!

How-to Microsoft

How to add WinSxS assemblies into a MSI package?

If you need to install Win32 side by side assemblies globally, you should use the MsiAssembly and MsiAssemblyName tables to do so. Your InstallExecuteSequence table should also include the MsiPublishAssemblies and MsiUnpublishAssemblies standard actions. There is more information on these tables in MSDN and the sample sequence.msi package provided with the Windows Installer SDK (of the Windows SDK) provides a recommended sequence number for those standard actions.

You can refer this article to get the basics of Assemblies

A win32 assembly is an unmanaged assembly (native code). An assembly that is installed to the GAC is actually a managed assembly or otherwise known as a .NET assembly. While the concept of the assembly unit is the same, there are quite a few differences between the two. Typically .NET assemblies are contained within a single module that includes an embedded manifest. For Win32 assemblies, the manifest and catalog file are separate from the binary itself.

You can review the assembly structure yourself by taking a look at the following folders on a Windows Vista machine:

.NET assemblies

Win32 assemblies

A good starting point on MSDN is


How do I Create Right-Click Context Menu for my Application?

Yesterday at office when we were discussing about the applications support for 64 bit Vista, One of my work-mate, Sreejith mentioned that Symantec Antivirus doesn’t give him a context menu for scanning viruses. Here are few simple steps to create the right click context menu for scanning viruses. I am just sharing the same to everyone for your reference.

Step 1: Create the following registry key in HKEY_CLASSES_ROOT\*\shell\ as shown in the below screen. (For demo purpose – I have added my name)

Creating Context Menu - 1

Step 2: Create the association to the “Application.exe” – You can use the main executable for Symantec Antivirus here. (For demo purpose – I have used notepad.exe)

That’s it. You’re done with creating a right-click context menu…!!

Testing the same…

How-to Windows Installer, Application Compatibility and Deployments

Best Practices and Guidelines: Packaging .NET Assemblies

This is a MSDN extract; I have still posted it because many of us do not follow these rules while packaging .NET applications. The Installer can install, remove and update Win32 and .NET assemblies, including side-by-side and private assemblies in Windows XP. To avoid common problems, follow these rules when using assemblies:


  • A component should contain no more than one assembly.
  • All of the files in an assembly should be in a single component.
  • Each component that contains an assembly should have an entry in the MsiAssembly table.
  • The strong assembly cache name of each assembly should be authored into the MsiAssemblyName table.
  • Use the Registry table instead of the Class table when you register COM Interop for an assembly.
  • Assemblies that have the same strong name are the same assembly. When the same assembly is installed by different applications, the components that contain the assembly should use the same value for the ComponentId in their Component tables.

Win32 Assemblies:

  • Do not use the manifest file or the catalogue file as the KeyPath in the Component table for the component containing the Win32 assembly.
  • The KeyPath value in the Component table for a component that contains a Win32 policy assembly should be Null.
  • Add a row to the MsiAssemblyName table for each name and value pair that are listed in the <assemblyIdentity> section of the Win32 assembly’s manifest.

.NET Assemblies:

  • The KeyPath value in the Component table for a component that contains the assembly should not be Null.
    When you install an assembly used by the common language runtime to the global assembly cache, the value in the File_Application column of the MsiAssembly table must be Null.
  • Add a row to the MsiAssemblyName table for each attribute of the assembly’s strong name. All assemblies must have the Name, Version, and Culture attributes that are specified in the MsiAssemblyName table. A publicKeyToken attribute is required for a global assembly.
How-to Windows Installer, Application Compatibility and Deployments

What is a Restricted Public Property? How can I use that?

There are 3 types of properties in Windows Installer; namely: Public Property, Private Property and Restricted Public Property.

Public property can be changed from command line while installing the package whereas private properties cannot be changed from command line. Restricted public properties can be only changed by a system administrator or by a user who has elevated privileges. To include public properties in Restricted public properties, add them to the SecureCustomProperties property.

Generally we add INSTALLDIR as Restricted public property.

General How-to Microsoft

Packaging and deploying applications for Windows Mobile

Here is a noteworthy blog which explains on Packaging and deploying applications for Windows Mobile..

Best Practices How-to Windows Installer, Application Compatibility and Deployments

How good is to use GetVersion function to detect the OS version number?

The internal version number for Windows Vista is 6.0 and Windows 7 is 6.1.  The GetVersion function returns this version number. The problem is, some applications will return a higher version number. 

Symptoms of OS Version 

  1. Applications that check for OS version will get higher version number.
  2. Application installers may prevent themselves from installing the app and apps may prevent themselves from starting.
  3. Applications may warn users and continue to function properly.

Mitigation Techniques for OS Version

  1. For apps and installers that check for OS version, a Compatibility mode is provided in Windows Vista
  2. Users can right right-click the shortcut or the EXE and apply the Windows XP SP2 compatibility mode from the Compatibility tab. This applies multiple shims including “WinXPSP2VersionLie”
  3. Better: Apply the shim “WinXPSP2VersionLie”
  4. In many cases, applications will work the same way that it did in Windows XP and there is no need for changes to the application

Fixes for OS Version

Applications should not perform version checks for equality (== 5.1)

  1. If you need a specific feature, check whether the feature is available.
  2. If you need Windows XP, check for Windows XP or later (>= 5.1).
  3. Exceptions to this occur when there is a very specific business, or legal need to do a version check, such as regulatory body requires you to certify your application for each operating system and version.
Best Practices How-to Windows Installer, Application Compatibility and Deployments

Capture configuration Entries through Gap-Capture

This tip will shine some light on the concept of performing a “Gap Capture”. Let’s start with a simple equation: GAP CAPTURE = SOURCE APPLICATION – CAPTURED MSI.

Basically, a Gap Capture is the difference between a Source Application and Captured MSI.

When do we do this??

You have done the setup capture but your MSI fails in Functionality Testing. One reason could be that some files or registry is missing in your package. To capture the LEFT OUT entries, we need to do GAP capture.

How do I do this ??

1. Install Captured MSI of the Application on your system.
2. RUN Setup Capture and take the SnapShot.
3. Install Source Application over it.
4. Now finish the Capture (SnapShot of OS+MSI+Source Application)

What you’ve captured in the WSI is now a GAP Capture.

What Next??

First re-build the machine and install your earlier packaged MSI. If the Gapcaptured content is a registry entry or a file. just add this entry in the machine and launch the application shortcut. If it launches fine..its a Bingo!

Now, add this content to the MSI. Many a times, it can also be beause of an autoupdation of an ini file. In this case, install the source application and extract the ini files into your package and check for its functionality. I reckon, these steps will help !!!

How-to Windows Installer, Application Compatibility and Deployments

Basics and Introduction to .NET Framework Assemblies

An Assembly is a logical unit of code. Assembly physically exist as DLLs or EXEs. One assembly can contain one or more files. The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs. When you compile your source code by default the exe/dll generated is actually an assembly, Unless your code is bundled as assembly it can not be used in any other application. Every assembly file contains information about itself. This information is called as Assembly Manifest.

What is assembly manifest?

Assembly manifest is a data structure which stores information about an assembly. This information is stored within the assembly file(DLL/EXE) itself. The information includes version information, list of constituent files etc.

What is private and shared assembly?

The assembly which is used only by a single application is called as private assembly. Suppose you created a DLL which encapsulates your business logic. This DLL will be used by your client application only and not by any other application. In order to run the application properly your DLL must reside in the same folder in which the client application is installed. Thus the assembly is private to your application.

Suppose that you are creating a general purpose DLL which provides functionality which will be used by variety of applications. Now, instead of each client application having its own copy of DLL you can place the DLL in ‘global assembly cache’. Such assemblies are called as shared assemblies.

What is Global Assembly Cache?

Global assembly cache is nothing but a special disk folder where all the shared assemblies will be kept. It is located under <drive>:\WinNT\Assembly folder.

How assemblies avoid DLL Hell?

As stated earlier most of the assemblies are private. Hence each client application refers assemblies from its own installation folder. So, even though there are multiple versions of same assembly they will not conflict with each other. Consider following example:

  • You created assembly Assembly1
  • You also created a client application which uses Assembly1 say Client1
  • You installed the client in C:\MyApp1 and also placed Assembly1 in this folder
  • After some days you changed Assembly1
  • You now created another application Client2 which uses this changed Assembly1
  • You installed Client2 in C:\MyApp2 and also placed changed Assembly1 in this folder
  • Since both the clients are referring to their own versions of Assembly1 everything goes on smoothly

Now consider the case when you develop assembly that is shared one. In this case it is important to know how assemblies are versioned. All assemblies has a version number in the form: If you change the original assembly the changed version will be considered compatible with existing one if the major and minor versions of both the assemblies match. When the client application requests assembly the requested version number is matched against available versions and the version matching major and minor version numbers and having most latest build and revision number are supplied.

How-to Microsoft

How to register a File Extension in Windows?

If your application uses special file extensions, you might want to register them so that the application gets started when the icon associated with the file gets double-clicked.

There are special tables for this in the MSI structure (Extension and ProgId). The contents of these tables are used for advertising. You can also make your own registry entries to create application-to-file-extension relations. This example shows how to register the .dvi extensions to be opened with the yap.exe program.

Link the extension .dvi to the DVI.Document class:

Key: HKLM\SOFTWARE\Classes\.dvi
Value: <default> = “DVI.Document”

Describe the DVI.Document class:

Key: HKLM\SOFTWARE\Classes\DVI.Document
Value: <default> = “DVI Document”

Select Icon #0 from yap.exe which is in the MSI:

Key: HKLM\SOFTWARE\Classes\DVI.Document\DefaultIcon
Value: <default> = “[!yap.exe],0”

How to open the .dvi file if it is double clicked in the Explorer:

Key: HKLM\SOFTWARE\Classes\DVI.Document\shell\open\command
Value: <default> = “[!yap.exe]” “%1”