How to get the Program Files dir in Windows c++
Here's some psuedocode. Hopefully the external references are self-explanatory. One thing that's important to understand is that when running a 32 bit app, FOLDERID_ProgramFilesX86 and FOLDERID_ProgramFiles will both return the x86 version of the program files folder. I'm not sure what the behavior is for a 64 bit app, but the following code will work regardless.
PWSTR path = NULL;
HRESULT hr = SHGetKnownFolderPath(FOLDERID_ProgramFiles, 0, NULL, &path);
std::string s = ParseHelper::expandEnvString("%ProgramFiles%");
if (ParseHelper::endsWith(s, " (x86)"))
sv.push_back(s + " (x86)");
// Not handled in Linux