Commit a484dadf authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

schedsvc: Add support for generating new task name in SchRpcRegisterTask.

parent af0ede42
MODULE = schedsvc.dll
IMPORTS = rpcrt4 advapi32
IMPORTS = rpcrt4 advapi32 ole32
C_SRCS = \
schedsvc.c \
......
......@@ -180,27 +180,37 @@ HRESULT __cdecl SchRpcRegisterTask(const WCHAR *path, const WCHAR *xml, DWORD fl
/* FIXME: assume that validation is performed on the client side */
if (flags & TASK_VALIDATE_ONLY) return S_OK;
if (!path)
if (path)
{
FIXME("NULL name is not supported\n");
return E_INVALIDARG;
}
full_name = get_full_name(path, &relative_path);
if (!full_name) return E_OUTOFMEMORY;
full_name = get_full_name(path, &relative_path);
if (!full_name) return E_OUTOFMEMORY;
if (strchrW(path, '\\') || strchrW(path, '/'))
{
WCHAR *p = strrchrW(full_name, '/');
if (!p) p = strrchrW(full_name, '\\');
*p = 0;
hr = create_directory(full_name);
if (hr != S_OK && hr != HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS))
if (strchrW(path, '\\') || strchrW(path, '/'))
{
heap_free(full_name);
return hr;
WCHAR *p = strrchrW(full_name, '/');
if (!p) p = strrchrW(full_name, '\\');
*p = 0;
hr = create_directory(full_name);
if (hr != S_OK && hr != HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS))
{
heap_free(full_name);
return hr;
}
*p = '\\';
}
*p = '\\';
}
else
{
IID iid;
WCHAR uuid_str[39];
UuidCreate(&iid);
StringFromGUID2(&iid, uuid_str, 39);
full_name = get_full_name(uuid_str, &relative_path);
if (!full_name) return E_OUTOFMEMORY;
/* skip leading '\' */
relative_path++;
}
switch (flags & (TASK_CREATE | TASK_UPDATE))
......
......@@ -521,17 +521,13 @@ todo_wine
path = NULL;
info = NULL;
hr = SchRpcRegisterTask(NULL, xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
todo_wine
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(!info, "expected NULL, info %p\n", info);
if (hr == S_OK)
{
hr = IIDFromString(path, &iid);
ok(hr == S_OK, "IIDFromString(%s) error %#x\n", wine_dbgstr_w(path), hr);
hr = SchRpcDelete(path, 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
MIDL_user_free(path);
}
hr = RpcBindingFree(&rpc_handle);
ok(hr == RPC_S_OK, "RpcBindingFree error %#x\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment