Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
65d98714
Commit
65d98714
authored
Aug 22, 2008
by
Roy Shea
Committed by
Alexandre Julliard
Aug 26, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mstask: Implemented (Set|Get)Trigger.
parent
7c5f411e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
245 additions
and
51 deletions
+245
-51
Makefile.in
dlls/mstask/Makefile.in
+1
-1
mstask_private.h
dlls/mstask/mstask_private.h
+1
-0
task_trigger.c
dlls/mstask/task_trigger.c
+179
-4
task_trigger.c
dlls/mstask/tests/task_trigger.c
+64
-46
No files found.
dlls/mstask/Makefile.in
View file @
65d98714
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
MODULE
=
mstask.dll
IMPORTS
=
uuid ole32 kernel32
IMPORTS
=
uuid ole32 kernel32
ntdll
C_SRCS
=
\
factory.c
\
...
...
dlls/mstask/mstask_private.h
View file @
65d98714
...
...
@@ -42,6 +42,7 @@ typedef struct
{
const
ITaskTriggerVtbl
*
lpVtbl
;
LONG
ref
;
TASK_TRIGGER
triggerCond
;
}
TaskTriggerImpl
;
extern
HRESULT
TaskTriggerConstructor
(
LPVOID
*
ppObj
);
...
...
dlls/mstask/task_trigger.c
View file @
65d98714
...
...
@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "winternl.h"
#include "mstask_private.h"
#include "wine/debug.h"
...
...
@@ -74,16 +76,174 @@ static HRESULT WINAPI MSTASK_ITaskTrigger_SetTrigger(
ITaskTrigger
*
iface
,
const
PTASK_TRIGGER
pTrigger
)
{
FIXME
(
"Not implemented
\n
"
);
return
E_NOTIMPL
;
TaskTriggerImpl
*
This
=
(
TaskTriggerImpl
*
)
iface
;
TIME_FIELDS
field_time
;
LARGE_INTEGER
sys_time
;
TASK_TRIGGER
tmp_trigger_cond
;
TRACE
(
"(%p, %p)
\n
"
,
iface
,
pTrigger
);
/* Verify valid structure size */
if
(
pTrigger
->
cbTriggerSize
!=
sizeof
(
*
pTrigger
))
return
E_INVALIDARG
;
tmp_trigger_cond
.
cbTriggerSize
=
pTrigger
->
cbTriggerSize
;
/* Reserved field must be zero */
tmp_trigger_cond
.
Reserved1
=
0
;
/* Verify and set valid start date and time */
memset
(
&
field_time
,
0
,
sizeof
(
field_time
));
field_time
.
Year
=
pTrigger
->
wBeginYear
;
field_time
.
Month
=
pTrigger
->
wBeginMonth
;
field_time
.
Day
=
pTrigger
->
wBeginDay
;
field_time
.
Hour
=
pTrigger
->
wStartHour
;
field_time
.
Minute
=
pTrigger
->
wStartMinute
;
if
(
!
RtlTimeFieldsToTime
(
&
field_time
,
&
sys_time
))
return
E_INVALIDARG
;
tmp_trigger_cond
.
wBeginYear
=
pTrigger
->
wBeginYear
;
tmp_trigger_cond
.
wBeginMonth
=
pTrigger
->
wBeginMonth
;
tmp_trigger_cond
.
wBeginDay
=
pTrigger
->
wBeginDay
;
tmp_trigger_cond
.
wStartHour
=
pTrigger
->
wStartHour
;
tmp_trigger_cond
.
wStartMinute
=
pTrigger
->
wStartMinute
;
/* Verify valid end date if TASK_TRIGGER_FLAG_HAS_END_DATE flag is set */
if
(
pTrigger
->
rgFlags
&
TASK_TRIGGER_FLAG_HAS_END_DATE
)
{
memset
(
&
field_time
,
0
,
sizeof
(
field_time
));
field_time
.
Year
=
pTrigger
->
wEndYear
;
field_time
.
Month
=
pTrigger
->
wEndMonth
;
field_time
.
Day
=
pTrigger
->
wEndDay
;
if
(
!
RtlTimeFieldsToTime
(
&
field_time
,
&
sys_time
))
return
E_INVALIDARG
;
}
/* Set valid end date independent of TASK_TRIGGER_FLAG_HAS_END_DATE flag */
tmp_trigger_cond
.
wEndYear
=
pTrigger
->
wEndYear
;
tmp_trigger_cond
.
wEndMonth
=
pTrigger
->
wEndMonth
;
tmp_trigger_cond
.
wEndDay
=
pTrigger
->
wEndDay
;
/* Verify duration and interval pair */
if
(
pTrigger
->
MinutesDuration
<=
pTrigger
->
MinutesInterval
&&
pTrigger
->
MinutesInterval
>
0
)
return
E_INVALIDARG
;
if
(
pTrigger
->
MinutesDuration
>
0
&&
pTrigger
->
MinutesInterval
==
0
)
return
E_INVALIDARG
;
tmp_trigger_cond
.
MinutesDuration
=
pTrigger
->
MinutesDuration
;
tmp_trigger_cond
.
MinutesInterval
=
pTrigger
->
MinutesInterval
;
/* Copy over flags */
tmp_trigger_cond
.
rgFlags
=
pTrigger
->
rgFlags
;
/* Set TriggerType dependent fields of Type union */
tmp_trigger_cond
.
TriggerType
=
pTrigger
->
TriggerType
;
switch
(
pTrigger
->
TriggerType
)
{
case
TASK_TIME_TRIGGER_DAILY
:
tmp_trigger_cond
.
Type
.
Daily
.
DaysInterval
=
pTrigger
->
Type
.
Daily
.
DaysInterval
;
break
;
case
TASK_TIME_TRIGGER_WEEKLY
:
tmp_trigger_cond
.
Type
.
Weekly
.
WeeksInterval
=
pTrigger
->
Type
.
Weekly
.
WeeksInterval
;
tmp_trigger_cond
.
Type
.
Weekly
.
rgfDaysOfTheWeek
=
pTrigger
->
Type
.
Weekly
.
rgfDaysOfTheWeek
;
break
;
case
TASK_TIME_TRIGGER_MONTHLYDATE
:
tmp_trigger_cond
.
Type
.
MonthlyDate
.
rgfDays
=
pTrigger
->
Type
.
MonthlyDate
.
rgfDays
;
tmp_trigger_cond
.
Type
.
MonthlyDate
.
rgfMonths
=
pTrigger
->
Type
.
MonthlyDate
.
rgfMonths
;
break
;
case
TASK_TIME_TRIGGER_MONTHLYDOW
:
tmp_trigger_cond
.
Type
.
MonthlyDOW
.
wWhichWeek
=
pTrigger
->
Type
.
MonthlyDOW
.
wWhichWeek
;
tmp_trigger_cond
.
Type
.
MonthlyDOW
.
rgfDaysOfTheWeek
=
pTrigger
->
Type
.
MonthlyDOW
.
rgfDaysOfTheWeek
;
tmp_trigger_cond
.
Type
.
MonthlyDOW
.
rgfMonths
=
pTrigger
->
Type
.
MonthlyDOW
.
rgfMonths
;
break
;
case
TASK_TIME_TRIGGER_ONCE
:
case
TASK_EVENT_TRIGGER_ON_IDLE
:
case
TASK_EVENT_TRIGGER_AT_SYSTEMSTART
:
case
TASK_EVENT_TRIGGER_AT_LOGON
:
default:
tmp_trigger_cond
.
Type
=
This
->
triggerCond
.
Type
;
break
;
}
/* Reserved field must be zero */
tmp_trigger_cond
.
Reserved2
=
0
;
/* wRandomMinutesInterval not currently used and is initialized to zero */
tmp_trigger_cond
.
wRandomMinutesInterval
=
0
;
/* Update object copy of triggerCond */
This
->
triggerCond
=
tmp_trigger_cond
;
return
S_OK
;
}
static
HRESULT
WINAPI
MSTASK_ITaskTrigger_GetTrigger
(
ITaskTrigger
*
iface
,
PTASK_TRIGGER
pTrigger
)
{
FIXME
(
"Not implemented
\n
"
);
return
E_NOTIMPL
;
TaskTriggerImpl
*
This
=
(
TaskTriggerImpl
*
)
iface
;
TRACE
(
"(%p, %p)
\n
"
,
iface
,
pTrigger
);
/* Native implementation doesn't verify equivalent cbTriggerSize fields */
/* Copy relevant fields of the structure */
pTrigger
->
cbTriggerSize
=
This
->
triggerCond
.
cbTriggerSize
;
pTrigger
->
Reserved1
=
0
;
pTrigger
->
wBeginYear
=
This
->
triggerCond
.
wBeginYear
;
pTrigger
->
wBeginMonth
=
This
->
triggerCond
.
wBeginMonth
;
pTrigger
->
wBeginDay
=
This
->
triggerCond
.
wBeginDay
;
pTrigger
->
wEndYear
=
This
->
triggerCond
.
wEndYear
;
pTrigger
->
wEndMonth
=
This
->
triggerCond
.
wEndMonth
;
pTrigger
->
wEndDay
=
This
->
triggerCond
.
wEndDay
;
pTrigger
->
wStartHour
=
This
->
triggerCond
.
wStartHour
;
pTrigger
->
wStartMinute
=
This
->
triggerCond
.
wStartMinute
;
pTrigger
->
MinutesDuration
=
This
->
triggerCond
.
MinutesDuration
;
pTrigger
->
MinutesInterval
=
This
->
triggerCond
.
MinutesInterval
;
pTrigger
->
rgFlags
=
This
->
triggerCond
.
rgFlags
;
pTrigger
->
TriggerType
=
This
->
triggerCond
.
TriggerType
;
switch
(
This
->
triggerCond
.
TriggerType
)
{
case
TASK_TIME_TRIGGER_DAILY
:
pTrigger
->
Type
.
Daily
.
DaysInterval
=
This
->
triggerCond
.
Type
.
Daily
.
DaysInterval
;
break
;
case
TASK_TIME_TRIGGER_WEEKLY
:
pTrigger
->
Type
.
Weekly
.
WeeksInterval
=
This
->
triggerCond
.
Type
.
Weekly
.
WeeksInterval
;
pTrigger
->
Type
.
Weekly
.
rgfDaysOfTheWeek
=
This
->
triggerCond
.
Type
.
Weekly
.
rgfDaysOfTheWeek
;
break
;
case
TASK_TIME_TRIGGER_MONTHLYDATE
:
pTrigger
->
Type
.
MonthlyDate
.
rgfDays
=
This
->
triggerCond
.
Type
.
MonthlyDate
.
rgfDays
;
pTrigger
->
Type
.
MonthlyDate
.
rgfMonths
=
This
->
triggerCond
.
Type
.
MonthlyDate
.
rgfMonths
;
break
;
case
TASK_TIME_TRIGGER_MONTHLYDOW
:
pTrigger
->
Type
.
MonthlyDOW
.
wWhichWeek
=
This
->
triggerCond
.
Type
.
MonthlyDOW
.
wWhichWeek
;
pTrigger
->
Type
.
MonthlyDOW
.
rgfDaysOfTheWeek
=
This
->
triggerCond
.
Type
.
MonthlyDOW
.
rgfDaysOfTheWeek
;
pTrigger
->
Type
.
MonthlyDOW
.
rgfMonths
=
This
->
triggerCond
.
Type
.
MonthlyDOW
.
rgfMonths
;
break
;
case
TASK_TIME_TRIGGER_ONCE
:
case
TASK_EVENT_TRIGGER_ON_IDLE
:
case
TASK_EVENT_TRIGGER_AT_SYSTEMSTART
:
case
TASK_EVENT_TRIGGER_AT_LOGON
:
default:
break
;
}
pTrigger
->
Reserved2
=
0
;
pTrigger
->
wRandomMinutesInterval
=
0
;
return
S_OK
;
}
static
HRESULT
WINAPI
MSTASK_ITaskTrigger_GetTriggerString
(
...
...
@@ -107,6 +267,7 @@ static const ITaskTriggerVtbl MSTASK_ITaskTriggerVtbl =
HRESULT
TaskTriggerConstructor
(
LPVOID
*
ppObj
)
{
TaskTriggerImpl
*
This
;
SYSTEMTIME
time
;
TRACE
(
"(%p)
\n
"
,
ppObj
);
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
));
...
...
@@ -116,6 +277,20 @@ HRESULT TaskTriggerConstructor(LPVOID *ppObj)
This
->
lpVtbl
=
&
MSTASK_ITaskTriggerVtbl
;
This
->
ref
=
1
;
/* Most fields of triggerCond default to zero. Initialize other
* fields to default values. */
memset
(
&
This
->
triggerCond
,
0
,
sizeof
(
TASK_TRIGGER
));
GetLocalTime
(
&
time
);
This
->
triggerCond
.
cbTriggerSize
=
sizeof
(
This
->
triggerCond
);
This
->
triggerCond
.
wBeginYear
=
time
.
wYear
;
This
->
triggerCond
.
wBeginMonth
=
time
.
wMonth
;
This
->
triggerCond
.
wBeginDay
=
time
.
wDay
;
This
->
triggerCond
.
wStartHour
=
time
.
wHour
;
This
->
triggerCond
.
wStartMinute
=
time
.
wMinute
;
This
->
triggerCond
.
rgFlags
=
TASK_TRIGGER_FLAG_DISABLED
;
This
->
triggerCond
.
TriggerType
=
TASK_TIME_TRIGGER_DAILY
,
This
->
triggerCond
.
Type
.
Daily
.
DaysInterval
=
1
;
*
ppObj
=
&
This
->
lpVtbl
;
InterlockedIncrement
(
&
dll_ref
);
return
S_OK
;
...
...
dlls/mstask/tests/task_trigger.c
View file @
65d98714
...
...
@@ -70,67 +70,67 @@ static BOOL compare_trigger_state(TASK_TRIGGER found_state,
"cbTriggerSize: Found %d but expected %d
\n
"
,
found_state
.
cbTriggerSize
,
expected_state
.
cbTriggerSize
);
todo_wine
ok
(
found_state
.
Reserved1
==
expected_state
.
Reserved1
,
ok
(
found_state
.
Reserved1
==
expected_state
.
Reserved1
,
"Reserved1: Found %d but expected %d
\n
"
,
found_state
.
Reserved1
,
expected_state
.
Reserved1
);
todo_wine
ok
(
found_state
.
wBeginYear
==
expected_state
.
wBeginYear
,
ok
(
found_state
.
wBeginYear
==
expected_state
.
wBeginYear
,
"wBeginYear: Found %d but expected %d
\n
"
,
found_state
.
wBeginYear
,
expected_state
.
wBeginYear
);
todo_wine
ok
(
found_state
.
wBeginMonth
==
expected_state
.
wBeginMonth
,
ok
(
found_state
.
wBeginMonth
==
expected_state
.
wBeginMonth
,
"wBeginMonth: Found %d but expected %d
\n
"
,
found_state
.
wBeginMonth
,
expected_state
.
wBeginMonth
);
todo_wine
ok
(
found_state
.
wBeginDay
==
expected_state
.
wBeginDay
,
ok
(
found_state
.
wBeginDay
==
expected_state
.
wBeginDay
,
"wBeginDay: Found %d but expected %d
\n
"
,
found_state
.
wBeginDay
,
expected_state
.
wBeginDay
);
todo_wine
ok
(
found_state
.
wEndYear
==
expected_state
.
wEndYear
,
ok
(
found_state
.
wEndYear
==
expected_state
.
wEndYear
,
"wEndYear: Found %d but expected %d
\n
"
,
found_state
.
wEndYear
,
expected_state
.
wEndYear
);
todo_wine
ok
(
found_state
.
wEndMonth
==
expected_state
.
wEndMonth
,
ok
(
found_state
.
wEndMonth
==
expected_state
.
wEndMonth
,
"wEndMonth: Found %d but expected %d
\n
"
,
found_state
.
wEndMonth
,
expected_state
.
wEndMonth
);
todo_wine
ok
(
found_state
.
wEndDay
==
expected_state
.
wEndDay
,
ok
(
found_state
.
wEndDay
==
expected_state
.
wEndDay
,
"wEndDay: Found %d but expected %d
\n
"
,
found_state
.
wEndDay
,
expected_state
.
wEndDay
);
todo_wine
ok
(
found_state
.
wStartHour
==
expected_state
.
wStartHour
,
ok
(
found_state
.
wStartHour
==
expected_state
.
wStartHour
,
"wStartHour: Found %d but expected %d
\n
"
,
found_state
.
wStartHour
,
expected_state
.
wStartHour
);
todo_wine
ok
(
found_state
.
wStartMinute
==
expected_state
.
wStartMinute
,
ok
(
found_state
.
wStartMinute
==
expected_state
.
wStartMinute
,
"wStartMinute: Found %d but expected %d
\n
"
,
found_state
.
wStartMinute
,
expected_state
.
wStartMinute
);
todo_wine
ok
(
found_state
.
MinutesDuration
==
expected_state
.
MinutesDuration
,
ok
(
found_state
.
MinutesDuration
==
expected_state
.
MinutesDuration
,
"MinutesDuration: Found %d but expected %d
\n
"
,
found_state
.
MinutesDuration
,
expected_state
.
MinutesDuration
);
todo_wine
ok
(
found_state
.
MinutesInterval
==
expected_state
.
MinutesInterval
,
ok
(
found_state
.
MinutesInterval
==
expected_state
.
MinutesInterval
,
"MinutesInterval: Found %d but expected %d
\n
"
,
found_state
.
MinutesInterval
,
expected_state
.
MinutesInterval
);
todo_wine
ok
(
found_state
.
rgFlags
==
expected_state
.
rgFlags
,
ok
(
found_state
.
rgFlags
==
expected_state
.
rgFlags
,
"rgFlags: Found %d but expected %d
\n
"
,
found_state
.
rgFlags
,
expected_state
.
rgFlags
);
todo_wine
ok
(
found_state
.
TriggerType
==
expected_state
.
TriggerType
,
ok
(
found_state
.
TriggerType
==
expected_state
.
TriggerType
,
"TriggerType: Found %d but expected %d
\n
"
,
found_state
.
TriggerType
,
expected_state
.
TriggerType
);
todo_wine
ok
(
found_state
.
Type
.
Daily
.
DaysInterval
==
expected_state
.
Type
.
Daily
.
DaysInterval
,
ok
(
found_state
.
Type
.
Daily
.
DaysInterval
==
expected_state
.
Type
.
Daily
.
DaysInterval
,
"Type.Daily.DaysInterval: Found %d but expected %d
\n
"
,
found_state
.
Type
.
Daily
.
DaysInterval
,
expected_state
.
Type
.
Daily
.
DaysInterval
);
todo_wine
ok
(
found_state
.
Reserved2
==
expected_state
.
Reserved2
,
ok
(
found_state
.
Reserved2
==
expected_state
.
Reserved2
,
"Reserved2: Found %d but expected %d
\n
"
,
found_state
.
Reserved2
,
expected_state
.
Reserved2
);
todo_wine
ok
(
found_state
.
wRandomMinutesInterval
==
expected_state
.
wRandomMinutesInterval
,
ok
(
found_state
.
wRandomMinutesInterval
==
expected_state
.
wRandomMinutesInterval
,
"wRandomMinutesInterval: Found %d but expected %d
\n
"
,
found_state
.
wRandomMinutesInterval
,
expected_state
.
wRandomMinutesInterval
);
...
...
@@ -181,25 +181,25 @@ static void test_SetTrigger_GetTrigger(void)
memset
(
&
trigger_state
,
0xcf
,
sizeof
(
trigger_state
));
trigger_state
.
cbTriggerSize
=
sizeof
(
trigger_state
);
hres
=
ITaskTrigger_GetTrigger
(
test_trigger
,
&
trigger_state
);
todo_wine
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
compare_trigger_state
(
trigger_state
,
empty_trigger_state
);
/* Test setting basic empty trigger */
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
empty_trigger_state
);
todo_wine
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
memset
(
&
trigger_state
,
0xcf
,
sizeof
(
trigger_state
));
trigger_state
.
cbTriggerSize
=
sizeof
(
trigger_state
);
hres
=
ITaskTrigger_GetTrigger
(
test_trigger
,
&
trigger_state
);
todo_wine
ok
(
hres
==
S_OK
,
"Failed to GetTrigger
\n
"
);
ok
(
hres
==
S_OK
,
"Failed to GetTrigger
\n
"
);
compare_trigger_state
(
trigger_state
,
empty_trigger_state
);
/* Test setting basic non-empty trigger */
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
memset
(
&
trigger_state
,
0xcf
,
sizeof
(
trigger_state
));
trigger_state
.
cbTriggerSize
=
sizeof
(
trigger_state
);
hres
=
ITaskTrigger_GetTrigger
(
test_trigger
,
&
trigger_state
);
todo_wine
ok
(
hres
==
S_OK
,
"Failed to GetTrigger
\n
"
);
ok
(
hres
==
S_OK
,
"Failed to GetTrigger
\n
"
);
compare_trigger_state
(
trigger_state
,
normal_trigger_state
);
/* The following tests modify the normal_trigger_state structure
...
...
@@ -210,21 +210,21 @@ static void test_SetTrigger_GetTrigger(void)
/* Test setting trigger with invalid cbTriggerSize */
normal_trigger_state
.
cbTriggerSize
=
sizeof
(
trigger_state
)
-
1
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
cbTriggerSize
=
sizeof
(
trigger_state
)
+
1
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
cbTriggerSize
=
sizeof
(
trigger_state
);
/* Test setting trigger with invalid Reserved fields */
normal_trigger_state
.
Reserved1
=
80
;
normal_trigger_state
.
Reserved2
=
80
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
memset
(
&
trigger_state
,
0xcf
,
sizeof
(
trigger_state
));
trigger_state
.
cbTriggerSize
=
sizeof
(
trigger_state
);
hres
=
ITaskTrigger_GetTrigger
(
test_trigger
,
&
trigger_state
);
todo_wine
ok
(
trigger_state
.
Reserved1
==
0
&&
trigger_state
.
Reserved2
==
0
,
ok
(
trigger_state
.
Reserved1
==
0
&&
trigger_state
.
Reserved2
==
0
,
"Reserved fields should be set to zero
\n
"
);
normal_trigger_state
.
Reserved1
=
0
;
normal_trigger_state
.
Reserved2
=
0
;
...
...
@@ -232,23 +232,23 @@ static void test_SetTrigger_GetTrigger(void)
/* Test setting trigger with invalid month */
normal_trigger_state
.
wBeginMonth
=
0
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
wBeginMonth
=
13
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
wBeginMonth
=
1
;
/* Test setting trigger with invalid begin date */
normal_trigger_state
.
wBeginDay
=
0
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
wBeginDay
=
32
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
wBeginMonth
=
2
;
normal_trigger_state
.
wBeginDay
=
30
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
wBeginMonth
=
1
;
normal_trigger_state
.
wBeginDay
=
1
;
...
...
@@ -257,20 +257,20 @@ static void test_SetTrigger_GetTrigger(void)
normal_trigger_state
.
wEndMonth
=
200
;
normal_trigger_state
.
wEndDay
=
200
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
memset
(
&
trigger_state
,
0xcf
,
sizeof
(
trigger_state
));
trigger_state
.
cbTriggerSize
=
sizeof
(
trigger_state
);
hres
=
ITaskTrigger_GetTrigger
(
test_trigger
,
&
trigger_state
);
todo_wine
ok
(
trigger_state
.
wEndYear
==
0
,
"End year should be 0: %d
\n
"
,
ok
(
trigger_state
.
wEndYear
==
0
,
"End year should be 0: %d
\n
"
,
trigger_state
.
wEndYear
);
todo_wine
ok
(
trigger_state
.
wEndMonth
==
200
,
"End month should be 200: %d
\n
"
,
ok
(
trigger_state
.
wEndMonth
==
200
,
"End month should be 200: %d
\n
"
,
trigger_state
.
wEndMonth
);
todo_wine
ok
(
trigger_state
.
wEndDay
==
200
,
"End day should be 200: %d
\n
"
,
ok
(
trigger_state
.
wEndDay
==
200
,
"End day should be 200: %d
\n
"
,
trigger_state
.
wEndDay
);
normal_trigger_state
.
rgFlags
=
TASK_TRIGGER_FLAG_DISABLED
|
TASK_TRIGGER_FLAG_HAS_END_DATE
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
rgFlags
=
TASK_TRIGGER_FLAG_DISABLED
;
normal_trigger_state
.
wEndYear
=
2980
;
normal_trigger_state
.
wEndMonth
=
1
;
...
...
@@ -279,40 +279,40 @@ static void test_SetTrigger_GetTrigger(void)
/* Test setting trigger with invalid hour or minute*/
normal_trigger_state
.
wStartHour
=
24
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
wStartHour
=
3
;
normal_trigger_state
.
wStartHour
=
60
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
wStartHour
=
3
;
/* Test setting trigger with invalid duration / interval pairs */
normal_trigger_state
.
MinutesDuration
=
5
;
normal_trigger_state
.
MinutesInterval
=
5
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
MinutesDuration
=
5
;
normal_trigger_state
.
MinutesInterval
=
6
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
MinutesDuration
=
0
;
normal_trigger_state
.
MinutesInterval
=
6
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
MinutesDuration
=
5
;
normal_trigger_state
.
MinutesInterval
=
0
;
todo_wine
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
E_INVALIDARG
,
"Expected E_INVALIDARG: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
MinutesDuration
=
0
;
normal_trigger_state
.
MinutesInterval
=
0
;
/* Test setting trigger with end date before start date */
normal_trigger_state
.
wEndYear
=
1979
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
rgFlags
=
TASK_TRIGGER_FLAG_DISABLED
|
TASK_TRIGGER_FLAG_HAS_END_DATE
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
normal_trigger_state
.
rgFlags
=
TASK_TRIGGER_FLAG_DISABLED
;
normal_trigger_state
.
wEndYear
=
2980
;
normal_trigger_state
.
wEndMonth
=
1
;
...
...
@@ -324,7 +324,7 @@ static void test_SetTrigger_GetTrigger(void)
normal_trigger_state
.
Type
.
Weekly
.
WeeksInterval
=
2
;
normal_trigger_state
.
Type
.
Weekly
.
rgfDaysOfTheWeek
=
(
TASK_MONDAY
|
TASK_TUESDAY
);
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
memset
(
&
trigger_state
,
0xcf
,
sizeof
(
trigger_state
));
trigger_state
.
cbTriggerSize
=
sizeof
(
trigger_state
);
hres
=
ITaskTrigger_GetTrigger
(
test_trigger
,
&
trigger_state
);
...
...
@@ -341,14 +341,32 @@ static void test_SetTrigger_GetTrigger(void)
/* Test setting trigger with set wRandomMinutesInterval */
normal_trigger_state
.
wRandomMinutesInterval
=
5
;
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
todo_wine
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
memset
(
&
trigger_state
,
0xcf
,
sizeof
(
trigger_state
));
trigger_state
.
cbTriggerSize
=
sizeof
(
trigger_state
);
hres
=
ITaskTrigger_GetTrigger
(
test_trigger
,
&
trigger_state
);
todo_wine
ok
(
trigger_state
.
wRandomMinutesInterval
==
0
,
ok
(
trigger_state
.
wRandomMinutesInterval
==
0
,
"wRandomMinutesInterval should be set to zero
\n
"
);
normal_trigger_state
.
wRandomMinutesInterval
=
0
;
/* Test GetTrigger using invalid cbTriggerSiz in pTrigger. In
* contrast to available documentation, this succeeds in practice. */
hres
=
ITaskTrigger_SetTrigger
(
test_trigger
,
&
normal_trigger_state
);
ok
(
hres
==
S_OK
,
"Failed to set trigger: 0x%08x
\n
"
,
hres
);
memset
(
&
trigger_state
,
0xcf
,
sizeof
(
trigger_state
));
trigger_state
.
cbTriggerSize
=
sizeof
(
trigger_state
)
-
1
;
hres
=
ITaskTrigger_GetTrigger
(
test_trigger
,
&
trigger_state
);
ok
(
hres
==
S_OK
,
"Failed to GetTrigger
\n
"
);
ok
(
compare_trigger_state
(
trigger_state
,
normal_trigger_state
),
"Invalid state
\n
"
);
memset
(
&
trigger_state
,
0xcf
,
sizeof
(
trigger_state
));
trigger_state
.
cbTriggerSize
=
0
;
hres
=
ITaskTrigger_GetTrigger
(
test_trigger
,
&
trigger_state
);
ok
(
hres
==
S_OK
,
"Failed to GetTrigger
\n
"
);
ok
(
compare_trigger_state
(
trigger_state
,
normal_trigger_state
),
"Invalid state
\n
"
);
cleanup_trigger
();
return
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment