In a .NET 2.0 C# application I use the following code to detect the operating system platform:
string os_platform = System.Environment.OSVersion.Platform.ToS
Use this to get the installed Windows architecture:
string getOSArchitecture() { string architectureStr; if (Directory.Exists(Environment.GetFolderPath( Environment.SpecialFolder.ProgramFilesX86))) { architectureStr ="64-bit"; } else { architectureStr = "32-bit"; } return architectureStr; }