title: wix: get install location from custom dll
body: <p>I have a problem with WiX and C++ custom actions DLL: I want to get the installation location specified in the .wxs file from custom action dll, I am using WcaGetTargetPath, but this API doesn't work. Anyone any idea how to do achieve this? </p>
  
  <p>WiX file:</p>
  
  <pre><code> &lt;Directory Id="TARGETDIR" Name="SourceDir"&gt;
        &lt;Directory Id="$(var.PlatformProgramFilesFolder)" Name="PFiles"&gt;
          &lt;Directory Id="CompanyDir" Name="ABC"&gt;
            &lt;Directory Id="PCMINSTALLDIR" Name="ClientMonitor"&gt;
              &lt;Directory Id="STDSCIPTSDIR" Name="standard_scripts"&gt;
              &lt;/Directory&gt;
  
              &lt;Directory Id="CSTMSCIPTSDIR" Name="custom_scripts"&gt;
              &lt;/Directory&gt;
            &lt;/Directory&gt;
          &lt;/Directory&gt;
        &lt;/Directory&gt;
      &lt;/Directory&gt;
  .....
   &lt;CustomAction Id="ChangeConfig"
                    BinaryKey="PcmConfig"
                    DllEntry="ModifyConfigFile"
                    Execute="deferred"
                    Return="check"
                    Impersonate="no"
                    HideTarget="no" /&gt;
  
  &lt;InstallExecuteSequence&gt;
    &lt;Custom Action="ChangeConfig" Before="InstallFinalize" /&gt;
  &lt;/InstallExecuteSequence&gt;
  
  Custom Action method:
  
      LPWSTR pwzTargetPath = NULL;
      hr = WcaGetTargetPath(L"PCMINSTALLDIR", &amp;pwzTargetPath);
      ExitOnFailure(hr, "Failed to get the PCM installation path.");
  </code></pre>