mstask: Implemented (Set|Get)Comment.
This commit is contained in:
parent
2f95e5123b
commit
37708b1e5c
|
@ -60,6 +60,7 @@ typedef struct
|
||||||
LPWSTR taskName;
|
LPWSTR taskName;
|
||||||
LPWSTR applicationName;
|
LPWSTR applicationName;
|
||||||
LPWSTR parameters;
|
LPWSTR parameters;
|
||||||
|
LPWSTR comment;
|
||||||
} TaskImpl;
|
} TaskImpl;
|
||||||
extern HRESULT TaskConstructor(LPCWSTR pwszTaskName, LPVOID *ppObj);
|
extern HRESULT TaskConstructor(LPCWSTR pwszTaskName, LPVOID *ppObj);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ static inline TaskImpl *impl_from_IPersistFile( IPersistFile *iface )
|
||||||
static void TaskDestructor(TaskImpl *This)
|
static void TaskDestructor(TaskImpl *This)
|
||||||
{
|
{
|
||||||
TRACE("%p\n", This);
|
TRACE("%p\n", This);
|
||||||
|
HeapFree(GetProcessHeap(), 0, This->comment);
|
||||||
HeapFree(GetProcessHeap(), 0, This->parameters);
|
HeapFree(GetProcessHeap(), 0, This->parameters);
|
||||||
HeapFree(GetProcessHeap(), 0, This->taskName);
|
HeapFree(GetProcessHeap(), 0, This->taskName);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
@ -219,16 +220,52 @@ static HRESULT WINAPI MSTASK_ITask_SetComment(
|
||||||
ITask* iface,
|
ITask* iface,
|
||||||
LPCWSTR pwszComment)
|
LPCWSTR pwszComment)
|
||||||
{
|
{
|
||||||
FIXME("(%p, %s): stub\n", iface, debugstr_w(pwszComment));
|
DWORD n;
|
||||||
return E_NOTIMPL;
|
TaskImpl *This = (TaskImpl *)iface;
|
||||||
|
LPWSTR tmp_comment;
|
||||||
|
|
||||||
|
TRACE("(%p, %s)\n", iface, debugstr_w(pwszComment));
|
||||||
|
|
||||||
|
/* Empty comment */
|
||||||
|
if (pwszComment[0] == 0)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, This->comment);
|
||||||
|
This->comment = NULL;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set to pwszComment */
|
||||||
|
n = (lstrlenW(pwszComment) + 1);
|
||||||
|
tmp_comment = HeapAlloc(GetProcessHeap(), 0, n * sizeof(WCHAR));
|
||||||
|
if (!tmp_comment)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
lstrcpyW(tmp_comment, pwszComment);
|
||||||
|
HeapFree(GetProcessHeap(), 0, This->comment);
|
||||||
|
This->comment = tmp_comment;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MSTASK_ITask_GetComment(
|
static HRESULT WINAPI MSTASK_ITask_GetComment(
|
||||||
ITask* iface,
|
ITask* iface,
|
||||||
LPWSTR *ppwszComment)
|
LPWSTR *ppwszComment)
|
||||||
{
|
{
|
||||||
FIXME("(%p, %p): stub\n", iface, ppwszComment);
|
DWORD n;
|
||||||
return E_NOTIMPL;
|
TaskImpl *This = (TaskImpl *)iface;
|
||||||
|
|
||||||
|
TRACE("(%p, %p)\n", iface, ppwszComment);
|
||||||
|
|
||||||
|
n = This->comment ? lstrlenW(This->comment) + 1 : 1;
|
||||||
|
*ppwszComment = CoTaskMemAlloc(n * sizeof(WCHAR));
|
||||||
|
if (!*ppwszComment)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
if (!This->comment)
|
||||||
|
*ppwszComment[0] = 0;
|
||||||
|
else
|
||||||
|
lstrcpyW(*ppwszComment, This->comment);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MSTASK_ITask_SetCreator(
|
static HRESULT WINAPI MSTASK_ITask_SetCreator(
|
||||||
|
@ -682,6 +719,7 @@ HRESULT TaskConstructor(LPCWSTR pwszTaskName, LPVOID *ppObj)
|
||||||
lstrcpyW(This->taskName, pwszTaskName);
|
lstrcpyW(This->taskName, pwszTaskName);
|
||||||
This->applicationName = NULL;
|
This->applicationName = NULL;
|
||||||
This->parameters = NULL;
|
This->parameters = NULL;
|
||||||
|
This->comment = NULL;
|
||||||
|
|
||||||
*ppObj = &This->lpVtbl;
|
*ppObj = &This->lpVtbl;
|
||||||
InterlockedIncrement(&dll_ref);
|
InterlockedIncrement(&dll_ref);
|
||||||
|
|
|
@ -319,49 +319,49 @@ static void test_SetComment_GetComment(void)
|
||||||
|
|
||||||
/* Get comment before setting it*/
|
/* Get comment before setting it*/
|
||||||
hres = ITask_GetComment(test_task, &comment);
|
hres = ITask_GetComment(test_task, &comment);
|
||||||
todo_wine ok(hres == S_OK, "GetComment failed: %08x\n", hres);
|
ok(hres == S_OK, "GetComment failed: %08x\n", hres);
|
||||||
if (hres == S_OK)
|
if (hres == S_OK)
|
||||||
{
|
{
|
||||||
todo_wine ok(!lstrcmpW(comment, empty),
|
ok(!lstrcmpW(comment, empty),
|
||||||
"Got %s, expected empty string\n", dbgstr_w(comment));
|
"Got %s, expected empty string\n", dbgstr_w(comment));
|
||||||
CoTaskMemFree(comment);
|
CoTaskMemFree(comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set comment to a simple string */
|
/* Set comment to a simple string */
|
||||||
hres = ITask_SetComment(test_task, comment_a);
|
hres = ITask_SetComment(test_task, comment_a);
|
||||||
todo_wine ok(hres == S_OK, "Failed setting comment %s: %08x\n",
|
ok(hres == S_OK, "Failed setting comment %s: %08x\n",
|
||||||
dbgstr_w(comment_a), hres);
|
dbgstr_w(comment_a), hres);
|
||||||
hres = ITask_GetComment(test_task, &comment);
|
hres = ITask_GetComment(test_task, &comment);
|
||||||
todo_wine ok(hres == S_OK, "GetComment failed: %08x\n", hres);
|
ok(hres == S_OK, "GetComment failed: %08x\n", hres);
|
||||||
if (hres == S_OK)
|
if (hres == S_OK)
|
||||||
{
|
{
|
||||||
todo_wine ok(!lstrcmpW(comment, comment_a), "Got %s, expected %s\n",
|
ok(!lstrcmpW(comment, comment_a), "Got %s, expected %s\n",
|
||||||
dbgstr_w(comment), dbgstr_w(comment_a));
|
dbgstr_w(comment), dbgstr_w(comment_a));
|
||||||
CoTaskMemFree(comment);
|
CoTaskMemFree(comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update comment to a different simple string */
|
/* Update comment to a different simple string */
|
||||||
hres = ITask_SetComment(test_task, comment_b);
|
hres = ITask_SetComment(test_task, comment_b);
|
||||||
todo_wine ok(hres == S_OK, "Failed setting comment %s: %08x\n",
|
ok(hres == S_OK, "Failed setting comment %s: %08x\n",
|
||||||
dbgstr_w(comment_b), hres);
|
dbgstr_w(comment_b), hres);
|
||||||
hres = ITask_GetComment(test_task, &comment);
|
hres = ITask_GetComment(test_task, &comment);
|
||||||
todo_wine ok(hres == S_OK, "GetComment failed: %08x\n", hres);
|
ok(hres == S_OK, "GetComment failed: %08x\n", hres);
|
||||||
if (hres == S_OK)
|
if (hres == S_OK)
|
||||||
{
|
{
|
||||||
todo_wine ok(!lstrcmpW(comment, comment_b), "Got %s, expected %s\n",
|
ok(!lstrcmpW(comment, comment_b), "Got %s, expected %s\n",
|
||||||
dbgstr_w(comment), dbgstr_w(comment_b));
|
dbgstr_w(comment), dbgstr_w(comment_b));
|
||||||
CoTaskMemFree(comment);
|
CoTaskMemFree(comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear comment */
|
/* Clear comment */
|
||||||
hres = ITask_SetComment(test_task, empty);
|
hres = ITask_SetComment(test_task, empty);
|
||||||
todo_wine ok(hres == S_OK, "Failed setting comment %s: %08x\n",
|
ok(hres == S_OK, "Failed setting comment %s: %08x\n",
|
||||||
dbgstr_w(empty), hres);
|
dbgstr_w(empty), hres);
|
||||||
hres = ITask_GetComment(test_task, &comment);
|
hres = ITask_GetComment(test_task, &comment);
|
||||||
todo_wine ok(hres == S_OK, "GetComment failed: %08x\n", hres);
|
ok(hres == S_OK, "GetComment failed: %08x\n", hres);
|
||||||
if (hres == S_OK)
|
if (hres == S_OK)
|
||||||
{
|
{
|
||||||
todo_wine ok(!lstrcmpW(comment, empty),
|
ok(!lstrcmpW(comment, empty),
|
||||||
"Got %s, expected empty string\n", dbgstr_w(comment));
|
"Got %s, expected empty string\n", dbgstr_w(comment));
|
||||||
CoTaskMemFree(comment);
|
CoTaskMemFree(comment);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue