Commit e14e6bde authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

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

parent d3a9af15
......@@ -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++)
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment