diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index 9cdf92e3198..68452afa4fb 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -491,11 +491,14 @@ static HRESULT WINAPI MSTASK_ITask_GetErrorRetryInterval(ITask *iface, WORD *int return E_NOTIMPL; } -static HRESULT WINAPI MSTASK_ITask_SetFlags( - ITask* iface, - DWORD dwFlags) +static HRESULT WINAPI MSTASK_ITask_SetFlags(ITask *iface, DWORD flags) { - FIXME("(%p, 0x%08x): stub\n", iface, dwFlags); + TaskImpl *This = impl_from_ITask(iface); + + TRACE("(%p, 0x%08x)\n", iface, flags); + This->flags &= 0xffff8000; + This->flags |= flags & 0x7fff; + This->is_dirty = TRUE; return S_OK; } diff --git a/dlls/mstask/tests/task.c b/dlls/mstask/tests/task.c index 58c102060bb..0e2b4339ad1 100644 --- a/dlls/mstask/tests/task.c +++ b/dlls/mstask/tests/task.c @@ -683,6 +683,43 @@ static void test_Run(void) ok(hr == S_OK, "got %#x\n", hr); } +static void test_SetFlags(void) +{ + HRESULT hr; + ITask *task; + DWORD flags; + + hr = ITaskScheduler_NewWorkItem(scheduler, task_name, &CLSID_CTask, + &IID_ITask, (IUnknown **)&task); + ok(hr == S_OK, "got %#x\n", hr); + + hr = ITask_SetFlags(task, 0); + ok(hr == S_OK, "got %#x\n", hr); + + flags = 0xdeadbeef; + hr = ITask_GetFlags(task, &flags); + ok(hr == S_OK, "got %#x\n", hr); + ok(flags == 0, "got %#x\n", flags); + + hr = ITask_SetFlags(task, 0xffffffff); + ok(hr == S_OK, "got %#x\n", hr); + + flags = 0xdeadbeef; + hr = ITask_GetFlags(task, &flags); + ok(hr == S_OK, "got %#x\n", hr); + ok(flags == 0x7fff, "got %#x\n", flags); + + hr = ITask_SetFlags(task, 0x9234); + ok(hr == S_OK, "got %#x\n", hr); + + flags = 0xdeadbeef; + hr = ITask_GetFlags(task, &flags); + ok(hr == S_OK, "got %#x\n", hr); + ok(flags == 0x1234, "got %#x\n", flags); + + ITask_Release(task); +} + START_TEST(task) { HRESULT hr; @@ -700,6 +737,7 @@ START_TEST(task) test_SetAccountInformation_GetAccountInformation(); test_task_state(); test_Run(); + test_SetFlags(); ITaskScheduler_Release(scheduler); CoUninitialize();