mstask: Store comment using IRegistrationInfo.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-04-02 13:27:07 +08:00 committed by Alexandre Julliard
parent f6d6365430
commit 6ff9f7e870

View File

@ -248,41 +248,56 @@ static HRESULT WINAPI MSTASK_ITask_GetExitCode(
static HRESULT WINAPI MSTASK_ITask_SetComment(ITask *iface, LPCWSTR comment) static HRESULT WINAPI MSTASK_ITask_SetComment(ITask *iface, LPCWSTR comment)
{ {
TaskImpl *This = impl_from_ITask(iface); TaskImpl *This = impl_from_ITask(iface);
IRegistrationInfo *info;
HRESULT hr;
TRACE("(%p, %s)\n", iface, debugstr_w(comment)); TRACE("(%p, %s)\n", iface, debugstr_w(comment));
if (!comment || !comment[0]) if (!comment || !comment[0])
comment = NULL; comment = NULL;
return IExecAction_put_Id(This->action, (BSTR)comment); hr = ITaskDefinition_get_RegistrationInfo(This->task, &info);
if (hr == S_OK)
{
hr = IRegistrationInfo_put_Description(info, (BSTR)comment);
IRegistrationInfo_Release(info);
}
return hr;
} }
static HRESULT WINAPI MSTASK_ITask_GetComment(ITask *iface, LPWSTR *comment) static HRESULT WINAPI MSTASK_ITask_GetComment(ITask *iface, LPWSTR *comment)
{ {
TaskImpl *This = impl_from_ITask(iface); TaskImpl *This = impl_from_ITask(iface);
IRegistrationInfo *info;
HRESULT hr; HRESULT hr;
BSTR id; BSTR description;
DWORD len; DWORD len;
TRACE("(%p, %p)\n", iface, comment); TRACE("(%p, %p)\n", iface, comment);
hr = IExecAction_get_Id(This->action, &id); hr = ITaskDefinition_get_RegistrationInfo(This->task, &info);
if (hr != S_OK) return hr; if (hr != S_OK) return hr;
len = id ? lstrlenW(id) + 1 : 1; hr = IRegistrationInfo_get_Description(info, &description);
*comment = CoTaskMemAlloc(len * sizeof(WCHAR)); if (hr == S_OK)
if (*comment)
{ {
if (!id) len = description ? lstrlenW(description) + 1 : 1;
*comment[0] = 0; *comment = CoTaskMemAlloc(len * sizeof(WCHAR));
if (*comment)
{
if (!description)
*comment[0] = 0;
else
lstrcpyW(*comment, description);
hr = S_OK;
}
else else
lstrcpyW(*comment, id); hr = E_OUTOFMEMORY;
hr = S_OK;
}
else
hr = E_OUTOFMEMORY;
SysFreeString(id); SysFreeString(description);
}
IRegistrationInfo_Release(info);
return hr; return hr;
} }