mstask.idl 9.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * Task Scheduler Service interface
 *
 * Copyright (C) 2008 Google (Roy Shea)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 *
 */

import "oaidl.idl";
import "oleidl.idl";

25 26 27 28 29 30
#ifndef __WIDL__
#define threading(model)
#define progid(str)
#define vi_progid(str)
#endif

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
cpp_quote("#define TASK_SUNDAY 0x1")
cpp_quote("#define TASK_MONDAY 0x2")
cpp_quote("#define TASK_TUESDAY 0x4")
cpp_quote("#define TASK_WEDNESDAY 0x8")
cpp_quote("#define TASK_THURSDAY 0x10")
cpp_quote("#define TASK_FRIDAY 0x20")
cpp_quote("#define TASK_SATURDAY 0x40")

cpp_quote("#define TASK_FIRST_WEEK 1")
cpp_quote("#define TASK_SECOND_WEEK 2")
cpp_quote("#define TASK_THIRD_WEEK 3")
cpp_quote("#define TASK_FOURTH_WEEK 4")
cpp_quote("#define TASK_LAST_WEEK 5")

cpp_quote("#define TASK_JANUARY 0x1")
cpp_quote("#define TASK_FEBRUARY 0x2")
cpp_quote("#define TASK_MARCH 0x4")
cpp_quote("#define TASK_APRIL 0x8")
cpp_quote("#define TASK_MAY 0x10")
cpp_quote("#define TASK_JUNE 0x20")
cpp_quote("#define TASK_JULY 0x40")
cpp_quote("#define TASK_AUGUST 0x80")
cpp_quote("#define TASK_SEPTEMBER 0x100")
cpp_quote("#define TASK_OCTOBER 0x200")
cpp_quote("#define TASK_NOVEMBER 0x400")
cpp_quote("#define TASK_DECEMBER 0x800")

cpp_quote("#define TASK_TRIGGER_FLAG_HAS_END_DATE 0x1")
cpp_quote("#define TASK_TRIGGER_FLAG_KILL_AT_DURATION_END 0x2")
cpp_quote("#define TASK_TRIGGER_FLAG_DISABLED 0x4")

62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
[
    local,
    object,
    uuid(148BD528-A2AB-11CE-B11F-00AA00530503),
    pointer_default(unique)
]
interface IEnumWorkItems : IUnknown
{
    HRESULT Next(
            [in]   ULONG celt,
            [out]  LPWSTR **rgpwszNames,
            [out]  ULONG *pceltFetched);

    HRESULT Skip(
            [in]  ULONG celt);

    HRESULT Reset();

    HRESULT Clone(
            [out]  IEnumWorkItems **ppEnumWorkItems);
}

cpp_quote("#ifndef _HPROPSHEETPAGE_DEFINED")
typedef struct _PSP *HPROPSHEETPAGE;
cpp_quote("#define _HPROPSHEETPAGE_DEFINED")
cpp_quote("#endif")

[
    local,
    object,
    uuid(4086658a-cbbb-11cf-b604-00c04fd8d565),
    pointer_default(unique)
]
interface IProvideTaskPage : IUnknown
{
    typedef enum _TASKPAGE {
        TASKPAGE_TASK       = 0,
        TASKPAGE_SCHEDULE   = 1,
        TASKPAGE_SETTINGS   = 2
    } TASKPAGE;

    HRESULT GetPage(
            [in]   TASKPAGE tpType,
            [in]   BOOL fPersistChanges,
            [out]  HPROPSHEETPAGE *phPage);
}

[
    local,
    object,
    uuid(148BD52B-A2AB-11CE-B11F-00AA00530503),
    pointer_default(unique)
]
interface ITaskTrigger : IUnknown
{
    typedef enum _TASK_TRIGGER_TYPE {
        TASK_TIME_TRIGGER_ONCE              = 0,
        TASK_TIME_TRIGGER_DAILY             = 1,
        TASK_TIME_TRIGGER_WEEKLY            = 2,
        TASK_TIME_TRIGGER_MONTHLYDATE       = 3,
        TASK_TIME_TRIGGER_MONTHLYDOW        = 4,
        TASK_EVENT_TRIGGER_ON_IDLE          = 5,
        TASK_EVENT_TRIGGER_AT_SYSTEMSTART   = 6,
        TASK_EVENT_TRIGGER_AT_LOGON         = 7
    } TASK_TRIGGER_TYPE, *PTASK_TRIGGER_TYPE;

