title: Check For A Software Installation & Install Directory In Windows with C/C++
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>One way was to check if the file exists in "C:\Program Files... etc."</p>
  
  <p>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)".</p>
  
  <p>So there is hardly any point of checking presence of file in the default installation directory.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>Edit: The software that I'm patching are Dev C++ and Code::Blocks compilers.</p>
  
  <p>Thank you!</p>