From af0ede42d597e29f8526dd57c451490a9c717e03 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Thu, 10 Apr 2014 17:41:27 +0900 Subject: [PATCH] schedsvc/tests: Add a test for NULL task name passed to SchRpcRegisterTask. --- dlls/schedsvc/schedsvc.c | 6 ++++++ dlls/schedsvc/tests/Makefile.in | 2 +- dlls/schedsvc/tests/rpcapi.c | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/dlls/schedsvc/schedsvc.c b/dlls/schedsvc/schedsvc.c index eb84998a698..5ce7d1da9ff 100644 --- a/dlls/schedsvc/schedsvc.c +++ b/dlls/schedsvc/schedsvc.c @@ -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; diff --git a/dlls/schedsvc/tests/Makefile.in b/dlls/schedsvc/tests/Makefile.in index f671f855bd8..cd56fde214e 100644 --- a/dlls/schedsvc/tests/Makefile.in +++ b/dlls/schedsvc/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = schedsvc.dll -IMPORTS = rpcrt4 +IMPORTS = rpcrt4 ole32 C_SRCS = \ rpcapi.c diff --git a/dlls/schedsvc/tests/rpcapi.c b/dlls/schedsvc/tests/rpcapi.c index 02f6882e84f..beaf7da70e5 100644 --- a/dlls/schedsvc/tests/rpcapi.c +++ b/dlls/schedsvc/tests/rpcapi.c @@ -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); }