I'm struggling with a problem of how to determine the location of 64-bit Program Files directory on 64-bit Windows Vista from a 32-bit application.
Calls to SHGetKnownFolderPath( FOLDERID_ProgramFilesX64 ) do not return anything. MSDN website also states that this particular call with FOLDERID_ProgramFilesX64 is not supported for 32-bit apps. (http://msdn.microsoft.com/en-us/library/bb762584%28VS.85%29.aspx)
I would like to avoid as much as possible hardcoding the path to "C:\Program Files". Doing something like GetWindowsDirectory(), extracting drive from the return value and adding "\Program Files" to it is not appealing either.
Can anyone provide clues to how 32-bit app can properly get the location of the folder from 64-bit Vista?