Dmitry Timoshkov : mstask: Implement ITask::GetStatus().

Alexandre Julliard julliard at winehq.org
Fri Apr 20 17:55:42 CDT 2018


Module: wine
Branch: master
Commit: 5907782d59300acc641ec32b81e211673ceecc19
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5907782d59300acc641ec32b81e211673ceecc19

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Apr 20 16:37:08 2018 +0800

mstask: Implement ITask::GetStatus().

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 c4e9f84..d144f98 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 956aa0b..cc855be 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();
 }




More information about the wine-cvs mailing list