Program Files is typically C:\Program Files; however it is not always; famously on German installs it was C:\Programme, the installation drive was not guaranteed to be C, and other things would make hardcoding "Program Files" fraught with peril.
The modern suggestion is SHGetFolderPath
which didn't exist on Windows 95. A little spelunking revealed SHGetSpecialFolderLocation
but that doesn't actually work.
SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidprogramfiles))
Yields an error. A trace bit of documentation left around on MSDN says CSIDL_PROGRAM_FILES
started existing with Version 5 (Windows 2000). So how the hey were installers supposed to find it?
I can make this work by reading HKLM Software\Microsoft\Windows\CurrentVersion ProgramFilesDir ; however this reading the registry for this stuff is something Raymond Chen has been rather famously yelling about.
CSIDL_PROGRAM_FILES
).SHGetFolderPath()
". But when that isn't reliably present (because no one bothered to install IE5.0), it's pretty hard to follow that advice....