taskschd: Add support for registering a task with NULL name in the root folder.
Because server receives full task name it can't autogenerate a name in a non-root folder.
This commit is contained in:
parent
adc60c779f
commit
39c1c9c262
|
@ -313,8 +313,21 @@ HRESULT RegisteredTask_create(const WCHAR *path, const WCHAR *name, ITaskDefinit
|
|||
RegisteredTask *regtask;
|
||||
HRESULT hr;
|
||||
|
||||
full_name = get_full_path(path, name);
|
||||
if (!full_name) return E_OUTOFMEMORY;
|
||||
if (!name)
|
||||
{
|
||||
if (!create) return E_INVALIDARG;
|
||||
|
||||
/* NULL task name is allowed only in the root folder */
|
||||
if (path[0] != '\\' || path[1])
|
||||
return E_INVALIDARG;
|
||||
|
||||
full_name = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
full_name = get_full_path(path, name);
|
||||
if (!full_name) return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
regtask = heap_alloc(sizeof(*regtask));
|
||||
if (!regtask)
|
||||
|
@ -337,6 +350,9 @@ HRESULT RegisteredTask_create(const WCHAR *path, const WCHAR *name, ITaskDefinit
|
|||
SysFreeString(xml);
|
||||
return hr;
|
||||
}
|
||||
|
||||
heap_free(full_name);
|
||||
full_name = heap_strdupW(actual_path);
|
||||
MIDL_user_free(actual_path);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -851,7 +851,6 @@ todo_wine
|
|||
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);
|
||||
|
@ -929,10 +928,8 @@ 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);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
|
||||
hr = IRegisteredTask_get_Name(task1, &bstr);
|
||||
ok(hr == S_OK, "get_Name error %#x\n", hr);
|
||||
hr = IIDFromString(bstr, &iid);
|
||||
|
@ -942,10 +939,8 @@ if (hr == S_OK)
|
|||
|
||||
hr = ITaskFolder_DeleteTask(root, bstr, 0);
|
||||
ok(hr == S_OK, "DeleteTask error %#x\n", hr);
|
||||
}
|
||||
|
||||
hr = ITaskFolder_RegisterTask(folder, NULL, xmlW, TASK_CREATE, v_null, v_null, TASK_LOGON_NONE, v_null, &task1);
|
||||
todo_wine
|
||||
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
|
||||
|
||||
ITaskFolder_Release(folder);
|
||||
|
|
Loading…
Reference in New Issue