Here's the situation:

The C structs:



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;

The way I have them defined:

DAILY STRUCT
DaysInterval WORD ?
DAILY ENDS

WEEKLY STRUCT
WeeksInterval WORD ?
rgfDaysOfTheWeek WORD ?
WEEKLY ENDS

MONTHLYDATE STRUCT
rgfDays DWORD ?
rgfMonths WORD ?
MONTHLYDATE ENDS

MONTHLYDOW STRUCT
wWhichWeek WORD ?
rgfDaysOfTheWeek WORD ?
rgfMonths WORD ?
MONTHLYDOW ENDS

TRIGGER_TYPE_UNION UNION
Daily DAILY <>
Weekly WEEKLY <>
MonthlyDate MONTHLYDATE <>
MonthlyDOW MONTHLYDOW <>
TRIGGER_TYPE_UNION ENDS

TASK_TRIGGER STRUCT
cbTriggerSize WORD ?
Reserved1 WORD ?
wBeginYear WORD ?
wBeginMonth WORD ?
wBeginDay WORD ?
wEndYear WORD ?
wEndMonth WORD ?
wEndDay WORD ?
wStartHour WORD ?
wStartMinute WORD ?
MinutesDuration DWORD ?
MinutesInterval DWORD ?
rgFlags DWORD ?
TriggerType DWORD ?
TypeT TRIGGER_TYPE_UNION <>
Reserved2 WORD ?
wRandomMinutesInterval WORD ?
TASK_TRIGGER ENDS
PTASK_TRIGGER TYPEDEF PTR TASK_TRIGGER


I'm using TypeT instead of Type, since I get an error if I use Type.
I have TriggerType defined as a DWORD.

Here is the C code I'm dealing with:



HRESULT SetTrigger(
const PTASK_TRIGGER pTrigger
);

Here is my Problem area:

INVOKE RtlZeroMemory,ADDR Trigger,SIZEOF TASK_TRIGGER

mov Trigger.cbTriggerSize,SIZEOF TASK_TRIGGER
mov Trigger.wBeginYear,2005
mov Trigger.wBeginMonth,1
mov Trigger.wBeginDay,12
mov Trigger.MinutesInterval,5
mov Trigger.TriggerType,TASK_TRIGGER_TYPE_TASK_TIME_TRIGGER_DAILY
mov Trigger.TypeT.Daily.DaysInterval,1
mov Trigger.wStartHour,13
mov Trigger.wStartMinute,45

mov edx,stTaskTrigger
mov edx,[edx]

INVOKE (ITaskTrigger PTR [edx]).SetTrigger,stTaskTrigger,ADDR Trigger

cmp eax,S_OK
jne MT003



Everything works if I take out the SetTrigger function. It makes a task object with no trigger. Ain't that great. :-)
I did notice in the C code the pointer to the TASK_TRIGGER is a const!!!

The error I get is E_INVALIDARG.

Anyhow this is my situation. Any help would be greatly appreciated.

Thanks for your time and consideration,

Darrel
Posted on 2005-01-12 17:14:43 by Darrel
Greetings,
I suggest following the steps provided in the link Creating a New Trigger, and then implement the code sample referenced at the end of the page.
Posted on 2005-01-12 19:42:01 by Poimander
Greetings,

The link you gave me is where I have been reading. I'm not understanding the const pointer they're using in the ITaskTrigger::SetTrigger method.

Thanks again,

Darrel
Posted on 2005-01-12 20:17:50 by Darrel
(1)
The link you gave me is where I have been reading.

I thought that was the case.

(2)
I'm not understanding the const pointer they're using in the ITaskTrigger::SetTrigger method.

Look at the prototype of ITaskTrigger::SetTrigger -- the argument is of type PTASK_TRIGGER, i.e. a pointer to a TASK_TRIGGER structure. Don't worry
about the 'const' keyword.

This is your mistake -->

mov edx, stTaskTrigger
mov edx,


you're using the wrong pointer! The pointer you should be using here is the one obtained from a previous call to ITask::CreateTrigger as exhibited in C/C++ code example.
Posted on 2005-01-12 20:41:37 by Poimander
This is the pointer I'm using:

	mov	edx,stTask

mov edx,[edx]

INVOKE (ITask PTR [edx]).CreateTrigger,stTask,ADDR NewTrigger,ADDR stTaskTrigger

cmp eax,S_OK
jne MT002

INVOKE RtlZeroMemory,ADDR Trigger,SIZEOF TASK_TRIGGER

mov Trigger.cbTriggerSize,SIZEOF TASK_TRIGGER
mov Trigger.wBeginYear,2005
mov Trigger.wBeginMonth,1
mov Trigger.wBeginDay,12
mov Trigger.MinutesInterval,5
mov Trigger.TriggerType,TASK_TRIGGER_TYPE_TASK_TIME_TRIGGER_DAILY
mov Trigger.TypeT.Daily.DaysInterval,1
mov Trigger.wStartHour,13
mov Trigger.wStartMinute,45

mov edx,stTaskTrigger
mov edx,[edx]

INVOKE (ITaskTrigger PTR [edx]).SetTrigger,stTaskTrigger,ADDR Trigger

cmp eax,S_OK
jne MT003

I'm not seeing the fault in my logic.

Darrel
Posted on 2005-01-12 20:56:04 by Darrel
Actually I am in error here -- your code looks, on the face, it correct! However you may have a minor error elsewhere in your code -- or even in
of one your header files. If you could upload the code one of us should be able to find the error.
Posted on 2005-01-12 21:18:47 by Poimander
OK



MakeTask PROC
LOCAL stTaskScheduler
LOCAL stTask
LOCAL stTaskTrigger
LOCAL stPersistFile
LOCAL Trigger:TASK_TRIGGER

INVOKE CoInitialize,NULL

INVOKE CoCreateInstance,ADDR CLSID_CTaskScheduler,NULL,CLSCTX_INPROC_SERVER,ADDR IID_ITaskScheduler,ADDR stTaskScheduler

cmp eax,S_OK
jne MT000

mov edx,stTaskScheduler
mov edx,[edx]

INVOKE (ITaskScheduler PTR [edx]).NewWorkItem,stTaskScheduler,ADDR szTaskerW,ADDR CLSID_CTask,ADDR IID_ITask,ADDR stTask

cmp eax,S_OK
jne MT001

mov edx,stTask
mov edx,[edx]

INVOKE (ITask PTR [edx]).SetCreator,stTask,ADDR szUserNameW

cmp eax,S_OK
jne MT002

mov edx,stTask
mov edx,[edx]

INVOKE (ITask PTR [edx]).SetFlags,stTask,TASK_FLAG_RUN_ONLY_IF_LOGGED_ON

cmp eax,S_OK
jne MT002

mov edx,stTask
mov edx,[edx]

INVOKE (ITask PTR [edx]).SetApplicationName,stTask,ADDR szProgramW

cmp eax,S_OK
jne MT002

mov edx,stTask
mov edx,[edx]

INVOKE (ITask PTR [edx]).SetWorkingDirectory,stTask,ADDR szProgramDirW

cmp eax,S_OK
jne MT002

mov edx,stTask
mov edx,[edx]

INVOKE (ITask PTR [edx]).SetPriority,stTask,REALTIME_PRIORITY_CLASS

cmp eax,S_OK
jne MT002

mov edx,stTask
mov edx,[edx]

