growled on Sunday, October 28, 2007 6:44:13 AM (Pacific Standard Time, UTC-08:00)
barked at microsoft

My first day as a Microsoft employee was 10.28.2002, which happens to have been BillG’s 48th birthday. In five years I’ve:

  • had 7 offices
  • had 7 managers
  • written 200+ .cmd, .vbs and sql scripts
  • spent several hundred hours in meetings…that I’ll never get back mind you
  • answered I don’t know how many escalation calls in the middle of the night
  • written 357 blog posts (mostly personal)
  • been TechCrunched once…ugh
  • gotten ~10 free shirts
  • bought 3 Smartphones
  • submitted the definition for OOF* at MSW (our internal corporate site)
  • stood within ~15 feet of BillG at MSN’s 10th anniversary event
  • emptied my Inbox (one time in 2006)!

* OOF = Out Of Facility.  It's used as a common word around the Microsoft hallways: "I'll be OOF on Friday."  Most people mistakenly believe that it's a misspelled acronym for Out Of Office.  I even knew one person who sent out a few emails saying "I will be OOO the rest of the week" thinking that they knew the acronym better than the rest of us.  :-)

~tod

PS:  I've actually worked at Microsoft since 10.4.1999, but the first few years were as a vendor. I count those, but the official Microsoft HR folks don't. ;-)

growled on Saturday, October 13, 2007 8:41:35 AM (Pacific Standard Time, UTC-08:00)
barked at code [.net]

Just the other day, I wanted to detect if an application is running on 32 or 64 bit (x86 versus x64) Windows operating system so I could display it in a label control.  I thought to myself "ok that should be easy with a registry key or a file version of a system file," but I didn't know a definitive source so off I go to the wild, wild web.  A few searches [1, 2, 3] yielded no useful results for doing this programmatically [and yes, I tried Google too ;-)]. 

So I turned to my brother who has been working with operating system deployments in our data centers for the past 10 years [probably what I should have done in the first place].  Just as I thought, there is a registry key that gives you this information. Since I couldn't find it easily online, I'll add it here.

HKLM\System\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE

Adding this to a .NET C# application is only a few lines of code (using Microsoft.Win32 namespace):

private string GetProcessorArchitecture()
{
    RegistryKey environmentKey = Registry.LocalMachine;  // points to HKLM hive
    environmentKey = environmentKey.OpenSubKey
        (@"System\CurrentControlSet\Control\Session Manager\Environment", false);
    string strEnvironment = 
        environmentKey.GetValue("PROCESSOR_ARCHITECTURE").ToString();
    return strEnvironment;
}

So there you go...how to determine whether the architecture of the operating system is 32-bit or 64-bit.

~tod