taskschd: Implement ExecAction::put_Id and ExecAction::get_Id.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-03-30 16:57:55 +08:00 committed by Alexandre Julliard
parent 4c71db15ca
commit f9d1aa586e
2 changed files with 45 additions and 6 deletions

View File

@ -1679,6 +1679,7 @@ typedef struct
WCHAR *path;
WCHAR *directory;
WCHAR *args;
WCHAR *id;
} ExecAction;
static inline ExecAction *impl_from_IExecAction(IExecAction *iface)
@ -1703,6 +1704,7 @@ static ULONG WINAPI ExecAction_Release(IExecAction *iface)
heap_free(action->path);
heap_free(action->directory);
heap_free(action->args);
heap_free(action->id);
heap_free(action);
}
@ -1759,14 +1761,30 @@ static HRESULT WINAPI ExecAction_Invoke(IExecAction *iface, DISPID dispid, REFII
static HRESULT WINAPI ExecAction_get_Id(IExecAction *iface, BSTR *id)
{
FIXME("%p,%p: stub\n", iface, id);
return E_NOTIMPL;
ExecAction *action = impl_from_IExecAction(iface);
TRACE("%p,%p\n", iface, id);
if (!id) return E_POINTER;
if (!action->id) *id = NULL;
else if (!(*id = SysAllocString(action->id))) return E_OUTOFMEMORY;
return S_OK;
}
static HRESULT WINAPI ExecAction_put_Id(IExecAction *iface, BSTR id)
{
FIXME("%p,%s: stub\n", iface, debugstr_w(id));
return E_NOTIMPL;
ExecAction *action = impl_from_IExecAction(iface);
WCHAR *str = NULL;
TRACE("%p,%s\n", iface, debugstr_w(id));
if (id && !(str = heap_strdupW((id)))) return E_OUTOFMEMORY;
heap_free(action->id);
action->id = str;
return S_OK;
}
static HRESULT WINAPI ExecAction_get_Type(IExecAction *iface, TASK_ACTION_TYPE *type)
@ -1896,6 +1914,7 @@ static HRESULT ExecAction_create(IExecAction **obj)
action->path = NULL;
action->directory = NULL;
action->args = NULL;
action->id = NULL;
*obj = &action->IExecAction_iface;

View File

@ -1306,12 +1306,13 @@ static void create_action(ITaskDefinition *taskdef)
static WCHAR task1_exe[] = { 't','a','s','k','1','.','e','x','e',0 };
static WCHAR workdir[] = { 'w','o','r','k','d','i','r',0 };
static WCHAR args[] = { 'a','r','g','u','m','e','n','s',0 };
static WCHAR comment[] = { 'c','o','m','m','e','n','t',0 };
HRESULT hr;
IActionCollection *actions;
IAction *action;
IExecAction *exec_action;
TASK_ACTION_TYPE type;
BSTR path;
BSTR path, str;
hr = ITaskDefinition_get_Actions(taskdef, NULL);
ok(hr == E_POINTER, "got %#x\n", hr);
@ -1384,7 +1385,7 @@ static void create_action(ITaskDefinition *taskdef)
ok(hr == S_OK, "put_Arguments error %#x\n", hr);
hr = IExecAction_put_Arguments(exec_action, args);
ok(hr == S_OK, "put_WorkingDirectory error %#x\n", hr);
ok(hr == S_OK, "put_Arguments error %#x\n", hr);
path = NULL;
hr = IExecAction_get_Arguments(exec_action, &path);
@ -1393,6 +1394,25 @@ static void create_action(ITaskDefinition *taskdef)
ok(!lstrcmpW(path, args), "got %s\n", wine_dbgstr_w(path));
SysFreeString(path);
str = (BSTR)0xdeadbeef;
hr = IExecAction_get_Id(exec_action, &str);
ok(hr == S_OK, "get_Id error %#x\n", hr);
ok(str == NULL, "id should be NULL\n");
hr = IExecAction_put_Id(exec_action, NULL);
ok(hr == S_OK, "put_Id error %#x\n", hr);
hr = IExecAction_put_Id(exec_action, comment);
ok(hr == S_OK, "put_Id error %#x\n", hr);
str = NULL;
hr = IExecAction_get_Id(exec_action, &str);
ok(hr == S_OK, "get_Id error %#x\n", hr);
ok(str != NULL, "should not be NULL\n");
ok(!lstrcmpW(str, comment), "got %s\n", wine_dbgstr_w(str));
SysFreeString(str);
IExecAction_Release(exec_action);
IAction_Release(action);
IActionCollection_Release(actions);