INVOKE (ITask PTR [edx]).SetMaxRunTime,stTask,INFINITE

cmp eax,S_OK
jne MT002

mov edx,stTask
mov edx,[edx]

INVOKE (ITask PTR [edx]).SetAccountInformation,stTask,ADDR szComputerNameW,NULL

cmp eax,S_OK
jne MT002

mov edx,stTask
mov edx,[edx]

INVOKE (ITask PTR [edx]).CreateTrigger,stTask,ADDR NewTrigger,ADDR stTaskTrigger

cmp eax,S_OK
jne MT002

INVOKE RtlZeroMemory,ADDR Trigger,SIZEOF TASK_TRIGGER

mov Trigger.cbTriggerSize,SIZEOF TASK_TRIGGER
mov Trigger.wBeginYear,2005
mov Trigger.wBeginMonth,1
mov Trigger.wBeginDay,12
mov Trigger.MinutesInterval,5
mov Trigger.TriggerType,TASK_TRIGGER_TYPE_TASK_TIME_TRIGGER_DAILY
mov Trigger.TypeT.Daily.DaysInterval,1
mov Trigger.wStartHour,13
mov Trigger.wStartMinute,45

mov edx,stTaskTrigger
mov edx,[edx]

INVOKE (ITaskTrigger PTR [edx]).SetTrigger,stTaskTrigger,ADDR Trigger

cmp eax,S_OK
jne MT003

mov edx,stTask
mov edx,[edx]

INVOKE (ITask PTR [edx]).QueryInterface,stTask,ADDR IID_IPersistFile,ADDR stPersistFile

cmp eax,S_OK
jne MT003

mov edx,stPersistFile
mov edx,[edx]

INVOKE (IPersistFile PTR [edx]).Save,stPersistFile,NULL,TRUE

mov edx,stPersistFile
mov edx,[edx]

INVOKE (IPersistFile PTR [edx]).Release,stPersistFile

MT003:
mov edx,stTaskTrigger
mov edx,[edx]

INVOKE (ITaskTrigger PTR [edx]).Release,stTaskTrigger

MT002:
mov edx,stTask
mov edx,[edx]

INVOKE (ITask PTR [edx]).Release,stTask

MT001:
mov edx,stTaskScheduler
mov edx,[edx]

INVOKE (ITaskScheduler PTR [edx]).Release,stTaskScheduler

MT000:
INVOKE CoUninitialize

ret

MakeTask ENDP


My concern is using TypeT instead of Type in TASK_TRIGGER STRUCT or my defining TriggerType as a DWORD instead of the ENUM STRUCT.

If I omit the SetTrigger function everything is fine, except my task object has no trigger. :-)

Here are my Interfaces:



;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
externdef IID_IUnknown:IID
LPUNKNOWN typedef DWORD
LPPUNKNOWN typedef ptr LPUNKNOWN

IUnknown_QueryInterfaceProto typedef proto :DWORD, :DWORD, :DWORD
IUnknown_AddRefProto typedef proto :DWORD
IUnknown_ReleaseProto typedef proto :DWORD

IUnknown_QueryInterface typedef ptr IUnknown_QueryInterfaceProto
IUnknown_AddRef typedef ptr IUnknown_AddRefProto
IUnknown_Release typedef ptr IUnknown_ReleaseProto

IUnknown STRUCT DWORD
QueryInterface IUnknown_QueryInterface ?
AddRef IUnknown_AddRef ?
Release IUnknown_Release ?
IUnknown ENDS
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
sCLSID_CTaskScheduler TEXTEQU <{0148BD52Ah,0A2ABh,011CEh,{0B1h,01Fh,000h,0AAh,000h,053h,005h,003h}}>
sIID_ITaskScheduler TEXTEQU <{0148BD527h,0A2ABh,011CEh,{0B1h,01Fh,000h,0AAh,000h,053h,005h,003h}}>
sCLSID_CTask TEXTEQU <{0148BD520h,0A2ABh,011CEh,{0B1h,01Fh,000h,0AAh,000h,053h,005h,003h}}>

LPTASKSCHEDULER typedef DWORD
LPPTASKSCHEDULER typedef ptr LPTASKSCHEDULER

ITaskScheduler_SetTargetComputerProto typedef proto :DWORD, :DWORD
ITaskScheduler_GetTargetComputerProto typedef proto :DWORD, :DWORD
ITaskScheduler_EnumProto typedef proto :DWORD, :DWORD
ITaskScheduler_ActivateProto typedef proto :DWORD, :DWORD, :DWORD, :DWORD
ITaskScheduler_DeleteProto typedef proto :DWORD, :DWORD
ITaskScheduler_NewWorkItemProto typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
ITaskScheduler_AddWorkItemProto typedef proto :DWORD, :DWORD, :DWORD
ITaskScheduler_IsOfTypeProto typedef proto :DWORD, :DWORD, :DWORD

ITaskScheduler_SetTargetComputer typedef ptr ITaskScheduler_SetTargetComputerProto
ITaskScheduler_GetTargetComputer typedef ptr ITaskScheduler_GetTargetComputerProto
ITaskScheduler_Enum typedef ptr ITaskScheduler_EnumProto
ITaskScheduler_Activate typedef ptr ITaskScheduler_ActivateProto
ITaskScheduler_Delete typedef ptr ITaskScheduler_DeleteProto
ITaskScheduler_NewWorkItem typedef ptr ITaskScheduler_NewWorkItemProto
ITaskScheduler_AddWorkItem typedef ptr ITaskScheduler_AddWorkItemProto
ITaskScheduler_IsOfType typedef ptr ITaskScheduler_IsOfTypeProto

ITaskScheduler STRUCT DWORD
QueryInterface IUnknown_QueryInterface ?
AddRef IUnknown_AddRef ?
Release IUnknown_Release ?
SetTargetComputer ITaskScheduler_SetTargetComputer ?
GetTargetComputer ITaskScheduler_GetTargetComputer ?
Enum ITaskScheduler_Enum ?
Activate ITaskScheduler_Activate ?
Delete ITaskScheduler_Delete ?
NewWorkItem ITaskScheduler_NewWorkItem ?
AddWorkItem ITaskScheduler_AddWorkItem ?
IsOfType ITaskScheduler_IsOfType ?
ITaskScheduler ENDS
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
sIID_IScheduledWorkItem TEXTEQU <{0a6b952f0h,0a4b1h,011d0h,{099h,07dh,000h,0aah,000h,068h,087h,0ech}}>

LPSCHEDULEDWORKITEM typedef DWORD
LPPSCHEDULEDWORKITEM typedef ptr LPSCHEDULEDWORKITEM

