# HG changeset patch # User moel.mich # Date 1269637090 0 # Node ID 91edecb084a13b90918fa89e0da41d530023bda2 # Parent 7f4079703ab033da42fd91119a61f98c9acb0975 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. diff -r 7f4079703ab0 -r 91edecb084a1 External/WinRing0.vxd Binary file External/WinRing0.vxd has changed diff -r 7f4079703ab0 -r 91edecb084a1 GUI/MainForm.Designer.cs --- a/GUI/MainForm.Designer.cs Mon Mar 22 17:58:21 2010 +0000 +++ b/GUI/MainForm.Designer.cs Fri Mar 26 20:58:10 2010 +0000 @@ -97,6 +97,7 @@ this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.startMinMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.minTrayMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.startupMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); this.hddMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -105,7 +106,7 @@ this.splitContainer = new System.Windows.Forms.SplitContainer(); this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel(); this.notifyContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); - this.restoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.hideShowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); @@ -427,6 +428,7 @@ this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.startMinMenuItem, this.minTrayMenuItem, + this.startupMenuItem, this.toolStripMenuItem3, this.hddMenuItem}); this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; @@ -437,28 +439,35 @@ // this.startMinMenuItem.CheckOnClick = true; this.startMinMenuItem.Name = "startMinMenuItem"; - this.startMinMenuItem.Size = new System.Drawing.Size(166, 22); + this.startMinMenuItem.Size = new System.Drawing.Size(207, 22); this.startMinMenuItem.Text = "Start Minimized"; // // minTrayMenuItem // - this.minTrayMenuItem.Checked = true; this.minTrayMenuItem.CheckOnClick = true; - this.minTrayMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.minTrayMenuItem.Name = "minTrayMenuItem"; - this.minTrayMenuItem.Size = new System.Drawing.Size(166, 22); + this.minTrayMenuItem.Size = new System.Drawing.Size(207, 22); this.minTrayMenuItem.Text = "Minimize To Tray"; + this.minTrayMenuItem.CheckedChanged += new System.EventHandler(this.minTrayMenuItem_CheckedChanged); + // + // startupMenuItem + // + this.startupMenuItem.CheckOnClick = true; + this.startupMenuItem.Name = "startupMenuItem"; + this.startupMenuItem.Size = new System.Drawing.Size(207, 22); + this.startupMenuItem.Text = "Run On Windows Startup"; + this.startupMenuItem.CheckedChanged += new System.EventHandler(this.runOnWindowsStartupToolStripMenuItem_CheckedChanged); // // toolStripMenuItem3 // this.toolStripMenuItem3.Name = "toolStripMenuItem3"; - this.toolStripMenuItem3.Size = new System.Drawing.Size(163, 6); + this.toolStripMenuItem3.Size = new System.Drawing.Size(204, 6); // // hddMenuItem // this.hddMenuItem.CheckOnClick = true; this.hddMenuItem.Name = "hddMenuItem"; - this.hddMenuItem.Size = new System.Drawing.Size(166, 22); + this.hddMenuItem.Size = new System.Drawing.Size(207, 22); this.hddMenuItem.Text = "HDD sensors"; this.hddMenuItem.CheckedChanged += new System.EventHandler(this.hddsensorsToolStripMenuItem_CheckedChanged); // @@ -515,29 +524,29 @@ // notifyContextMenuStrip // this.notifyContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.restoreToolStripMenuItem, + this.hideShowToolStripMenuItem, this.toolStripMenuItem2, this.exitToolStripMenuItem1}); this.notifyContextMenuStrip.Name = "notifyContextMenuStrip"; - this.notifyContextMenuStrip.Size = new System.Drawing.Size(119, 54); + this.notifyContextMenuStrip.Size = new System.Drawing.Size(153, 76); // - // restoreToolStripMenuItem + // hideShowToolStripMenuItem // - this.restoreToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold); - this.restoreToolStripMenuItem.Name = "restoreToolStripMenuItem"; - this.restoreToolStripMenuItem.Size = new System.Drawing.Size(118, 22); - this.restoreToolStripMenuItem.Text = "Restore"; - this.restoreToolStripMenuItem.Click += new System.EventHandler(this.restoreClick); + this.hideShowToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold); + this.hideShowToolStripMenuItem.Name = "hideShowToolStripMenuItem"; + this.hideShowToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.hideShowToolStripMenuItem.Text = "Hide/Show"; + this.hideShowToolStripMenuItem.Click += new System.EventHandler(this.hideShowClick); // // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(115, 6); + this.toolStripMenuItem2.Size = new System.Drawing.Size(149, 6); // // exitToolStripMenuItem1 // this.exitToolStripMenuItem1.Name = "exitToolStripMenuItem1"; - this.exitToolStripMenuItem1.Size = new System.Drawing.Size(118, 22); + this.exitToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); this.exitToolStripMenuItem1.Text = "Exit"; this.exitToolStripMenuItem1.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -613,7 +622,7 @@ private System.Windows.Forms.ToolStripMenuItem hddMenuItem; private System.Windows.Forms.ToolStripMenuItem loadMenuItem; private System.Windows.Forms.ContextMenuStrip notifyContextMenuStrip; - private System.Windows.Forms.ToolStripMenuItem restoreToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem hideShowToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem minTrayMenuItem; @@ -621,6 +630,7 @@ private System.Windows.Forms.ContextMenuStrip sensorContextMenuStrip; private System.Windows.Forms.ToolStripMenuItem startMinMenuItem; private System.Windows.Forms.ToolStripMenuItem flowsMenuItem; + private System.Windows.Forms.ToolStripMenuItem startupMenuItem; } } diff -r 7f4079703ab0 -r 91edecb084a1 GUI/MainForm.cs --- a/GUI/MainForm.cs Mon Mar 22 17:58:21 2010 +0000 +++ b/GUI/MainForm.cs Fri Mar 26 20:58:10 2010 +0000 @@ -58,6 +58,7 @@ private Color[] plotColorPalette; private SensorSystemTray sensorSystemTray; private NotifyIcon notifyIcon; + private StartupManager startupManager = new StartupManager(); public MainForm() { InitializeComponent(); @@ -105,7 +106,7 @@ notifyIcon.ContextMenuStrip = this.notifyContextMenuStrip; notifyIcon.Icon = EmbeddedResources.GetIcon("smallicon.ico"); notifyIcon.Text = "Open Hardware Monitor"; - notifyIcon.DoubleClick += new EventHandler(this.restoreClick); + notifyIcon.DoubleClick += new EventHandler(this.hideShowClick); sensorSystemTray = new SensorSystemTray(computer); @@ -136,6 +137,7 @@ startMinMenuItem.Checked = Config.Get(startMinMenuItem.Name, false); minTrayMenuItem.Checked = Config.Get(minTrayMenuItem.Name, true); + startupMenuItem.Checked = startupManager.Startup; hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true); voltMenuItem.Checked = Config.Get(voltMenuItem.Name, true); @@ -148,9 +150,7 @@ timer.Enabled = true; if (startMinMenuItem.Checked) { - if (minTrayMenuItem.Checked) { - notifyIcon.Visible = true; - } else { + if (!minTrayMenuItem.Checked) { WindowState = FormWindowState.Minimized; Show(); } @@ -273,7 +273,7 @@ Config.Set(loadMenuItem.Name, loadMenuItem.Checked); Config.Set(tempMenuItem.Name, tempMenuItem.Checked); Config.Set(fansMenuItem.Name, fansMenuItem.Checked); - Config.Set(flowsMenuItem.Name, flowsMenuItem.Checked); + Config.Set(flowsMenuItem.Name, flowsMenuItem.Checked); if (WindowState != FormWindowState.Minimized) { Config.Set("mainForm.Location.X", Location.X); @@ -391,15 +391,10 @@ UpdateSensorTypeVisible(node); } - private void ToggleSysTray() { - if (notifyIcon.Visible) { - Visible = true; - notifyIcon.Visible = false; - Activate(); - } else { - notifyIcon.Visible = true; - Visible = false; - } + private void SysTrayHideShow() { + Visible = !Visible; + if (Visible) + Activate(); } protected override void WndProc(ref Message m) { @@ -407,14 +402,14 @@ const int SC_MINIMIZE = 0xF020; if (minTrayMenuItem.Checked && m.Msg == WM_SYSCOMMAND && m.WParam.ToInt32() == SC_MINIMIZE) { - ToggleSysTray(); + SysTrayHideShow(); } else { base.WndProc(ref m); } } - private void restoreClick(object sender, EventArgs e) { - ToggleSysTray(); + private void hideShowClick(object sender, EventArgs e) { + SysTrayHideShow(); } private void removeToolStripMenuItem_Click(object sender, EventArgs e) { @@ -444,5 +439,15 @@ ShowParameterForm(node.Sensor); } } + + private void runOnWindowsStartupToolStripMenuItem_CheckedChanged( + object sender, EventArgs e) + { + startupManager.Startup = startupMenuItem.Checked; + } + + private void minTrayMenuItem_CheckedChanged(object sender, EventArgs e) { + notifyIcon.Visible = minTrayMenuItem.Checked; + } } } diff -r 7f4079703ab0 -r 91edecb084a1 GUI/StartupManager.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/StartupManager.cs Fri Mar 26 20:58:10 2010 +0000 @@ -0,0 +1,160 @@ +/* + + Version: MPL 1.1/GPL 2.0/LGPL 2.1 + + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + for the specific language governing rights and limitations under the License. + + The Original Code is the Open Hardware Monitor code. + + The Initial Developer of the Original Code is + Michael Möller . + Portions created by the Initial Developer are Copyright (C) 2009-2010 + the Initial Developer. All Rights Reserved. + + Contributor(s): + + Alternatively, the contents of this file may be used under the terms of + either the GNU General Public License Version 2 or later (the "GPL"), or + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + in which case the provisions of the GPL or the LGPL are applicable instead + of those above. If you wish to allow use of your version of this file only + under the terms of either the GPL or the LGPL, and not to allow others to + use your version of this file under the terms of the MPL, indicate your + decision by deleting the provisions above and replace them with the notice + and other provisions required by the GPL or the LGPL. If you do not delete + the provisions above, a recipient may use your version of this file under + the terms of any one of the MPL, the GPL or the LGPL. + +*/ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Windows.Forms; +using Microsoft.Win32; +using OpenHardwareMonitor.TaskScheduler; + +namespace OpenHardwareMonitor.GUI { + public class StartupManager { + + private TaskSchedulerClass scheduler; + private bool startup; + + private const string REGISTRY_RUN = + @"Software\Microsoft\Windows\CurrentVersion\Run"; + + public StartupManager() { + try { + scheduler = new TaskSchedulerClass(); + scheduler.Connect(null, null, null, null); + } catch (Exception) { + scheduler = null; + } + + if (scheduler != null) { + try { + ITaskFolder folder = scheduler.GetFolder("\\Open Hardware Monitor"); + IRegisteredTask task = folder.GetTask("Startup"); + startup = task != null; + } catch (FileNotFoundException) { + startup = false; + } + } else { + RegistryKey key = Registry.CurrentUser.OpenSubKey(REGISTRY_RUN); + startup = false; + if (key != null) { + string value = (string)key.GetValue("OpenHardwareMonitor"); + if (value != null) + startup = value == Application.ExecutablePath; + } + } + } + + private void CreateSchedulerTask() { + ITaskDefinition definition = scheduler.NewTask(0); + definition.RegistrationInfo.Description = + "This task starts the Open Hardware Monitor on Windows startup."; + definition.Principal.RunLevel = + TASK_RUNLEVEL.TASK_RUNLEVEL_HIGHEST; + definition.Settings.DisallowStartIfOnBatteries = false; + definition.Settings.StopIfGoingOnBatteries = false; + definition.Settings.ExecutionTimeLimit = "PT0S"; + + ILogonTrigger trigger = (ILogonTrigger)definition.Triggers.Create( + TASK_TRIGGER_TYPE2.TASK_TRIGGER_LOGON); + + IExecAction action = (IExecAction)definition.Actions.Create( + TASK_ACTION_TYPE.TASK_ACTION_EXEC); + action.Path = Application.ExecutablePath; + action.WorkingDirectory = + Path.GetDirectoryName(Application.ExecutablePath); + + ITaskFolder root = scheduler.GetFolder("\\"); + ITaskFolder folder; + try { + folder = root.GetFolder("Open Hardware Monitor"); + } catch (FileNotFoundException) { + folder = root.CreateFolder("Open Hardware Monitor", ""); + } + folder.RegisterTaskDefinition("Startup", definition, + (int)TASK_CREATION.TASK_CREATE_OR_UPDATE, null, null, + TASK_LOGON_TYPE.TASK_LOGON_INTERACTIVE_TOKEN, ""); + } + + private void DeleteSchedulerTask() { + ITaskFolder root = scheduler.GetFolder("\\"); + try { + ITaskFolder folder = root.GetFolder("Open Hardware Monitor"); + folder.DeleteTask("Startup", 0); + } catch (FileNotFoundException) { } + try { + root.DeleteFolder("Open Hardware Monitor", 0); + } catch (FileNotFoundException) { } + } + + private void CreateRegistryRun() { + RegistryKey key = Registry.CurrentUser.CreateSubKey(REGISTRY_RUN); + key.SetValue("OpenHardwareMonitor", Application.ExecutablePath); + } + + private void DeleteRegistryRun() { + RegistryKey key = Registry.CurrentUser.CreateSubKey(REGISTRY_RUN); + key.DeleteValue("OpenHardwareMonitor"); + } + + public bool Startup { + get { + return startup; + } + set { + if (startup != value) { + startup = value; + if (scheduler != null) { + if (startup) + CreateSchedulerTask(); + else + DeleteSchedulerTask(); + } else { + if (startup) + CreateRegistryRun(); + else + DeleteRegistryRun(); + } + } + } + } + } + + + + + +} diff -r 7f4079703ab0 -r 91edecb084a1 GUI/TaskScheduler.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/TaskScheduler.cs Fri Mar 26 20:58:10 2010 +0000 @@ -0,0 +1,423 @@ +/* + + Version: MPL 1.1/GPL 2.0/LGPL 2.1 + + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + for the specific language governing rights and limitations under the License. + + The Original Code is the Open Hardware Monitor code. + + The Initial Developer of the Original Code is + Michael Möller . + Portions created by the Initial Developer are Copyright (C) 2009-2010 + the Initial Developer. All Rights Reserved. + + Contributor(s): + + Alternatively, the contents of this file may be used under the terms of + either the GNU General Public License Version 2 or later (the "GPL"), or + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + in which case the provisions of the GPL or the LGPL are applicable instead + of those above. If you wish to allow use of your version of this file only + under the terms of either the GPL or the LGPL, and not to allow others to + use your version of this file under the terms of the MPL, indicate your + decision by deleting the provisions above and replace them with the notice + and other provisions required by the GPL or the LGPL. If you do not delete + the provisions above, a recipient may use your version of this file under + the terms of any one of the MPL, the GPL or the LGPL. + +*/ + +using System; +using System.Collections; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace OpenHardwareMonitor.TaskScheduler { + + public enum TASK_ACTION_TYPE { + TASK_ACTION_COM_HANDLER = 5, + TASK_ACTION_EXEC = 0, + TASK_ACTION_SEND_EMAIL = 6, + TASK_ACTION_SHOW_MESSAGE = 7 + } + + public enum TASK_CREATION { + TASK_CREATE = 2, + TASK_CREATE_OR_UPDATE = 6, + TASK_DISABLE = 8, + TASK_DONT_ADD_PRINCIPAL_ACE = 0x10, + TASK_IGNORE_REGISTRATION_TRIGGERS = 0x20, + TASK_UPDATE = 4, + TASK_VALIDATE_ONLY = 1 + } + + public enum TASK_ENUM_FLAGS { + TASK_ENUM_HIDDEN = 1 + } + + public enum TASK_INSTANCES_POLICY { + TASK_INSTANCES_PARALLEL, + TASK_INSTANCES_QUEUE, + TASK_INSTANCES_IGNORE_NEW, + TASK_INSTANCES_STOP_EXISTING + } + + public enum TASK_LOGON_TYPE { + TASK_LOGON_NONE, + TASK_LOGON_PASSWORD, + TASK_LOGON_S4U, + TASK_LOGON_INTERACTIVE_TOKEN, + TASK_LOGON_GROUP, + TASK_LOGON_SERVICE_ACCOUNT, + TASK_LOGON_INTERACTIVE_TOKEN_OR_PASSWORD + } + + public enum TASK_RUN_FLAGS { + TASK_RUN_AS_SELF = 1, + TASK_RUN_IGNORE_CONSTRAINTS = 2, + TASK_RUN_NO_FLAGS = 0, + TASK_RUN_USE_SESSION_ID = 4, + TASK_RUN_USER_SID = 8 + } + + public enum TASK_RUNLEVEL { + TASK_RUNLEVEL_LUA, + TASK_RUNLEVEL_HIGHEST + } + + public enum TASK_STATE { + TASK_STATE_UNKNOWN, + TASK_STATE_DISABLED, + TASK_STATE_QUEUED, + TASK_STATE_READY, + TASK_STATE_RUNNING + } + + public enum TASK_TRIGGER_TYPE2 { + TASK_TRIGGER_BOOT = 8, + TASK_TRIGGER_DAILY = 2, + TASK_TRIGGER_EVENT = 0, + TASK_TRIGGER_IDLE = 6, + TASK_TRIGGER_LOGON = 9, + TASK_TRIGGER_MONTHLY = 4, + TASK_TRIGGER_MONTHLYDOW = 5, + TASK_TRIGGER_REGISTRATION = 7, + TASK_TRIGGER_SESSION_STATE_CHANGE = 11, + TASK_TRIGGER_TIME = 1, + TASK_TRIGGER_WEEKLY = 3 + } + + [ComImport, TypeLibType((short)0x10c0), Guid("BAE54997-48B1-4CBE-9965-D6BE263EBEA4")] + public interface IAction { + [DispId(1)] + 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; } + [DispId(2)] + TASK_ACTION_TYPE Type { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] get; } + } + + [ComImport, TypeLibType((short)0x10c0), Guid("02820E19-7B98-4ED2-B2E8-FDCCCEFF619B")] + public interface IActionCollection : IEnumerable { + [DispId(1)] + int Count { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; } + [DispId(0)] + IAction this[int index] { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; } + [DispId(2)] + 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; } + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] + IAction Create([In] TASK_ACTION_TYPE Type); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] + void Remove([In, MarshalAs(UnmanagedType.Struct)] object index); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] + void Clear(); + [DispId(6)] + 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; } + } + + [ComImport, Guid("4C3D624D-FD6B-49A3-B9B7-09CB3CD3F047"), TypeLibType((short)0x10c0)] + public interface IExecAction : IAction { + [DispId(10)] + 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; } + [DispId(11)] + 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; } + [DispId(12)] + 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; } + } + + [ComImport, Guid("72DADE38-FAE4-4B3E-BAF4-5D009AF02B1C"), TypeLibType((short)0x10c0)] + public interface ILogonTrigger : ITrigger { + [DispId(20)] + 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; } + [DispId(0x15)] + 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; } + } + + [ComImport, Guid("D98D51E5-C9B4-496A-A9C1-18980261CF0F"), TypeLibType((short)0x10c0)] + public interface IPrincipal { + [DispId(1)] + 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; } + [DispId(2)] + 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; } + [DispId(3)] + 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; } + [DispId(4)] + TASK_LOGON_TYPE LogonType { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] set; } + [DispId(5)] + 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; } + [DispId(6)] + TASK_RUNLEVEL RunLevel { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] set; } + } + + [ComImport, DefaultMember("Path"), Guid("9C86F320-DEE3-4DD1-B972-A303F26B061E"), TypeLibType((short)0x10c0), ComConversionLoss] + public interface IRegisteredTask { + [DispId(1)] + string Name { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; } + [DispId(0)] + string Path { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; } + [DispId(2)] + TASK_STATE State { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] get; } + [DispId(3)] + bool Enabled { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] get; [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] set; } + [DispId(8)] + DateTime LastRunTime { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(8)] get; } + [DispId(9)] + int LastTaskResult { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(9)] get; } + [DispId(11)] + int NumberOfMissedRuns { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(11)] get; } + [DispId(12)] + DateTime NextRunTime { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] get; } + [DispId(13)] + ITaskDefinition Definition { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(13)] get; } + [DispId(14)] + string Xml { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(14)] get; } + [return: MarshalAs(UnmanagedType.BStr)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(15)] + string GetSecurityDescriptor([In] int securityInformation); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x10)] + void SetSecurityDescriptor([In, MarshalAs(UnmanagedType.BStr)] string sddl, [In] int flags); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x11)] + void Stop([In] int flags); + } + + [ComImport, TypeLibType((short)0x10c0), Guid("86627EB4-42A7-41E4-A4D9-AC33A72F2D52")] + public interface IRegisteredTaskCollection : IEnumerable { + [DispId(0x60020000)] + int Count { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020000)] get; } + [DispId(0)] + IRegisteredTask this[object index] { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; } + } + + [ComImport, Guid("416D8B73-CB41-4EA1-805C-9BE9A5AC4A74"), TypeLibType((short)0x10c0)] + public interface IRegistrationInfo { + [DispId(1)] + 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; } + [DispId(2)] + 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; } + [DispId(4)] + 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; } + [DispId(5)] + 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; } + [DispId(6)] + 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; } + [DispId(9)] + 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; } + [DispId(10)] + 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; } + [DispId(11)] + 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; } + [DispId(12)] + 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; } + } + + [ComImport, TypeLibType((short)0x10c0), Guid("F5BC8FC5-536D-4F77-B852-FBC1356FDEB6")] + public interface ITaskDefinition { + [DispId(1)] + 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; } + [DispId(2)] + 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; } + [DispId(7)] + 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; } + [DispId(11)] + 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; } + [DispId(12)] + 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; } + [DispId(13)] + 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; } + [DispId(14)] + 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; } + } + + [ComImport, DefaultMember("Path"), Guid("8CFAC062-A080-4C15-9A88-AA7C2AF80DFC"), TypeLibType((short)0x10c0)] + public interface ITaskFolder { + [DispId(1)] + string Name { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; } + [DispId(0)] + string Path { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; } + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] + ITaskFolder GetFolder([MarshalAs(UnmanagedType.BStr)] string Path); + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] + ITaskFolderCollection GetFolders([In] int flags); + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] + ITaskFolder CreateFolder([In, MarshalAs(UnmanagedType.BStr)] string subFolderName, [In, Optional, MarshalAs(UnmanagedType.Struct)] object sddl); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] + void DeleteFolder([MarshalAs(UnmanagedType.BStr)] string subFolderName, [In] int flags); + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] + IRegisteredTask GetTask([In, MarshalAs(UnmanagedType.BStr)] string Path); + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(8)] + IRegisteredTaskCollection GetTasks([In] int flags); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(9)] + void DeleteTask([In, MarshalAs(UnmanagedType.BStr)] string Name, [In] int flags); + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(10)] + 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); + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(11)] + 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); + [return: MarshalAs(UnmanagedType.BStr)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] + string GetSecurityDescriptor(int securityInformation); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(13)] + void SetSecurityDescriptor([In, MarshalAs(UnmanagedType.BStr)] string sddl, [In] int flags); + } + + [ComImport, TypeLibType((short)0x10c0), Guid("79184A66-8664-423F-97F1-637356A5D812")] + public interface ITaskFolderCollection : IEnumerable { + [DispId(0x60020000)] + int Count { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020000)] get; } + [DispId(0)] + ITaskFolder this[object index] { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; } + } + + [ComImport, TypeLibType((short)0x10c0), DefaultMember("TargetServer"), Guid("2FABA4C7-4DA9-4013-9697-20CC3FD40F85")] + public interface ITaskService { + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] + ITaskFolder GetFolder([In, MarshalAs(UnmanagedType.BStr)] string Path); + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] + ITaskDefinition NewTask([In] uint flags); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] + 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); + [DispId(5)] + bool Connected { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] get; } + [DispId(0)] + string TargetServer { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; } + [DispId(6)] + string ConnectedUser { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] get; } + [DispId(7)] + string ConnectedDomain { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] get; } + [DispId(8)] + uint HighestVersion { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(8)] get; } + } + + [ComImport, TypeLibType((short)0x10c0), Guid("8FD4711D-2D02-4C8C-87E3-EFF699DE127E")] + public interface ITaskSettings { + [DispId(3)] + bool AllowDemandStart { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] set; } + [DispId(4)] + 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; } + [DispId(5)] + int RestartCount { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] set; } + [DispId(6)] + TASK_INSTANCES_POLICY MultipleInstances { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] set; } + [DispId(7)] + bool StopIfGoingOnBatteries { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] set; } + [DispId(8)] + bool DisallowStartIfOnBatteries { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(8)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(8)] set; } + [DispId(9)] + bool AllowHardTerminate { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(9)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(9)] set; } + [DispId(10)] + bool StartWhenAvailable { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(10)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(10)] set; } + [DispId(11)] + 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; } + [DispId(12)] + bool RunOnlyIfNetworkAvailable { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(12)] set; } + [DispId(13)] + 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; } + [DispId(14)] + bool Enabled { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(14)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(14)] set; } + [DispId(15)] + 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; } + [DispId(0x10)] + int Priority { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x10)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x10)] set; } + [DispId(0x12)] + bool Hidden { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x12)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x12)] set; } + [DispId(20)] + bool RunOnlyIfIdle { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(20)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(20)] set; } + [DispId(0x15)] + bool WakeToRun { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x15)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x15)] set; } + } + + [ComImport, TypeLibType((short)0x10c0), Guid("09941815-EA89-4B5B-89E0-2A773801FAC3")] + public interface ITrigger { + [DispId(1)] + TASK_TRIGGER_TYPE2 Type { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; } + [DispId(2)] + 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; } + [DispId(4)] + 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; } + [DispId(5)] + 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; } + [DispId(6)] + 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; } + [DispId(7)] + bool Enabled { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] set; } + } + + [ComImport, TypeLibType((short)0x10c0), Guid("85DF5081-1B24-4F32-878A-D9D14DF4CB77")] + public interface ITriggerCollection : IEnumerable { + [DispId(1)] + int Count { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; } + [DispId(0)] + ITrigger this[int index] { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; } + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(2)] + ITrigger Create([In] TASK_TRIGGER_TYPE2 Type); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] + void Remove([In, MarshalAs(UnmanagedType.Struct)] object index); + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] + void Clear(); + } + + [ComImport, CoClass(typeof(TaskSchedulerClass)), Guid("2FABA4C7-4DA9-4013-9697-20CC3FD40F85")] + public interface TaskScheduler : ITaskService { + } + + [ComImport, ClassInterface((short)0), DefaultMember("TargetServer"), Guid("0F87369F-A4E5-4CFC-BD3E-73E6154572DD"), TypeLibType((short)2)] + public class TaskSchedulerClass : ITaskService, TaskScheduler { + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(4)] + 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); + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] + public virtual extern ITaskFolder GetFolder([In, MarshalAs(UnmanagedType.BStr)] string Path); + [return: MarshalAs(UnmanagedType.Interface)] + [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(3)] + public virtual extern ITaskDefinition NewTask([In] uint flags); + [DispId(5)] + public virtual extern bool Connected { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(5)] get; } + [DispId(7)] + public virtual extern string ConnectedDomain { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(7)] get; } + [DispId(6)] + public virtual extern string ConnectedUser { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(6)] get; } + [DispId(8)] + public virtual extern uint HighestVersion { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(8)] get; } + [DispId(0)] + public virtual extern string TargetServer { [return: MarshalAs(UnmanagedType.BStr)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; } + } +} + + diff -r 7f4079703ab0 -r 91edecb084a1 OpenHardwareMonitor.csproj --- a/OpenHardwareMonitor.csproj Mon Mar 22 17:58:21 2010 +0000 +++ b/OpenHardwareMonitor.csproj Fri Mar 26 20:58:10 2010 +0000 @@ -66,6 +66,8 @@ + +