Esempio n. 1
0
        private bool ConfigurePluginAutorun(bool enable)
        {
            Microsoft.Win32.RegistryKey runKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(RunKeyName, true);
            bool result = runKey != null;

            if (result)
            {
                bool entryPopulated = !string.IsNullOrEmpty((string)runKey.GetValue(RunInstval));

                if (!enable) // If turning off
                {
                    result = false;

                    if (entryPopulated) // If entry in registry populated
                    {
                        result = SetRegistryValue(runKey, RunInstval, string.Empty, log);

                        if (!result)
                        {
                            log.Error("Failed to clear registry value \"{0}\\{1}\"", runKey.Name, RunInstval);
                        }
                    }    // Ends if entry in registry populated
                    else // Else entry in registry not populated
                    {
                        result = true;
                    } // Ends else entry in registry not populated
                }     // Ends if turning off
                else  // Else turning off
                {
                    if (!entryPopulated) // If entry in registry not populated
                    {
                        string installPath = System.IO.Path.Combine(this.installDir, "XenGuestPlugin.exe");
                        if (installPath.Contains(' '))
                        {
                            installPath = "\"" + installPath + "\"";
                        }

                        result = SetRegistryValue(runKey, RunInstval, installPath, log);
                    }    // Ends if entry in registry not populated
                    else // Else entry in registry populated
                    {
                        result = true;
                    } // Ends else entry in registry populated
                }     // Ends else turning off
            }

            return(result);
        }
Esempio n. 2
0
        private XcDiagProcessInfo GetXcDiagProcessInfo(string mode)
        {
            XcDiagProcessInfo xcdiagProcessInfo = null;
            string            xcDiagPath, xcDiagOutputPath;

            if (FindXcDiagCommandParameters(out xcDiagPath, out xcDiagOutputPath))
            {
                if (!System.IO.File.Exists(xcDiagPath))
                {
                    log.Error("Unable to find xcdiag with path: \"{0}\"", xcDiagPath);
                }
                else
                {
                    xcdiagProcessInfo = new XcDiagProcessInfo(xcDiagPath, xcDiagOutputPath, mode);
                }
            }

            return(xcdiagProcessInfo);
        }