2 * Task Scheduler definitions
4 * Copyright 2013 Dmitry Timoshkov
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 uuid(e34cb9f1
-c7f7
-424c
-be29
-027dcc09363a
),
30 importlib
("stdole2.tlb");
32 typedef enum _TASK_STATE
41 typedef enum _TASK_ENUM_FLAGS
43 TASK_ENUM_HIDDEN
= 0x0001
46 typedef enum _TASK_LOGON_TYPE
51 TASK_LOGON_INTERACTIVE_TOKEN
,
53 TASK_LOGON_SERVICE_ACCOUNT
,
54 TASK_LOGON_INTERACTIVE_TOKEN_OR_PASSWORD
57 typedef enum _TASK_RUNLEVEL
63 typedef enum _TASK_TRIGGER_TYPE2
70 TASK_TRIGGER_MONTHLYDOW
,
72 TASK_TRIGGER_REGISTRATION
,
75 TASK_TRIGGER_SESSION_STATE_CHANGE
= 11
78 typedef enum _TASK_ACTION_TYPE
81 TASK_ACTION_COM_HANDLER
= 5,
82 TASK_ACTION_SEND_EMAIL
= 6,
83 TASK_ACTION_SHOW_MESSAGE
= 7
86 typedef enum _TASK_INSTANCES_POLICY
88 TASK_INSTANCES_PARALLEL
,
90 TASK_INSTANCES_IGNORE_NEW
,
91 TASK_INSTANCES_STOP_EXISTING
92 } TASK_INSTANCES_POLICY
;
94 typedef enum _TASK_COMPATIBILITY
96 TASK_COMPATIBILITY_AT
,
97 TASK_COMPATIBILITY_V1
,
98 TASK_COMPATIBILITY_V2
,
99 TASK_COMPATIBILITY_V2_1
100 } TASK_COMPATIBILITY
;
102 typedef enum _TASK_CREATION
104 TASK_VALIDATE_ONLY
= 1,
107 TASK_CREATE_OR_UPDATE
= 6,
109 TASK_DONT_ADD_PRINCIPAL_ACE
= 16,
110 TASK_IGNORE_REGISTRATION_TRIGGERS
= 32
113 interface ITaskService
;
114 interface IRegisteredTask
;
115 interface IRegisteredTaskCollection
;
116 interface IRegistrationInfo
;
117 interface ITaskFolder
;
118 interface ITaskFolderCollection
;
119 interface ITaskDefinition
;
120 interface ITaskSettings
;
121 interface IIdleSettings
;
122 interface IRunningTask
;
123 interface IRunningTaskCollection
;
125 interface ITriggerCollection
;
126 interface ITimeTrigger
;
127 interface IRepetitionPattern
;
129 interface IActionCollection
;
130 interface IExecAction
;
131 interface INetworkSettings
;
132 interface IPrincipal
;
137 uuid(2faba4c7
-4da9
-4013-9697-20cc3fd40f85
)
139 interface ITaskService
: IDispatch
141 HRESULT GetFolder
([in] BSTR path
, [out, retval] ITaskFolder
**folder
);
142 HRESULT GetRunningTasks
([in] LONG flags
, [out, retval] IRunningTaskCollection
**tasks
);
143 HRESULT NewTask
([in] DWORD flags
, [out, retval] ITaskDefinition
**definition
);
144 HRESULT Connect
([in, optional] VARIANT server
, [in, optional] VARIANT user
, [in, optional] VARIANT domain
, [in, optional] VARIANT password
);
145 [propget] HRESULT Connected
([out, retval] VARIANT_BOOL *connected
);
146 [propget] HRESULT TargetServer
([out, retval] BSTR *server
);
147 [propget] HRESULT ConnectedUser
([out, retval] BSTR *user
);
148 [propget] HRESULT ConnectedDomain
([out, retval] BSTR *domain
);
149 [propget] HRESULT HighestVersion
([out, retval] DWORD
*version);
155 uuid(9c86f320
-dee3
-4dd1
-b972
-a303f26b061e
)
157 interface IRegisteredTask
: IDispatch
159 [propget] HRESULT Name
([out, retval] BSTR *name
);
160 [propget] HRESULT Path
([out, retval] BSTR *path
);
161 [propget] HRESULT State
([out, retval] TASK_STATE
*state
);
162 [propget] HRESULT Enabled
([out, retval] VARIANT_BOOL *enabled
);
163 [propput] HRESULT Enabled
(VARIANT_BOOL enabled
);
164 HRESULT Run
([in] VARIANT params
, [out, retval] IRunningTask
**task
);
165 HRESULT RunEx
([in] VARIANT params
, [in] LONG flags
, [in] LONG sessionID
, [in] BSTR user
, [out, retval] IRunningTask
**task
);
166 HRESULT GetInstances
([in] LONG flags
, [out, retval] IRunningTaskCollection
**tasks
);
167 [propget] HRESULT LastRunTime
([out, retval] DATE
*date
);
168 [propget] HRESULT LastTaskResult
([out, retval] LONG *result
);
169 [propget] HRESULT NumberOfMissedRuns
([out, retval] LONG *runs
);
170 [propget] HRESULT NextRunTime
([out, retval] DATE
*date
);
171 [propget] HRESULT Definition
([out, retval] ITaskDefinition
**task
);
172 [propget] HRESULT Xml
([out, retval] BSTR *xml
);
173 HRESULT GetSecurityDescriptor
([in] LONG info
, [out, retval] BSTR *sddl
);
174 HRESULT SetSecurityDescriptor
([in] BSTR sddl
, [in] LONG flags
);
175 HRESULT Stop
([in] LONG flags
);
176 HRESULT GetRunTimes
([in] const LPSYSTEMTIME start
, [in] const LPSYSTEMTIME end
, [in, out] DWORD
*count
, [out] LPSYSTEMTIME
*time
);
182 uuid(86627eb4
-42a7
-41e4
-a4d9
-ac33a72f2d52
)
184 interface IRegisteredTaskCollection
: IDispatch
186 [propget] HRESULT Count
([out, retval] LONG *count
);
187 [propget] HRESULT Item
([in] VARIANT index
, [out, retval] IRegisteredTask
**task
);
188 [propget] HRESULT _NewEnum
([out, retval] IUnknown
**penum
);
194 uuid(416d8b73
-cb41
-4ea1
-805c
-9be9a5ac4a74
)
196 interface IRegistrationInfo
: IDispatch
198 [propget] HRESULT Description
([out, retval] BSTR *description
);
199 [propput] HRESULT Description
([in] BSTR description
);
200 [propget] HRESULT Author
([out, retval] BSTR *author
);
201 [propput] HRESULT Author
([in] BSTR author
);
202 [propget] HRESULT Version([out, retval] BSTR *version);
203 [propput] HRESULT Version([in] BSTR version);
204 [propget] HRESULT Date
([out, retval] BSTR *date
);
205 [propput] HRESULT Date
([in] BSTR date
);
206 [propget] HRESULT Documentation
([out, retval] BSTR *doc
);
207 [propput] HRESULT Documentation
([in] BSTR doc
);
208 [propget] HRESULT XmlText
([out, retval] BSTR *xml
);
209 [propput] HRESULT XmlText
([in] BSTR xml
);
210 [propget] HRESULT URI
([out, retval] BSTR *uri
);
211 [propput] HRESULT URI
([in] BSTR uri
);
212 [propget] HRESULT SecurityDescriptor
([out, retval] VARIANT *sddl
);
213 [propput] HRESULT SecurityDescriptor
([in] VARIANT sddl
);
214 [propget] HRESULT Source([out, retval] BSTR *source);
215 [propput] HRESULT Source([in] BSTR source);
221 uuid(8cfac062
-a080
-4c15
-9a88
-aa7c2af80dfc
)
223 interface ITaskFolder
: IDispatch
225 [propget] HRESULT Name
([out, retval] BSTR *name
);
226 [propget] HRESULT Path
([out, retval] BSTR *path
);
227 HRESULT GetFolder
([in] BSTR path
, [out, retval] ITaskFolder
**folder
);
228 HRESULT GetFolders
([in] LONG flags
, [out, retval] ITaskFolderCollection
**folders
);
229 HRESULT CreateFolder
([in] BSTR name
, [in] VARIANT sddl
, [out, retval] ITaskFolder
**folder
);
230 HRESULT DeleteFolder
([in] BSTR name
, [in] LONG flags
);
231 HRESULT GetTask
([in] BSTR path
, [out, retval] IRegisteredTask
**task
);
232 HRESULT GetTasks
([in] LONG flags
, [out, retval] IRegisteredTaskCollection
**tasks
);
233 HRESULT DeleteTask
([in] BSTR name
, [in] LONG flags
);
234 HRESULT RegisterTask
([in] BSTR path
, [in] BSTR xml
, [in] LONG flags
, [in] VARIANT user
, [in] VARIANT password
,
235 [in] TASK_LOGON_TYPE logonType
, [in] VARIANT sddl
, [out, retval] IRegisteredTask
**task
);
236 HRESULT RegisterTaskDefinition
([in] BSTR path
, [in] ITaskDefinition
*definition
, [in] LONG flags
,
237 [in] VARIANT user
, [in] VARIANT password
, [in] TASK_LOGON_TYPE logon
,
238 [in] VARIANT sddl
, [out, retval] IRegisteredTask
**task
);
239 HRESULT GetSecurityDescriptor
(LONG info
, [out, retval] BSTR *sddl
);
240 HRESULT SetSecurityDescriptor
([in] BSTR sddl
, [in] LONG flags
);
246 uuid(79184a66
-8664-423f
-97f1
-637356a5d812
)
248 interface ITaskFolderCollection
: IDispatch
250 [propget] HRESULT Count
([out, retval] LONG *count
);
251 [propget] HRESULT Item
([in] VARIANT index
, [out, retval] ITaskFolder
**folder
);
252 [propget] HRESULT _NewEnum
([out, retval] IUnknown
**penum
);
258 uuid(f5bc8fc5
-536d
-4f77
-b852
-fbc1356fdeb6
)
260 interface ITaskDefinition
: IDispatch
262 [propget] HRESULT RegistrationInfo
([out, retval] IRegistrationInfo
**info
);
263 [propput] HRESULT RegistrationInfo
([in] IRegistrationInfo
*info
);
264 [propget] HRESULT Triggers
([out, retval] ITriggerCollection
**triggers
);
265 [propput] HRESULT Triggers
([in] ITriggerCollection
*triggers
);
266 [propget] HRESULT Settings
([out, retval] ITaskSettings
**settings
);
267 [propput] HRESULT Settings
([in] ITaskSettings
*settings
);
268 [propget] HRESULT Data
([out, retval] BSTR *data
);
269 [propput] HRESULT Data
([in] BSTR data
);
270 [propget] HRESULT Principal
([out, retval] IPrincipal
**principal
);
271 [propput] HRESULT Principal
([in] IPrincipal
*principal
);
272 [propget] HRESULT Actions
([out, retval] IActionCollection
**actions
);
273 [propput] HRESULT Actions
([in] IActionCollection
*actions
);
274 [propget] HRESULT XmlText
([out, retval] BSTR *xml
);
275 [propput] HRESULT XmlText
([in] BSTR xml
);
281 uuid(8fd4711d
-2d02
-4c8c
-87e3
-eff699de127e
)
283 interface ITaskSettings
: IDispatch
285 [propget] HRESULT AllowDemandStart
([out, retval] VARIANT_BOOL *allow
);
286 [propput] HRESULT AllowDemandStart
([in] VARIANT_BOOL allow
);
287 [propget] HRESULT RestartInterval
([out, retval] BSTR *interval
);
288 [propput] HRESULT RestartInterval
([in] BSTR interval
);
289 [propget] HRESULT RestartCount
([out, retval] INT *count
);
290 [propput] HRESULT RestartCount
([in] INT count
);
291 [propget] HRESULT MultipleInstances
([out, retval] TASK_INSTANCES_POLICY
*policy
);
292 [propput] HRESULT MultipleInstances
([in] TASK_INSTANCES_POLICY policy
);
293 [propget] HRESULT StopIfGoingOnBatteries
([out, retval] VARIANT_BOOL *stop
);
294 [propput] HRESULT StopIfGoingOnBatteries
([in] VARIANT_BOOL stop
);
295 [propget] HRESULT DisallowStartIfOnBatteries
([out, retval] VARIANT_BOOL *disallow
);
296 [propput] HRESULT DisallowStartIfOnBatteries
([in] VARIANT_BOOL disallow
);
297 [propget] HRESULT AllowHardTerminate
([out, retval] VARIANT_BOOL *allow
);
298 [propput] HRESULT AllowHardTerminate
([in] VARIANT_BOOL allow
);
299 [propget] HRESULT StartWhenAvailable
([out, retval] VARIANT_BOOL *start
);
300 [propput] HRESULT StartWhenAvailable
([in] VARIANT_BOOL start
);
301 [propget] HRESULT XmlText
([out, retval] BSTR *xml
);
302 [propput] HRESULT XmlText
([in] BSTR xml
);
303 [propget] HRESULT RunOnlyIfNetworkAvailable
([out, retval] VARIANT_BOOL *run
);
304 [propput] HRESULT RunOnlyIfNetworkAvailable
([in] VARIANT_BOOL run
);
305 [propget] HRESULT ExecutionTimeLimit
([out, retval] BSTR *limit
);
306 [propput] HRESULT ExecutionTimeLimit
([in] BSTR limit
);
307 [propget] HRESULT Enabled
([out, retval] VARIANT_BOOL *enabled
);
308 [propput] HRESULT Enabled
([in] VARIANT_BOOL enabled
);
309 [propget] HRESULT DeleteExpiredTaskAfter
([out, retval] BSTR *delay
);
310 [propput] HRESULT DeleteExpiredTaskAfter
([in] BSTR delay
);
311 [propget] HRESULT Priority
([out, retval] INT *priority
);
312 [propput] HRESULT Priority
([in] INT priority
);
313 [propget] HRESULT Compatibility
([out, retval] TASK_COMPATIBILITY
*level
);
314 [propput] HRESULT Compatibility
([in] TASK_COMPATIBILITY level
);
315 [propget] HRESULT Hidden([out, retval] VARIANT_BOOL *hidden);
316 [propput] HRESULT Hidden([in] VARIANT_BOOL hidden);
317 [propget] HRESULT IdleSettings
([out, retval] IIdleSettings
**settings
);
318 [propput] HRESULT IdleSettings
([in] IIdleSettings
*settings
);
319 [propget] HRESULT RunOnlyIfIdle
([out, retval] VARIANT_BOOL *run
);
320 [propput] HRESULT RunOnlyIfIdle
([in] VARIANT_BOOL run
);
321 [propget] HRESULT WakeToRun
([out, retval] VARIANT_BOOL *wake
);
322 [propput] HRESULT WakeToRun
([in] VARIANT_BOOL wake
);
323 [propget] HRESULT NetworkSettings
([out, retval] INetworkSettings
**settings
);
324 [propput] HRESULT NetworkSettings
([in] INetworkSettings
*settings
);
330 uuid(84594461-0053-4342-a8fd
-088fabf11f32
)
332 interface IIdleSettings
: IDispatch
334 [propget] HRESULT IdleDuration
([out, retval] BSTR *delay
);
335 [propput] HRESULT IdleDuration
([in] BSTR delay
);
336 [propget] HRESULT WaitTimeout
([out, retval] BSTR *timeout
);
337 [propput] HRESULT WaitTimeout
([in] BSTR timeout
);
338 [propget] HRESULT StopOnIdleEnd
([out, retval] VARIANT_BOOL *stop
);
339 [propput] HRESULT StopOnIdleEnd
([in] VARIANT_BOOL stop
);
340 [propget] HRESULT RestartOnIdle
([out, retval] VARIANT_BOOL *restart
);
341 [propput] HRESULT RestartOnIdle
([in] VARIANT_BOOL restart
);
347 uuid(653758fb
-7b9a
-4f1e
-a471
-beeb8e9b834e
)
349 interface IRunningTask
: IDispatch
351 [propget] HRESULT Name
([out, retval] BSTR *name
);
352 [propget] HRESULT InstanceGuid
([out, retval] BSTR *guid
);
353 [propget] HRESULT Path
([out, retval] BSTR *path
);
354 [propget] HRESULT State
([out, retval] TASK_STATE
*state
);
355 [propget] HRESULT CurrentAction
([out, retval] BSTR *name
);
357 HRESULT Refresh
(void );
358 [propget] HRESULT EnginePID
([out, retval] DWORD
*pid
);
364 uuid(6a67614b
-6828-4fec
-aa54
-6d52e8f1f2db
)
366 interface IRunningTaskCollection
: IDispatch
368 [propget] HRESULT Count
([out, retval] LONG *count
);
369 [propget] HRESULT Item
([in] VARIANT index
, [out, retval] IRunningTask
**task
);
370 [propget] HRESULT _NewEnum
([out, retval] IUnknown
**penum
);
376 uuid(09941815-ea89
-4b5b
-89e0
-2a773801fac3
)
378 interface ITrigger
: IDispatch
380 [propget] HRESULT Type
([out, retval] TASK_TRIGGER_TYPE2
*type
);
381 [propget] HRESULT Id([out, retval] BSTR *id);
382 [propput] HRESULT Id([in] BSTR id);
383 [propget] HRESULT Repetition
([out, retval] IRepetitionPattern
**repeat
);
384 [propput] HRESULT Repetition
([in] IRepetitionPattern
*repeat
);
385 [propget] HRESULT ExecutionTimeLimit
([out, retval] BSTR *limit
);
386 [propput] HRESULT ExecutionTimeLimit
([in] BSTR limit
);
387 [propget] HRESULT StartBoundary
([out, retval] BSTR *start
);
388 [propput] HRESULT StartBoundary
([in] BSTR start
);
389 [propget] HRESULT EndBoundary
([out, retval] BSTR *end
);
390 [propput] HRESULT EndBoundary
([in] BSTR end
);
391 [propget] HRESULT Enabled
([out, retval] VARIANT_BOOL *enabled
);
392 [propput] HRESULT Enabled
([in] VARIANT_BOOL enabled
);
397 uuid(126c5cd8
-b288
-41d5
-8dbf
-e491446adc5c
),
402 interface IDailyTrigger
: ITrigger
404 [propget] HRESULT DaysInterval
([out, retval] short *pDays
);
405 [propput] HRESULT DaysInterval
([in] short days
);
406 [propget] HRESULT RandomDelay
([out, retval] BSTR *pRandomDelay
);
407 [propput] HRESULT RandomDelay
([in] BSTR randomDelay
);
413 uuid(85df5081
-1b24
-4f32
-878a
-d9d14df4cb77
)
415 interface ITriggerCollection
: IDispatch
417 [propget] HRESULT Count
([out, retval] LONG *count
);
418 [propget] HRESULT Item
([in] LONG index
, [out, retval] ITrigger
**trigger
);
419 [propget] HRESULT _NewEnum
([out, retval] IUnknown
**penum
);
420 HRESULT Create
([in] TASK_TRIGGER_TYPE2 type
, [out, retval] ITrigger
**trigger
);
421 HRESULT Remove
([in] VARIANT index
);
428 uuid(b45747e0
-eba7
-4276-9f29
-85c5bb300006
)
430 interface ITimeTrigger
: ITrigger
432 [propget] HRESULT RandomDelay
([out, retval] BSTR *delay
);
433 [propput] HRESULT RandomDelay
([in] BSTR delay
);
439 uuid(7fb9acf1
-26be
-400e-85b5
-294b9c75dfd6
)
441 interface IRepetitionPattern
: IDispatch
443 [propget] HRESULT Interval
([out, retval] BSTR *interval
);
444 [propput] HRESULT Interval
([in] BSTR interval
);
445 [propget] HRESULT Duration
([out, retval] BSTR *duration
);
446 [propput] HRESULT Duration
([in] BSTR duration
);
447 [propget] HRESULT StopAtDurationEnd
([out, retval] VARIANT_BOOL *stop
);
448 [propput] HRESULT StopAtDurationEnd
([in] VARIANT_BOOL sop
);
454 uuid(bae54997
-48b1
-4cbe
-9965-d6be263ebea4
)
456 interface IAction
: IDispatch
458 [propget] HRESULT Id([out, retval] BSTR *id);
459 [propput] HRESULT Id([in] BSTR id);
460 [propget] HRESULT Type
([out, retval] TASK_ACTION_TYPE
*type
);
466 uuid(02820e19
-7b98
-4ed2
-b2e8
-fdccceff619b
)
468 interface IActionCollection
: IDispatch
470 [propget] HRESULT Count
([out, retval] LONG *count
);
471 [propget] HRESULT Item
([in] LONG index
, [out, retval] IAction
**action
);
472 [propget] HRESULT _NewEnum
([out, retval] IUnknown
**penum
);
473 [propget] HRESULT XmlText
([out, retval] BSTR *xml
);
474 [propput] HRESULT XmlText
([in] BSTR xml
);
475 HRESULT Create
([in] TASK_ACTION_TYPE Type
, [out, retval] IAction
**action
);
476 HRESULT Remove
([in] VARIANT index
);
478 [propget] HRESULT Context
([out, retval] BSTR *ctx
);
479 [propput] HRESULT Context
([in] BSTR ctx
);
485 uuid(4c3d624d
-fd6b
-49a3
-b9b7
-09cb3cd3f047
)
487 interface IExecAction
: IAction
489 [propget] HRESULT Path
([out, retval] BSTR *path
);
490 [propput] HRESULT Path
([in] BSTR path
);
491 [propget] HRESULT Arguments
([out, retval] BSTR *argument
);
492 [propput] HRESULT Arguments
([in] BSTR argument
);
493 [propget] HRESULT WorkingDirectory
([out, retval] BSTR *directory
);
494 [propput] HRESULT WorkingDirectory
([in] BSTR directory
);
500 uuid(9f7dea84
-c30b
-4245-80b6
-00e9f646f1b4
)
502 interface INetworkSettings
: IDispatch
504 [propget] HRESULT Name
([out, retval] BSTR *name
);
505 [propput] HRESULT Name
([in] BSTR name
);
506 [propget] HRESULT Id([out, retval] BSTR *id);
507 [propput] HRESULT Id([in] BSTR id);
513 uuid(d98d51e5
-c9b4
-496a
-a9c1
-18980261cf0f
)
515 interface IPrincipal
: IDispatch
517 [propget] HRESULT Id([out, retval] BSTR *id);
518 [propput] HRESULT Id([in] BSTR id);
519 [propget] HRESULT DisplayName
([out, retval] BSTR *name
);
520 [propput] HRESULT DisplayName
([in] BSTR name
);
521 [propget] HRESULT UserId
([out, retval] BSTR *user
);
522 [propput] HRESULT UserId
([in] BSTR user
);
523 [propget] HRESULT LogonType
([out, retval] TASK_LOGON_TYPE
*logon
);
524 [propput] HRESULT LogonType
([in] TASK_LOGON_TYPE logon
);
525 [propget] HRESULT GroupId
([out, retval] BSTR *group
);
526 [propput] HRESULT GroupId
([in] BSTR group
);
527 [propget] HRESULT RunLevel
([out, retval] TASK_RUNLEVEL_TYPE
*level
);
528 [propput] HRESULT RunLevel
([in] TASK_RUNLEVEL_TYPE level
);
533 progid
("Schedule.Service.1"),
534 vi_progid
("Schedule.Service"),
535 uuid(0f87369f
-a4e5
-4cfc
-bd3e
-73e6154572dd
)
537 coclass TaskScheduler
539 interface ITaskService
;
542 } /* library TaskScheduler */