mstask: Implement ITaskScheduler::AddWorkItem().
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bf635fd4f7
commit
f429c8188b
|
@ -331,13 +331,30 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_NewWorkItem(
|
||||||
return TaskConstructor(This->service, task_name, (ITask **)task);
|
return TaskConstructor(This->service, task_name, (ITask **)task);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MSTASK_ITaskScheduler_AddWorkItem(
|
static HRESULT WINAPI MSTASK_ITaskScheduler_AddWorkItem(ITaskScheduler *iface, LPCWSTR name, IScheduledWorkItem *item)
|
||||||
ITaskScheduler* iface,
|
|
||||||
LPCWSTR pwszTaskName,
|
|
||||||
IScheduledWorkItem *pWorkItem)
|
|
||||||
{
|
{
|
||||||
FIXME("%p, %s, %p: stub\n", iface, debugstr_w(pwszTaskName), pWorkItem);
|
static const WCHAR tasksW[] = { '\\','T','a','s','k','s','\\',0 };
|
||||||
return E_NOTIMPL;
|
static const WCHAR jobW[] = { '.','j','o','b',0 };
|
||||||
|
WCHAR task_name[MAX_PATH];
|
||||||
|
IPersistFile *pfile;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
TRACE("%p, %s, %p\n", iface, debugstr_w(name), item);
|
||||||
|
|
||||||
|
if (strchrW(name, '.')) return E_INVALIDARG;
|
||||||
|
|
||||||
|
GetWindowsDirectoryW(task_name, MAX_PATH);
|
||||||
|
lstrcatW(task_name, tasksW);
|
||||||
|
lstrcatW(task_name, name);
|
||||||
|
lstrcatW(task_name, jobW);
|
||||||
|
|
||||||
|
hr = IScheduledWorkItem_QueryInterface(item, &IID_IPersistFile, (void **)&pfile);
|
||||||
|
if (hr == S_OK)
|
||||||
|
{
|
||||||
|
hr = IPersistFile_Save(pfile, task_name, TRUE);
|
||||||
|
IPersistFile_Release(pfile);
|
||||||
|
}
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MSTASK_ITaskScheduler_IsOfType(
|
static HRESULT WINAPI MSTASK_ITaskScheduler_IsOfType(
|
||||||
|
|
|
@ -343,30 +343,23 @@ static void test_task_storage(void)
|
||||||
ok(task2 == (ITask *)0xdeadbeef, "task should not be set to NULL\n");
|
ok(task2 == (ITask *)0xdeadbeef, "task should not be set to NULL\n");
|
||||||
|
|
||||||
hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task);
|
hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task);
|
||||||
todo_wine
|
|
||||||
ok(hr == S_OK, "AddWorkItem error %#x\n", hr);
|
ok(hr == S_OK, "AddWorkItem error %#x\n", hr);
|
||||||
|
|
||||||
curfile = get_task_curfile(task);
|
curfile = get_task_curfile(task);
|
||||||
todo_wine
|
|
||||||
ok(file_exists(curfile), "curfile should exist\n");
|
ok(file_exists(curfile), "curfile should exist\n");
|
||||||
|
|
||||||
hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task);
|
hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task);
|
||||||
todo_wine
|
|
||||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#x\n", hr);
|
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#x\n", hr);
|
||||||
|
|
||||||
curfile = get_task_curfile(task);
|
curfile = get_task_curfile(task);
|
||||||
todo_wine
|
|
||||||
ok(file_exists(curfile), "curfile should exist\n");
|
ok(file_exists(curfile), "curfile should exist\n");
|
||||||
|
|
||||||
ITask_Release(task);
|
ITask_Release(task);
|
||||||
|
|
||||||
task = NULL;
|
task = NULL;
|
||||||
hr = ITaskScheduler_Activate(scheduler, Task1, &IID_ITask, (IUnknown **)&task);
|
hr = ITaskScheduler_Activate(scheduler, Task1, &IID_ITask, (IUnknown **)&task);
|
||||||
todo_wine
|
|
||||||
ok(hr == S_OK, "Activate error %#x\n", hr);
|
ok(hr == S_OK, "Activate error %#x\n", hr);
|
||||||
todo_wine
|
|
||||||
ok(task != NULL, "task should not be set to NULL\n");
|
ok(task != NULL, "task should not be set to NULL\n");
|
||||||
if (task == NULL) goto fail;
|
|
||||||
|
|
||||||
curfile2 = get_task_curfile(task);
|
curfile2 = get_task_curfile(task);
|
||||||
ok(file_exists(curfile2), "curfile2 should exist\n");
|
ok(file_exists(curfile2), "curfile2 should exist\n");
|
||||||
|
@ -380,7 +373,6 @@ todo_wine
|
||||||
CoTaskMemFree(curfile);
|
CoTaskMemFree(curfile);
|
||||||
|
|
||||||
ITask_Release(task);
|
ITask_Release(task);
|
||||||
fail:
|
|
||||||
ITaskScheduler_Release(scheduler);
|
ITaskScheduler_Release(scheduler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue