I am writing a patch for an existing application on Windows using C++. The motive is to edit the configuration file of a software to make it work as per users' requirements.
However, it is important to check whether the software is installed or not before patching it. Moreover, if the software is installed it is important to know in which directory it is installed so that I can open the file in that directory and edit it.
One way was to check if the file exists in "C:\Program Files... etc."
Now, the problem comes when the user has modified the install directory of that software during installation or if it is 64 bit of Windows OS which will instead store it in "C:\Program Files (x86)".
So there is hardly any point of checking presence of file in the default installation directory.
The other way that I have heard some developers do this is by checking Windows registry to know whether the software is installed or not, and in which directory it is installed if it does exists.
Also, I do not know how to look through registry using C++. Neither do I know which registry key or value to check to get the installation path of the software.
Please tell me if there is an alternative to the above two methods that you know of. If there does not exist any good alternative, I would just like to know how can I achieve this goal using registry.
Edit: The software that I'm patching are Dev C++ and Code::Blocks compilers.
Thank you!