public Win32() { Win32VersionInfo osvi = new Win32VersionInfo(); osvi.dwOSVersionInfoSize = Marshal.SizeOf(osvi); GetVersionEx(osvi); Win32SystemInfo sysInfo = new Win32SystemInfo(); GetSystemInfo(ref sysInfo); ClassName = null; PlatformType = "Windows"; System.OperatingSystem os = Environment.OSVersion; Version = os.Version.Major + "." + os.Version.Minor; switch (os.Platform) { case PlatformID.Win32Windows: switch (os.Version.Major) { case 4: switch (os.Version.Minor) { case 0: if (osvi.szCSDVersion == "B" || osvi.szCSDVersion == "C") { ClassName = "Windows.v95"; PlatformSubType = "95"; Edition = "OSR2"; } else { ClassName = "Windows.v95"; PlatformSubType = "95"; Edition = ""; } break; case 10: if (osvi.szCSDVersion == "A") { ClassName = "Windows.v98"; PlatformSubType = "98"; Edition = "SE"; } else { ClassName = "Windows.v98"; PlatformSubType = "98"; Edition = ""; } break; case 90: ClassName = "Windows.ME"; PlatformSubType = "ME"; Edition = ""; break; } break; } break; case PlatformID.Win32NT: switch (os.Version.Major) { case 3: ClassName = "Windows.NT"; PlatformSubType = "NT"; Edition = "3.51"; break; case 4: switch (osvi.wProductType) { case 1: ClassName = "Windows.NT"; PlatformSubType = "NT"; Edition = "4.0 Workstation"; break; case 3: if (osvi.wSuiteMask == SuiteVersion.Enterprise) { ClassName = "Windows.NT"; PlatformSubType = "NT"; Edition = "4.0 Server Enterprise"; } else { ClassName = "Windows.NT"; PlatformSubType = "NT"; Edition = "4.0 Server Standard"; } break; } break; case 5: switch (os.Version.Minor) { case 0: switch (osvi.wSuiteMask) { case SuiteVersion.DataCenter: ClassName = "Windows.v2000"; PlatformSubType = "2000"; Edition = "Data Center"; break; case SuiteVersion.Enterprise: ClassName = "Windows.v2000"; PlatformSubType = "2000"; Edition = "Advanced"; break; default: ClassName = "Windows.v2000"; PlatformSubType = "2000"; Edition = "Standard"; break; } break; case 1: if (osvi.wSuiteMask == SuiteVersion.Personal) { ClassName = "Windows.XP"; PlatformSubType = "XP"; Edition = "Professional"; } else { ClassName = "Windows.XP"; PlatformSubType = "XP"; Edition = "Home"; } break; case 2: if ((osvi.wProductType == NTVersion.Workstation) && (sysInfo.processorArchitecture == ProcessorArchitecture.AMD64)) { ClassName = "Windows.XP"; PlatformSubType = "XP"; Edition = "Professional x64"; } else if ((osvi.wProductType == NTVersion.Server) && (GetSystemMetrics(SystemMetrics.ServerR2) == 0) && (osvi.wSuiteMask == SuiteVersion.Enterprise)) { ClassName = "Windows.v2003"; PlatformSubType = "Server"; Edition = "2003 Enterprise"; } else if ((osvi.wProductType == NTVersion.Server) && GetSystemMetrics(SystemMetrics.ServerR2) != 0) { ClassName = "Windows.v2003"; PlatformSubType = "Server"; Edition = "2003 R2"; } else { switch (osvi.wSuiteMask) { case SuiteVersion.DataCenter: ClassName = "Windows.v2003"; PlatformSubType = "Server"; Edition = "2003 Data Center"; break; case SuiteVersion.Blade: ClassName = "Windows.v2003"; PlatformSubType = "Server"; Edition = "2003 Web Edition"; break; case SuiteVersion.WHServer: ClassName = "Windows.v2003"; PlatformSubType = "2003"; Edition = "Home Server"; break; default: ClassName = "Windows.v2003"; PlatformSubType = "Server"; Edition = "2003 Standard"; break; } } break; } break; case 6: Win32ProductInfo ospi = new Win32ProductInfo(); ospi.dwOSProductInfoSize = Marshal.SizeOf(ospi); ospi.dwOSMajorVersion = os.Version.Major; ospi.dwOSMinorVersion = os.Version.Minor; ospi.dwSpMajorVersion = 0; ospi.dwSpMinorVersion = 0; GetProductInfo(ospi); Version = Version + "." + ospi.dwOSEdition; switch (os.Version.Minor) { case 0: if (osvi.wProductType == NTVersion.Workstation) { // Vista Detection switch (ospi.dwOSEdition) { case ProductType.Undefined: ClassName = "Windows.Undefined"; PlatformSubType = "Vista"; Edition = "is not defined!"; break; case ProductType.Ultimate: // 1 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Ultimate Edition"; break; case ProductType.HomeBasic: // 2 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Home Basic Edition"; break; case ProductType.HomePremium: // 3 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Home Premium Edition"; break; case ProductType.Enterprise: // 4 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Enterprise Edition"; break; case ProductType.HomeBasicN: // 5 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Home Basic N Edition (EU Only)"; break; case ProductType.Business: // 6 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Business Edition"; break; case ProductType.Starter: // B ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Starter Edition"; break; case ProductType.BusinessN: // 10 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Business N Edition (EU Only)"; break; case ProductType.HomePremiumN: // 1A ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Home Premium N Edition (EU Only)"; break; case ProductType.EnterpriseN: // 1B ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Enterprise N Edition (EU Only)"; break; case ProductType.UltimateN: // 1C ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Ultimate N Edition (EU Only)"; break; case ProductType.Unlicensed: // 0xABCDABCD ClassName = "Windows.Unlicensed"; PlatformSubType = "Vista"; Edition = "Unlicensed"; break; default: ClassName = "Windows.Unknown"; PlatformSubType = "Vista"; Edition = "is not defined!"; break; } } else { switch (ospi.dwOSEdition) { //Windows 2008 Detection case ProductType.Undefined: ClassName = "Windows.Undefined"; PlatformSubType = "2008"; Edition = "is not defined!"; break; case ProductType.StandardServer: // 7 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Standard Server"; break; case ProductType.DataCenterServer: //8 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Data Center Server"; break; case ProductType.SmallBusinessServer: //9 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Small Business Server"; break; case ProductType.EnterpriseServer: // A ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Enterprise Server"; break; case ProductType.DataCenterServerCore: // C ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Data Center Server Core"; break; case ProductType.StandardServerCore: // D ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Standard Server Core"; break; case ProductType.EnterpriseServerCore: // E ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Enterprise Server Core"; break; case ProductType.EnterpriseServerIA64: // F ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Enterprise Server IA64"; break; case ProductType.WebServer: // 11 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Web Server"; break; case ProductType.ClusterServer: // 12 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Cluster Server"; break; case ProductType.HomeServer: // 13 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Home Server"; break; case ProductType.StorageExpressServer: // 14 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Express Server"; break; case ProductType.StorageStandardServer: // 15 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Standard Server"; break; case ProductType.StorageWorkgroupServer: // 16 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Workgroup Server"; break; case ProductType.StorageEnterpriseServer: // 17 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Enterprise Server"; break; case ProductType.ServerForSmallBusiness: // 18 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Server for Small Businesses"; break; case ProductType.SmallBusinessServerPremium: // 19 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Small Business Server Premium"; break; case ProductType.WebServerCore: // 1D ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Web Server Core"; break; case ProductType.MediumBusinessServerManagement: // 1E ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Medium Business Server Management"; break; case ProductType.MediumBusinessServerSecurity: // 1F ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Medium Business Server Security"; break; case ProductType.MediumBusinessServerMessaging: // 20 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Medium Business Server Messaging"; break; case ProductType.SmallBusinessServerPrime: // 21 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Small Business Server Prime"; break; case ProductType.HomePremiumServer: // 22 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Home Premium Server"; break; case ProductType.ServerForSmallBusinessV: // 23 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Server for Small Business (Hyper-V)"; break; case ProductType.StandardServerV: // 24 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Standard Server (Hyper-V)"; break; case ProductType.DataCenterServerV: // 25 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Data Center Server (Hyper-V)"; break; case ProductType.EnterpriseServerV: // 26 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Enterprise Server (Hyper-V)"; break; case ProductType.DataCenterServerCoreV: // 27 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Data Center Server Core (Hyper-V)"; break; case ProductType.StandardServerCoreV: // 28 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Standard Server Core (Hyper-V)"; break; case ProductType.EnterpriseServerCoreV: // 29 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Enterprise Server Core (Hyper-V)"; break; case ProductType.HyperV: // 2A ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "(Hyper-V)"; break; case ProductType.StorageExpressServerCore: // 2B ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Express Server Core"; break; case ProductType.StorageStandardServerCore: // 2C ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Standard Server Core"; break; case ProductType.StorageWorkgroupServerCore: // 2D ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Workgroup Server Core"; break; case ProductType.StorageEnterpriseServerCore: // 2E ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Enterprise Server Core"; break; case ProductType.Unlicensed: // 0xABCDABCD ClassName = "Windows.Unlicensed"; PlatformSubType = "2008"; Edition = "Unlicensed"; break; default: ClassName = "Windows.Unknown"; PlatformSubType = "2008"; Edition = "is unknown!"; break; } } break; case 1: switch (ospi.dwOSEdition) { case ProductType.Undefined: ClassName = "Windows.Undefined"; PlatformSubType = "7"; Edition = "is undefined"; break; case ProductType.Ultimate: // 1 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Ultimate Edition"; break; case ProductType.HomeBasic: // 2 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Home Basic Edition"; break; case ProductType.HomePremium: // 3 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Home Premium Edition"; break; case ProductType.Enterprise: // 4 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Enterprise Edition"; break; case ProductType.HomeBasicN: // 5 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Home Basic N Edition (EU only)"; break; case ProductType.Business: // 6 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Business Edition"; break; case ProductType.BusinessN: // 10 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Business N Edition (EU only)"; break; } break; } //End os.Version.Minor break; } // End os.Version.Major break; } // End os.Platform if (ClassName == null) { throw new ArgumentNullException("ClassName was not defined. Please report this bug."); } }
private static extern bool GetVersionEx([In, Out] Win32VersionInfo osvi);
public Win32() { Win32VersionInfo osvi = new Win32VersionInfo(); osvi.dwOSVersionInfoSize = Marshal.SizeOf(osvi); GetVersionEx(osvi); Win32SystemInfo sysInfo = new Win32SystemInfo(); GetSystemInfo(ref sysInfo); ClassName = null; PlatformType = "Windows"; System.OperatingSystem os = Environment.OSVersion; Version = os.Version.Major + "."+os.Version.Minor; switch (os.Platform) { case PlatformID.Win32Windows: switch (os.Version.Major) { case 4: switch (os.Version.Minor) { case 0: if (osvi.szCSDVersion == "B" || osvi.szCSDVersion == "C") { ClassName = "Windows.v95"; PlatformSubType = "95"; Edition = "OSR2"; } else { ClassName = "Windows.v95"; PlatformSubType = "95"; Edition = ""; } break; case 10: if (osvi.szCSDVersion == "A") { ClassName = "Windows.v98"; PlatformSubType = "98"; Edition = "SE"; } else { ClassName = "Windows.v98"; PlatformSubType = "98"; Edition = ""; } break; case 90: ClassName = "Windows.ME"; PlatformSubType = "ME"; Edition = ""; break; } break; } break; case PlatformID.Win32NT: switch (os.Version.Major) { case 3: ClassName = "Windows.NT"; PlatformSubType = "NT"; Edition = "3.51"; break; case 4: switch (osvi.wProductType) { case 1: ClassName = "Windows.NT"; PlatformSubType = "NT"; Edition = "4.0 Workstation"; break; case 3: if (osvi.wSuiteMask == SuiteVersion.Enterprise) { ClassName = "Windows.NT"; PlatformSubType = "NT"; Edition = "4.0 Server Enterprise"; } else { ClassName = "Windows.NT"; PlatformSubType = "NT"; Edition = "4.0 Server Standard"; } break; } break; case 5: switch (os.Version.Minor) { case 0: switch (osvi.wSuiteMask) { case SuiteVersion.DataCenter: ClassName = "Windows.v2000"; PlatformSubType = "2000"; Edition = "Data Center"; break; case SuiteVersion.Enterprise: ClassName = "Windows.v2000"; PlatformSubType = "2000"; Edition = "Advanced"; break; default: ClassName = "Windows.v2000"; PlatformSubType = "2000"; Edition = "Standard"; break; } break; case 1: if (osvi.wSuiteMask == SuiteVersion.Personal) { ClassName = "Windows.XP"; PlatformSubType = "XP"; Edition = "Professional"; } else { ClassName = "Windows.XP"; PlatformSubType = "XP"; Edition = "Home"; } break; case 2: if ((osvi.wProductType == NTVersion.Workstation) && (sysInfo.processorArchitecture == ProcessorArchitecture.AMD64)) { ClassName = "Windows.XP"; PlatformSubType = "XP"; Edition = "Professional x64"; } else if ((osvi.wProductType == NTVersion.Server) && (GetSystemMetrics(SystemMetrics.ServerR2) == 0) && (osvi.wSuiteMask == SuiteVersion.Enterprise)) { ClassName = "Windows.v2003"; PlatformSubType = "Server"; Edition = "2003 Enterprise"; } else if ((osvi.wProductType == NTVersion.Server) && GetSystemMetrics(SystemMetrics.ServerR2) != 0) { ClassName = "Windows.v2003"; PlatformSubType = "Server"; Edition = "2003 R2"; } else { switch (osvi.wSuiteMask) { case SuiteVersion.DataCenter: ClassName = "Windows.v2003"; PlatformSubType = "Server"; Edition = "2003 Data Center"; break; case SuiteVersion.Blade: ClassName = "Windows.v2003"; PlatformSubType = "Server"; Edition = "2003 Web Edition"; break; case SuiteVersion.WHServer: ClassName = "Windows.v2003"; PlatformSubType = "2003"; Edition = "Home Server"; break; default: ClassName = "Windows.v2003"; PlatformSubType = "Server"; Edition = "2003 Standard"; break; } } break; } break; case 6: Win32ProductInfo ospi = new Win32ProductInfo(); ospi.dwOSProductInfoSize = Marshal.SizeOf(ospi); ospi.dwOSMajorVersion = os.Version.Major; ospi.dwOSMinorVersion = os.Version.Minor; ospi.dwSpMajorVersion = 0; ospi.dwSpMinorVersion = 0; GetProductInfo(ospi); Version = Version+"."+ospi.dwOSEdition; switch (os.Version.Minor) { case 0: if (osvi.wProductType == NTVersion.Workstation) { // Vista Detection switch (ospi.dwOSEdition) { case ProductType.Undefined: ClassName = "Windows.Undefined"; PlatformSubType = "Vista"; Edition = "is not defined!"; break; case ProductType.Ultimate: // 1 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Ultimate Edition"; break; case ProductType.HomeBasic: // 2 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Home Basic Edition"; break; case ProductType.HomePremium: // 3 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Home Premium Edition"; break; case ProductType.Enterprise: // 4 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Enterprise Edition"; break; case ProductType.HomeBasicN: // 5 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Home Basic N Edition (EU Only)"; break; case ProductType.Business: // 6 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Business Edition"; break; case ProductType.Starter:// B ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Starter Edition"; break; case ProductType.BusinessN: // 10 ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Business N Edition (EU Only)"; break; case ProductType.HomePremiumN: // 1A ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Home Premium N Edition (EU Only)"; break; case ProductType.EnterpriseN: // 1B ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Enterprise N Edition (EU Only)"; break; case ProductType.UltimateN: // 1C ClassName = "Windows.Vista"; PlatformSubType = "Vista"; Edition = "Ultimate N Edition (EU Only)"; break; case ProductType.Unlicensed: // 0xABCDABCD ClassName = "Windows.Unlicensed"; PlatformSubType = "Vista"; Edition = "Unlicensed"; break; default: ClassName = "Windows.Unknown"; PlatformSubType = "Vista"; Edition = "is not defined!"; break; } } else { switch (ospi.dwOSEdition) { //Windows 2008 Detection case ProductType.Undefined: ClassName = "Windows.Undefined"; PlatformSubType = "2008"; Edition = "is not defined!"; break; case ProductType.StandardServer: // 7 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Standard Server"; break; case ProductType.DataCenterServer://8 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Data Center Server"; break; case ProductType.SmallBusinessServer://9 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Small Business Server"; break; case ProductType.EnterpriseServer:// A ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Enterprise Server"; break; case ProductType.DataCenterServerCore: // C ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Data Center Server Core"; break; case ProductType.StandardServerCore: // D ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Standard Server Core"; break; case ProductType.EnterpriseServerCore: // E ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Enterprise Server Core"; break; case ProductType.EnterpriseServerIA64: // F ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Enterprise Server IA64"; break; case ProductType.WebServer: // 11 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Web Server"; break; case ProductType.ClusterServer: // 12 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Cluster Server"; break; case ProductType.HomeServer: // 13 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Home Server"; break; case ProductType.StorageExpressServer: // 14 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Express Server"; break; case ProductType.StorageStandardServer: // 15 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Standard Server"; break; case ProductType.StorageWorkgroupServer: // 16 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Workgroup Server"; break; case ProductType.StorageEnterpriseServer: // 17 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Enterprise Server"; break; case ProductType.ServerForSmallBusiness: // 18 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Server for Small Businesses"; break; case ProductType.SmallBusinessServerPremium: // 19 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Small Business Server Premium"; break; case ProductType.WebServerCore: // 1D ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Web Server Core"; break; case ProductType.MediumBusinessServerManagement: // 1E ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Medium Business Server Management"; break; case ProductType.MediumBusinessServerSecurity: // 1F ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Medium Business Server Security"; break; case ProductType.MediumBusinessServerMessaging: // 20 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Medium Business Server Messaging"; break; case ProductType.SmallBusinessServerPrime: // 21 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Small Business Server Prime"; break; case ProductType.HomePremiumServer: // 22 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Home Premium Server"; break; case ProductType.ServerForSmallBusinessV: // 23 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Server for Small Business (Hyper-V)"; break; case ProductType.StandardServerV: // 24 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Standard Server (Hyper-V)"; break; case ProductType.DataCenterServerV: // 25 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Data Center Server (Hyper-V)"; break; case ProductType.EnterpriseServerV: // 26 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Enterprise Server (Hyper-V)"; break; case ProductType.DataCenterServerCoreV: // 27 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Data Center Server Core (Hyper-V)"; break; case ProductType.StandardServerCoreV: // 28 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Standard Server Core (Hyper-V)"; break; case ProductType.EnterpriseServerCoreV: // 29 ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Enterprise Server Core (Hyper-V)"; break; case ProductType.HyperV: // 2A ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "(Hyper-V)"; break; case ProductType.StorageExpressServerCore: // 2B ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Express Server Core"; break; case ProductType.StorageStandardServerCore: // 2C ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Standard Server Core"; break; case ProductType.StorageWorkgroupServerCore: // 2D ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Workgroup Server Core"; break; case ProductType.StorageEnterpriseServerCore: // 2E ClassName = "Windows.v2008"; PlatformSubType = "2008"; Edition = "Storage Enterprise Server Core"; break; case ProductType.Unlicensed: // 0xABCDABCD ClassName = "Windows.Unlicensed"; PlatformSubType = "2008"; Edition = "Unlicensed"; break; default: ClassName = "Windows.Unknown"; PlatformSubType = "2008"; Edition = "is unknown!"; break; } } break; case 1: switch (ospi.dwOSEdition) { case ProductType.Undefined: ClassName = "Windows.Undefined"; PlatformSubType = "7"; Edition = "is undefined"; break; case ProductType.Ultimate: // 1 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Ultimate Edition"; break; case ProductType.HomeBasic: // 2 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Home Basic Edition"; break; case ProductType.HomePremium: // 3 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Home Premium Edition"; break; case ProductType.Enterprise: // 4 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Enterprise Edition"; break; case ProductType.HomeBasicN: // 5 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Home Basic N Edition (EU only)"; break; case ProductType.Business: // 6 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Business Edition"; break; case ProductType.BusinessN: // 10 ClassName = "Windows.v7"; PlatformSubType = "7"; Edition = "Business N Edition (EU only)"; break; } break; } //End os.Version.Minor break; } // End os.Version.Major break; } // End os.Platform if (ClassName == null) throw new ArgumentNullException("ClassName was not defined. Please report this bug."); }