From a5602f1708fbdcd65d058e7417210ca1eee2acbc Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 8 Apr 2014 21:38:14 +0900 Subject: [PATCH] taskschd: Implement IRegisteredTask::get_Path. --- dlls/taskschd/regtask.c | 12 ++++++++++-- dlls/taskschd/tests/scheduler.c | 34 +++++++++++++++++++++++++-------- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/dlls/taskschd/regtask.c b/dlls/taskschd/regtask.c index 817ba36d89..2953c6efb2 100644 --- a/dlls/taskschd/regtask.c +++ b/dlls/taskschd/regtask.c @@ -138,8 +138,16 @@ static HRESULT WINAPI regtask_get_Name(IRegisteredTask *iface, BSTR *name) static HRESULT WINAPI regtask_get_Path(IRegisteredTask *iface, BSTR *path) { - FIXME("%p,%p: stub\n", iface, path); - return E_NOTIMPL; + RegisteredTask *regtask = impl_from_IRegisteredTask(iface); + + TRACE("%p,%p\n", iface, path); + + if (!path) return E_POINTER; + + *path = SysAllocString(regtask->path); + if (!*path) return E_OUTOFMEMORY; + + return S_OK; } static HRESULT WINAPI regtask_get_State(IRegisteredTask *iface, TASK_STATE *state) diff --git a/dlls/taskschd/tests/scheduler.c b/dlls/taskschd/tests/scheduler.c index d24e1ca38d..5e5d3035b3 100644 --- a/dlls/taskschd/tests/scheduler.c +++ b/dlls/taskschd/tests/scheduler.c @@ -812,21 +812,18 @@ todo_wine ok(!lstrcmpW(bstr, Task1), "expected Task1, got %s\n", wine_dbgstr_w(bstr)); SysFreeString(bstr); hr = IRegisteredTask_get_Path(task1, &bstr); -todo_wine ok(hr == S_OK, "get_Path error %#x\n", hr); - /* FIXME: Remove once implemented */ - if (hr != S_OK) - { - ITaskFolder_DeleteTask(root, Wine_Task1, 0); - goto failed; - } ok(!lstrcmpW(bstr, Wine_Task1), "expected \\Wine\\Task1, got %s\n", wine_dbgstr_w(bstr)); SysFreeString(bstr); hr = IRegisteredTask_get_State(task1, &state); +todo_wine ok(hr == S_OK, "get_State error %#x\n", hr); +if (hr == S_OK) ok(state == TASK_STATE_DISABLED, "expected TASK_STATE_DISABLED, got %d\n", state); hr = IRegisteredTask_get_Enabled(task1, &vbool); +todo_wine ok(hr == S_OK, "get_Enabled error %#x\n", hr); +if (hr == S_OK) ok(vbool == VARIANT_FALSE, "expected VARIANT_FALSE, got %d\n", vbool); IRegisteredTask_Release(task1); @@ -848,15 +845,20 @@ todo_wine ok(!lstrcmpW(bstr, Wine_Task2), "expected \\Wine\\Task2, got %s\n", wine_dbgstr_w(bstr)); SysFreeString(bstr); hr = IRegisteredTask_get_State(task2, &state); +todo_wine ok(hr == S_OK, "get_State error %#x\n", hr); +if (hr == S_OK) ok(state == TASK_STATE_READY, "expected TASK_STATE_READY, got %d\n", state); hr = IRegisteredTask_get_Enabled(task2, &vbool); +todo_wine ok(hr == S_OK, "get_Enabled error %#x\n", hr); +if (hr == S_OK) ok(vbool == VARIANT_TRUE, "expected VARIANT_TRUE, got %d\n", vbool); IRegisteredTask_Release(task2); hr = ITaskFolder_GetTask(root, NULL, &task1); +todo_wine ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); hr = ITaskFolder_GetTask(root, Wine_Task1, NULL); @@ -874,19 +876,28 @@ todo_wine ok(!lstrcmpW(bstr, Wine_Task1), "expected \\Wine\\Task1, got %s\n", wine_dbgstr_w(bstr)); SysFreeString(bstr); hr = IRegisteredTask_get_State(task1, &state); +todo_wine ok(hr == S_OK, "get_State error %#x\n", hr); +if (hr == S_OK) ok(state == TASK_STATE_DISABLED, "expected TASK_STATE_DISABLED, got %d\n", state); hr = IRegisteredTask_get_Enabled(task1, &vbool); +todo_wine ok(hr == S_OK, "get_Enabled error %#x\n", hr); +if (hr == S_OK) ok(vbool == VARIANT_FALSE, "expected VARIANT_FALSE, got %d\n", vbool); hr = IRegisteredTask_put_Enabled(task1, VARIANT_TRUE); +todo_wine ok(hr == S_OK, "put_Enabled error %#x\n", hr); hr = IRegisteredTask_get_State(task1, &state); +todo_wine ok(hr == S_OK, "get_State error %#x\n", hr); +if (hr == S_OK) ok(state == TASK_STATE_READY, "expected TASK_STATE_READY, got %d\n", state); hr = IRegisteredTask_get_Enabled(task1, &vbool); +todo_wine ok(hr == S_OK, "get_Enabled error %#x\n", hr); +if (hr == S_OK) ok(vbool == VARIANT_TRUE, "expected VARIANT_TRUE, got %d\n", vbool); IRegisteredTask_Release(task1); @@ -903,15 +914,20 @@ todo_wine ok(!lstrcmpW(bstr, Wine_Task2), "expected \\Wine\\Task2, got %s\n", wine_dbgstr_w(bstr)); SysFreeString(bstr); hr = IRegisteredTask_get_State(task2, &state); +todo_wine ok(hr == S_OK, "get_State error %#x\n", hr); +if (hr == S_OK) ok(state == TASK_STATE_READY, "expected TASK_STATE_READY, got %d\n", state); hr = IRegisteredTask_get_Enabled(task2, &vbool); +todo_wine ok(hr == S_OK, "get_Enabled error %#x\n", hr); +if (hr == S_OK) ok(vbool == VARIANT_TRUE, "expected VARIANT_TRUE, got %d\n", vbool); IRegisteredTask_Release(task2); hr = ITaskFolder_DeleteTask(folder, NULL, 0); +todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_DIR_NOT_EMPTY), "expected ERROR_DIR_NOT_EMPTY, got %#x\n", hr); hr = ITaskFolder_DeleteTask(root, Wine_Task1, 0); @@ -923,8 +939,10 @@ todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "expected ERROR_FILE_NOT_FOUND, got %#x\n", hr); hr = ITaskFolder_RegisterTask(root, NULL, xmlW, TASK_CREATE, v_null, v_null, TASK_LOGON_NONE, v_null, &task1); +todo_wine ok(hr == S_OK, "RegisterTask error %#x\n", hr); - + /* FIXME: Remove once implemented */ + if (hr != S_OK) goto failed; hr = IRegisteredTask_get_Name(task1, &bstr); ok(hr == S_OK, "get_Name error %#x\n", hr); hr = IIDFromString(bstr, &iid);