/// <summary>GetServicePack</summary> /// <remarks>http://support.microsoft.com/?kbid=304721</remarks> public static string GetServicePack() { string servicePack = "No Service Pack Installed"; OSVERSIONINFO os = new OSVERSIONINFO(); os.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFO)); GetVersionEx(ref os); if (os.szCSDVersion != "") { servicePack = os.szCSDVersion; } return(servicePack); }
///<summary>GetVersionEx</summary> [DllImport("kernel32.Dll")] public static extern short GetVersionEx(ref OSVERSIONINFO o);