Added an option to automatically startup after Windows logon using the Task Scheduler 2.0 for Windows Vista/7 or the Registry for Windows XP.
authormoel.mich
Fri, 26 Mar 2010 20:58:10 +0000
changeset 8291edecb084a1
parent 81 7f4079703ab0
child 83 3fdadd4a830f
Added an option to automatically startup after Windows logon using the Task Scheduler 2.0 for Windows Vista/7 or the Registry for Windows XP.
External/WinRing0.vxd
GUI/MainForm.Designer.cs
GUI/MainForm.cs
GUI/StartupManager.cs
GUI/TaskScheduler.cs
OpenHardwareMonitor.csproj
     1.1 Binary file External/WinRing0.vxd has changed
     2.1 --- a/GUI/MainForm.Designer.cs	Mon Mar 22 17:58:21 2010 +0000
     2.2 +++ b/GUI/MainForm.Designer.cs	Fri Mar 26 20:58:10 2010 +0000
     2.3 @@ -97,6 +97,7 @@
     2.4        this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     2.5        this.startMinMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     2.6        this.minTrayMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     2.7 +      this.startupMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     2.8        this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
     2.9        this.hddMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.10        this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.11 @@ -105,7 +106,7 @@
    2.12        this.splitContainer = new System.Windows.Forms.SplitContainer();
    2.13        this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
    2.14        this.notifyContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
    2.15 -      this.restoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.16 +      this.hideShowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.17        this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
    2.18        this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
    2.19        this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
    2.20 @@ -427,6 +428,7 @@
    2.21        this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
    2.22              this.startMinMenuItem,
    2.23              this.minTrayMenuItem,
    2.24 +            this.startupMenuItem,
    2.25              this.toolStripMenuItem3,
    2.26              this.hddMenuItem});
    2.27        this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
    2.28 @@ -437,28 +439,35 @@
    2.29        // 
    2.30        this.startMinMenuItem.CheckOnClick = true;
    2.31        this.startMinMenuItem.Name = "startMinMenuItem";
    2.32 -      this.startMinMenuItem.Size = new System.Drawing.Size(166, 22);
    2.33 +      this.startMinMenuItem.Size = new System.Drawing.Size(207, 22);
    2.34        this.startMinMenuItem.Text = "Start Minimized";
    2.35        // 
    2.36        // minTrayMenuItem
    2.37        // 
    2.38 -      this.minTrayMenuItem.Checked = true;
    2.39        this.minTrayMenuItem.CheckOnClick = true;
    2.40 -      this.minTrayMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
    2.41        this.minTrayMenuItem.Name = "minTrayMenuItem";
    2.42 -      this.minTrayMenuItem.Size = new System.Drawing.Size(166, 22);
    2.43 +      this.minTrayMenuItem.Size = new System.Drawing.Size(207, 22);
    2.44        this.minTrayMenuItem.Text = "Minimize To Tray";
    2.45 +      this.minTrayMenuItem.CheckedChanged += new System.EventHandler(this.minTrayMenuItem_CheckedChanged);
    2.46 +      // 
    2.47 +      // startupMenuItem
    2.48 +      // 
    2.49 +      this.startupMenuItem.CheckOnClick = true;
    2.50 +      this.startupMenuItem.Name = "startupMenuItem";
    2.51 +      this.startupMenuItem.Size = new System.Drawing.Size(207, 22);
    2.52 +      this.startupMenuItem.Text = "Run On Windows Startup";
    2.53 +      this.startupMenuItem.CheckedChanged += new System.EventHandler(this.runOnWindowsStartupToolStripMenuItem_CheckedChanged);
    2.54        // 
    2.55        // toolStripMenuItem3
    2.56        // 
    2.57        this.toolStripMenuItem3.Name = "toolStripMenuItem3";
    2.58 -      this.toolStripMenuItem3.Size = new System.Drawing.Size(163, 6);
    2.59 +      this.toolStripMenuItem3.Size = new System.Drawing.Size(204, 6);
    2.60        // 
    2.61        // hddMenuItem
    2.62        // 
    2.63        this.hddMenuItem.CheckOnClick = true;
    2.64        this.hddMenuItem.Name = "hddMenuItem";
    2.65 -      this.hddMenuItem.Size = new System.Drawing.Size(166, 22);
    2.66 +      this.hddMenuItem.Size = new System.Drawing.Size(207, 22);
    2.67        this.hddMenuItem.Text = "HDD sensors";
    2.68        this.hddMenuItem.CheckedChanged += new System.EventHandler(this.hddsensorsToolStripMenuItem_CheckedChanged);
    2.69        // 
    2.70 @@ -515,29 +524,29 @@
    2.71        // notifyContextMenuStrip
    2.72        // 
    2.73        this.notifyContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
    2.74 -            this.restoreToolStripMenuItem,
    2.75 +            this.hideShowToolStripMenuItem,
    2.76              this.toolStripMenuItem2,
    2.77              this.exitToolStripMenuItem1});
    2.78        this.notifyContextMenuStrip.Name = "notifyContextMenuStrip";
    2.79 -      this.notifyContextMenuStrip.Size = new System.Drawing.Size(119, 54);
    2.80 +      this.notifyContextMenuStrip.Size = new System.Drawing.Size(153, 76);
    2.81        // 
    2.82 -      // restoreToolStripMenuItem
    2.83 +      // hideShowToolStripMenuItem
    2.84        // 
    2.85 -      this.restoreToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
    2.86 -      this.restoreToolStripMenuItem.Name = "restoreToolStripMenuItem";
    2.87 -      this.restoreToolStripMenuItem.Size = new System.Drawing.Size(118, 22);
    2.88 -      this.restoreToolStripMenuItem.Text = "Restore";
    2.89 -      this.restoreToolStripMenuItem.Click += new System.EventHandler(this.restoreClick);
    2.90 +      this.hideShowToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
    2.91 +      this.hideShowToolStripMenuItem.Name = "hideShowToolStripMenuItem";
    2.92 +      this.hideShowToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
    2.93 +      this.hideShowToolStripMenuItem.Text = "Hide/Show";
    2.94 +      this.hideShowToolStripMenuItem.Click += new System.EventHandler(this.hideShowClick);
    2.95        // 
    2.96        // toolStripMenuItem2
    2.97        // 
    2.98        this.toolStripMenuItem2.Name = "toolStripMenuItem2";
    2.99 -      this.toolStripMenuItem2.Size = new System.Drawing.Size(115, 6);
   2.100 +      this.toolStripMenuItem2.Size = new System.Drawing.Size(149, 6);
   2.101        // 
   2.102        // exitToolStripMenuItem1
   2.103        // 
   2.104        this.exitToolStripMenuItem1.Name = "exitToolStripMenuItem1";
   2.105 -      this.exitToolStripMenuItem1.Size = new System.Drawing.Size(118, 22);
   2.106 +      this.exitToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
   2.107        this.exitToolStripMenuItem1.Text = "Exit";
   2.108        this.exitToolStripMenuItem1.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
   2.109        // 
   2.110 @@ -613,7 +622,7 @@
   2.111      private System.Windows.Forms.ToolStripMenuItem hddMenuItem;
   2.112      private System.Windows.Forms.ToolStripMenuItem loadMenuItem;
   2.113      private System.Windows.Forms.ContextMenuStrip notifyContextMenuStrip;
   2.114 -    private System.Windows.Forms.ToolStripMenuItem restoreToolStripMenuItem;
   2.115 +    private System.Windows.Forms.ToolStripMenuItem hideShowToolStripMenuItem;
   2.116      private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
   2.117      private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1;
   2.118      private System.Windows.Forms.ToolStripMenuItem minTrayMenuItem;
   2.119 @@ -621,6 +630,7 @@
   2.120      private System.Windows.Forms.ContextMenuStrip sensorContextMenuStrip;
   2.121      private System.Windows.Forms.ToolStripMenuItem startMinMenuItem;
   2.122      private System.Windows.Forms.ToolStripMenuItem flowsMenuItem;
   2.123 +    private System.Windows.Forms.ToolStripMenuItem startupMenuItem;
   2.124    }
   2.125  }
   2.126  
     3.1 --- a/GUI/MainForm.cs	Mon Mar 22 17:58:21 2010 +0000
     3.2 +++ b/GUI/MainForm.cs	Fri Mar 26 20:58:10 2010 +0000
     3.3 @@ -58,6 +58,7 @@
     3.4      private Color[] plotColorPalette;
     3.5      private SensorSystemTray sensorSystemTray;
     3.6      private NotifyIcon notifyIcon;
     3.7 +    private StartupManager startupManager = new StartupManager();
     3.8  
     3.9      public MainForm() {      
    3.10        InitializeComponent();
    3.11 @@ -105,7 +106,7 @@
    3.12        notifyIcon.ContextMenuStrip = this.notifyContextMenuStrip;
    3.13        notifyIcon.Icon = EmbeddedResources.GetIcon("smallicon.ico");
    3.14        notifyIcon.Text = "Open Hardware Monitor";      
    3.15 -      notifyIcon.DoubleClick += new EventHandler(this.restoreClick);
    3.16 +      notifyIcon.DoubleClick += new EventHandler(this.hideShowClick);
    3.17  
    3.18        sensorSystemTray = new SensorSystemTray(computer);
    3.19  
    3.20 @@ -136,6 +137,7 @@
    3.21  
    3.22        startMinMenuItem.Checked = Config.Get(startMinMenuItem.Name, false); 
    3.23        minTrayMenuItem.Checked = Config.Get(minTrayMenuItem.Name, true);
    3.24 +      startupMenuItem.Checked = startupManager.Startup;
    3.25        hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true);
    3.26  
    3.27        voltMenuItem.Checked = Config.Get(voltMenuItem.Name, true);
    3.28 @@ -148,9 +150,7 @@
    3.29        timer.Enabled = true;
    3.30  
    3.31        if (startMinMenuItem.Checked) {
    3.32 -        if (minTrayMenuItem.Checked) {
    3.33 -          notifyIcon.Visible = true;
    3.34 -        } else {
    3.35 +        if (!minTrayMenuItem.Checked) {
    3.36            WindowState = FormWindowState.Minimized;
    3.37            Show();
    3.38          }
    3.39 @@ -273,7 +273,7 @@
    3.40        Config.Set(loadMenuItem.Name, loadMenuItem.Checked);
    3.41        Config.Set(tempMenuItem.Name, tempMenuItem.Checked);
    3.42        Config.Set(fansMenuItem.Name, fansMenuItem.Checked);
    3.43 -      Config.Set(flowsMenuItem.Name, flowsMenuItem.Checked);
    3.44 +      Config.Set(flowsMenuItem.Name, flowsMenuItem.Checked);      
    3.45  
    3.46        if (WindowState != FormWindowState.Minimized) {
    3.47          Config.Set("mainForm.Location.X", Location.X);
    3.48 @@ -391,15 +391,10 @@
    3.49          UpdateSensorTypeVisible(node);
    3.50      }
    3.51  
    3.52 -    private void ToggleSysTray() {
    3.53 -      if (notifyIcon.Visible) {
    3.54 -        Visible = true;
    3.55 -        notifyIcon.Visible = false;
    3.56 -        Activate(); 
    3.57 -      } else {
    3.58 -        notifyIcon.Visible = true;
    3.59 -        Visible = false;           
    3.60 -      }
    3.61 +    private void SysTrayHideShow() {
    3.62 +      Visible = !Visible;
    3.63 +      if (Visible)
    3.64 +        Activate();    
    3.65      }
    3.66  
    3.67      protected override void WndProc(ref Message m) {
    3.68 @@ -407,14 +402,14 @@
    3.69        const int SC_MINIMIZE = 0xF020;
    3.70        if (minTrayMenuItem.Checked && 
    3.71          m.Msg == WM_SYSCOMMAND && m.WParam.ToInt32() == SC_MINIMIZE) {
    3.72 -        ToggleSysTray();
    3.73 +        SysTrayHideShow();
    3.74        } else {      
    3.75          base.WndProc(ref m);
    3.76        }
    3.77      }
    3.78  
    3.79 -    private void restoreClick(object sender, EventArgs e) {
    3.80 -      ToggleSysTray();
    3.81 +    private void hideShowClick(object sender, EventArgs e) {
    3.82 +      SysTrayHideShow();
    3.83      }
    3.84  
    3.85      private void removeToolStripMenuItem_Click(object sender, EventArgs e) {
    3.86 @@ -444,5 +439,15 @@
    3.87          ShowParameterForm(node.Sensor);
    3.88        }
    3.89      }
    3.90 +
    3.91 +    private void runOnWindowsStartupToolStripMenuItem_CheckedChanged(
    3.92 +      object sender, EventArgs e) 
    3.93 +    {
    3.94 +      startupManager.Startup = startupMenuItem.Checked;
    3.95 +    }
    3.96 +
    3.97 +    private void minTrayMenuItem_CheckedChanged(object sender, EventArgs e) {
    3.98 +      notifyIcon.Visible = minTrayMenuItem.Checked;
    3.99 +    }
   3.100    }
   3.101  }
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/GUI/StartupManager.cs	Fri Mar 26 20:58:10 2010 +0000
     4.3 @@ -0,0 +1,160 @@
     4.4 +/*
     4.5 +  
     4.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     4.7 +
     4.8 +  The contents of this file are subject to the Mozilla Public License Version
     4.9 +  1.1 (the "License"); you may not use this file except in compliance with
    4.10 +  the License. You may obtain a copy of the License at
    4.11 + 
    4.12 +  http://www.mozilla.org/MPL/
    4.13 +
    4.14 +  Software distributed under the License is distributed on an "AS IS" basis,
    4.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    4.16 +  for the specific language governing rights and limitations under the License.
    4.17 +
    4.18 +  The Original Code is the Open Hardware Monitor code.
    4.19 +
    4.20 +  The Initial Developer of the Original Code is 
    4.21 +  Michael Möller <m.moeller@gmx.ch>.
    4.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    4.23 +  the Initial Developer. All Rights Reserved.
    4.24 +
    4.25 +  Contributor(s):
    4.26 +
    4.27 +  Alternatively, the contents of this file may be used under the terms of
    4.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    4.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    4.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
    4.31 +  of those above. If you wish to allow use of your version of this file only
    4.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
    4.33 +  use your version of this file under the terms of the MPL, indicate your
    4.34 +  decision by deleting the provisions above and replace them with the notice
    4.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
    4.36 +  the provisions above, a recipient may use your version of this file under
    4.37 +  the terms of any one of the MPL, the GPL or the LGPL.
    4.38 + 
    4.39 +*/
    4.40 +
    4.41 +using System;
    4.42 +using System.Collections.Generic;
    4.43 +using System.IO;
    4.44 +using System.Windows.Forms;
    4.45 +using Microsoft.Win32;
    4.46 +using OpenHardwareMonitor.TaskScheduler;
    4.47 +
    4.48 +namespace OpenHardwareMonitor.GUI {
    4.49 +  public class StartupManager {
    4.50 +
    4.51 +    private TaskSchedulerClass scheduler;
    4.52 +    private bool startup;
    4.53 +
    4.54 +    private const string REGISTRY_RUN =
    4.55 +      @"Software\Microsoft\Windows\CurrentVersion\Run";
    4.56 +
    4.57 +    public StartupManager() {
    4.58 +      try {
    4.59 +        scheduler = new TaskSchedulerClass();
    4.60 +        scheduler.Connect(null, null, null, null);
    4.61 +      } catch (Exception) {
    4.62 +        scheduler = null;
    4.63 +      }
    4.64 +
    4.65 +      if (scheduler != null) {
    4.66 +        try {
    4.67 +          ITaskFolder folder = scheduler.GetFolder("\\Open Hardware Monitor");
    4.68 +          IRegisteredTask task = folder.GetTask("Startup");
    4.69 +          startup = task != null;
    4.70 +        } catch (FileNotFoundException) {
    4.71 +          startup = false;
    4.72 +        }
    4.73 +      } else {
    4.74 +        RegistryKey key = Registry.CurrentUser.OpenSubKey(REGISTRY_RUN);
    4.75 +        startup = false;
    4.76 +        if (key != null) {
    4.77 +          string value = (string)key.GetValue("OpenHardwareMonitor");
    4.78 +          if (value != null)
    4.79 +            startup = value == Application.ExecutablePath;
    4.80 +        }
    4.81 +      }
    4.82 +    }
    4.83 +
    4.84 +    private void CreateSchedulerTask() {
    4.85 +      ITaskDefinition definition = scheduler.NewTask(0);
    4.86 +      definition.RegistrationInfo.Description =
    4.87 +        "This task starts the Open Hardware Monitor on Windows startup.";
    4.88 +      definition.Principal.RunLevel =
    4.89 +        TASK_RUNLEVEL.TASK_RUNLEVEL_HIGHEST;
    4.90 +      definition.Settings.DisallowStartIfOnBatteries = false;
    4.91 +      definition.Settings.StopIfGoingOnBatteries = false;
    4.92 +      definition.Settings.ExecutionTimeLimit = "PT0S";
    4.93 +
    4.94 +      ILogonTrigger trigger = (ILogonTrigger)definition.Triggers.Create(
    4.95 +        TASK_TRIGGER_TYPE2.TASK_TRIGGER_LOGON);
    4.96 +
    4.97 +      IExecAction action = (IExecAction)definition.Actions.Create(
    4.98 +        TASK_ACTION_TYPE.TASK_ACTION_EXEC);
    4.99 +      action.Path = Application.ExecutablePath;
   4.100 +      action.WorkingDirectory =
   4.101 +        Path.GetDirectoryName(Application.ExecutablePath);
   4.102 +
   4.103 +      ITaskFolder root = scheduler.GetFolder("\\");
   4.104 +      ITaskFolder folder;
   4.105 +      try {
   4.106 +        folder = root.GetFolder("Open Hardware Monitor");
   4.107 +      } catch (FileNotFoundException) {
   4.108 +        folder = root.CreateFolder("Open Hardware Monitor", "");
   4.109 +      }
   4.110 +      folder.RegisterTaskDefinition("Startup", definition,
   4.111 +        (int)TASK_CREATION.TASK_CREATE_OR_UPDATE, null, null,
   4.112 +        TASK_LOGON_TYPE.TASK_LOGON_INTERACTIVE_TOKEN, "");
   4.113 +    }
   4.114 +
   4.115 +    private void DeleteSchedulerTask() {
   4.116 +      ITaskFolder root = scheduler.GetFolder("\\");
   4.117 +      try {
   4.118 +        ITaskFolder folder = root.GetFolder("Open Hardware Monitor");
   4.119 +        folder.DeleteTask("Startup", 0);
   4.120 +      } catch (FileNotFoundException) { }
   4.121 +      try {
   4.122 +        root.DeleteFolder("Open Hardware Monitor", 0);
   4.123 +      } catch (FileNotFoundException) { }
   4.124 +    }
   4.125 +
   4.126 +    private void CreateRegistryRun() {
   4.127 +      RegistryKey key = Registry.CurrentUser.CreateSubKey(REGISTRY_RUN);
   4.128 +      key.SetValue("OpenHardwareMonitor", Application.ExecutablePath);
   4.129 +    }
   4.130 +
   4.131 +    private void DeleteRegistryRun() {
   4.132 +      RegistryKey key = Registry.CurrentUser.CreateSubKey(REGISTRY_RUN);
   4.133 +      key.DeleteValue("OpenHardwareMonitor");
   4.134 +    }
   4.135 +
   4.136 +    public bool Startup {
   4.137 +      get {
   4.138 +        return startup;
   4.139 +      }
   4.140 +      set {
   4.141 +        if (startup != value) {
   4.142 +          startup = value;
   4.143 +          if (scheduler != null) {
   4.144 +            if (startup)
   4.145 +              CreateSchedulerTask();
   4.146 +            else
   4.147 +              DeleteSchedulerTask();
   4.148 +          } else {
   4.149 +            if (startup)
   4.150 +              CreateRegistryRun();
   4.151 +            else
   4.152 +              DeleteRegistryRun();
   4.153 +          }
   4.154 +        }
   4.155 +      }
   4.156 +    }
   4.157 +  }
   4.158 +
   4.159 + 
   4.160 +
   4.161 + 
   4.162 +
   4.163 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/GUI/TaskScheduler.cs	Fri Mar 26 20:58:10 2010 +0000
     5.3 @@ -0,0 +1,423 @@
     5.4 +/*
     5.5 +  
     5.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     5.7 +
     5.8 +  The contents of this file are subject to the Mozilla Public License Version
     5.9 +  1.1 (the "License"); you may not use this file except in compliance with
    5.10 +  the License. You may obtain a copy of the License at
    5.11 + 
    5.12 +  http://www.mozilla.org/MPL/
    5.13 +
    5.14 +  Software distributed under the License is distributed on an "AS IS" basis,
    5.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    5.16 +  for the specific language governing rights and limitations under the License.
    5.17 +
    5.18 +  The Original Code is the Open Hardware Monitor code.
    5.19 +
    5.20 +  The Initial Developer of the Original Code is 
    5.21 +  Michael Möller <m.moeller@gmx.ch>.
    5.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    5.23 +  the Initial Developer. All Rights Reserved.
    5.24 +
    5.25 +  Contributor(s):
    5.26 +
    5.27 +  Alternatively, the contents of this file may be used under the terms of
    5.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    5.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    5.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
    5.31 +  of those above. If you wish to allow use of your version of this file only
    5.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
    5.33 +  use your version of this file under the terms of the MPL, indicate your
    5.34 +  decision by deleting the provisions above and replace them with the notice
    5.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
    5.36 +  the provisions above, a recipient may use your version of this file under
    5.37 +  the terms of any one of the MPL, the GPL or the LGPL.
    5.38 + 
    5.39 +*/
    5.40 +
    5.41 +using System;
    5.42 +using System.Collections;
    5.43 +using System.Reflection;
    5.44 +using System.Runtime.CompilerServices;
    5.45 +using System.Runtime.InteropServices;
    5.46 +
    5.47 +namespace OpenHardwareMonitor.TaskScheduler {
    5.48 +
    5.49 +  public enum TASK_ACTION_TYPE {
    5.50 +    TASK_ACTION_COM_HANDLER = 5,
    5.51 +    TASK_ACTION_EXEC = 0,
    5.52 +    TASK_ACTION_SEND_EMAIL = 6,
    5.53 +    TASK_ACTION_SHOW_MESSAGE = 7
    5.54 +  }
    5.55 +
    5.56 +  public enum TASK_CREATION {
    5.57 +    TASK_CREATE = 2,
    5.58 +    TASK_CREATE_OR_UPDATE = 6,
    5.59 +    TASK_DISABLE = 8,
    5.60 +    TASK_DONT_ADD_PRINCIPAL_ACE = 0x10,
    5.61 +    TASK_IGNORE_REGISTRATION_TRIGGERS = 0x20,
    5.62 +    TASK_UPDATE = 4,
    5.63 +    TASK_VALIDATE_ONLY = 1
    5.64 +  }
    5.65 +
    5.66 +  public enum TASK_ENUM_FLAGS {
    5.67 +    TASK_ENUM_HIDDEN = 1
    5.68 +  }
    5.69 +
    5.70 +  public enum TASK_INSTANCES_POLICY {
    5.71 +    TASK_INSTANCES_PARALLEL,
    5.72 +    TASK_INSTANCES_QUEUE,
    5.73 +    TASK_INSTANCES_IGNORE_NEW,
    5.74 +    TASK_INSTANCES_STOP_EXISTING
    5.75 +  }
    5.76 +
    5.77 +  public enum TASK_LOGON_TYPE {
    5.78 +    TASK_LOGON_NONE,
    5.79 +    TASK_LOGON_PASSWORD,
    5.80 +    TASK_LOGON_S4U,
    5.81 +    TASK_LOGON_INTERACTIVE_TOKEN,
    5.82 +    TASK_LOGON_GROUP,
    5.83 +    TASK_LOGON_SERVICE_ACCOUNT,
    5.84 +    TASK_LOGON_INTERACTIVE_TOKEN_OR_PASSWORD
    5.85 +  }
    5.86 +
    5.87 +  public enum TASK_RUN_FLAGS {
    5.88 +    TASK_RUN_AS_SELF = 1,
    5.89 +    TASK_RUN_IGNORE_CONSTRAINTS = 2,
    5.90 +    TASK_RUN_NO_FLAGS = 0,
    5.91 +    TASK_RUN_USE_SESSION_ID = 4,
    5.92 +    TASK_RUN_USER_SID = 8
    5.93 +  }
    5.94 +
    5.95 +  public enum TASK_RUNLEVEL {
    5.96 +    TASK_RUNLEVEL_LUA,
    5.97 +    TASK_RUNLEVEL_HIGHEST
    5.98 +  }
    5.99 +
   5.100 +  public enum TASK_STATE {
   5.101 +    TASK_STATE_UNKNOWN,
   5.102 +    TASK_STATE_DISABLED,
   5.103 +    TASK_STATE_QUEUED,
   5.104 +    TASK_STATE_READY,
   5.105 +    TASK_STATE_RUNNING
   5.106 +  }
   5.107 +
   5.108 +  public enum TASK_TRIGGER_TYPE2 {
   5.109 +    TASK_TRIGGER_BOOT = 8,
   5.110 +    TASK_TRIGGER_DAILY = 2,
   5.111 +    TASK_TRIGGER_EVENT = 0,
   5.112 +    TASK_TRIGGER_IDLE = 6,
   5.113 +    TASK_TRIGGER_LOGON = 9,
   5.114 +    TASK_TRIGGER_MONTHLY = 4,
   5.115 +    TASK_TRIGGER_MONTHLYDOW = 5,
   5.116 +    TASK_TRIGGER_REGISTRATION = 7,
   5.117 +    TASK_TRIGGER_SESSION_STATE_CHANGE = 11,
   5.118 +    TASK_TRIGGER_TIME = 1,
   5.119 +    TASK_TRIGGER_WEEKLY = 3
   5.120 +  }
   5.121 +
   5.122 +  [ComImport, TypeLibType((short)0x10c0), Guid("BAE54997-48B1-4CBE-9965-D6BE263EBEA4")]
   5.123 +  public interface IAction {
   5.124 +    [DispId(1)]
   5.125 +    string Id { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] set; }
   5.126 +    [DispId(2)]
   5.127 +    TASK_ACTION_TYPE Type { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] get; }
   5.128 +  }
   5.129 +
   5.130 +  [ComImport, TypeLibType((short)0x10c0), Guid("02820E19-7B98-4ED2-B2E8-FDCCCEFF619B")]
   5.131 +  public interface IActionCollection : IEnumerable {
   5.132 +    [DispId(1)]
   5.133 +    int Count { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; }
   5.134 +    [DispId(0)]
   5.135 +    IAction this[int index] { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; }
   5.136 +    [DispId(2)]
   5.137 +    string XmlText { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] set; }
   5.138 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.139 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)]
   5.140 +    IAction Create([In] TASK_ACTION_TYPE Type);
   5.141 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)]
   5.142 +    void Remove([In, MarshalAs(UnmanagedType.Struct)] object index);
   5.143 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)]
   5.144 +    void Clear();
   5.145 +    [DispId(6)]
   5.146 +    string Context { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] set; }
   5.147 +  }
   5.148 +
   5.149 +  [ComImport, Guid("4C3D624D-FD6B-49A3-B9B7-09CB3CD3F047"), TypeLibType((short)0x10c0)]
   5.150 +  public interface IExecAction : IAction {
   5.151 +    [DispId(10)]
   5.152 +    string Path { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(10)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(10)] set; }
   5.153 +    [DispId(11)]
   5.154 +    string Arguments { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(11)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(11)] set; }
   5.155 +    [DispId(12)]
   5.156 +    string WorkingDirectory { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] set; }
   5.157 +  }
   5.158 +
   5.159 +  [ComImport, Guid("72DADE38-FAE4-4B3E-BAF4-5D009AF02B1C"), TypeLibType((short)0x10c0)]
   5.160 +  public interface ILogonTrigger : ITrigger {
   5.161 +    [DispId(20)]
   5.162 +    string Delay { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(20)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(20)] set; }
   5.163 +    [DispId(0x15)]
   5.164 +    string UserId { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x15)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x15)] set; }
   5.165 +  }
   5.166 +
   5.167 +  [ComImport, Guid("D98D51E5-C9B4-496A-A9C1-18980261CF0F"), TypeLibType((short)0x10c0)]
   5.168 +  public interface IPrincipal {
   5.169 +    [DispId(1)]
   5.170 +    string Id { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] set; }
   5.171 +    [DispId(2)]
   5.172 +    string DisplayName { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] set; }
   5.173 +    [DispId(3)]
   5.174 +    string UserId { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] set; }
   5.175 +    [DispId(4)]
   5.176 +    TASK_LOGON_TYPE LogonType { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] set; }
   5.177 +    [DispId(5)]
   5.178 +    string GroupId { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] set; }
   5.179 +    [DispId(6)]
   5.180 +    TASK_RUNLEVEL RunLevel { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] set; }
   5.181 +  }
   5.182 +
   5.183 +  [ComImport, DefaultMember("Path"), Guid("9C86F320-DEE3-4DD1-B972-A303F26B061E"), TypeLibType((short)0x10c0), ComConversionLoss]
   5.184 +  public interface IRegisteredTask {
   5.185 +    [DispId(1)]
   5.186 +    string Name { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; }
   5.187 +    [DispId(0)]
   5.188 +    string Path { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; }
   5.189 +    [DispId(2)]
   5.190 +    TASK_STATE State { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] get; }
   5.191 +    [DispId(3)]
   5.192 +    bool Enabled { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] get; [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] set; }
   5.193 +    [DispId(8)]
   5.194 +    DateTime LastRunTime { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(8)] get; }
   5.195 +    [DispId(9)]
   5.196 +    int LastTaskResult { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(9)] get; }
   5.197 +    [DispId(11)]
   5.198 +    int NumberOfMissedRuns { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(11)] get; }
   5.199 +    [DispId(12)]
   5.200 +    DateTime NextRunTime { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] get; }
   5.201 +    [DispId(13)]
   5.202 +    ITaskDefinition Definition { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(13)] get; }
   5.203 +    [DispId(14)]
   5.204 +    string Xml { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(14)] get; }
   5.205 +    [return: MarshalAs(UnmanagedType.BStr)]
   5.206 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(15)]
   5.207 +    string GetSecurityDescriptor([In] int securityInformation);
   5.208 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x10)]
   5.209 +    void SetSecurityDescriptor([In, MarshalAs(UnmanagedType.BStr)] string sddl, [In] int flags);
   5.210 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x11)]
   5.211 +    void Stop([In] int flags);
   5.212 +  }
   5.213 +
   5.214 +  [ComImport, TypeLibType((short)0x10c0), Guid("86627EB4-42A7-41E4-A4D9-AC33A72F2D52")]
   5.215 +  public interface IRegisteredTaskCollection : IEnumerable {
   5.216 +    [DispId(0x60020000)]
   5.217 +    int Count { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020000)] get; }
   5.218 +    [DispId(0)]
   5.219 +    IRegisteredTask this[object index] { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; }
   5.220 +  }
   5.221 +
   5.222 +  [ComImport, Guid("416D8B73-CB41-4EA1-805C-9BE9A5AC4A74"), TypeLibType((short)0x10c0)]
   5.223 +  public interface IRegistrationInfo {
   5.224 +    [DispId(1)]
   5.225 +    string Description { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] set; }
   5.226 +    [DispId(2)]
   5.227 +    string Author { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] set; }
   5.228 +    [DispId(4)]
   5.229 +    string Version { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] set; }
   5.230 +    [DispId(5)]
   5.231 +    string Date { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] set; }
   5.232 +    [DispId(6)]
   5.233 +    string Documentation { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] set; }
   5.234 +    [DispId(9)]
   5.235 +    string XmlText { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(9)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(9)] set; }
   5.236 +    [DispId(10)]
   5.237 +    string URI { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(10)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(10)] set; }
   5.238 +    [DispId(11)]
   5.239 +    object SecurityDescriptor { [return: MarshalAs(UnmanagedType.Struct)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(11)] get; [param: In, MarshalAs(UnmanagedType.Struct)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(11)] set; }
   5.240 +    [DispId(12)]
   5.241 +    string Source { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] set; }
   5.242 +  }
   5.243 +
   5.244 +  [ComImport, TypeLibType((short)0x10c0), Guid("F5BC8FC5-536D-4F77-B852-FBC1356FDEB6")]
   5.245 +  public interface ITaskDefinition {
   5.246 +    [DispId(1)]
   5.247 +    IRegistrationInfo RegistrationInfo { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; [param: In, MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] set; }
   5.248 +    [DispId(2)]
   5.249 +    ITriggerCollection Triggers { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] get; [param: In, MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] set; }
   5.250 +    [DispId(7)]
   5.251 +    ITaskSettings Settings { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] get; [param: In, MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] set; }
   5.252 +    [DispId(11)]
   5.253 +    string Data { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(11)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(11)] set; }
   5.254 +    [DispId(12)]
   5.255 +    IPrincipal Principal { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] get; [param: In, MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] set; }
   5.256 +    [DispId(13)]
   5.257 +    IActionCollection Actions { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(13)] get; [param: In, MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(13)] set; }
   5.258 +    [DispId(14)]
   5.259 +    string XmlText { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(14)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(14)] set; }
   5.260 +  }
   5.261 +
   5.262 +  [ComImport, DefaultMember("Path"), Guid("8CFAC062-A080-4C15-9A88-AA7C2AF80DFC"), TypeLibType((short)0x10c0)]
   5.263 +  public interface ITaskFolder {
   5.264 +    [DispId(1)]
   5.265 +    string Name { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; }
   5.266 +    [DispId(0)]
   5.267 +    string Path { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; }
   5.268 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.269 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)]
   5.270 +    ITaskFolder GetFolder([MarshalAs(UnmanagedType.BStr)] string Path);
   5.271 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.272 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)]
   5.273 +    ITaskFolderCollection GetFolders([In] int flags);
   5.274 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.275 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)]
   5.276 +    ITaskFolder CreateFolder([In, MarshalAs(UnmanagedType.BStr)] string subFolderName, [In, Optional, MarshalAs(UnmanagedType.Struct)] object sddl);
   5.277 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)]
   5.278 +    void DeleteFolder([MarshalAs(UnmanagedType.BStr)] string subFolderName, [In] int flags);
   5.279 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.280 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)]
   5.281 +    IRegisteredTask GetTask([In, MarshalAs(UnmanagedType.BStr)] string Path);
   5.282 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.283 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(8)]
   5.284 +    IRegisteredTaskCollection GetTasks([In] int flags);
   5.285 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(9)]
   5.286 +    void DeleteTask([In, MarshalAs(UnmanagedType.BStr)] string Name, [In] int flags);
   5.287 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.288 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(10)]
   5.289 +    IRegisteredTask RegisterTask([In, MarshalAs(UnmanagedType.BStr)] string Path, [In, MarshalAs(UnmanagedType.BStr)] string XmlText, [In] int flags, [In, MarshalAs(UnmanagedType.Struct)] object UserId, [In, MarshalAs(UnmanagedType.Struct)] object password, [In] TASK_LOGON_TYPE LogonType, [In, Optional, MarshalAs(UnmanagedType.Struct)] object sddl);
   5.290 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.291 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(11)]
   5.292 +    IRegisteredTask RegisterTaskDefinition([In, MarshalAs(UnmanagedType.BStr)] string Path, [In, MarshalAs(UnmanagedType.Interface)] ITaskDefinition pDefinition, [In] int flags, [In, MarshalAs(UnmanagedType.Struct)] object UserId, [In, MarshalAs(UnmanagedType.Struct)] object password, [In] TASK_LOGON_TYPE LogonType, [In, Optional, MarshalAs(UnmanagedType.Struct)] object sddl);
   5.293 +    [return: MarshalAs(UnmanagedType.BStr)]
   5.294 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)]
   5.295 +    string GetSecurityDescriptor(int securityInformation);
   5.296 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(13)]
   5.297 +    void SetSecurityDescriptor([In, MarshalAs(UnmanagedType.BStr)] string sddl, [In] int flags);
   5.298 +  }
   5.299 +
   5.300 +  [ComImport, TypeLibType((short)0x10c0), Guid("79184A66-8664-423F-97F1-637356A5D812")]
   5.301 +  public interface ITaskFolderCollection : IEnumerable {
   5.302 +    [DispId(0x60020000)]
   5.303 +    int Count { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020000)] get; }
   5.304 +    [DispId(0)]
   5.305 +    ITaskFolder this[object index] { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; }
   5.306 +  }
   5.307 +
   5.308 +  [ComImport, TypeLibType((short)0x10c0), DefaultMember("TargetServer"), Guid("2FABA4C7-4DA9-4013-9697-20CC3FD40F85")]
   5.309 +  public interface ITaskService {
   5.310 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.311 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)]
   5.312 +    ITaskFolder GetFolder([In, MarshalAs(UnmanagedType.BStr)] string Path);
   5.313 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.314 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)]
   5.315 +    ITaskDefinition NewTask([In] uint flags);
   5.316 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)]
   5.317 +    void Connect([In, Optional, MarshalAs(UnmanagedType.Struct)] object serverName, [In, Optional, MarshalAs(UnmanagedType.Struct)] object user, [In, Optional, MarshalAs(UnmanagedType.Struct)] object domain, [In, Optional, MarshalAs(UnmanagedType.Struct)] object password);
   5.318 +    [DispId(5)]
   5.319 +    bool Connected { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] get; }
   5.320 +    [DispId(0)]
   5.321 +    string TargetServer { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; }
   5.322 +    [DispId(6)]
   5.323 +    string ConnectedUser { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] get; }
   5.324 +    [DispId(7)]
   5.325 +    string ConnectedDomain { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] get; }
   5.326 +    [DispId(8)]
   5.327 +    uint HighestVersion { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(8)] get; }
   5.328 +  }
   5.329 +
   5.330 +  [ComImport, TypeLibType((short)0x10c0), Guid("8FD4711D-2D02-4C8C-87E3-EFF699DE127E")]
   5.331 +  public interface ITaskSettings {
   5.332 +    [DispId(3)]
   5.333 +    bool AllowDemandStart { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] set; }
   5.334 +    [DispId(4)]
   5.335 +    string RestartInterval { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] set; }
   5.336 +    [DispId(5)]
   5.337 +    int RestartCount { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] set; }
   5.338 +    [DispId(6)]
   5.339 +    TASK_INSTANCES_POLICY MultipleInstances { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] set; }
   5.340 +    [DispId(7)]
   5.341 +    bool StopIfGoingOnBatteries { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] set; }
   5.342 +    [DispId(8)]
   5.343 +    bool DisallowStartIfOnBatteries { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(8)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(8)] set; }
   5.344 +    [DispId(9)]
   5.345 +    bool AllowHardTerminate { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(9)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(9)] set; }
   5.346 +    [DispId(10)]
   5.347 +    bool StartWhenAvailable { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(10)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(10)] set; }
   5.348 +    [DispId(11)]
   5.349 +    string XmlText { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(11)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(11)] set; }
   5.350 +    [DispId(12)]
   5.351 +    bool RunOnlyIfNetworkAvailable { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] set; }
   5.352 +    [DispId(13)]
   5.353 +    string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(13)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(13)] set; }
   5.354 +    [DispId(14)]
   5.355 +    bool Enabled { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(14)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(14)] set; }
   5.356 +    [DispId(15)]
   5.357 +    string DeleteExpiredTaskAfter { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(15)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(15)] set; }
   5.358 +    [DispId(0x10)]
   5.359 +    int Priority { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x10)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x10)] set; }
   5.360 +    [DispId(0x12)]
   5.361 +    bool Hidden { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x12)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x12)] set; }
   5.362 +    [DispId(20)]
   5.363 +    bool RunOnlyIfIdle { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(20)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(20)] set; }
   5.364 +    [DispId(0x15)]
   5.365 +    bool WakeToRun { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x15)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x15)] set; }
   5.366 +  }
   5.367 +
   5.368 +  [ComImport, TypeLibType((short)0x10c0), Guid("09941815-EA89-4B5B-89E0-2A773801FAC3")]
   5.369 +  public interface ITrigger {
   5.370 +    [DispId(1)]
   5.371 +    TASK_TRIGGER_TYPE2 Type { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; }
   5.372 +    [DispId(2)]
   5.373 +    string Id { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] set; }
   5.374 +    [DispId(4)]
   5.375 +    string ExecutionTimeLimit { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] set; }
   5.376 +    [DispId(5)]
   5.377 +    string StartBoundary { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] set; }
   5.378 +    [DispId(6)]
   5.379 +    string EndBoundary { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] set; }
   5.380 +    [DispId(7)]
   5.381 +    bool Enabled { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] set; }
   5.382 +  }
   5.383 +
   5.384 +  [ComImport, TypeLibType((short)0x10c0), Guid("85DF5081-1B24-4F32-878A-D9D14DF4CB77")]
   5.385 +  public interface ITriggerCollection : IEnumerable {
   5.386 +    [DispId(1)]
   5.387 +    int Count { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; }
   5.388 +    [DispId(0)]
   5.389 +    ITrigger this[int index] { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; }
   5.390 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.391 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)]
   5.392 +    ITrigger Create([In] TASK_TRIGGER_TYPE2 Type);
   5.393 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)]
   5.394 +    void Remove([In, MarshalAs(UnmanagedType.Struct)] object index);
   5.395 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)]
   5.396 +    void Clear();
   5.397 +  }
   5.398 +
   5.399 +  [ComImport, CoClass(typeof(TaskSchedulerClass)), Guid("2FABA4C7-4DA9-4013-9697-20CC3FD40F85")]
   5.400 +  public interface TaskScheduler : ITaskService {
   5.401 +  }
   5.402 +
   5.403 +  [ComImport, ClassInterface((short)0), DefaultMember("TargetServer"), Guid("0F87369F-A4E5-4CFC-BD3E-73E6154572DD"), TypeLibType((short)2)]
   5.404 +  public class TaskSchedulerClass : ITaskService, TaskScheduler {
   5.405 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)]
   5.406 +    public virtual extern void Connect([In, Optional, MarshalAs(UnmanagedType.Struct)] object serverName, [In, Optional, MarshalAs(UnmanagedType.Struct)] object user, [In, Optional, MarshalAs(UnmanagedType.Struct)] object domain, [In, Optional, MarshalAs(UnmanagedType.Struct)] object password);
   5.407 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.408 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)]
   5.409 +    public virtual extern ITaskFolder GetFolder([In, MarshalAs(UnmanagedType.BStr)] string Path);
   5.410 +    [return: MarshalAs(UnmanagedType.Interface)]
   5.411 +    [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)]
   5.412 +    public virtual extern ITaskDefinition NewTask([In] uint flags);
   5.413 +    [DispId(5)]
   5.414 +    public virtual extern bool Connected { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] get; }
   5.415 +    [DispId(7)]
   5.416 +    public virtual extern string ConnectedDomain { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] get; }
   5.417 +    [DispId(6)]
   5.418 +    public virtual extern string ConnectedUser { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] get; }
   5.419 +    [DispId(8)]
   5.420 +    public virtual extern uint HighestVersion { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(8)] get; }
   5.421 +    [DispId(0)]
   5.422 +    public virtual extern string TargetServer { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; }
   5.423 +  }
   5.424 +}
   5.425 +
   5.426 +
     6.1 --- a/OpenHardwareMonitor.csproj	Mon Mar 22 17:58:21 2010 +0000
     6.2 +++ b/OpenHardwareMonitor.csproj	Fri Mar 26 20:58:10 2010 +0000
     6.3 @@ -66,6 +66,8 @@
     6.4      </Compile>
     6.5      <Compile Include="GUI\SensorNotifyIcon.cs" />
     6.6      <Compile Include="GUI\SensorSystemTray.cs" />
     6.7 +    <Compile Include="GUI\StartupManager.cs" />
     6.8 +    <Compile Include="GUI\TaskScheduler.cs" />
     6.9      <Compile Include="GUI\TypeNode.cs" />
    6.10      <Compile Include="Hardware\CPU\AMD10CPU.cs" />
    6.11      <Compile Include="Hardware\CPU\AMD0FCPU.cs" />