Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/mstask/task.c | 6 ++++++ dlls/mstask/tests/task_trigger.c | 13 +++++++++++++ 2 files changed, 19 insertions(+)
diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index 012bf48612..a201e44a1f 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -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(¤t_st);
for (i = 0; i < This->trigger_count; i++) diff --git a/dlls/mstask/tests/task_trigger.c b/dlls/mstask/tests/task_trigger.c index f7ab461aa9..a89fa62d1c 100644 --- a/dlls/mstask/tests/task_trigger.c +++ b/dlls/mstask/tests/task_trigger.c @@ -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);