2 * Task Scheduler Service interface
4 * Copyright (C) 2008 Google (Roy Shea)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 cpp_quote("#define TASK_SUNDAY 0x1")
26 cpp_quote("#define TASK_MONDAY 0x2")
27 cpp_quote("#define TASK_TUESDAY 0x4")
28 cpp_quote("#define TASK_WEDNESDAY 0x8")
29 cpp_quote("#define TASK_THURSDAY 0x10")
30 cpp_quote("#define TASK_FRIDAY 0x20")
31 cpp_quote("#define TASK_SATURDAY 0x40")
33 cpp_quote("#define TASK_FIRST_WEEK 1")
34 cpp_quote("#define TASK_SECOND_WEEK 2")
35 cpp_quote("#define TASK_THIRD_WEEK 3")
36 cpp_quote("#define TASK_FOURTH_WEEK 4")
37 cpp_quote("#define TASK_LAST_WEEK 5")
39 cpp_quote("#define TASK_JANUARY 0x1")
40 cpp_quote("#define TASK_FEBRUARY 0x2")
41 cpp_quote("#define TASK_MARCH 0x4")
42 cpp_quote("#define TASK_APRIL 0x8")
43 cpp_quote("#define TASK_MAY 0x10")
44 cpp_quote("#define TASK_JUNE 0x20")
45 cpp_quote("#define TASK_JULY 0x40")
46 cpp_quote("#define TASK_AUGUST 0x80")
47 cpp_quote("#define TASK_SEPTEMBER 0x100")
48 cpp_quote("#define TASK_OCTOBER 0x200")
49 cpp_quote("#define TASK_NOVEMBER 0x400")
50 cpp_quote("#define TASK_DECEMBER 0x800")
52 cpp_quote("#define TASK_TRIGGER_FLAG_HAS_END_DATE 0x1")
53 cpp_quote("#define TASK_TRIGGER_FLAG_KILL_AT_DURATION_END 0x2")
54 cpp_quote("#define TASK_TRIGGER_FLAG_DISABLED 0x4")
59 uuid(148BD528-A2AB-11CE-B11F-00AA00530503),
60 pointer_default(unique)
62 interface IEnumWorkItems : IUnknown
66 [out] LPWSTR **rgpwszNames,
67 [out] ULONG *pceltFetched);
75 [out] IEnumWorkItems **ppEnumWorkItems);
78 cpp_quote("#ifndef _HPROPSHEETPAGE_DEFINED")
79 typedef struct _PSP *HPROPSHEETPAGE;
80 cpp_quote("#define _HPROPSHEETPAGE_DEFINED")
86 uuid(4086658a-cbbb-11cf-b604-00c04fd8d565),
87 pointer_default(unique)
89 interface IProvideTaskPage : IUnknown
91 typedef enum _TASKPAGE {
93 TASKPAGE_SCHEDULE = 1,
99 [in] BOOL fPersistChanges,
100 [out] HPROPSHEETPAGE *phPage);
106 uuid(148BD52B-A2AB-11CE-B11F-00AA00530503),
107 pointer_default(unique)
109 interface ITaskTrigger : IUnknown
111 typedef enum _TASK_TRIGGER_TYPE {
112 TASK_TIME_TRIGGER_ONCE = 0,
113 TASK_TIME_TRIGGER_DAILY = 1,
114 TASK_TIME_TRIGGER_WEEKLY = 2,
115 TASK_TIME_TRIGGER_MONTHLYDATE = 3,
116 TASK_TIME_TRIGGER_MONTHLYDOW = 4,
117 TASK_EVENT_TRIGGER_ON_IDLE = 5,
118 TASK_EVENT_TRIGGER_AT_SYSTEMSTART = 6,
119 TASK_EVENT_TRIGGER_AT_LOGON = 7
120 } TASK_TRIGGER_TYPE, *PTASK_TRIGGER_TYPE;
122 typedef struct _DAILY {
126 typedef struct _WEEKLY {
128 WORD rgfDaysOfTheWeek;
131 typedef struct _MONTHLYDATE {
136 typedef struct _MONTHLYDOW {
138 WORD rgfDaysOfTheWeek;
142 typedef union _TRIGGER_TYPE_UNION {
145 MONTHLYDATE MonthlyDate;
146 MONTHLYDOW MonthlyDOW;
147 } TRIGGER_TYPE_UNION;
149 typedef struct _TASK_TRIGGER {
160 DWORD MinutesDuration;
161 DWORD MinutesInterval;
163 TASK_TRIGGER_TYPE TriggerType;
164 TRIGGER_TYPE_UNION Type;
166 WORD wRandomMinutesInterval;
167 } TASK_TRIGGER, *PTASK_TRIGGER;
170 [in] const PTASK_TRIGGER pTrigger);
173 [out] PTASK_TRIGGER pTrigger);
175 HRESULT GetTriggerString(
176 [out] LPWSTR *ppwszTrigger);
182 uuid(a6b952f0-a4b1-11d0-997d-00aa006887ec),
183 pointer_default(unique)
185 interface IScheduledWorkItem : IUnknown
187 HRESULT CreateTrigger(
188 [out] WORD *piNewTrigger,
189 [out] ITaskTrigger **ppTrigger);
191 HRESULT DeleteTrigger(
194 HRESULT GetTriggerCount(
195 [out] WORD *plCount);
199 [out] ITaskTrigger **ppTrigger);
201 HRESULT GetTriggerString(
203 [out] LPWSTR *ppwszTrigger);
206 [in] const LPSYSTEMTIME pstBegin,
207 [in] const LPSYSTEMTIME pstEnd,
208 [in, out] WORD *pCount,
209 [out] LPSYSTEMTIME *rgstTaskTimes);
211 HRESULT GetNextRunTime(
212 [out] SYSTEMTIME *pstNextRun);
215 [in] WORD wIdleMinutes,
216 [in] WORD wDeadlineMinutes);
219 [out] WORD *pwIdleMinutes,
220 [out] WORD *pwDeadlineMinutes);
226 HRESULT EditWorkItem(
228 [in] DWORD dwReserved);
230 HRESULT GetMostRecentRunTime(
231 [out] SYSTEMTIME *pstLastRun);
234 [out] HRESULT *phrStatus);
237 [out] DWORD *pdwExitCode);
240 [in] LPCWSTR pwszComment);
243 [out] LPWSTR *ppwszComment);
246 LPCWSTR pwszCreator);
249 [out] LPWSTR *ppwszCreator);
251 HRESULT SetWorkItemData(
253 [in] BYTE rgbData[]);
255 HRESULT GetWorkItemData(
257 [out] BYTE **ppBytes);
259 HRESULT SetErrorRetryCount(
262 HRESULT GetErrorRetryCount(
263 [out] WORD *pwRetryCount);
265 HRESULT SetErrorRetryInterval(
266 WORD wRetryInterval);
268 HRESULT GetErrorRetryInterval(
269 [out] WORD *pwRetryInterval);
275 [out] DWORD *pdwFlags);
277 HRESULT SetAccountInformation(
278 [in] LPCWSTR pwszAccountName,
279 [in] LPCWSTR pwszPassword);
281 HRESULT GetAccountInformation(
282 [out] LPWSTR *ppwszAccountName);
288 uuid(148BD524-A2AB-11CE-B11F-00AA00530503),
289 pointer_default(unique)
291 interface ITask : IScheduledWorkItem
293 HRESULT SetApplicationName(
294 [in] LPCWSTR pwszApplicationName);
296 HRESULT GetApplicationName(
297 [out] LPWSTR *ppwszApplicationName);
299 HRESULT SetParameters(
300 [in] LPCWSTR pwszParameters);
302 HRESULT GetParameters(
303 [out] LPWSTR *ppwszParameters);
305 HRESULT SetWorkingDirectory(
306 [in] LPCWSTR pwszWorkingDirectory);
308 HRESULT GetWorkingDirectory(
309 [in] LPWSTR *ppwszWorkingDirectory);
312 [in] DWORD dwPriority);
315 [out] DWORD *pdwPriority);
317 HRESULT SetTaskFlags(
320 HRESULT GetTaskFlags(
321 [out] DWORD *pdwFlags);
323 HRESULT SetMaxRunTime(
324 [in] DWORD dwMaxRunTime);
326 HRESULT GetMaxRunTime(
327 [out] DWORD *pdwMaxRunTime);
333 uuid(148BD527-A2AB-11CE-B11F-00AA00530503),
334 pointer_default(unique)
336 interface ITaskScheduler : IUnknown
338 HRESULT SetTargetComputer(
339 [in] LPCWSTR pwszComputer);
341 HRESULT GetTargetComputer(
342 [out] LPWSTR *ppwszComputer);
345 [out] IEnumWorkItems **ppEnumTasks);
348 [in] LPCWSTR pwszName,
350 [out] IUnknown **ppunk);
353 [in] LPCWSTR pwszName);
356 [in] LPCWSTR pwszTaskName,
357 [in] REFCLSID rclsid,
359 [out] IUnknown **ppunk);
362 [in] LPCWSTR pwszTaskName,
363 [in] IScheduledWorkItem *pWorkItem);
366 [in] LPCWSTR pwszName,
371 uuid(148BD52A-A2AB-11CE-B11F-00AA00530503)
373 coclass CTaskScheduler
375 [default] interface ITaskScheduler;
380 uuid(148BD520-A2AB-11CE-B11F-00AA00530503)
384 [default] interface ITask;