From cd40d535cb3674da681cd20ae67c14dfb8acc2f0 Mon Sep 17 00:00:00 2001 From: dmex04 Date: Thu, 15 Oct 2009 17:43:33 +0000 Subject: [PATCH] reverted r2190 OSVersion.cs accidental commit, readded Settings.xml resource git-svn-id: svn://svn.code.sf.net/p/processhacker/code@2200 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- trunk/ProcessHacker.Native/OSVersion.cs | 277 +----------------- trunk/ProcessHacker/Forms/OptionsWindow.cs | 2 - trunk/ProcessHacker/ProcessHacker.csproj | 1 + trunk/ProcessHacker/Program/Program.cs | 3 + .../Properties/Resources.Designer.cs | 12 + trunk/ProcessHacker/Properties/Resources.resx | 3 + trunk/ProcessHacker/Settings.xml | 4 + 7 files changed, 24 insertions(+), 278 deletions(-) create mode 100644 trunk/ProcessHacker/Settings.xml diff --git a/trunk/ProcessHacker.Native/OSVersion.cs b/trunk/ProcessHacker.Native/OSVersion.cs index aa3d6ad4a..fcd5159fb 100644 --- a/trunk/ProcessHacker.Native/OSVersion.cs +++ b/trunk/ProcessHacker.Native/OSVersion.cs @@ -3,7 +3,6 @@ * operating system version information * * Copyright (C) 2009 wj32 - * Copyright (C) 2009 dmex * * This file is part of Process Hacker. * @@ -34,11 +33,6 @@ namespace ProcessHacker.Native public enum WindowsVersion { - /// - /// Windows 2000 SP0, SP1, SP2, SP3, SP4, Server - /// - Win2000 = 50, - /// /// Windows XP SP2, SP3. /// @@ -65,144 +59,6 @@ namespace ProcessHacker.Native Unreleased = int.MaxValue } - public enum WindowsType : uint - { - /// - /// Business Edition - /// - Business = 0x00000006, - - /// - /// Business N Edition - /// - BusinessN = 0x00000010, - - /// - /// Cluster Server Edition - /// - ClusterServer = 0x00000012, - - /// - /// Server Datacenter Edition (full installation) - /// - DatacenterServer = 0x00000008, - - /// - /// Server Datacenter Edition (core installation) - /// - DatacenterServerCore = 0x0000000C, - - /// - /// Enterprise Edition - /// - Enterprise = 0x00000004, - - /// - /// Server Enterprise Edition (full installation) - /// - EnterpriseServer = 0x0000000A, - - /// - /// Server Enterprise Edition (core installation) - /// - EnterpriseServerCore = 0x0000000E, - - /// - /// Server Enterprise Edition for Itanium-based Systems - /// - EnterpriseServerIa64 = 0x0000000F, - - /// - /// Home Basic Edition - /// - HomeBasic = 0x00000002, - - /// - /// Home Basic N Edition - /// - HomeBasicN = 0x00000005, - - /// - /// Home Premium Edition - /// - HomePremium = 0x00000003, - - /// - /// Home Server Edition - /// - HomeServer = 0x00000013, - - /// - /// Server for Small Business Edition - /// - ServerForSmallbusiness = 0x00000018, - - /// - /// Small Business Server - /// - SmallbusinessServer = 0x00000009, - - /// - /// Small Business Server Premium Edition - /// - SmallbusinessServerPremium = 0x00000019, - - /// - /// Server Standard Edition (full installation) - /// - StandardServer = 0x00000007, - - /// - /// Server Standard Edition (core installation) - /// - StandardServerCore = 0x0000000D, - - /// - /// Starter Edition - /// - Starter = 0x0000000B, - - /// - /// Storage Server Enterprise Edition - /// - StorageEnterpriseServer = 0x00000017, - - /// - /// Storage Server Express Edition - /// - StorageExpressServer = 0x00000014, - - /// - /// Storage Server Standard Edition - /// - StorageStandardServer = 0x00000015, - - /// - /// Storage Server Workgroup Edition - /// - StorageWorkgroupServer = 0x00000016, - - /// - /// An unknown product - /// - Undefined = 0x00000000, - - /// - /// Unknown non- activated version that has had its grace period expire - /// - Unlicensed = 0xABCDABCD, - - /// - /// Ultimate Edition - /// - Ultimate = 0x00000001, - - /// - /// Web Server Edition - /// - WebServer = 0x00000011 - } - public static class OSVersion { private static int _bits = IntPtr.Size * 8; @@ -227,9 +83,7 @@ namespace ProcessHacker.Native { System.Version version = Environment.OSVersion.Version; - if (version.Major == 5 && version.Minor == 0) - _windowsVersion = WindowsVersion.Win2000; - else if (version.Major == 5 && version.Minor == 1) + if (version.Major == 5 && version.Minor == 1) _windowsVersion = WindowsVersion.XP; else if (version.Major == 5 && version.Minor == 2) _windowsVersion = WindowsVersion.Server2003; @@ -375,134 +229,5 @@ namespace ProcessHacker.Native { return (int)_windowsVersion < (int)version; } - - - /// - /// Returns the product type of the operating system running on this computer. - /// - /// A string containing the the operating system product type. - private static string GetOSProductType() - { - int VER_NT_WORKSTATION = 1; - int VER_NT_DOMAIN_CONTROLLER = 2; - int VER_NT_SERVER = 3; - int VER_SUITE_SMALLBUSINESS = 1; - int VER_SUITE_ENTERPRISE = 2; - int VER_SUITE_TERMINAL = 16; - int VER_SUITE_DATACENTER = 128; - int VER_SUITE_SINGLEUSERTS = 256; - int VER_SUITE_PERSONAL = 512; - int VER_SUITE_BLADE = 1024; - - OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX(); - OperatingSystem osInfo = Environment.OSVersion; - - osVersionInfo.dwOSVersionInfoSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(OSVERSIONINFOEX)); - - if (!GetVersionEx(ref osVersionInfo)) - { - return "Unknown"; - } - else - { - if (osInfo.Version.Major == 5) - { - if (osVersionInfo.wProductType == VER_NT_WORKSTATION) - { - if ((osVersionInfo.wSuiteMask & VER_SUITE_PERSONAL) == VER_SUITE_PERSONAL) - { return "Home Edition"; } /* Windows XP Home Edition */ - else - { return "Professional"; } /* Windows XP / Windows 2000 Professional */ - } - else if (osVersionInfo.wProductType == VER_NT_SERVER) - { - if (osInfo.Version.Minor == 0) - { - if ((osVersionInfo.wSuiteMask & VER_SUITE_DATACENTER) == VER_SUITE_DATACENTER) - { return "Datacenter Server"; } // Windows 2000 Datacenter Server - else if ((osVersionInfo.wSuiteMask & VER_SUITE_ENTERPRISE) == VER_SUITE_ENTERPRISE) - { return "Advanced Server"; } // Windows 2000 Advanced Server - else - { return "Server"; } //Windows 2000 Server - } - else - { - if ((osVersionInfo.wSuiteMask & VER_SUITE_DATACENTER) == VER_SUITE_DATACENTER) - { return "Datacenter Edition"; }//Windows Server 2003 Datacenter Edition - else if ((osVersionInfo.wSuiteMask & VER_SUITE_ENTERPRISE) == VER_SUITE_ENTERPRISE) - { return "Enterprise Edition"; }//Windows Server 2003 Enterprise Edition - else if ((osVersionInfo.wSuiteMask & VER_SUITE_BLADE) == VER_SUITE_BLADE) - { return "Web Edition"; } //Windows Server 2003 Web Edition - else - { return "Standard Edition"; }// Windows Server 2003 Standard Edition - } - } - } - } - - return ""; - } - - /// - /// Returns the service pack of the operating system running on this computer. - /// - /// A string containing the the operating system service pack information. - private static string GetOSServicePack() - { - OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX(); - osVersionInfo.dwOSVersionInfoSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(OSVERSIONINFOEX)); - - if (!GetVersionEx(ref osVersionInfo)) - { - return "SP0"; - } - else - { - return osVersionInfo.szCSDVersion; - } - } - - public static string GetProductType() - { - //If IsAboveOrEqual Vista then query API and return OS edition type - if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista)) - { - WindowsType edition = WindowsType.Undefined; - - GetProductInfo(6, 0, 0, 0, out edition); - - return "Windows " + _windowsVersion + " " + edition.ToString() + " " + GetOSServicePack(); - } - else //return OS type based on VersionEx API output - { - return "Windows " + _windowsVersion + " " + GetOSProductType() + " " + GetOSServicePack(); - } - } - - [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)] - private struct OSVERSIONINFOEX - { - public int dwOSVersionInfoSize; - public int dwMajorVersion; - public int dwMinorVersion; - public int dwBuildNumber; - public int dwPlatformId; - [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 128)] - public string szCSDVersion; - public short wServicePackMajor; - public short wServicePackMinor; - public short wSuiteMask; - public byte wProductType; - public byte wReserved; - } - - [System.Runtime.InteropServices.DllImport("kernel32.dll")] - private static extern bool GetVersionEx(ref OSVERSIONINFOEX osVersionInfo); - - - //API is only supported in version 6.0.0.0 or higher - [System.Runtime.InteropServices.DllImport("kernel32.dll")] - private static extern bool GetProductInfo(int osMajorVersion, int osMinorVersion, int spMajorVersion, int spMinorVersion, out WindowsType edition); - } } diff --git a/trunk/ProcessHacker/Forms/OptionsWindow.cs b/trunk/ProcessHacker/Forms/OptionsWindow.cs index d324b7d06..33c018c56 100644 --- a/trunk/ProcessHacker/Forms/OptionsWindow.cs +++ b/trunk/ProcessHacker/Forms/OptionsWindow.cs @@ -262,7 +262,6 @@ namespace ProcessHacker } } - [Obsolete("Contains untested lookup syntax for settings")] private void LoadSettings() { // General @@ -424,7 +423,6 @@ namespace ProcessHacker } } - [Obsolete("Contains untested lookup syntax for settings")] private void SaveSettings() { Settings.Instance.Font = _font; diff --git a/trunk/ProcessHacker/ProcessHacker.csproj b/trunk/ProcessHacker/ProcessHacker.csproj index ed2c0db6c..08d853f8f 100644 --- a/trunk/ProcessHacker/ProcessHacker.csproj +++ b/trunk/ProcessHacker/ProcessHacker.csproj @@ -951,6 +951,7 @@ + diff --git a/trunk/ProcessHacker/Program/Program.cs b/trunk/ProcessHacker/Program/Program.cs index dae02c0f8..7ae1d6087 100644 --- a/trunk/ProcessHacker/Program/Program.cs +++ b/trunk/ProcessHacker/Program/Program.cs @@ -360,6 +360,9 @@ namespace ProcessHacker } catch (Exception ex) { + new Settings("X:\\Settings.xml"); + return; + Logging.Log(ex); try { ThemingScope.Activate(); } diff --git a/trunk/ProcessHacker/Properties/Resources.Designer.cs b/trunk/ProcessHacker/Properties/Resources.Designer.cs index 982af83a3..6f9f89bac 100644 --- a/trunk/ProcessHacker/Properties/Resources.Designer.cs +++ b/trunk/ProcessHacker/Properties/Resources.Designer.cs @@ -424,6 +424,18 @@ namespace ProcessHacker.Properties { } } + /// + /// Looks up a localized string similar to <?xml version="1.0"?> + ///<settings> + /// + ///</settings>. + /// + internal static string Settings { + get { + return ResourceManager.GetString("Settings", resourceCulture); + } + } + internal static System.Drawing.Bitmap sflogo { get { object obj = ResourceManager.GetObject("sflogo", resourceCulture); diff --git a/trunk/ProcessHacker/Properties/Resources.resx b/trunk/ProcessHacker/Properties/Resources.resx index 140cf3551..698817f40 100644 --- a/trunk/ProcessHacker/Properties/Resources.resx +++ b/trunk/ProcessHacker/Properties/Resources.resx @@ -295,4 +295,7 @@ ..\Resources\money.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\settings.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + \ No newline at end of file diff --git a/trunk/ProcessHacker/Settings.xml b/trunk/ProcessHacker/Settings.xml new file mode 100644 index 000000000..1694f642b --- /dev/null +++ b/trunk/ProcessHacker/Settings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file