示例#1
0
        private void SetUpdatedInformation()
        {
            string manufacturer, model, supportHours, supportPhone, supportUrl, logo;

            manufacturer = txtManufacturer.Text;
            model        = txtModel.Text;
            supportHours = txtSupportHours.Text;
            supportPhone = txtSupportPhone.Text;
            supportUrl   = txtSupportUrl.Text;
            logo         = (string)imgLogo.Tag;
            RegistryKey key = OEMKey.GetKey();

            // Set value of HelpCustomized to false (0) ONLY if it exists and is true (1).
            // Default is false.
            if ((int)key.GetValue("HelpCustomized", 0) == 1)
            {
                key.SetValue("HelpCustomized", 0, RegistryValueKind.DWord);
            }

            key.SetValue("Manufacturer", manufacturer);
            key.SetValue("Model", model);
            key.SetValue("SupportHours", supportHours);
            key.SetValue("SupportPhone", supportPhone);
            key.SetValue("SupportURL", supportUrl);
            if (logo == null)
            {
                key.SetValue("Logo", "");
            }
            else
            {
                string system32Directory = Path.Combine(Environment.ExpandEnvironmentVariables("%windir%"), "sysnative");
                if (logo.IndexOf(system32Directory, StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    if (Environment.Is64BitOperatingSystem)
                    {
                        // For 32-bit processes on 64-bit systems, %windir%\system32 folder
                        // can only be accessed by specifying %windir%\sysnative folder.
                        logo = Regex.Replace(logo, "sysnative", "system32", RegexOptions.IgnoreCase);
                    }
                }
                key.SetValue("Logo", logo);
            }
            string cplPath = System.IO.Path.Combine(Environment.SystemDirectory, "control.exe");

            System.Diagnostics.Process.Start(cplPath, "/name Microsoft.System");
        }
示例#2
0
        private void GetCurrentInformation()
        {
            RegistryKey key = OEMKey.GetKey();

            txtManufacturer.Text = OEMKey.GetStringFromKey("Manufacturer");
            txtModel.Text        = OEMKey.GetStringFromKey("Model");
            txtSupportHours.Text = OEMKey.GetStringFromKey("SupportHours");
            txtSupportPhone.Text = OEMKey.GetStringFromKey("SupportPhone");
            txtSupportUrl.Text   = OEMKey.GetStringFromKey("SupportURL");
            string system32Directory = Path.Combine(Environment.ExpandEnvironmentVariables("%windir%"), "system32");
            string logo = OEMKey.GetStringFromKey("Logo");

            if (logo.IndexOf(system32Directory, StringComparison.OrdinalIgnoreCase) >= 0)
            {
                if (Environment.Is64BitOperatingSystem)
                {
                    // For 32-bit processes on 64-bit systems, %windir%\system32 folder
                    // can only be accessed by specifying %windir%\sysnative folder.
                    string sysnative = Path.Combine(Environment.ExpandEnvironmentVariables("%windir%"), "sysnative");
                    logo = Regex.Replace(logo, "system32", "sysnative", RegexOptions.IgnoreCase);
                }
            }
            SetLogoValues(logo);
        }