Search code examples
installshieldregeditinstallscriptinstallshield-2011

How to find the install location and GUID of 3rd party application whose GUID changes for every installation using install shield?


I know the application name and trying to find the install location and GUID of the application using install shield.

I found the application registry values(like DisplayName, InstallLocation, UninstallString, etc) in following location manually: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall{GUID}

But GUID of the application is different in each client machine, So I'm not able to hard code the registry path to get these values using following function. RegDBGetKeyValueEx();

Can we able to find the GUID of the application if we know the application name?

Thanks.


Solution

  • You can list the Uninstall keys with code similar to the RegDBQueryKey example:

    #define UNINSTALLKEYPATH "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
    listKeys = ListCreate(STRINGLIST);
    RegDBQueryKey(UNINSTALLKEYPATH, REGDB_KEYS, listKeys);
    

    And then you can iterate these keys looking for the appropriate value using code similar to the ListGetNextItem example:

    nResult = ListGetFirstItem(listKeys, sItem);
    while (nResult != END_OF_LIST)
        RegDBGetKeyValueEx(UNINSTALLKEYPATH ^ sItem, ...); // check each key
        nResult = ListGetNextItem(listKeys, sItem);
    endwhile;
    

    Once you find it, you can leverage any other information in that key, or the name of the key itself. (Note: don't forget to destroy the list.)

    If you know additional things about this setup, for instance if it's an MSI, there may be more direct approaches that leverage Windows Installer APIs.