How to tell if OS architecture is 64 bit or 32 bit

While working on some installer code I ran into a problem where my C# code was called by msiexec.exe on an x64 operating system.  Msiexec.exe runs as a 32 bit process on 64 bit systems so using (IntPtr.Size == 8) or IsWow64Process won't work, the solution is to use GetSystemWow64Directory, if it returns 0 it fails and you are running on a 32 bit system, if it's non zero you are running on a 64 bit system.

[DllImport("Kernel32.dll")]
public static extern int GetSystemWow64Directory( [MarshalAs(UnmanagedType.LPStr, SizeConst=256)] [In,Out] StringBuilder lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

public static bool Is64BitOs()
{
     StringBuilder path = new StringBuilder(256);

     int result = GetSystemWow64Directory(path, (uint)path.Length);    

     return result != 0;
}


Samsung's really bad firmware updater for optical drives

The picture is from Samsung's LiveUpdate Program for Windows that is supposed to download the latest firmware from their website.  I had it installed on Vista and it worked about as well as the translation on the right.

If you are a billion dollar company, if you ship hundreds of thousands of optical drives you should really spend a little extra and splurge on someone to do a better job of translating the text in your application.  

They should take a look at the Web Updater Garmin uses for their GPS units, it's simple, straight forward and easy to use.

 

 

 


About Me

Matt Gieselman
.Net Developer
PADI Scuba Instructor
Del Mar, CA
Facebook: my profile

Recent comments

Search

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010