IScheduledWorkItem_CreateTriggerProto typedef proto :DWORD, :DWORD, :DWORD
IScheduledWorkItem_DeleteTriggerProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_GetTriggerCountProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_GetTriggerProto typedef proto :DWORD, :DWORD, :DWORD
IScheduledWorkItem_GetTriggerStringProto typedef proto :DWORD, :DWORD, :DWORD
IScheduledWorkItem_GetRunTimesProto typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
IScheduledWorkItem_GetNextRunTimeProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_SetIdleWaitProto typedef proto :DWORD, :DWORD, :DWORD
IScheduledWorkItem_GetIdleWaitProto typedef proto :DWORD, :DWORD, :DWORD
IScheduledWorkItem_RunProto typedef proto :DWORD
IScheduledWorkItem_TerminateProto typedef proto :DWORD
IScheduledWorkItem_EditWorkItemProto typedef proto :DWORD, :DWORD, :DWORD
IScheduledWorkItem_GetMostRecentRunTimeProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_GetStatusProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_GetExitCodeProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_SetCommentProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_GetCommentProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_SetCreatorProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_GetCreatorProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_SetWorkItemDataProto typedef proto :DWORD, :DWORD, :DWORD
IScheduledWorkItem_GetWorkItemDataProto typedef proto :DWORD, :DWORD, :DWORD
IScheduledWorkItem_SetErrorRetryCountProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_GetErrorRetryCountProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_SetErrorRetryIntervalProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_GetErrorRetryIntervalProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_SetFlagsProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_GetFlagsProto typedef proto :DWORD, :DWORD
IScheduledWorkItem_SetAccountInformationProto typedef proto :DWORD, :DWORD, :DWORD
IScheduledWorkItem_GetAccountInformationProto typedef proto :DWORD, :DWORD

IScheduledWorkItem_CreateTrigger typedef ptr IScheduledWorkItem_CreateTriggerProto
IScheduledWorkItem_DeleteTrigger typedef ptr IScheduledWorkItem_DeleteTriggerProto
IScheduledWorkItem_GetTriggerCount typedef ptr IScheduledWorkItem_GetTriggerCountProto
IScheduledWorkItem_GetTrigger typedef ptr IScheduledWorkItem_GetTriggerProto
IScheduledWorkItem_GetTriggerString typedef ptr IScheduledWorkItem_GetTriggerStringProto
IScheduledWorkItem_GetRunTimes typedef ptr IScheduledWorkItem_GetRunTimesProto
IScheduledWorkItem_GetNextRunTime typedef ptr IScheduledWorkItem_GetNextRunTimeProto
IScheduledWorkItem_SetIdleWait typedef ptr IScheduledWorkItem_SetIdleWaitProto
IScheduledWorkItem_GetIdleWait typedef ptr IScheduledWorkItem_GetIdleWaitProto
IScheduledWorkItem_Run typedef ptr IScheduledWorkItem_RunProto
IScheduledWorkItem_Terminate typedef ptr IScheduledWorkItem_TerminateProto
IScheduledWorkItem_EditWorkItem typedef ptr IScheduledWorkItem_EditWorkItemProto
IScheduledWorkItem_GetMostRecentRunTime typedef ptr IScheduledWorkItem_GetMostRecentRunTimeProto
IScheduledWorkItem_GetStatus typedef ptr IScheduledWorkItem_GetStatusProto
IScheduledWorkItem_GetExitCode typedef ptr IScheduledWorkItem_GetExitCodeProto
IScheduledWorkItem_SetComment typedef ptr IScheduledWorkItem_SetCommentProto
IScheduledWorkItem_GetComment typedef ptr IScheduledWorkItem_GetCommentProto
IScheduledWorkItem_SetCreator typedef ptr IScheduledWorkItem_SetCreatorProto
IScheduledWorkItem_GetCreator typedef ptr IScheduledWorkItem_GetCreatorProto
IScheduledWorkItem_SetWorkItemData typedef ptr IScheduledWorkItem_SetWorkItemDataProto
IScheduledWorkItem_GetWorkItemData typedef ptr IScheduledWorkItem_GetWorkItemDataProto
IScheduledWorkItem_SetErrorRetryCount typedef ptr IScheduledWorkItem_SetErrorRetryCountProto
IScheduledWorkItem_GetErrorRetryCount typedef ptr IScheduledWorkItem_GetErrorRetryCountProto
IScheduledWorkItem_SetErrorRetryInterval typedef ptr IScheduledWorkItem_SetErrorRetryIntervalProto
IScheduledWorkItem_GetErrorRetryInterval typedef ptr IScheduledWorkItem_GetErrorRetryIntervalProto
IScheduledWorkItem_SetFlags typedef ptr IScheduledWorkItem_SetFlagsProto
IScheduledWorkItem_GetFlags typedef ptr IScheduledWorkItem_GetFlagsProto
IScheduledWorkItem_SetAccountInformation typedef ptr IScheduledWorkItem_SetAccountInformationProto
IScheduledWorkItem_GetAccountInformation typedef ptr IScheduledWorkItem_GetAccountInformationProto

IScheduledWorkItem STRUCT DWORD
QueryInterface IUnknown_QueryInterface ?
AddRef IUnknown_AddRef ?
Release IUnknown_Release ?
CreateTrigger IScheduledWorkItem_CreateTrigger ?
DeleteTrigger IScheduledWorkItem_DeleteTrigger ?
GetTriggerCount IScheduledWorkItem_GetTriggerCount ?
GetTrigger IScheduledWorkItem_GetTrigger ?
GetTriggerString IScheduledWorkItem_GetTriggerString ?
GetRunTimes IScheduledWorkItem_GetRunTimes ?
GetNextRunTime IScheduledWorkItem_GetNextRunTime ?
SetIdleWait IScheduledWorkItem_SetIdleWait ?
GetIdleWait IScheduledWorkItem_GetIdleWait ?
Run IScheduledWorkItem_Run ?
Terminate IScheduledWorkItem_Terminate ?
EditWorkItem IScheduledWorkItem_EditWorkItem ?
GetMostRecentRunTime IScheduledWorkItem_GetMostRecentRunTime ?
GetStatus IScheduledWorkItem_GetStatus ?
GetExitCode IScheduledWorkItem_GetExitCode ?
SetComment IScheduledWorkItem_SetComment ?
GetComment IScheduledWorkItem_GetComment ?
SetCreator IScheduledWorkItem_SetCreator ?
GetCreator IScheduledWorkItem_GetCreator ?
SetWorkItemData IScheduledWorkItem_SetWorkItemData ?
GetWorkItemData IScheduledWorkItem_GetWorkItemData ?
SetErrorRetryCount IScheduledWorkItem_SetErrorRetryCount ?
GetErrorRetryCount IScheduledWorkItem_GetErrorRetryCount ?
SetErrorRetryInterval IScheduledWorkItem_SetErrorRetryInterval ?
GetErrorRetryInterval IScheduledWorkItem_GetErrorRetryInterval ?
SetFlags IScheduledWorkItem_SetFlags ?
GetFlags IScheduledWorkItem_GetFlags ?
SetAccountInformation IScheduledWorkItem_SetAccountInformation ?
GetAccountInformation IScheduledWorkItem_GetAccountInformation ?
IScheduledWorkItem ENDS
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
sIID_ITask TEXTEQU <{0148BD524h,0A2ABh,011CEh,{0B1h,01Fh,000h,0AAh,000h,053h,005h,003h}}>
;sIID_ITask TEXTEQU <{05A897574h,0B79Bh,011D2h,{0B5h,023h,000h,0C0h,04Fh,0A3h,060h,00Ah}}>

LPTASK typedef DWORD
LPPTASK typedef ptr LPTASK

