Ryan Burnham
Ryan Burnham

Reputation: 2669

Where does the Version DWORD come from in the Uninstall Registry Key (Windows Installer)?

I'm trying to write an custom automatic updater for our app. Its originally installed using InstallShield and MSI. I found the information used for Add / Remove programs is located in

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall{Guid}

If i update the Version, VersionMajor and VersionMinor to be the same as the new version (when i run the installer) then the patch applies fine, otherwise it does a repair when the app starts.

The VersionMajor and VersionMinor both match the Primary Exe's Major and Minor version. The Version though seems to be a random number and dosn't match any part of the Exe's version. Where does it come from?

For example if the Exe version is 5.12.0.2019

I can run this code to get the Version Info

    class Program
{
    static void Main(string[] args)
    {
        FileVersionInfo vi = FileVersionInfo.GetVersionInfo(@"C:\MyApp.exe");
        Console.WriteLine("Version: {0}", vi.FileVersion);
        Console.WriteLine("Major: {0}", vi.FileMajorPart);
        Console.WriteLine("Minor: {0}", vi.FileMinorPart);
        Console.WriteLine("Build: {0}", vi.FileBuildPart);
        Console.WriteLine("Private: {0}", vi.FilePrivatePart);
        Console.WriteLine("Product Version: {0}", vi.ProductVersion);
        Console.WriteLine("Product Major: {0}", vi.ProductMajorPart);
        Console.WriteLine("Product Minor: {0}", vi.ProductMinorPart);
        Console.WriteLine("Product Build: {0}", vi.ProductBuildPart);
        Console.WriteLine("Product Private: {0}", vi.ProductPrivatePart);

        Console.Read();
    }
}

The output is

Version: 5.12.2019
Major: 5
Minor: 12
Build: 0
Private: 2019
Product Version: 5.12.2019
Product Major: 5
Product Minor: 12
Product Build: 0
Product Private: 2019

But the version that is in the reg is some 9digit number like "118358017" that doesn't match any of that info. I was expecting to see the Private version in there but this isn't the case

Upvotes: 3

Views: 2024

Answers (1)

Michael Urman
Michael Urman

Reputation: 15905

It may help to look at 118358017 in hexadecimal:

070E0001

After breaking it apart under the assumption that it's a packed DWORD of Major/minor/Build of MMmmBBBB, this sounds like 7.14.1 to me.

Upvotes: 5

Related Questions