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
2a56402c
Commit
2a56402c
authored
May 22, 2018
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
May 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mstask: Add support for event triggers to ITask::GetNextRunTime().
Signed-off-by:
Dmitry Timoshkov
<
dmitry@baikal.ru
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e14e6bde
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
2 deletions
+63
-2
task.c
dlls/mstask/task.c
+8
-1
task_trigger.c
dlls/mstask/tests/task_trigger.c
+55
-1
No files found.
dlls/mstask/task.c
View file @
2a56402c
...
@@ -469,6 +469,7 @@ static void filetime_add_days(FILETIME *ft, ULONG days)
...
@@ -469,6 +469,7 @@ static void filetime_add_days(FILETIME *ft, ULONG days)
static
HRESULT
WINAPI
MSTASK_ITask_GetNextRunTime
(
ITask
*
iface
,
SYSTEMTIME
*
rt
)
static
HRESULT
WINAPI
MSTASK_ITask_GetNextRunTime
(
ITask
*
iface
,
SYSTEMTIME
*
rt
)
{
{
TaskImpl
*
This
=
impl_from_ITask
(
iface
);
TaskImpl
*
This
=
impl_from_ITask
(
iface
);
HRESULT
hr
=
SCHED_S_TASK_NO_VALID_TRIGGERS
;
SYSTEMTIME
st
,
current_st
;
SYSTEMTIME
st
,
current_st
;
FILETIME
current_ft
,
begin_ft
,
end_ft
,
best_ft
;
FILETIME
current_ft
,
begin_ft
,
end_ft
,
best_ft
;
BOOL
have_best_time
=
FALSE
;
BOOL
have_best_time
=
FALSE
;
...
@@ -493,6 +494,12 @@ static HRESULT WINAPI MSTASK_ITask_GetNextRunTime(ITask *iface, SYSTEMTIME *rt)
...
@@ -493,6 +494,12 @@ static HRESULT WINAPI MSTASK_ITask_GetNextRunTime(ITask *iface, SYSTEMTIME *rt)
switch
(
This
->
trigger
[
i
].
TriggerType
)
switch
(
This
->
trigger
[
i
].
TriggerType
)
{
{
case
TASK_EVENT_TRIGGER_ON_IDLE
:
case
TASK_EVENT_TRIGGER_AT_SYSTEMSTART
:
case
TASK_EVENT_TRIGGER_AT_LOGON
:
hr
=
SCHED_S_EVENT_TRIGGER
;
break
;
case
TASK_TIME_TRIGGER_ONCE
:
case
TASK_TIME_TRIGGER_ONCE
:
st
=
current_st
;
st
=
current_st
;
st
.
wHour
=
This
->
trigger
[
i
].
wStartHour
;
st
.
wHour
=
This
->
trigger
[
i
].
wStartHour
;
...
@@ -547,7 +554,7 @@ static HRESULT WINAPI MSTASK_ITask_GetNextRunTime(ITask *iface, SYSTEMTIME *rt)
...
@@ -547,7 +554,7 @@ static HRESULT WINAPI MSTASK_ITask_GetNextRunTime(ITask *iface, SYSTEMTIME *rt)
}
}
memset
(
rt
,
0
,
sizeof
(
*
rt
));
memset
(
rt
,
0
,
sizeof
(
*
rt
));
return
SCHED_S_TASK_NO_VALID_TRIGGERS
;
return
hr
;
}
}
static
HRESULT
WINAPI
MSTASK_ITask_SetIdleWait
(
static
HRESULT
WINAPI
MSTASK_ITask_SetIdleWait
(
...
...
dlls/mstask/tests/task_trigger.c
View file @
2a56402c
...
@@ -477,7 +477,7 @@ static void test_GetNextRunTime(void)
...
@@ -477,7 +477,7 @@ static void test_GetNextRunTime(void)
ITask
*
task
;
ITask
*
task
;
ITaskTrigger
*
trigger
;
ITaskTrigger
*
trigger
;
TASK_TRIGGER
data
;
TASK_TRIGGER
data
;
WORD
idx
;
WORD
idx
,
i
;
SYSTEMTIME
st
,
cmp
;
SYSTEMTIME
st
,
cmp
;
hr
=
ITaskScheduler_NewWorkItem
(
test_task_scheduler
,
task_name
,
&
CLSID_CTask
,
hr
=
ITaskScheduler_NewWorkItem
(
test_task_scheduler
,
task_name
,
&
CLSID_CTask
,
...
@@ -557,6 +557,60 @@ static void test_GetNextRunTime(void)
...
@@ -557,6 +557,60 @@ static void test_GetNextRunTime(void)
/* FIXME: TASK_TIME_TRIGGER_MONTHLYDOW */
/* FIXME: TASK_TIME_TRIGGER_MONTHLYDOW */
ITaskTrigger_Release
(
trigger
);
ITaskTrigger_Release
(
trigger
);
/* do not delete a valid trigger */
idx
=
0xdead
;
hr
=
ITask_CreateTrigger
(
task
,
&
idx
,
&
trigger
);
ok
(
hr
==
S_OK
,
"got %#x
\n
"
,
hr
);
ok
(
idx
==
1
,
"got %u
\n
"
,
idx
);
/* TASK_EVENT_TRIGGER_ON_IDLE = 5
* TASK_EVENT_TRIGGER_AT_SYSTEMSTART = 6
* TASK_EVENT_TRIGGER_AT_LOGON = 7
*/
for
(
i
=
5
;
i
<=
7
;
i
++
)
{
hr
=
ITaskTrigger_GetTrigger
(
trigger
,
&
data
);
ok
(
hr
==
S_OK
,
"got %#x
\n
"
,
hr
);
data
.
rgFlags
&=
~
TASK_TRIGGER_FLAG_DISABLED
;
data
.
TriggerType
=
i
;
hr
=
ITaskTrigger_SetTrigger
(
trigger
,
&
data
);
ok
(
hr
==
S_OK
,
"got %#x
\n
"
,
hr
);
memset
(
&
st
,
0xff
,
sizeof
(
st
));
hr
=
ITask_GetNextRunTime
(
task
,
&
st
);
ok
(
hr
==
S_OK
,
"got %#x
\n
"
,
hr
);
ok
(
!
memcmp
(
&
st
,
&
cmp
,
sizeof
(
st
)),
"got %u/%u/%u wday %u %u:%02u:%02u
\n
"
,
st
.
wDay
,
st
.
wMonth
,
st
.
wYear
,
st
.
wDayOfWeek
,
st
.
wHour
,
st
.
wMinute
,
st
.
wSecond
);
}
ITaskTrigger_Release
(
trigger
);
hr
=
ITask_DeleteTrigger
(
task
,
0
);
ok
(
hr
==
S_OK
,
"got %#x
\n
"
,
hr
);
hr
=
ITask_GetTrigger
(
task
,
0
,
&
trigger
);
ok
(
hr
==
S_OK
,
"got %#x
\n
"
,
hr
);
for
(
i
=
5
;
i
<=
7
;
i
++
)
{
hr
=
ITaskTrigger_GetTrigger
(
trigger
,
&
data
);
ok
(
hr
==
S_OK
,
"got %#x
\n
"
,
hr
);
data
.
rgFlags
&=
~
TASK_TRIGGER_FLAG_DISABLED
;
data
.
TriggerType
=
i
;
hr
=
ITaskTrigger_SetTrigger
(
trigger
,
&
data
);
ok
(
hr
==
S_OK
,
"got %#x
\n
"
,
hr
);
memset
(
&
st
,
0xff
,
sizeof
(
st
));
hr
=
ITask_GetNextRunTime
(
task
,
&
st
);
ok
(
hr
==
SCHED_S_EVENT_TRIGGER
,
"got %#x
\n
"
,
hr
);
ok
(
!
memcmp
(
&
st
,
&
st_empty
,
sizeof
(
st
)),
"got %u/%u/%u wday %u %u:%02u:%02u
\n
"
,
st
.
wDay
,
st
.
wMonth
,
st
.
wYear
,
st
.
wDayOfWeek
,
st
.
wHour
,
st
.
wMinute
,
st
.
wSecond
);
}
ITaskTrigger_Release
(
trigger
);
ITask_Release
(
task
);
ITask_Release
(
task
);
}
}
...
...
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