    typedef struct _DAILY {
        WORD DaysInterval;
    } DAILY;

    typedef struct _WEEKLY {
        WORD WeeksInterval;
        WORD rgfDaysOfTheWeek;
    } WEEKLY;

    typedef struct _MONTHLYDATE {
        DWORD rgfDays;
        WORD rgfMonths;
    } MONTHLYDATE;

    typedef struct _MONTHLYDOW {
        WORD wWhichWeek;
        WORD rgfDaysOfTheWeek;
        WORD rgfMonths;
    } MONTHLYDOW;

    typedef union _TRIGGER_TYPE_UNION {
        DAILY Daily;
        WEEKLY Weekly;
        MONTHLYDATE MonthlyDate;
        MONTHLYDOW MonthlyDOW;
    } TRIGGER_TYPE_UNION;

    typedef struct _TASK_TRIGGER {
        WORD cbTriggerSize;
        WORD Reserved1;
        WORD wBeginYear;
        WORD wBeginMonth;
        WORD wBeginDay;
        WORD wEndYear;
        WORD wEndMonth;
        WORD wEndDay;
        WORD wStartHour;
        WORD wStartMinute;
        DWORD MinutesDuration;
        DWORD MinutesInterval;
        DWORD rgFlags;
        TASK_TRIGGER_TYPE TriggerType;
        TRIGGER_TYPE_UNION Type;
        WORD Reserved2;
        WORD wRandomMinutesInterval;
    } TASK_TRIGGER, *PTASK_TRIGGER;

    HRESULT SetTrigger(
            [in]  const PTASK_TRIGGER pTrigger);

    HRESULT GetTrigger(
            [out]  PTASK_TRIGGER pTrigger);

    HRESULT GetTriggerString(
            [out]  LPWSTR *ppwszTrigger);
}

[
    local,
    object,
    uuid(a6b952f0-a4b1-11d0-997d-00aa006887ec),
    pointer_default(unique)
]
interface IScheduledWorkItem : IUnknown
{
    HRESULT CreateTrigger(
            [out]  WORD *piNewTrigger,
            [out]  ITaskTrigger **ppTrigger);

    HRESULT DeleteTrigger(
            [in]  WORD iTrigger);

    HRESULT GetTriggerCount(
            [out]  WORD *plCount);

    HRESULT GetTrigger(
            [in]   WORD iTrigger,
            [out]  ITaskTrigger **ppTrigger);

    HRESULT GetTriggerString(
            [in]   WORD iTrigger,
            [out]  LPWSTR *ppwszTrigger);

    HRESULT GetRunTimes(
            [in]       const LPSYSTEMTIME pstBegin,
            [in]       const LPSYSTEMTIME pstEnd,
            [in, out]  WORD *pCount,
            [out]      LPSYSTEMTIME *rgstTaskTimes);

    HRESULT GetNextRunTime(
            [out]  SYSTEMTIME *pstNextRun);

    HRESULT SetIdleWait(
            [in]  WORD wIdleMinutes,
            [in]  WORD wDeadlineMinutes);

    HRESULT GetIdleWait(
            [out]  WORD *pwIdleMinutes,
            [out]  WORD *pwDeadlineMinutes);

    HRESULT Run();

    HRESULT Terminate();

    HRESULT EditWorkItem(
            [in]  HWND hParent,
            [in]  DWORD dwReserved);

    HRESULT GetMostRecentRunTime(
            [out]  SYSTEMTIME *pstLastRun);

    HRESULT GetStatus(
            [out]  HRESULT *phrStatus);

    HRESULT GetExitCode(
            [out]  DWORD *pdwExitCode);

    HRESULT SetComment(
            [in]  LPCWSTR pwszComment);

    HRESULT GetComment(
            [out]  LPWSTR *ppwszComment);

    HRESULT SetCreator(
            LPCWSTR pwszCreator);

    HRESULT GetCreator(
            [out]  LPWSTR *ppwszCreator);

    HRESULT SetWorkItemData(
            [in]  WORD cBytes,
            [in]  BYTE rgbData[]);

    HRESULT GetWorkItemData(
            [out]  WORD *pcBytes,
            [out]  BYTE **ppBytes);

    HRESULT SetErrorRetryCount(
            WORD wRetryCount);

    HRESULT GetErrorRetryCount(
            [out]  WORD *pwRetryCount);

    HRESULT SetErrorRetryInterval(
            WORD wRetryInterval);

    HRESULT GetErrorRetryInterval(
            [out]  WORD *pwRetryInterval);

    HRESULT SetFlags(
            DWORD dwFlags);

    HRESULT GetFlags(
            [out]  DWORD *pdwFlags);

    HRESULT SetAccountInformation(
            [in]  LPCWSTR pwszAccountName,
            [in]  LPCWSTR pwszPassword);

    HRESULT GetAccountInformation(
            [out]  LPWSTR *ppwszAccountName);
}

[
    local,
    object,
    uuid(148BD524-A2AB-11CE-B11F-00AA00530503),
    pointer_default(unique)
]
interface ITask : IScheduledWorkItem
{
    HRESULT SetApplicationName(
            [in]  LPCWSTR pwszApplicationName);

    HRESULT GetApplicationName(
            [out]  LPWSTR *ppwszApplicationName);

    HRESULT SetParameters(
            [in]  LPCWSTR pwszParameters);

    HRESULT GetParameters(
            [out]  LPWSTR *ppwszParameters);

    HRESULT SetWorkingDirectory(
            [in]  LPCWSTR pwszWorkingDirectory);

    HRESULT GetWorkingDirectory(
            [in]  LPWSTR *ppwszWorkingDirectory);

    HRESULT SetPriority(
            [in]  DWORD dwPriority);

    HRESULT GetPriority(
            [out]  DWORD *pdwPriority);

    HRESULT SetTaskFlags(
            [in]  DWORD dwFlags);

    HRESULT GetTaskFlags(
            [out]  DWORD *pdwFlags);

    HRESULT SetMaxRunTime(
            [in]  DWORD dwMaxRunTime);

    HRESULT GetMaxRunTime(
            [out]  DWORD *pdwMaxRunTime);
}

[
    local,
    object,
    uuid(148BD527-A2AB-11CE-B11F-00AA00530503),
    pointer_default(unique)
]
interface ITaskScheduler : IUnknown
{
    HRESULT SetTargetComputer(
            [in]  LPCWSTR pwszComputer);

    HRESULT GetTargetComputer(
            [out]  LPWSTR *ppwszComputer);

    HRESULT Enum(
            [out]  IEnumWorkItems **ppEnumTasks);

    HRESULT Activate(
            [in]   LPCWSTR pwszName,
            [in]   REFIID riid,
            [out]  IUnknown **ppunk);

    HRESULT Delete(
            [in]  LPCWSTR pwszName);

    HRESULT NewWorkItem(
            [in]   LPCWSTR pwszTaskName,
            [in]   REFCLSID rclsid,
            [in]   REFIID riid,
            [out]  IUnknown **ppunk);

    HRESULT AddWorkItem(
            [in]  LPCWSTR pwszTaskName,
            [in]  IScheduledWorkItem *pWorkItem);

    HRESULT IsOfType(
            [in]  LPCWSTR pwszName,
            [in]  REFIID riid);
}

[
377
    threading(both),
378 379 380 381 382 383 384 385 386
    uuid(148BD52A-A2AB-11CE-B11F-00AA00530503)
]
coclass CTaskScheduler
{
    [default] interface ITaskScheduler;
};


[
387
    threading(both),
388 389 390 391 392 393
    uuid(148BD520-A2AB-11CE-B11F-00AA00530503)
]
coclass CTask
{
    [default] interface ITask;
};