On a 64 bit OS install, you can run a 32 bit version of a program
or a 64 bit version. They're kept in two separate folders, so
the installer knows how to handle each case. ....
You got two folders, because your OS is 64 bit.
Sure, there are a gazillion ways they *could* have implemented a
loader strategy. But they chose this way, for reasons that
aren't apparent.
It is actually possible, to tell apart "PE32" files from "PE32+"
files. So you can tell differences between 32 bit and 64 bit code.
Even the .NET executables have detectable differences. But it's
just cleaner to have two separate places to install to, so that
changes to one, don't affect the other.
I'm not blaming the messenger here, but that seems an eminently silly
design decision. As you say, Windows knows how to tell whether a
given program is 32- or 64-bit.
How often are people going to install a 32-bit and a 64-bit version
of the same program within the same installation of Windows? What
would be the motivation? (And BTW, Microsoft itself won't let you
have 32-bit and 64-bit Office on the same computer, which kind of
demolishes the "what if there are both versions?" justification.)
Even if that justification did hold water, if that rare case even
exists it would make a lot more sense just to install the second
program version to a different folder. This is what happens now with
say Office 2003 and 2010.
As it is now, every time anyone in support tells someone about
something in program files, we have have to do it twice: "If you have
64-bit Windows, do this; but if you have 32-bit Windows, do that."
This same silliness carries over into the Registry, where you have
HKEY_LOCAL_MACHINE\Software\(proramname) for 64-bit programs and
HKEY_LOCAL_MACHINE\Software\SysWOW6432\(programname) for 32-bit
programs. In theory there's supposed to be some kind of mapping to
make that transparent to applications, but if that actually exists
then it doesn't work in REGEDIT.