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

Alexandre Julliard julliard at winehq.org
Thu May 31 15:56:56 CDT 2018


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu May 31 12:20:14 2018 +0800

mstask: Implement ITask::GetMostRecentRunTime().

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

---

 dlls/mstask/task.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c
index 58be83e..91d2cb6 100644
--- a/dlls/mstask/task.c
+++ b/dlls/mstask/task.c
@@ -63,6 +63,7 @@ typedef struct
     HRESULT status;
     WORD idle_minutes, deadline_minutes;
     DWORD flags, priority, maxRunTime, exit_code;
+    SYSTEMTIME last_runtime;
     LPWSTR accountName;
     DWORD trigger_count;
     TASK_TRIGGER *trigger;
@@ -654,10 +655,18 @@ static HRESULT WINAPI MSTASK_ITask_EditWorkItem(
 
 static HRESULT WINAPI MSTASK_ITask_GetMostRecentRunTime(ITask *iface, SYSTEMTIME *st)
 {
-    FIXME("(%p, %p): stub\n", iface, st);
+    TaskImpl *This = impl_from_ITask(iface);
+
+    TRACE("(%p, %p)\n", iface, st);
+
+    if (This->status == SCHED_S_TASK_NOT_SCHEDULED)
+    {
+        memset(st, 0, sizeof(*st));
+        return SCHED_S_TASK_HAS_NOT_RUN;
+    }
 
-    memset(st, 0, sizeof(*st));
-    return SCHED_S_TASK_HAS_NOT_RUN;
+    *st = This->last_runtime;
+    return S_OK;
 }
 
 static HRESULT WINAPI MSTASK_ITask_GetStatus(ITask *iface, HRESULT *status)
@@ -1262,8 +1271,9 @@ static HRESULT load_job_data(TaskImpl *This, BYTE *data, DWORD size)
     This->status = fixed->status;
     TRACE("flags %08x\n", fixed->flags);
     This->flags = fixed->flags;
+    This->last_runtime = fixed->last_runtime;
     st = &fixed->last_runtime;
-    TRACE("last_runtime %d/%d/%d wday %d %d:%d:%d.%03d\n",
+    TRACE("last_runtime %u/%u/%u wday %u %u:%02u:%02u.%03u\n",
             st->wDay, st->wMonth, st->wYear, st->wDayOfWeek,
             st->wHour, st->wMinute, st->wSecond, st->wMilliseconds);
 
@@ -1617,7 +1627,7 @@ static HRESULT WINAPI MSTASK_IPersistFile_Save(IPersistFile *iface, LPCOLESTR ta
         This->status = SCHED_S_TASK_HAS_NOT_RUN;
     fixed.status = This->status;
     fixed.flags = This->flags;
-    memset(&fixed.last_runtime, 0, sizeof(fixed.last_runtime));
+    fixed.last_runtime = This->last_runtime;
 
     try = 1;
     for (;;)
@@ -1855,6 +1865,7 @@ HRESULT TaskConstructor(ITaskService *service, const WCHAR *name, ITask **task)
     This->is_dirty = FALSE;
     This->instance_count = 0;
 
+    memset(&This->last_runtime, 0, sizeof(This->last_runtime));
     CoCreateGuid(&This->uuid);
 
     /* Default time is 3 days = 259200000 ms */




More information about the wine-cvs mailing list