ITask_SetApplicationNameProto typedef proto :DWORD, :DWORD
ITask_GetApplicationNameProto typedef proto :DWORD, :DWORD
ITask_SetParametersProto typedef proto :DWORD, :DWORD
ITask_GetParametersProto typedef proto :DWORD, :DWORD
ITask_SetWorkingDirectoryProto typedef proto :DWORD, :DWORD
ITask_GetWorkingDirectoryProto typedef proto :DWORD, :DWORD
ITask_SetPriorityProto typedef proto :DWORD, :DWORD
ITask_GetPriorityProto typedef proto :DWORD, :DWORD
ITask_SetTaskFlagsProto typedef proto :DWORD, :DWORD
ITask_GetTaskFlagsProto typedef proto :DWORD, :DWORD
ITask_SetMaxRunTimeProto typedef proto :DWORD, :DWORD
ITask_GetMaxRunTimeProto typedef proto :DWORD, :DWORD

ITask_SetApplicationName typedef ptr ITask_SetApplicationNameProto
ITask_GetApplicationName typedef ptr ITask_GetApplicationNameProto
ITask_SetParameters typedef ptr ITask_SetParametersProto
ITask_GetParameters typedef ptr ITask_GetParametersProto
ITask_SetWorkingDirectory typedef ptr ITask_SetWorkingDirectoryProto
ITask_GetWorkingDirectory typedef ptr ITask_GetWorkingDirectoryProto
ITask_SetPriority typedef ptr ITask_SetPriorityProto
ITask_GetPriority typedef ptr ITask_GetPriorityProto
ITask_SetTaskFlags typedef ptr ITask_SetTaskFlagsProto
ITask_GetTaskFlags typedef ptr ITask_GetTaskFlagsProto
ITask_SetMaxRunTime typedef ptr ITask_SetMaxRunTimeProto
ITask_GetMaxRunTime typedef ptr ITask_GetMaxRunTimeProto

ITask STRUCT DWORD
QueryInterface IUnknown_QueryInterface ?
AddRef IUnknown_AddRef ?
Release IUnknown_Release ?
CreateTrigger IScheduledWorkItem_CreateTrigger ?
DeleteTrigger IScheduledWorkItem_DeleteTrigger ?
GetTriggerCount IScheduledWorkItem_GetTriggerCount ?
GetTrigger IScheduledWorkItem_GetTrigger ?
GetTriggerString IScheduledWorkItem_GetTriggerString ?
GetRunTimes IScheduledWorkItem_GetRunTimes ?
GetNextRunTime IScheduledWorkItem_GetNextRunTime ?
SetIdleWait IScheduledWorkItem_SetIdleWait ?
GetIdleWait IScheduledWorkItem_GetIdleWait ?
Run IScheduledWorkItem_Run ?
Terminate IScheduledWorkItem_Terminate ?
EditWorkItem IScheduledWorkItem_EditWorkItem ?
GetMostRecentRunTime IScheduledWorkItem_GetMostRecentRunTime ?
GetStatus IScheduledWorkItem_GetStatus ?
GetExitCode IScheduledWorkItem_GetExitCode ?
SetComment IScheduledWorkItem_SetComment ?
GetComment IScheduledWorkItem_GetComment ?
SetCreator IScheduledWorkItem_SetCreator ?
GetCreator IScheduledWorkItem_GetCreator ?
SetWorkItemData IScheduledWorkItem_SetWorkItemData ?
GetWorkItemData IScheduledWorkItem_GetWorkItemData ?
SetErrorRetryCount IScheduledWorkItem_SetErrorRetryCount ?
GetErrorRetryCount IScheduledWorkItem_GetErrorRetryCount ?
SetErrorRetryInterval IScheduledWorkItem_SetErrorRetryInterval ?
GetErrorRetryInterval IScheduledWorkItem_GetErrorRetryInterval ?
SetFlags IScheduledWorkItem_SetFlags ?
GetFlags IScheduledWorkItem_GetFlags ?
SetAccountInformation IScheduledWorkItem_SetAccountInformation ?
GetAccountInformation IScheduledWorkItem_GetAccountInformation ?
SetApplicationName ITask_SetApplicationName ?
GetApplicationName ITask_GetApplicationName ?
SetParameters ITask_SetParameters ?
GetParameters ITask_GetParameters ?
SetWorkingDirectory ITask_SetWorkingDirectory ?
GetWorkingDirectory ITask_GetWorkingDirectory ?
SetPriority ITask_SetPriority ?
GetPriority ITask_GetPriority ?
SetTaskFlags ITask_SetTaskFlags ?
GetTaskFlags ITask_GetTaskFlags ?
SetMaxRunTime ITask_SetMaxRunTime ?
GetMaxRunTime ITask_GetMaxRunTime ?
ITask ENDS
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
sIID_ITaskTrigger TEXTEQU <{0148BD52Bh,0A2ABh,011CEh,{0B1h,01Fh,000h,0AAh,000h,053h,005h,003h}}>

LPTASKTRIGGER typedef DWORD
LPPTASKTRIGGER typedef ptr LPTASKTRIGGER

ITaskTrigger_SetTriggerProto typedef proto :DWORD, :DWORD
ITaskTrigger_GetTriggerProto typedef proto :DWORD, :DWORD
ITaskTrigger_GetTriggerStringProto typedef proto :DWORD, :DWORD

ITaskTrigger_SetTrigger typedef ptr ITaskTrigger_SetTriggerProto
ITaskTrigger_GetTrigger typedef ptr ITaskTrigger_GetTriggerProto
ITaskTrigger_GetTriggerString typedef ptr ITaskTrigger_GetTriggerStringProto

ITaskTrigger STRUCT DWORD
QueryInterface IUnknown_QueryInterface ?
AddRef IUnknown_AddRef ?
Release IUnknown_Release ?
SetTrigger ITaskTrigger_SetTrigger ?
GetTrigger ITaskTrigger_GetTrigger ?
GetTriggerString ITaskTrigger_GetTriggerString ?
ITaskTrigger ENDS
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
sIID_IPersistFile TEXTEQU <{00000010Bh,00000h,00000h,{0C0h,000h,000h,000h,000h,000h,000h,046h}}>

LPPERSISTFILE typedef DWORD
LPPPERSISTFILE typedef ptr LPPERSISTFILE

IPersistFile_GetClassIDProto typedef proto :DWORD, :DWORD
IPersistFile_GetCurFileProto typedef proto :DWORD, :DWORD
IPersistFile_IsDirtyProto typedef proto :DWORD
IPersistFile_LoadProto typedef proto :DWORD, :DWORD, :DWORD
IPersistFile_SaveProto typedef proto :DWORD, :DWORD, :DWORD
IPersistFile_SaveCompletedProto typedef proto :DWORD, :DWORD

IPersistFile_GetClassID typedef ptr IPersistFile_GetClassIDProto
IPersistFile_GetCurFile typedef ptr IPersistFile_GetCurFileProto
IPersistFile_IsDirty typedef ptr IPersistFile_IsDirtyProto
IPersistFile_Load typedef ptr IPersistFile_LoadProto
IPersistFile_Save typedef ptr IPersistFile_SaveProto
IPersistFile_SaveCompleted typedef ptr IPersistFile_SaveCompletedProto

IPersistFile STRUCT DWORD
QueryInterface IUnknown_QueryInterface ?
AddRef IUnknown_AddRef ?
Release IUnknown_Release ?
GetClassID IPersistFile_GetClassID ?
IsDirty IPersistFile_IsDirty ?
Load IPersistFile_Load ?
Save IPersistFile_Save ?
SaveCompleted IPersistFile_SaveCompleted ?
GetCurFile IPersistFile_GetCurFile ?
IPersistFile ENDS
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>



