예제 #1
0
        /// <summary>
        /// Initializes a new instance of this class.
        /// </summary>
        private SystemInformation()
        {
            osVersionInfo    = GetOSVersion();
            product          = GetProduct(osVersionInfo);
            productSuite     = GetProductSuite(osVersionInfo);
            vistaProductType = GetVistaProductType(osVersionInfo);

            // calculate the build revision number by examining the file version of kernel32.dll
            // Environment.SpecialFolder.System
            string kernel32Path = Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\kernel32.dll";

            kernel32Version = FileVersionInfo.GetVersionInfo(kernel32Path);
        }
예제 #2
0
        private VistaProductType GetVistaProductType(Kernel32.OSVERSIONINFOEX osVersion)
        {
            VistaProductType vistaProduct = VistaProductType.None;

            // if this is a vista or longhorn install, call the new GetProductInfo API to retreive SKU data...
            if (osVersion.MajorVersion >= 6)
            {
                int productType = 0;
                if (Kernel32.GetProductInfo(osVersion.MajorVersion, osVersion.MinorVersion, osVersion.ServicePackMajor, osVersion.ServicePackMinor, ref productType) != 0)
                {
                    if (productType != 0)
                    {
                        vistaProduct = (VistaProductType)productType;
                    }
                    else
                    {
                        vistaProduct = VistaProductType.StorageEnterpriseServer;
                    }
                }
            }

            return(vistaProduct);
        }