I have a product GUID. And I want to know whether it is installed in windows machine or not and if installed then what is the location. Till now I've tried this
szKey= "\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{2D444666-5875-4B28-9ED8-15F750802BF5}";
if (RegDBKeyExist (szKey) < 0) then
MessageBox ("First call to RegDBKeyExist failed.", SEVERE);
else
SprintfBox (INFORMATION, TITLE_TEXT, "%s exists.", szKey);
endif;
Note :
I have the GUID under
HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall
{2D444666-5875-4B28-9ED8-15F750802BF5}
Is I am providing wrong value to szKey?
If that product was installed to 'All Users', it will appear under HKEY_LOCAL_MACHINE. If it was installed to 'current user only', it will appear under HKEY_CURRENT_USER.
Hence, in InstallShield you need to repeat this test twice, something like this. Also, note i removed the leading backslash from the key name.
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
szKey= "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{2D444666-5875-4B28-9ED8-15F750802BF5}";
if (RegDBKeyExist (szKey) < 0) then
RegDBSetDefaultRoot(HKEY_CURRENT_USER);
if (RegDBKeyExist (szKey) < 0) then
MessageBox ("call to RegDBKeyExist failed.", SEVERE);
else
SprintfBox (INFORMATION, TITLE_TEXT, "%s exists for current user.", szKey);
endif;
else
SprintfBox (INFORMATION, TITLE_TEXT, "%s exists for all users.", szKey);
endif;