Thanks again for your time and consideration,

Darrel
Posted on 2005-01-12 21:26:16 by Darrel
Your interfaces look ok. An error can result if the TASK_TRIGGER structure has been defined incorrectly. You may try using h2inc to generate an include
file, by creating a subsidiary '.h' from 'mstask.h' say -- including only the stuff you need to compile the TASK_TRIGGER structure -- that is if you have'nt done this already.
Posted on 2005-01-12 21:58:07 by Poimander
I don't have mstask.h, but I shall look for it.

Darrel
Posted on 2005-01-12 22:08:18 by Darrel
I would suggest:

- create an assembly listing of your C example and check if sizeof (TASK_TRIGGER) matches the one in the ASM source
- if there is a difference, define the union as follows:



TRIGGER_TYPE_UNION UNION 4
Daily DAILY <>
Weekly WEEKLY <>
MonthlyDate MONTHLYDATE <>
MonthlyDOW MONTHLYDOW <>
TRIGGER_TYPE_UNION ENDS


because AFAICS the union currently is 6 bytes in ASM, but may be 8 bytes in C
Posted on 2005-01-12 23:04:55 by japheth
Greetings japheth,

Well, I managed to compile the mstask.idl file which contains all of the
required interfaces and structure definitions, and then converted the file
using tlb2inc. Here's the generated .inc file:

;-===========================================================================-

;
; Generated .INC file (by TlbToInc v1.2 - Copyright (c) 2001 Maurice MONTGENIE)
;
; TypeLib filename: MSTASK.tlb
;
;-===========================================================================-

;Library : mstask
;~~~~~~~~~~~~~~~~
;{10646351-5E4B-4899-97BF-BD7F2E427732}
sLIBID_mstask TEXTEQU <{010646351H, 05E4BH, 04899H, {097H, 0BFH, 0BDH, 07FH, 02EH, 042H, 077H, 032H}}>

;Forward Declarations
_vtITaskTrigger MACRO CastName:REQ
ENDM
_vtIScheduledWorkItem MACRO CastName:REQ
ENDM
_vtITask MACRO CastName:REQ
ENDM
_vtITaskScheduler MACRO CastName:REQ
ENDM
_vtIEnumWorkItems MACRO CastName:REQ
ENDM
_vtIProvideTaskPage MACRO CastName:REQ
ENDM

;EnumType : _TASK_TRIGGER_TYPE
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_TASK_TRIGGER_TYPE TEXTEQU <DWORD>

TASK_TIME_TRIGGER_ONCE EQU 0
TASK_TIME_TRIGGER_DAILY EQU 1
TASK_TIME_TRIGGER_WEEKLY EQU 2
TASK_TIME_TRIGGER_MONTHLYDATE EQU 3
TASK_TIME_TRIGGER_MONTHLYDOW EQU 4
TASK_EVENT_TRIGGER_ON_IDLE EQU 5
TASK_EVENT_TRIGGER_AT_SYSTEMSTART EQU 6
TASK_EVENT_TRIGGER_AT_LOGON EQU 7

;EnumType : _TASKPAGE
;~~~~~~~~~~~~~~~~~~~~
_TASKPAGE TEXTEQU <DWORD>

TASKPAGE_TASK EQU 0
TASKPAGE_SCHEDULE EQU 1
TASKPAGE_SETTINGS EQU 2

;Union : _TRIGGER_TYPE_UNION
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_TRIGGER_TYPE_UNION UNION
Daily _DAILY <?>
Weekly _WEEKLY <?>
MonthlyDate _MONTHLYDATE <?>
MonthlyDOW _MONTHLYDOW <?>
_TRIGGER_TYPE_UNION ENDS

;Union : __MIDL_IWinTypes_0009
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__MIDL_IWinTypes_0009 UNION
hInproc SDWORD ?
hRemote SDWORD ?
__MIDL_IWinTypes_0009 ENDS

;Struct : _TASK_TRIGGER
;~~~~~~~~~~~~~~~~~~~~~~~
_TASK_TRIGGER STRUCT DWORD
cbTriggerSize SWORD ?
Reserved1 SWORD ?
wBeginYear SWORD ?
wBeginMonth SWORD ?
wBeginDay SWORD ?
wEndYear SWORD ?
wEndMonth SWORD ?
wEndDay SWORD ?
wStartHour SWORD ?
wStartMinute SWORD ?
MinutesDuration DWORD ?
MinutesInterval DWORD ?
rgFlags DWORD ?
TriggerType _TASK_TRIGGER_TYPE ?
Type _TRIGGER_TYPE_UNION <?>
Reserved2 SWORD ?
wRandomMinutesInterval SWORD ?
_TASK_TRIGGER ENDS

;Struct : _DAILY
;~~~~~~~~~~~~~~~~
_DAILY STRUCT DWORD
DaysInterval SWORD ?
_DAILY ENDS

;Struct : _WEEKLY
;~~~~~~~~~~~~~~~~~
_WEEKLY STRUCT DWORD
WeeksInterval SWORD ?
rgfDaysOfTheWeek SWORD ?
_WEEKLY ENDS

;Struct : _MONTHLYDATE
;~~~~~~~~~~~~~~~~~~~~~~
_MONTHLYDATE STRUCT DWORD
rgfDays DWORD ?
rgfMonths SWORD ?
_MONTHLYDATE ENDS

;Struct : _MONTHLYDOW
;~~~~~~~~~~~~~~~~~~~~~
_MONTHLYDOW STRUCT DWORD
wWhichWeek SWORD ?
rgfDaysOfTheWeek SWORD ?
rgfMonths SWORD ?
_MONTHLYDOW ENDS

;Struct : _SYSTEMTIME
;~~~~~~~~~~~~~~~~~~~~~
_SYSTEMTIME STRUCT DWORD
wYear SWORD ?
wMonth SWORD ?
wDayOfWeek SWORD ?
wDay SWORD ?
wHour SWORD ?
wMinute SWORD ?
wSecond SWORD ?
wMilliseconds SWORD ?
_SYSTEMTIME ENDS

;Struct : _RemotableHandle
;~~~~~~~~~~~~~~~~~~~~~~~~~~
_RemotableHandle STRUCT DWORD
fContext SDWORD ?
u __MIDL_IWinTypes_0009 <?>
_RemotableHandle ENDS

;Interface : ITaskTrigger
;~~~~~~~~~~~~~~~~~~~~~~~~
;{148BD52B-A2AB-11CE-B11F-00AA00530503}
sIID_ITaskTrigger TEXTEQU <{0148BD52BH, 0A2ABH, 011CEH, {0B1H, 01FH, 000H, 0AAH, 000H, 053H, 005H, 003H}}>

ITaskTrigger_SetTriggerProto typedef proto ITaskTrigger_SetTriggerProto :DWORD,:DWORD
ITaskTrigger_GetTriggerProto typedef proto ITaskTrigger_GetTriggerProto :DWORD,:DWORD
ITaskTrigger_GetTriggerStringProto typedef proto ITaskTrigger_GetTriggerStringProto :DWORD,:DWORD

ITaskTrigger_SetTriggerVal typedef ptr ITaskTrigger_SetTriggerProto
ITaskTrigger_GetTriggerVal typedef ptr ITaskTrigger_GetTriggerProto
ITaskTrigger_GetTriggerStringVal typedef ptr ITaskTrigger_GetTriggerStringProto

