I once had a requirement for the same problem. I figured out the solution but never made a point to blog it. But recently few others had the same issue and I had to think again how I did it. Anyway here is the simple method which tells you if you are running a 64-bit OS.
public bool Is64BitMachine()
{
return IntPtr.Size == 8;
}