cmd: cmd /c "pgmname" searches all extensions on PATHEXT.
[wine] / include / mstask.idl
1 /*
2  * Task Scheduler Service interface
3  *
4  * Copyright (C) 2008 Google (Roy Shea)
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 import "oaidl.idl";
23 import "oleidl.idl";
24
25 #ifndef __WIDL__
26 #define threading(model)
27 #define progid(str)
28 #define vi_progid(str)
29 #endif
30
31 cpp_quote("#define TASK_SUNDAY 0x1")
32 cpp_quote("#define TASK_MONDAY 0x2")
33 cpp_quote("#define TASK_TUESDAY 0x4")
34 cpp_quote("#define TASK_WEDNESDAY 0x8")
35 cpp_quote("#define TASK_THURSDAY 0x10")
36 cpp_quote("#define TASK_FRIDAY 0x20")
37 cpp_quote("#define TASK_SATURDAY 0x40")
38
39 cpp_quote("#define TASK_FIRST_WEEK 1")
40 cpp_quote("#define TASK_SECOND_WEEK 2")
41 cpp_quote("#define TASK_THIRD_WEEK 3")
42 cpp_quote("#define TASK_FOURTH_WEEK 4")
43 cpp_quote("#define TASK_LAST_WEEK 5")
44
45 cpp_quote("#define TASK_JANUARY 0x1")
46 cpp_quote("#define TASK_FEBRUARY 0x2")
47 cpp_quote("#define TASK_MARCH 0x4")
48 cpp_quote("#define TASK_APRIL 0x8")
49 cpp_quote("#define TASK_MAY 0x10")
50 cpp_quote("#define TASK_JUNE 0x20")
51 cpp_quote("#define TASK_JULY 0x40")
52 cpp_quote("#define TASK_AUGUST 0x80")
53 cpp_quote("#define TASK_SEPTEMBER 0x100")
54 cpp_quote("#define TASK_OCTOBER 0x200")
55 cpp_quote("#define TASK_NOVEMBER 0x400")
56 cpp_quote("#define TASK_DECEMBER 0x800")
57
58 cpp_quote("#define TASK_TRIGGER_FLAG_HAS_END_DATE 0x1")
59 cpp_quote("#define TASK_TRIGGER_FLAG_KILL_AT_DURATION_END 0x2")
60 cpp_quote("#define TASK_TRIGGER_FLAG_DISABLED 0x4")
61
62 [
63     local,
64     object,
65     uuid(148BD528-A2AB-11CE-B11F-00AA00530503),
66     pointer_default(unique)
67 ]
68 interface IEnumWorkItems : IUnknown
69 {
70     HRESULT Next(
71             [in]   ULONG celt,
72             [out]  LPWSTR **rgpwszNames,
73             [out]  ULONG *pceltFetched);
74
75     HRESULT Skip(
76             [in]  ULONG celt);
77
78     HRESULT Reset();
79
80     HRESULT Clone(
81             [out]  IEnumWorkItems **ppEnumWorkItems);
82 }
83
84 cpp_quote("#ifndef _HPROPSHEETPAGE_DEFINED")
85 typedef struct _PSP *HPROPSHEETPAGE;
86 cpp_quote("#define _HPROPSHEETPAGE_DEFINED")
87 cpp_quote("#endif")
88
89 [
90     local,
91     object,
92     uuid(4086658a-cbbb-11cf-b604-00c04fd8d565),
93     pointer_default(unique)
94 ]
95 interface IProvideTaskPage : IUnknown
96 {
97     typedef enum _TASKPAGE {
98         TASKPAGE_TASK       = 0,
99         TASKPAGE_SCHEDULE   = 1,
100         TASKPAGE_SETTINGS   = 2
101     } TASKPAGE;
102
103     HRESULT GetPage(
104             [in]   TASKPAGE tpType,
105             [in]   BOOL fPersistChanges,
106             [out]  HPROPSHEETPAGE *phPage);
107 }
108
109 [
110     local,
111     object,
112     uuid(148BD52B-A2AB-11CE-B11F-00AA00530503),
113     pointer_default(unique)
114 ]
115 interface ITaskTrigger : IUnknown
116 {
117     typedef enum _TASK_TRIGGER_TYPE {
118         TASK_TIME_TRIGGER_ONCE              = 0,
119         TASK_TIME_TRIGGER_DAILY             = 1,
120         TASK_TIME_TRIGGER_WEEKLY            = 2,
121         TASK_TIME_TRIGGER_MONTHLYDATE       = 3,
122         TASK_TIME_TRIGGER_MONTHLYDOW        = 4,
123         TASK_EVENT_TRIGGER_ON_IDLE          = 5,
124         TASK_EVENT_TRIGGER_AT_SYSTEMSTART   = 6,
125         TASK_EVENT_TRIGGER_AT_LOGON         = 7
126     } TASK_TRIGGER_TYPE, *PTASK_TRIGGER_TYPE;
127
128     typedef struct _DAILY {
129         WORD DaysInterval;
130     } DAILY;
131
132     typedef struct _WEEKLY {
133         WORD WeeksInterval;
134         WORD rgfDaysOfTheWeek;
135     } WEEKLY;
136
137     typedef struct _MONTHLYDATE {
138         DWORD rgfDays;
139         WORD rgfMonths;
140     } MONTHLYDATE;
141
142     typedef struct _MONTHLYDOW {
143         WORD wWhichWeek;
144         WORD rgfDaysOfTheWeek;
145         WORD rgfMonths;
146     } MONTHLYDOW;
147
148     typedef union _TRIGGER_TYPE_UNION {
149         DAILY Daily;
150         WEEKLY Weekly;
151         MONTHLYDATE MonthlyDate;
152         MONTHLYDOW MonthlyDOW;
153     } TRIGGER_TYPE_UNION;
154
155     typedef struct _TASK_TRIGGER {
156         WORD cbTriggerSize;
157         WORD Reserved1;
158         WORD wBeginYear;
159         WORD wBeginMonth;
160         WORD wBeginDay;
161         WORD wEndYear;
162         WORD wEndMonth;
163         WORD wEndDay;
164         WORD wStartHour;
165         WORD wStartMinute;
166         DWORD MinutesDuration;
167         DWORD MinutesInterval;
168         DWORD rgFlags;
169         TASK_TRIGGER_TYPE TriggerType;
170         TRIGGER_TYPE_UNION Type;
171         WORD Reserved2;
172         WORD wRandomMinutesInterval;
173     } TASK_TRIGGER, *PTASK_TRIGGER;
174
175     HRESULT SetTrigger(
176             [in]  const PTASK_TRIGGER pTrigger);
177
178     HRESULT GetTrigger(
179             [out]  PTASK_TRIGGER pTrigger);
180
181     HRESULT GetTriggerString(
182             [out]  LPWSTR *ppwszTrigger);
183 }
184
185 [
186     local,
187     object,
188     uuid(a6b952f0-a4b1-11d0-997d-00aa006887ec),
189     pointer_default(unique)
190 ]
191 interface IScheduledWorkItem : IUnknown
192 {
193     HRESULT CreateTrigger(
194             [out]  WORD *piNewTrigger,
195             [out]  ITaskTrigger **ppTrigger);
196
197     HRESULT DeleteTrigger(
198             [in]  WORD iTrigger);
199
200     HRESULT GetTriggerCount(
201             [out]  WORD *plCount);
202
203     HRESULT GetTrigger(
204             [in]   WORD iTrigger,
205             [out]  ITaskTrigger **ppTrigger);
206
207     HRESULT GetTriggerString(
208             [in]   WORD iTrigger,
209             [out]  LPWSTR *ppwszTrigger);
210
211     HRESULT GetRunTimes(
212             [in]       const LPSYSTEMTIME pstBegin,
213             [in]       const LPSYSTEMTIME pstEnd,
214             [in, out]  WORD *pCount,
215             [out]      LPSYSTEMTIME *rgstTaskTimes);
216
217     HRESULT GetNextRunTime(
218             [out]  SYSTEMTIME *pstNextRun);
219
220     HRESULT SetIdleWait(
221             [in]  WORD wIdleMinutes,
222             [in]  WORD wDeadlineMinutes);
223
224     HRESULT GetIdleWait(
225             [out]  WORD *pwIdleMinutes,
226             [out]  WORD *pwDeadlineMinutes);
227
228     HRESULT Run();
229
230     HRESULT Terminate();
231
232     HRESULT EditWorkItem(
233             [in]  HWND hParent,
234             [in]  DWORD dwReserved);
235
236     HRESULT GetMostRecentRunTime(
237             [out]  SYSTEMTIME *pstLastRun);
238
239     HRESULT GetStatus(
240             [out]  HRESULT *phrStatus);
241
242     HRESULT GetExitCode(
243             [out]  DWORD *pdwExitCode);
244
245     HRESULT SetComment(
246             [in]  LPCWSTR pwszComment);
247
248     HRESULT GetComment(
249             [out]  LPWSTR *ppwszComment);
250
251     HRESULT SetCreator(
252             LPCWSTR pwszCreator);
253
254     HRESULT GetCreator(
255             [out]  LPWSTR *ppwszCreator);
256
257     HRESULT SetWorkItemData(
258             [in]  WORD cBytes,
259             [in]  BYTE rgbData[]);
260
261     HRESULT GetWorkItemData(
262             [out]  WORD *pcBytes,
263             [out]  BYTE **ppBytes);
264
265     HRESULT SetErrorRetryCount(
266             WORD wRetryCount);
267
268     HRESULT GetErrorRetryCount(
269             [out]  WORD *pwRetryCount);
270
271     HRESULT SetErrorRetryInterval(
272             WORD wRetryInterval);
273
274     HRESULT GetErrorRetryInterval(
275             [out]  WORD *pwRetryInterval);
276
277     HRESULT SetFlags(
278             DWORD dwFlags);
279
280     HRESULT GetFlags(
281             [out]  DWORD *pdwFlags);
282
283     HRESULT SetAccountInformation(
284             [in]  LPCWSTR pwszAccountName,
285             [in]  LPCWSTR pwszPassword);
286
287     HRESULT GetAccountInformation(
288             [out]  LPWSTR *ppwszAccountName);
289 }
290
291 [
292     local,
293     object,
294     uuid(148BD524-A2AB-11CE-B11F-00AA00530503),
295     pointer_default(unique)
296 ]
297 interface ITask : IScheduledWorkItem
298 {
299     HRESULT SetApplicationName(
300             [in]  LPCWSTR pwszApplicationName);
301
302     HRESULT GetApplicationName(
303             [out]  LPWSTR *ppwszApplicationName);
304
305     HRESULT SetParameters(
306             [in]  LPCWSTR pwszParameters);
307
308     HRESULT GetParameters(
309             [out]  LPWSTR *ppwszParameters);
310
311     HRESULT SetWorkingDirectory(
312             [in]  LPCWSTR pwszWorkingDirectory);
313
314     HRESULT GetWorkingDirectory(
315             [in]  LPWSTR *ppwszWorkingDirectory);
316
317     HRESULT SetPriority(
318             [in]  DWORD dwPriority);
319
320     HRESULT GetPriority(
321             [out]  DWORD *pdwPriority);
322
323     HRESULT SetTaskFlags(
324             [in]  DWORD dwFlags);
325
326     HRESULT GetTaskFlags(
327             [out]  DWORD *pdwFlags);
328
329     HRESULT SetMaxRunTime(
330             [in]  DWORD dwMaxRunTime);
331
332     HRESULT GetMaxRunTime(
333             [out]  DWORD *pdwMaxRunTime);
334 }
335
336 [
337     local,
338     object,
339     uuid(148BD527-A2AB-11CE-B11F-00AA00530503),
340     pointer_default(unique)
341 ]
342 interface ITaskScheduler : IUnknown
343 {
344     HRESULT SetTargetComputer(
345             [in]  LPCWSTR pwszComputer);
346
347     HRESULT GetTargetComputer(
348             [out]  LPWSTR *ppwszComputer);
349
350     HRESULT Enum(
351             [out]  IEnumWorkItems **ppEnumTasks);
352
353     HRESULT Activate(
354             [in]   LPCWSTR pwszName,
355             [in]   REFIID riid,
356             [out]  IUnknown **ppunk);
357
358     HRESULT Delete(
359             [in]  LPCWSTR pwszName);
360
361     HRESULT NewWorkItem(
362             [in]   LPCWSTR pwszTaskName,
363             [in]   REFCLSID rclsid,
364             [in]   REFIID riid,
365             [out]  IUnknown **ppunk);
366
367     HRESULT AddWorkItem(
368             [in]  LPCWSTR pwszTaskName,
369             [in]  IScheduledWorkItem *pWorkItem);
370
371     HRESULT IsOfType(
372             [in]  LPCWSTR pwszName,
373             [in]  REFIID riid);
374 }
375
376 [
377     threading(both),
378     uuid(148BD52A-A2AB-11CE-B11F-00AA00530503)
379 ]
380 coclass CTaskScheduler
381 {
382     [default] interface ITaskScheduler;
383 };
384
385
386 [
387     threading(both),
388     uuid(148BD520-A2AB-11CE-B11F-00AA00530503)
389 ]
390 coclass CTask
391 {
392     [default] interface ITask;
393 };