[C#] - Fast identify the OS Architecture

Discussion in 'Mixed Languages' started by Josh Cell, Oct 23, 2011.

  1. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    6,250
    22,354
    210
    LOL :icecream: best method if not using Is64BitOperatingSystem in.Net4
     
  2. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    why wouldnt you use it? folder paths can be remapped and you can modify the property using the code posted for your special needs
     
  3. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    6,250
    22,354
    210
    lol i would and do, im just playing the game... posting more code...
     
  4. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    6,250
    22,354
    210
    #24 Alphawaves, Apr 6, 2013
    Last edited by a moderator: Apr 20, 2017
    Anyway lets not loose track we are just here to put different options across for anyone that is interested...

    LOL heres one for registry (only tried in 7) it probs dont even work, but hey :laie:

    Code:
     private static bool is64BitOS
            {
                get
                {
                    string is64 = (string)Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Session Manager\Environment", false).GetValue("PROCESSOR_ARCHITECTURE", false);
                    if (is64 != "x86")
                        return true;
                    else
                        return false;
                }
            }
    Usage:
    Code:
      if (is64BitOS)
                  MessageBox.Show("x64");
                else
                    MessageBox.Show("x86");