[PATCH 9/9] mstask: Store creator using IRegistrationInfo.

Dmitry Timoshkov dmitry at baikal.ru
Mon Apr 2 00:27:10 CDT 2018


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/mstask/task.c | 60 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 50 insertions(+), 10 deletions(-)

diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c
index d04666d76d..34d1fa010e 100644
--- a/dlls/mstask/task.c
+++ b/dlls/mstask/task.c
@@ -301,20 +301,60 @@ static HRESULT WINAPI MSTASK_ITask_GetComment(ITask *iface, LPWSTR *comment)
     return hr;
 }
 
-static HRESULT WINAPI MSTASK_ITask_SetCreator(
-        ITask* iface,
-        LPCWSTR pwszCreator)
+static HRESULT WINAPI MSTASK_ITask_SetCreator(ITask *iface, LPCWSTR creator)
 {
-    FIXME("(%p, %p): stub\n", iface, pwszCreator);
-    return E_NOTIMPL;
+    TaskImpl *This = impl_from_ITask(iface);
+    IRegistrationInfo *info;
+    HRESULT hr;
+
+    TRACE("(%p, %s)\n", iface, debugstr_w(creator));
+
+    if (!creator || !creator[0])
+        creator = NULL;
+
+    hr = ITaskDefinition_get_RegistrationInfo(This->task, &info);
+    if (hr == S_OK)
+    {
+        hr = IRegistrationInfo_put_Author(info, (BSTR)creator);
+        IRegistrationInfo_Release(info);
+    }
+    return hr;
 }
 
-static HRESULT WINAPI MSTASK_ITask_GetCreator(
-        ITask* iface,
-        LPWSTR *ppwszCreator)
+static HRESULT WINAPI MSTASK_ITask_GetCreator(ITask *iface, LPWSTR *creator)
 {
-    FIXME("(%p, %p): stub\n", iface, ppwszCreator);
-    return E_NOTIMPL;
+    TaskImpl *This = impl_from_ITask(iface);
+    IRegistrationInfo *info;
+    HRESULT hr;
+    BSTR author;
+    DWORD len;
+
+    TRACE("(%p, %p)\n", iface, creator);
+
+    hr = ITaskDefinition_get_RegistrationInfo(This->task, &info);
+    if (hr != S_OK) return hr;
+
+    hr = IRegistrationInfo_get_Author(info, &author);
+    if (hr == S_OK)
+    {
+        len = author ? lstrlenW(author) + 1 : 1;
+        *creator = CoTaskMemAlloc(len * sizeof(WCHAR));
+        if (*creator)
+        {
+            if (!author)
+                *creator[0] = 0;
+            else
+                lstrcpyW(*creator, author);
+            hr = S_OK;
+        }
+        else
+            hr =  E_OUTOFMEMORY;
+
+        SysFreeString(author);
+    }
+
+    IRegistrationInfo_Release(info);
+    return hr;
 }
 
 static HRESULT WINAPI MSTASK_ITask_SetWorkItemData(
-- 
2.16.3




More information about the wine-devel mailing list