I was trying to determine the installation directory of a SQL Server instance on a 64 bit machine from a 32bit .NET app, and got caught for a while trying to get the registry to work correctly as the regular registry accessed by my code was being virtualized or whatnot by the Windows OS.
I think I have an answer, but I was wondering if there was a better way.
I didn’t finish checking my first answer’s correctness because there is a somewhat better way, which is to use the WMI as described here:
https://stackoverflow.com/a/5497319/832705