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.

1

There are 1 best solutions below

0
Michael Urman On BEST ANSWER

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.