diff --git a/dlls/taskschd/task.c b/dlls/taskschd/task.c index 01e7c2d6bbd..df75236d9dc 100644 --- a/dlls/taskschd/task.c +++ b/dlls/taskschd/task.c @@ -1740,8 +1740,20 @@ static HRESULT WINAPI ExecAction_get_Type(IExecAction *iface, TASK_ACTION_TYPE * static HRESULT WINAPI ExecAction_get_Path(IExecAction *iface, BSTR *path) { - FIXME("%p,%p: stub\n", iface, path); - return E_NOTIMPL; + ExecAction *action = impl_from_IExecAction(iface); + + TRACE("%p,%p\n", iface, path); + + if (!path) return E_POINTER; + + if (!action->path) + { + *path = NULL; + return S_OK; + } + + if (!(*path = SysAllocString(action->path))) return E_OUTOFMEMORY; + return S_OK; } static HRESULT WINAPI ExecAction_put_Path(IExecAction *iface, BSTR path) diff --git a/dlls/taskschd/tests/scheduler.c b/dlls/taskschd/tests/scheduler.c index 22854d917c2..c7de7c70416 100644 --- a/dlls/taskschd/tests/scheduler.c +++ b/dlls/taskschd/tests/scheduler.c @@ -1236,6 +1236,7 @@ static void create_action(ITaskDefinition *taskdef) IAction *action; IExecAction *exec_action; TASK_ACTION_TYPE type; + BSTR path; hr = ITaskDefinition_get_Actions(taskdef, &actions); ok(hr == S_OK, "get_Actions error %#x\n", hr); @@ -1251,9 +1252,21 @@ static void create_action(ITaskDefinition *taskdef) ok(hr == S_OK, "get_Type error %#x\n", hr); ok(type == TASK_ACTION_EXEC, "got %u\n", type ); + path = (BSTR)0xdeadbeef; + hr = IExecAction_get_Path(exec_action, &path); + ok(hr == S_OK, "get_Path error %#x\n", hr); + ok(path == NULL, "path not set\n"); + hr = IExecAction_put_Path(exec_action, task1_exe); ok(hr == S_OK, "put_Path error %#x\n", hr); + path = NULL; + hr = IExecAction_get_Path(exec_action, &path); + ok(hr == S_OK, "get_Path error %#x\n", hr); + ok(path != NULL, "path not set\n"); + ok(!lstrcmpW(path, task1_exe), "wrong path\n" ); + SysFreeString(path); + IExecAction_Release(exec_action); IAction_Release(action); IActionCollection_Release(actions);