mstask: Implement ITaskScheduler::Delete().

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-05-11 12:36:23 +08:00 committed by Alexandre Julliard
parent 9ec4b572f8
commit 4bd663629d
2 changed files with 31 additions and 9 deletions

View File

@ -302,12 +302,25 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_Activate(ITaskScheduler *iface,
return hr;
}
static HRESULT WINAPI MSTASK_ITaskScheduler_Delete(
ITaskScheduler* iface,
LPCWSTR pwszName)
static HRESULT WINAPI MSTASK_ITaskScheduler_Delete(ITaskScheduler *iface, LPCWSTR name)
{
FIXME("%p, %s: stub\n", iface, debugstr_w(pwszName));
return E_NOTIMPL;
static const WCHAR tasksW[] = { '\\','T','a','s','k','s','\\',0 };
static const WCHAR jobW[] = { '.','j','o','b',0 };
WCHAR task_name[MAX_PATH];
TRACE("%p, %s\n", iface, debugstr_w(name));
if (strchrW(name, '.')) return E_INVALIDARG;
GetWindowsDirectoryW(task_name, MAX_PATH);
lstrcatW(task_name, tasksW);
lstrcatW(task_name, name);
lstrcatW(task_name, jobW);
if (!DeleteFileW(task_name))
return HRESULT_FROM_WIN32(GetLastError());
return S_OK;
}
static HRESULT WINAPI MSTASK_ITaskScheduler_NewWorkItem(

View File

@ -249,7 +249,7 @@ static void test_save_task_curfile(ITask *task)
curfile = NULL;
hr = IPersistFile_GetCurFile(pfile, &curfile);
ok(hr == S_OK, "GetCurFile error %#x\n", hr);
ok(curfile && curfile[0] , "curfile should not be NULL\n");
ok(curfile && curfile[0], "curfile should not be NULL\n");
ok(file_exists(curfile), "curfile should exist\n");
@ -343,6 +343,12 @@ static void test_task_storage(void)
return;
}
hr = ITaskScheduler_Delete(scheduler, Task1_ext);
ok(hr == E_INVALIDARG, "wrong error %#x\n", hr);
hr = ITaskScheduler_Delete(scheduler, Task1);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "wrong error %#x\n", hr);
hr = ITaskScheduler_NewWorkItem(scheduler, Task1_ext, &CLSID_CTask, &IID_ITask, (IUnknown **)&task);
ok(hr == E_INVALIDARG, "wrong error %#x\n", hr);
@ -418,9 +424,12 @@ static void test_task_storage(void)
test_save_task_curfile(task);
DeleteFileW(task1_full_name);
DeleteFileW(task2_full_name);
DeleteFileW(task3_full_name);
hr = ITaskScheduler_Delete(scheduler, Task1);
ok(hr == S_OK, "got %#x\n", hr);
hr = ITaskScheduler_Delete(scheduler, Task2);
ok(hr == S_OK, "got %#x\n", hr);
hr = ITaskScheduler_Delete(scheduler, Task3);
ok(hr == S_OK, "got %#x\n", hr);
ITask_Release(task);
ITaskScheduler_Release(scheduler);