_vtITaskTrigger MACRO CastName:REQ
; IUnknown methods
_vtIUnknown CastName
; ITaskTrigger methods
&CastName&_SetTrigger ITaskTrigger_SetTriggerVal ?
&CastName&_GetTrigger ITaskTrigger_GetTriggerVal ?
&CastName&_GetTriggerString ITaskTrigger_GetTriggerStringVal ?

ENDM

ITaskTrigger STRUCT
_vtITaskTrigger ITaskTrigger
ITaskTrigger ENDS

;Interface : IScheduledWorkItem
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;{A6B952F0-A4B1-11D0-997D-00AA006887EC}
sIID_IScheduledWorkItem TEXTEQU <{0A6B952F0H, 0A4B1H, 011D0H, {099H, 07DH, 000H, 0AAH, 000H, 068H, 087H, 0ECH}}>

IScheduledWorkItem_CreateTriggerProto typedef proto IScheduledWorkItem_CreateTriggerProto :DWORD,:DWORD,:DWORD
IScheduledWorkItem_DeleteTriggerProto typedef proto IScheduledWorkItem_DeleteTriggerProto :DWORD,:SWORD
IScheduledWorkItem_GetTriggerCountProto typedef proto IScheduledWorkItem_GetTriggerCountProto :DWORD,:DWORD
IScheduledWorkItem_GetTriggerProto typedef proto IScheduledWorkItem_GetTriggerProto :DWORD,:SWORD,:DWORD
IScheduledWorkItem_GetTriggerStringProto typedef proto IScheduledWorkItem_GetTriggerStringProto :DWORD,:SWORD,:DWORD
IScheduledWorkItem_GetRunTimesProto typedef proto IScheduledWorkItem_GetRunTimesProto :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
IScheduledWorkItem_GetNextRunTimeProto typedef proto IScheduledWorkItem_GetNextRunTimeProto :DWORD,:DWORD
IScheduledWorkItem_SetIdleWaitProto typedef proto IScheduledWorkItem_SetIdleWaitProto :DWORD,:SWORD,:SWORD
IScheduledWorkItem_GetIdleWaitProto typedef proto IScheduledWorkItem_GetIdleWaitProto :DWORD,:DWORD,:DWORD
IScheduledWorkItem_RunProto typedef proto IScheduledWorkItem_RunProto :DWORD
IScheduledWorkItem_TerminateProto typedef proto IScheduledWorkItem_TerminateProto :DWORD
IScheduledWorkItem_EditWorkItemProto typedef proto IScheduledWorkItem_EditWorkItemProto :DWORD,:DWORD,:DWORD
IScheduledWorkItem_GetMostRecentRunTimeProto typedef proto IScheduledWorkItem_GetMostRecentRunTimeProto :DWORD,:DWORD
IScheduledWorkItem_GetStatusProto typedef proto IScheduledWorkItem_GetStatusProto :DWORD,:DWORD
IScheduledWorkItem_GetExitCodeProto typedef proto IScheduledWorkItem_GetExitCodeProto :DWORD,:DWORD
IScheduledWorkItem_SetCommentProto typedef proto IScheduledWorkItem_SetCommentProto :DWORD,:DWORD
IScheduledWorkItem_GetCommentProto typedef proto IScheduledWorkItem_GetCommentProto :DWORD,:DWORD
IScheduledWorkItem_SetCreatorProto typedef proto IScheduledWorkItem_SetCreatorProto :DWORD,:DWORD
IScheduledWorkItem_GetCreatorProto typedef proto IScheduledWorkItem_GetCreatorProto :DWORD,:DWORD
IScheduledWorkItem_SetWorkItemDataProto typedef proto IScheduledWorkItem_SetWorkItemDataProto :DWORD,:SWORD,:DWORD
IScheduledWorkItem_GetWorkItemDataProto typedef proto IScheduledWorkItem_GetWorkItemDataProto :DWORD,:DWORD,:DWORD
IScheduledWorkItem_SetErrorRetryCountProto typedef proto IScheduledWorkItem_SetErrorRetryCountProto :DWORD,:SWORD
IScheduledWorkItem_GetErrorRetryCountProto typedef proto IScheduledWorkItem_GetErrorRetryCountProto :DWORD,:DWORD
IScheduledWorkItem_SetErrorRetryIntervalProto typedef proto IScheduledWorkItem_SetErrorRetryIntervalProto :DWORD,:SWORD
IScheduledWorkItem_GetErrorRetryIntervalProto typedef proto IScheduledWorkItem_GetErrorRetryIntervalProto :DWORD,:DWORD
IScheduledWorkItem_SetFlagsProto typedef proto IScheduledWorkItem_SetFlagsProto :DWORD,:DWORD
IScheduledWorkItem_GetFlagsProto typedef proto IScheduledWorkItem_GetFlagsProto :DWORD,:DWORD
IScheduledWorkItem_SetAccountInformationProto typedef proto IScheduledWorkItem_SetAccountInformationProto :DWORD,:DWORD,:DWORD
IScheduledWorkItem_GetAccountInformationProto typedef proto IScheduledWorkItem_GetAccountInformationProto :DWORD,:DWORD

IScheduledWorkItem_CreateTriggerVal typedef ptr IScheduledWorkItem_CreateTriggerProto
IScheduledWorkItem_DeleteTriggerVal typedef ptr IScheduledWorkItem_DeleteTriggerProto
IScheduledWorkItem_GetTriggerCountVal typedef ptr IScheduledWorkItem_GetTriggerCountProto
IScheduledWorkItem_GetTriggerVal typedef ptr IScheduledWorkItem_GetTriggerProto
IScheduledWorkItem_GetTriggerStringVal typedef ptr IScheduledWorkItem_GetTriggerStringProto
IScheduledWorkItem_GetRunTimesVal typedef ptr IScheduledWorkItem_GetRunTimesProto
IScheduledWorkItem_GetNextRunTimeVal typedef ptr IScheduledWorkItem_GetNextRunTimeProto
IScheduledWorkItem_SetIdleWaitVal typedef ptr IScheduledWorkItem_SetIdleWaitProto
IScheduledWorkItem_GetIdleWaitVal typedef ptr IScheduledWorkItem_GetIdleWaitProto
IScheduledWorkItem_RunVal typedef ptr IScheduledWorkItem_RunProto
IScheduledWorkItem_TerminateVal typedef ptr IScheduledWorkItem_TerminateProto
IScheduledWorkItem_EditWorkItemVal typedef ptr IScheduledWorkItem_EditWorkItemProto
IScheduledWorkItem_GetMostRecentRunTimeVal typedef ptr IScheduledWorkItem_GetMostRecentRunTimeProto
IScheduledWorkItem_GetStatusVal typedef ptr IScheduledWorkItem_GetStatusProto
IScheduledWorkItem_GetExitCodeVal typedef ptr IScheduledWorkItem_GetExitCodeProto
IScheduledWorkItem_SetCommentVal typedef ptr IScheduledWorkItem_SetCommentProto
IScheduledWorkItem_GetCommentVal typedef ptr IScheduledWorkItem_GetCommentProto
IScheduledWorkItem_SetCreatorVal typedef ptr IScheduledWorkItem_SetCreatorProto
IScheduledWorkItem_GetCreatorVal typedef ptr IScheduledWorkItem_GetCreatorProto
IScheduledWorkItem_SetWorkItemDataVal typedef ptr IScheduledWorkItem_SetWorkItemDataProto
IScheduledWorkItem_GetWorkItemDataVal typedef ptr IScheduledWorkItem_GetWorkItemDataProto
IScheduledWorkItem_SetErrorRetryCountVal typedef ptr IScheduledWorkItem_SetErrorRetryCountProto
IScheduledWorkItem_GetErrorRetryCountVal typedef ptr IScheduledWorkItem_GetErrorRetryCountProto
IScheduledWorkItem_SetErrorRetryIntervalVal typedef ptr IScheduledWorkItem_SetErrorRetryIntervalProto
IScheduledWorkItem_GetErrorRetryIntervalVal typedef ptr IScheduledWorkItem_GetErrorRetryIntervalProto
IScheduledWorkItem_SetFlagsVal typedef ptr IScheduledWorkItem_SetFlagsProto
IScheduledWorkItem_GetFlagsVal typedef ptr IScheduledWorkItem_GetFlagsProto
IScheduledWorkItem_SetAccountInformationVal typedef ptr IScheduledWorkItem_SetAccountInformationProto
IScheduledWorkItem_GetAccountInformationVal typedef ptr IScheduledWorkItem_GetAccountInformationProto

_vtIScheduledWorkItem MACRO CastName:REQ
; IUnknown methods
_vtIUnknown CastName
; IScheduledWorkItem methods
&CastName&_CreateTrigger IScheduledWorkItem_CreateTriggerVal ?
&CastName&_DeleteTrigger IScheduledWorkItem_DeleteTriggerVal ?
&CastName&_GetTriggerCount IScheduledWorkItem_GetTriggerCountVal ?
&CastName&_GetTrigger IScheduledWorkItem_GetTriggerVal ?
&CastName&_GetTriggerString IScheduledWorkItem_GetTriggerStringVal ?
&CastName&_GetRunTimes IScheduledWorkItem_GetRunTimesVal ?
&CastName&_GetNextRunTime IScheduledWorkItem_GetNextRunTimeVal ?
&CastName&_SetIdleWait IScheduledWorkItem_SetIdleWaitVal ?
&CastName&_GetIdleWait IScheduledWorkItem_GetIdleWaitVal ?
&CastName&_Run IScheduledWorkItem_RunVal ?
&CastName&_Terminate IScheduledWorkItem_TerminateVal ?
&CastName&_EditWorkItem IScheduledWorkItem_EditWorkItemVal ?
&CastName&_GetMostRecentRunTime IScheduledWorkItem_GetMostRecentRunTimeVal ?
&CastName&_GetStatus IScheduledWorkItem_GetStatusVal ?
&CastName&_GetExitCode IScheduledWorkItem_GetExitCodeVal ?
&CastName&_SetComment IScheduledWorkItem_SetCommentVal ?
&CastName&_GetComment IScheduledWorkItem_GetCommentVal ?
&CastName&_SetCreator IScheduledWorkItem_SetCreatorVal ?
&CastName&_GetCreator IScheduledWorkItem_GetCreatorVal ?
&CastName&_SetWorkItemData IScheduledWorkItem_SetWorkItemDataVal ?
&CastName&_GetWorkItemData IScheduledWorkItem_GetWorkItemDataVal ?
&CastName&_SetErrorRetryCount IScheduledWorkItem_SetErrorRetryCountVal ?
&CastName&_GetErrorRetryCount IScheduledWorkItem_GetErrorRetryCountVal ?
&CastName&_SetErrorRetryInterval IScheduledWorkItem_SetErrorRetryIntervalVal ?
&CastName&_GetErrorRetryInterval IScheduledWorkItem_GetErrorRetryIntervalVal ?
&CastName&_SetFlags IScheduledWorkItem_SetFlagsVal ?
&CastName&_GetFlags IScheduledWorkItem_GetFlagsVal ?
&CastName&_SetAccountInformation IScheduledWorkItem_SetAccountInformationVal ?
&CastName&_GetAccountInformation IScheduledWorkItem_GetAccountInformationVal ?

ENDM

IScheduledWorkItem STRUCT
_vtIScheduledWorkItem IScheduledWorkItem
IScheduledWorkItem ENDS

;Interface : ITask
;~~~~~~~~~~~~~~~~~
;{148BD524-A2AB-11CE-B11F-00AA00530503}
sIID_ITask TEXTEQU <{0148BD524H, 0A2ABH, 011CEH, {0B1H, 01FH, 000H, 0AAH, 000H, 053H, 005H, 003H}}>

ITask_SetApplicationNameProto typedef proto ITask_SetApplicationNameProto :DWORD,:DWORD
ITask_GetApplicationNameProto typedef proto ITask_GetApplicationNameProto :DWORD,:DWORD
ITask_SetParametersProto typedef proto ITask_SetParametersProto :DWORD,:DWORD
ITask_GetParametersProto typedef proto ITask_GetParametersProto :DWORD,:DWORD
ITask_SetWorkingDirectoryProto typedef proto ITask_SetWorkingDirectoryProto :DWORD,:DWORD
ITask_GetWorkingDirectoryProto typedef proto ITask_GetWorkingDirectoryProto :DWORD,:DWORD
ITask_SetPriorityProto typedef proto ITask_SetPriorityProto :DWORD,:DWORD
ITask_GetPriorityProto typedef proto ITask_GetPriorityProto :DWORD,:DWORD
ITask_SetTaskFlagsProto typedef proto ITask_SetTaskFlagsProto :DWORD,:DWORD
ITask_GetTaskFlagsProto typedef proto ITask_GetTaskFlagsProto :DWORD,:DWORD
ITask_SetMaxRunTimeProto typedef proto ITask_SetMaxRunTimeProto :DWORD,:DWORD
ITask_GetMaxRunTimeProto typedef proto ITask_GetMaxRunTimeProto :DWORD,:DWORD

ITask_SetApplicationNameVal typedef ptr ITask_SetApplicationNameProto
ITask_GetApplicationNameVal typedef ptr ITask_GetApplicationNameProto
ITask_SetParametersVal typedef ptr ITask_SetParametersProto
ITask_GetParametersVal typedef ptr ITask_GetParametersProto
ITask_SetWorkingDirectoryVal typedef ptr ITask_SetWorkingDirectoryProto
ITask_GetWorkingDirectoryVal typedef ptr ITask_GetWorkingDirectoryProto
ITask_SetPriorityVal typedef ptr ITask_SetPriorityProto
ITask_GetPriorityVal typedef ptr ITask_GetPriorityProto
ITask_SetTaskFlagsVal typedef ptr ITask_SetTaskFlagsProto
ITask_GetTaskFlagsVal typedef ptr ITask_GetTaskFlagsProto
ITask_SetMaxRunTimeVal typedef ptr ITask_SetMaxRunTimeProto
ITask_GetMaxRunTimeVal typedef ptr ITask_GetMaxRunTimeProto

_vtITask MACRO CastName:REQ
; IScheduledWorkItem methods
_vtIScheduledWorkItem CastName
; ITask methods
&CastName&_SetApplicationName ITask_SetApplicationNameVal ?
&CastName&_GetApplicationName ITask_GetApplicationNameVal ?
&CastName&_SetParameters ITask_SetParametersVal ?
&CastName&_GetParameters ITask_GetParametersVal ?
&CastName&_SetWorkingDirectory ITask_SetWorkingDirectoryVal ?
&CastName&_GetWorkingDirectory ITask_GetWorkingDirectoryVal ?
&CastName&_SetPriority ITask_SetPriorityVal ?
&CastName&_GetPriority ITask_GetPriorityVal ?
&CastName&_SetTaskFlags ITask_SetTaskFlagsVal ?
&CastName&_GetTaskFlags ITask_GetTaskFlagsVal ?
&CastName&_SetMaxRunTime ITask_SetMaxRunTimeVal ?
&CastName&_GetMaxRunTime ITask_GetMaxRunTimeVal ?

ENDM

ITask STRUCT
_vtITask ITask
ITask ENDS

;Interface : ITaskScheduler
;~~~~~~~~~~~~~~~~~~~~~~~~~~
;{148BD527-A2AB-11CE-B11F-00AA00530503}
sIID_ITaskScheduler TEXTEQU <{0148BD527H, 0A2ABH, 011CEH, {0B1H, 01FH, 000H, 0AAH, 000H, 053H, 005H, 003H}}>

ITaskScheduler_SetTargetComputerProto typedef proto ITaskScheduler_SetTargetComputerProto :DWORD,:DWORD
ITaskScheduler_GetTargetComputerProto typedef proto ITaskScheduler_GetTargetComputerProto :DWORD,:DWORD
ITaskScheduler_EnumProto typedef proto ITaskScheduler_EnumProto :DWORD,:DWORD
ITaskScheduler_ActivateProto typedef proto ITaskScheduler_ActivateProto :DWORD,:DWORD,:DWORD,:DWORD
ITaskScheduler_DeleteProto typedef proto ITaskScheduler_DeleteProto :DWORD,:DWORD
ITaskScheduler_NewWorkItemProto typedef proto ITaskScheduler_NewWorkItemProto :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
ITaskScheduler_AddWorkItemProto typedef proto ITaskScheduler_AddWorkItemProto :DWORD,:DWORD,:DWORD
ITaskScheduler_IsOfTypeProto typedef proto ITaskScheduler_IsOfTypeProto :DWORD,:DWORD,:DWORD

ITaskScheduler_SetTargetComputerVal typedef ptr ITaskScheduler_SetTargetComputerProto
ITaskScheduler_GetTargetComputerVal typedef ptr ITaskScheduler_GetTargetComputerProto
ITaskScheduler_EnumVal typedef ptr ITaskScheduler_EnumProto
ITaskScheduler_ActivateVal typedef ptr ITaskScheduler_ActivateProto
ITaskScheduler_DeleteVal typedef ptr ITaskScheduler_DeleteProto
ITaskScheduler_NewWorkItemVal typedef ptr ITaskScheduler_NewWorkItemProto
ITaskScheduler_AddWorkItemVal typedef ptr ITaskScheduler_AddWorkItemProto
ITaskScheduler_IsOfTypeVal typedef ptr ITaskScheduler_IsOfTypeProto

_vtITaskScheduler MACRO CastName:REQ
; IUnknown methods
_vtIUnknown CastName
; ITaskScheduler methods
&CastName&_SetTargetComputer ITaskScheduler_SetTargetComputerVal ?
&CastName&_GetTargetComputer ITaskScheduler_GetTargetComputerVal ?
&CastName&_Enum ITaskScheduler_EnumVal ?
&CastName&_Activate ITaskScheduler_ActivateVal ?
&CastName&_Delete ITaskScheduler_DeleteVal ?
&CastName&_NewWorkItem ITaskScheduler_NewWorkItemVal ?
&CastName&_AddWorkItem ITaskScheduler_AddWorkItemVal ?
&CastName&_IsOfType ITaskScheduler_IsOfTypeVal ?

ENDM

ITaskScheduler STRUCT
_vtITaskScheduler ITaskScheduler
ITaskScheduler ENDS

;Interface : IEnumWorkItems
;~~~~~~~~~~~~~~~~~~~~~~~~~~
;{148BD528-A2AB-11CE-B11F-00AA00530503}
sIID_IEnumWorkItems TEXTEQU <{0148BD528H, 0A2ABH, 011CEH, {0B1H, 01FH, 000H, 0AAH, 000H, 053H, 005H, 003H}}>

IEnumWorkItems_NextProto typedef proto IEnumWorkItems_NextProto :DWORD,:DWORD,:DWORD,:DWORD
IEnumWorkItems_SkipProto typedef proto IEnumWorkItems_SkipProto :DWORD,:DWORD
IEnumWorkItems_ResetProto typedef proto IEnumWorkItems_ResetProto :DWORD
IEnumWorkItems_CloneProto typedef proto IEnumWorkItems_CloneProto :DWORD,:DWORD

IEnumWorkItems_NextVal typedef ptr IEnumWorkItems_NextProto
IEnumWorkItems_SkipVal typedef ptr IEnumWorkItems_SkipProto
IEnumWorkItems_ResetVal typedef ptr IEnumWorkItems_ResetProto
IEnumWorkItems_CloneVal typedef ptr IEnumWorkItems_CloneProto

_vtIEnumWorkItems MACRO CastName:REQ
; IUnknown methods
_vtIUnknown CastName
; IEnumWorkItems methods
&CastName&_Next IEnumWorkItems_NextVal ?
&CastName&_Skip IEnumWorkItems_SkipVal ?
&CastName&_Reset IEnumWorkItems_ResetVal ?
&CastName&_Clone IEnumWorkItems_CloneVal ?

ENDM

IEnumWorkItems STRUCT
_vtIEnumWorkItems IEnumWorkItems
IEnumWorkItems ENDS

;Interface : IProvideTaskPage
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;{4086658A-CBBB-11CF-B604-00C04FD8D565}
sIID_IProvideTaskPage TEXTEQU <{04086658AH, 0CBBBH, 011CFH, {0B6H, 004H, 000H, 0C0H, 04FH, 0D8H, 0D5H, 065H}}>

IProvideTaskPage_GetPageProto typedef proto IProvideTaskPage_GetPageProto :DWORD,:DWORD,:SDWORD,:DWORD

IProvideTaskPage_GetPageVal typedef ptr IProvideTaskPage_GetPageProto

_vtIProvideTaskPage MACRO CastName:REQ
; IUnknown methods
_vtIUnknown CastName
; IProvideTaskPage methods
&CastName&_GetPage IProvideTaskPage_GetPageVal ?

ENDM

IProvideTaskPage STRUCT
_vtIProvideTaskPage IProvideTaskPage
IProvideTaskPage ENDS

Posted on 2005-01-13 00:07:22 by Poimander
You are right japheth, the union is 8 Bytes.

Now for the confession!!! :oops:

Trigger.MinutesDuration has to be greater than or equal to Trigger.MinutesInterval, naturally I had left it out.

Thank you both for your time and consideration, especially you Poimander.

Thanks,

Darrel
Posted on 2005-01-13 13:53:54 by Darrel
Hi Poimander, glad to hear you're still alive. :)
Posted on 2005-01-13 13:59:59 by japheth
Hi japheph,
Thank you, I'm still alive! As far as I am aware.
BTW, your site looks great!

Darrel, you're welcome!
Posted on 2005-01-13 18:40:51 by Poimander