Beispiel #1
0
        public bool ChangeLodingIco(bool isShow)
        {
            IntPtr ptr = default(IntPtr);

            try
            {
                DiyHelper.Wow64DisableWow64FsRedirection(ref ptr);
                string text = "";
                text = ((!isShow) ? "bcdedit.exe -set {globalsettings} bootuxdisabled on" : "bcdedit.exe -set {globalsettings} bootuxdisabled off");
                Console.WriteLine(text);
                LogoDiy.LogHelper.Info(text);
                Process process = new Process();
                process.StartInfo.FileName               = "cmd.exe";
                process.StartInfo.UseShellExecute        = false;
                process.StartInfo.RedirectStandardInput  = true;
                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.RedirectStandardError  = true;
                process.StartInfo.CreateNoWindow         = true;
                process.Start();
                process.StandardInput.WriteLine(text + "&exit");
                process.StandardInput.AutoFlush = true;
                process.WaitForExit();
                process.Close();
                return(true);
            }
            catch (Exception ex)
            {
                LogoDiy.LogHelper.Error(ex);
                return(false);
            }
            finally
            {
                DiyHelper.Wow64RevertWow64FsRedirection(ptr);
            }
        }
Beispiel #2
0
        private void GetShowLodingIco()
        {
            IntPtr ptr = default(IntPtr);

            try
            {
                DiyHelper.Wow64DisableWow64FsRedirection(ref ptr);
                string  text    = "bcdedit /enum all";
                Process process = new Process();
                process.StartInfo.FileName               = "cmd.exe";
                process.StartInfo.UseShellExecute        = false;
                process.StartInfo.RedirectStandardInput  = true;
                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.RedirectStandardError  = true;
                process.StartInfo.CreateNoWindow         = true;
                process.Start();
                process.StandardInput.WriteLine(text + "&exit");
                process.StandardInput.AutoFlush = true;
                StreamReader standardOutput = process.StandardOutput;
                string       text2          = standardOutput.ReadLine();
                bool         flag           = false;
                while (!standardOutput.EndOfStream)
                {
                    text2 = standardOutput.ReadLine();
                    if ((text2.Contains("标识符") || text2.Contains("identifier")) && text2.Contains("{globalsettings}"))
                    {
                        flag = true;
                    }
                    if (flag && text2.Contains("bootuxdisabled"))
                    {
                        Console.WriteLine("gobalsettings: " + text2);
                        string text3 = text2.Replace("bootuxdisabled", "").Trim();
                        IsShowLodingIco = text3.Contains("No");
                        LogoDiy.LogHelper.Info($"{text2}; 加载系统图标 = {IsShowLodingIco}");
                        flag = false;
                    }
                }
                process.WaitForExit();
                process.Close();
            }
            catch (Exception)
            {
            }
            finally
            {
                DiyHelper.Wow64RevertWow64FsRedirection(ptr);
            }
        }