diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index 5f1dc1d30c4..86721047680 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -240,12 +240,12 @@ static HRESULT WINAPI MSTASK_ITask_GetRunTimes( return E_NOTIMPL; } -static HRESULT WINAPI MSTASK_ITask_GetNextRunTime( - ITask* iface, - SYSTEMTIME *pstNextRun) +static HRESULT WINAPI MSTASK_ITask_GetNextRunTime(ITask *iface, SYSTEMTIME *st) { - FIXME("(%p, %p): stub\n", iface, pstNextRun); - return E_NOTIMPL; + FIXME("(%p, %p): stub\n", iface, st); + + memset(st, 0, sizeof(*st)); + return SCHED_S_TASK_NO_VALID_TRIGGERS; } static HRESULT WINAPI MSTASK_ITask_SetIdleWait( diff --git a/dlls/mstask/tests/task_trigger.c b/dlls/mstask/tests/task_trigger.c index a1b5597fff5..ab081a74cae 100644 --- a/dlls/mstask/tests/task_trigger.c +++ b/dlls/mstask/tests/task_trigger.c @@ -439,6 +439,44 @@ static void test_task_trigger(void) ok(ref == 0, "got %u\n", ref); } +static void test_GetNextRunTime(void) +{ + static const WCHAR task_name[] = { 'T','e','s','t','i','n','g',0 }; + static const SYSTEMTIME st_empty; + HRESULT hr; + ITask *task; + ITaskTrigger *trigger; + WORD idx; + SYSTEMTIME st; + + hr = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name, &CLSID_CTask, + &IID_ITask, (IUnknown **)&task); + ok(hr == S_OK, "got %#x\n", hr); + + if (0) /* crashes under Windows */ + hr = ITask_GetNextRunTime(task, NULL); + + memset(&st, 0xff, sizeof(st)); + hr = ITask_GetNextRunTime(task, &st); + ok(hr == SCHED_S_TASK_NO_VALID_TRIGGERS, "got %#x\n", hr); + ok(!memcmp(&st, &st_empty, sizeof(st)), "got %d/%d/%d wday %d %d:%d:%d.%03d\n", + st.wDay, st.wMonth, st.wYear, st.wDayOfWeek, + st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); + + hr = ITask_CreateTrigger(task, &idx, &trigger); + 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); + ok(!memcmp(&st, &st_empty, sizeof(st)), "got %d/%d/%d wday %d %d:%d:%d.%03d\n", + st.wDay, st.wMonth, st.wYear, st.wDayOfWeek, + st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); + + ITaskTrigger_Release(trigger); + ITask_Release(task); +} + START_TEST(task_trigger) { HRESULT hr; @@ -451,6 +489,7 @@ START_TEST(task_trigger) test_SetTrigger_GetTrigger(); test_task_trigger(); + test_GetNextRunTime(); ITaskScheduler_Release(test_task_scheduler); CoUninitialize();