taskschd: Forward ITaskFolder::RegisterTask to IRegisterTask constructor.

This commit is contained in:
Dmitry Timoshkov 2014-02-11 16:18:58 +09:00 committed by Alexandre Julliard
parent e4eee4ddb9
commit a20b10e445
4 changed files with 39 additions and 12 deletions

View File

@ -287,13 +287,15 @@ static HRESULT WINAPI TaskFolder_DeleteFolder(ITaskFolder *iface, BSTR name, LON
return reg_delete_folder(folder->path, name);
}
static HRESULT WINAPI TaskFolder_GetTask(ITaskFolder *iface, BSTR path, IRegisteredTask **task)
static HRESULT WINAPI TaskFolder_GetTask(ITaskFolder *iface, BSTR name, IRegisteredTask **task)
{
TRACE("%p,%s,%p\n", iface, debugstr_w(path), task);
TaskFolder *folder = impl_from_ITaskFolder(iface);
TRACE("%p,%s,%p\n", iface, debugstr_w(name), task);
if (!task) return E_POINTER;
return RegisteredTask_create(path, task);
return RegisteredTask_create(folder->path, name, NULL, 0, task, FALSE);
}
static HRESULT WINAPI TaskFolder_GetTasks(ITaskFolder *iface, LONG flags, IRegisteredTaskCollection **tasks)
@ -313,13 +315,31 @@ static HRESULT WINAPI TaskFolder_DeleteTask(ITaskFolder *iface, BSTR name, LONG
return E_NOTIMPL;
}
static HRESULT WINAPI TaskFolder_RegisterTask(ITaskFolder *iface, BSTR path, BSTR xml, LONG flags,
static HRESULT WINAPI TaskFolder_RegisterTask(ITaskFolder *iface, BSTR name, BSTR xml, LONG flags,
VARIANT user, VARIANT password, TASK_LOGON_TYPE logon,
VARIANT sddl, IRegisteredTask **task)
{
FIXME("%p,%s,%s,%x,%s,%s,%d,%s,%p: stub\n", iface, debugstr_w(path), debugstr_w(xml), flags,
TaskFolder *folder = impl_from_ITaskFolder(iface);
IRegisteredTask *regtask = NULL;
HRESULT hr;
FIXME("%p,%s,%s,%x,%s,%s,%d,%s,%p: stub\n", iface, debugstr_w(name), debugstr_w(xml), flags,
debugstr_variant(&user), debugstr_variant(&password), logon, debugstr_variant(&sddl), task);
return E_NOTIMPL;
if (!is_variant_null(&sddl))
FIXME("security descriptor %s is ignored\n", debugstr_variant(&sddl));
if (!is_variant_null(&user) || !is_variant_null(&password))
FIXME("user/password are ignored\n");
if (!task) task = &regtask;
hr = RegisteredTask_create(folder->path, name, xml, logon, task, TRUE);
if (regtask)
IRegisteredTask_Release(regtask);
return hr;
}
static HRESULT WINAPI TaskFolder_RegisterTaskDefinition(ITaskFolder *iface, BSTR path, ITaskDefinition *definition, LONG flags,

View File

@ -251,7 +251,8 @@ static const IRegisteredTaskVtbl RegisteredTask_vtbl =
regtask_GetRunTimes
};
HRESULT RegisteredTask_create(const WCHAR *path, IRegisteredTask **obj)
HRESULT RegisteredTask_create(const WCHAR *path, const WCHAR *name, const WCHAR *xml,
TASK_LOGON_TYPE logon, IRegisteredTask **obj, BOOL create)
{
RegisteredTask *regtask;

View File

@ -16,12 +16,16 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_TASKSCHD_PRIVATE_H__
#define __WINE_TASKSCHD_PRIVATE_H__
#include "wine/unicode.h"
HRESULT TaskService_create(void **obj) DECLSPEC_HIDDEN;
HRESULT TaskFolder_create(const WCHAR *parent, const WCHAR *path, ITaskFolder **obj, BOOL create) DECLSPEC_HIDDEN;
HRESULT TaskFolderCollection_create(const WCHAR *path, ITaskFolderCollection **obj) DECLSPEC_HIDDEN;
HRESULT RegisteredTask_create(const WCHAR *path, IRegisteredTask **obj) DECLSPEC_HIDDEN;
HRESULT RegisteredTask_create(const WCHAR *path, const WCHAR *name, const WCHAR *xml, TASK_LOGON_TYPE logon,
IRegisteredTask **obj, BOOL create) DECLSPEC_HIDDEN;
HRESULT RegisteredTaskCollection_create(const WCHAR *path, IRegisteredTaskCollection **obj) DECLSPEC_HIDDEN;
const char *debugstr_variant(const VARIANT *v) DECLSPEC_HIDDEN;
@ -52,3 +56,5 @@ static inline WCHAR *heap_strdupW(const WCHAR *src)
if ((dst = heap_alloc(len))) memcpy(dst, src, len);
return dst;
}
#endif /* __WINE_TASKSCHD_PRIVATE_H__ */

View File

@ -734,7 +734,6 @@ static void test_GetTask(void)
MultiByteToWideChar(CP_ACP, 0, xml1, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0]));
hr = ITaskFolder_RegisterTask(root, Wine_Task1, xmlW, TASK_CREATE, v_null, v_null, TASK_LOGON_NONE, v_null, NULL);
todo_wine
ok(hr == S_OK, "RegisterTask error %#x\n", hr);
hr = ITaskFolder_RegisterTask(root, Wine_Task1, xmlW, TASK_CREATE, v_null, v_null, TASK_LOGON_NONE, v_null, &task1);
@ -742,16 +741,17 @@ todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS), "expected ERROR_ALREADY_EXISTS, got %#x\n", hr);
hr = ITaskFolder_RegisterTask(root, Wine_Task1, xmlW, TASK_CREATE_OR_UPDATE, 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, NULL);
todo_wine
ok(hr == E_POINTER, "expected E_POINTER, got %#x\n", hr);
hr = IRegisteredTask_get_Name(task1, &bstr);
todo_wine
ok(hr == S_OK, "get_Name error %#x\n", hr);
/* FIXME: Remove once implemented */
if (hr != S_OK) goto failed;
ok(!lstrcmpW(bstr, Task1), "expected Task1, got %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
hr = IRegisteredTask_get_Path(task1, &bstr);