Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/mstask/task.c | 14 +++++++++----- dlls/mstask/tests/task.c | 14 +++++++++++--- 2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index c4e9f84a3f..d144f98ee3 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -39,6 +39,7 @@ typedef struct ITaskDefinition *task; IExecAction *action; LPWSTR task_name; + HRESULT status; DWORD maxRunTime; LPWSTR accountName; } TaskImpl; @@ -229,12 +230,14 @@ static HRESULT WINAPI MSTASK_ITask_GetMostRecentRunTime( return E_NOTIMPL; }
-static HRESULT WINAPI MSTASK_ITask_GetStatus( - ITask* iface, - HRESULT *phrStatus) +static HRESULT WINAPI MSTASK_ITask_GetStatus(ITask *iface, HRESULT *status) { - FIXME("(%p, %p): stub\n", iface, phrStatus); - return E_NOTIMPL; + TaskImpl *This = impl_from_ITask(iface); + + TRACE("(%p, %p)\n", iface, status); + + *status = This->status; + return S_OK; }
static HRESULT WINAPI MSTASK_ITask_GetExitCode( @@ -840,6 +843,7 @@ HRESULT TaskConstructor(ITaskService *service, const WCHAR *task_name, ITask **t This->ref = 1; This->task = taskdef; This->task_name = heap_strdupW(task_name); + This->status = SCHED_S_TASK_NOT_SCHEDULED; This->accountName = NULL;
/* Default time is 3 days = 259200000 ms */ diff --git a/dlls/mstask/tests/task.c b/dlls/mstask/tests/task.c index 956aa0bbd0..cc855beb66 100644 --- a/dlls/mstask/tests/task.c +++ b/dlls/mstask/tests/task.c @@ -2,6 +2,7 @@ * Test suite for Task interface * * Copyright (C) 2008 Google (Roy Shea) + * Copyright (C) 2018 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -496,10 +497,10 @@ static void test_SetAccountInformation_GetAccountInformation(void) return; }
-static void test_GetFlags(void) +static void test_task_state(void) { BOOL setup; - HRESULT hr; + HRESULT hr, status; DWORD flags;
setup = setup_task(); @@ -526,6 +527,13 @@ static void test_GetFlags(void) ok(hr == S_OK, "GetTaskFlags error %#x\n", hr); ok(flags == 0, "got %#x\n", flags);
+ if (0) /* crashes under Windows */ + hr = ITask_GetStatus(test_task, NULL); + + status = 0xdeadbeef; + hr = ITask_GetStatus(test_task, &status); + ok(status == SCHED_S_TASK_NOT_SCHEDULED, "got %#x\n", status); + cleanup_task(); }
@@ -538,6 +546,6 @@ START_TEST(task) test_SetComment_GetComment(); test_SetMaxRunTime_GetMaxRunTime(); test_SetAccountInformation_GetAccountInformation(); - test_GetFlags(); + test_task_state(); CoUninitialize(); }