mstask: Handle disabled tasks in ITask::GetNextRunTime().

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-05-22 16:18:30 +08:00 committed by Alexandre Julliard
parent d3a9af15d2
commit e14e6bdeed
2 changed files with 19 additions and 0 deletions

View File

@ -476,6 +476,12 @@ static HRESULT WINAPI MSTASK_ITask_GetNextRunTime(ITask *iface, SYSTEMTIME *rt)
TRACE("(%p, %p)\n", iface, rt);
if (This->flags & TASK_FLAG_DISABLED)
{
memset(rt, 0, sizeof(*rt));
return SCHED_S_TASK_DISABLED;
}
GetLocalTime(&current_st);
for (i = 0; i < This->trigger_count; i++)

View File

@ -487,6 +487,19 @@ static void test_GetNextRunTime(void)
if (0) /* crashes under Windows */
hr = ITask_GetNextRunTime(task, NULL);
hr = ITask_SetFlags(task, TASK_FLAG_DISABLED);
ok(hr == S_OK, "got %#x\n", hr);
memset(&st, 0xff, sizeof(st));
hr = ITask_GetNextRunTime(task, &st);
ok(hr == SCHED_S_TASK_DISABLED, "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);
hr = ITask_SetFlags(task, 0);
ok(hr == S_OK, "got %#x\n", hr);
memset(&st, 0xff, sizeof(st));
hr = ITask_GetNextRunTime(task, &st);
ok(hr == SCHED_S_TASK_NO_VALID_TRIGGERS, "got %#x\n", hr);