schedsvc/tests: Add a test for NULL task name passed to SchRpcRegisterTask.

This commit is contained in:
Dmitry Timoshkov 2014-04-10 17:41:27 +09:00 committed by Alexandre Julliard
parent ea248186b3
commit af0ede42d5
3 changed files with 23 additions and 1 deletions

View File

@ -180,6 +180,12 @@ 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)
{
FIXME("NULL name is not supported\n");
return E_INVALIDARG;
}
full_name = get_full_name(path, &relative_path);
if (!full_name) return E_OUTOFMEMORY;

View File

@ -1,5 +1,5 @@
TESTDLL = schedsvc.dll
IMPORTS = rpcrt4
IMPORTS = rpcrt4 ole32
C_SRCS = \
rpcapi.c

View File

@ -99,6 +99,7 @@ START_TEST(rpcapi)
TASK_NAMES names;
unsigned char *binding_str;
PTOP_LEVEL_EXCEPTION_FILTER old_exception_filter;
IID iid;
hr = RpcStringBindingComposeA(NULL, ncalrpc, NULL, NULL, NULL, &binding_str);
ok(hr == RPC_S_OK, "RpcStringBindingCompose error %#x\n", hr);
@ -517,6 +518,21 @@ todo_wine
hr = SchRpcDelete(Wine, 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
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);
}