From 7c74ff3bbbcfab3bbf809095140514c2fbf3e8ef Mon Sep 17 00:00:00 2001
From: Roy Shea <royshea@gmail.com>
Date: Thu, 10 Jul 2008 12:48:08 -0700
Subject: [PATCH] include: Add header for mstask.

---
 .gitignore          |   1 +
 include/Makefile.in |   1 +
 include/mstask.idl  | 354 ++++++++++++++++++++++++++++++++++++++++++++
 include/prsht.h     |   3 +
 include/winbase.h   |   3 +
 include/wtypes.idl  |  14 ++
 6 files changed, 376 insertions(+)
 create mode 100644 include/mstask.idl

diff --git a/.gitignore b/.gitignore
index 05ffba66dd0..44a8ce1b0b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -151,6 +151,7 @@ include/mscoree.h
 include/mshtmhst.h
 include/mshtml.h
 include/msinkaut.h
+include/mstask.h
 include/msxml.h
 include/msxml2.h
 include/netfw.h
diff --git a/include/Makefile.in b/include/Makefile.in
index 3b6370a7bd8..563119901d4 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -41,6 +41,7 @@ IDL_H_SRCS = \
 	mshtmhst.idl \
 	mshtml.idl \
 	msinkaut.idl \
+	mstask.idl \
 	msxml.idl \
 	msxml2.idl \
 	netfw.idl \
diff --git a/include/mstask.idl b/include/mstask.idl
new file mode 100644
index 00000000000..cac9e0813af
--- /dev/null
+++ b/include/mstask.idl
@@ -0,0 +1,354 @@
+/*
+ * 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";
+
+[
+    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);
+}
+
+[
+    uuid(148BD52A-A2AB-11CE-B11F-00AA00530503)
+]
+coclass CTaskScheduler
+{
+    [default] interface ITaskScheduler;
+};
+
+
+[
+    uuid(148BD520-A2AB-11CE-B11F-00AA00530503)
+]
+coclass CTask
+{
+    [default] interface ITask;
+};
diff --git a/include/prsht.h b/include/prsht.h
index b11d0d0d5d5..27e43c8c6da 100644
--- a/include/prsht.h
+++ b/include/prsht.h
@@ -44,7 +44,10 @@ static const WCHAR WC_PROPSHEETW[] = { 'S','y','s',
 struct _PROPSHEETPAGEA;  /** need to forward declare those structs **/
 struct _PROPSHEETPAGEW;
 struct _PSP;
+#ifndef _HPROPSHEETPAGE_DEFINED
+#define _HPROPSHEETPAGE_DEFINED
 typedef struct _PSP *HPROPSHEETPAGE;
+#endif /* _HPROPSHEETPAGE_DEFINED */
 
 
 typedef UINT (CALLBACK *LPFNPSPCALLBACKA)(HWND, UINT, struct _PROPSHEETPAGEA*);
diff --git a/include/winbase.h b/include/winbase.h
index c47a1a500fe..0ee36c2ff60 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -502,6 +502,8 @@ typedef struct tagMEMORYSTATUSEX {
 #include <poppack.h>
 
 
+#ifndef _SYSTEMTIME_
+#define _SYSTEMTIME_
 typedef struct _SYSTEMTIME{
         WORD wYear;
         WORD wMonth;
@@ -512,6 +514,7 @@ typedef struct _SYSTEMTIME{
         WORD wSecond;
         WORD wMilliseconds;
 } SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
+#endif /* _SYSTEMTIME_ */
 
 /* The 'overlapped' data structure used by async I/O functions.
  */
diff --git a/include/wtypes.idl b/include/wtypes.idl
index 8d8b8e3ba08..8378012fd0e 100644
--- a/include/wtypes.idl
+++ b/include/wtypes.idl
@@ -207,6 +207,20 @@ typedef struct tagLOGPALETTE
 } LOGPALETTE, *PLOGPALETTE, *LPLOGPALETTE;
 cpp_quote("#endif")
 
+cpp_quote("#ifndef _SYSTEMTIME_")
+cpp_quote("#define _SYSTEMTIME_")
+typedef struct _SYSTEMTIME{
+        WORD wYear;
+        WORD wMonth;
+        WORD wDayOfWeek;
+        WORD wDay;
+        WORD wHour;
+        WORD wMinute;
+        WORD wSecond;
+        WORD wMilliseconds;
+} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
+cpp_quote("#endif")
+
 cpp_quote("#ifndef _FILETIME_")
 cpp_quote("#define _FILETIME_")
 typedef struct _FILETIME {
-- 
GitLab