schedsvc: Add some tests for SchRpcGetTaskInfo.

This commit is contained in:
Dmitry Timoshkov 2014-04-09 18:50:49 +09:00 committed by Alexandre Julliard
parent 96452fc810
commit 9b9b07e4cd
2 changed files with 49 additions and 2 deletions

View file

@ -93,7 +93,7 @@ START_TEST(rpcapi)
};
WCHAR xmlW[sizeof(xml1)], *xml;
HRESULT hr;
DWORD version, start_index, count, i, enumed;
DWORD version, start_index, count, i, enumed, enabled, state;
WCHAR *path;
TASK_XML_ERROR_INFO *info;
TASK_NAMES names;
@ -407,7 +407,7 @@ START_TEST(rpcapi)
ok(names != NULL, "names should not be NULL\n");
/* returned name depends whether directory randomization is on */
ok(!lstrcmpW(names[0], Task1) || !lstrcmpW(names[0], Task2),
"expected Task3, got %s\n", wine_dbgstr_w(names[0]));
"expected Task1, got %s\n", wine_dbgstr_w(names[0]));
MIDL_user_free(names[0]);
MIDL_user_free(names);
@ -473,6 +473,52 @@ START_TEST(rpcapi)
MIDL_user_free(names[0]);
MIDL_user_free(names);
if (0) /* crashes under win7 */
{
hr = SchRpcGetTaskInfo(NULL, 0, NULL, NULL);
hr = SchRpcGetTaskInfo(Task1, 0, NULL, NULL);
hr = SchRpcGetTaskInfo(Task1, 0, &enabled, NULL);
hr = SchRpcGetTaskInfo(Task1, 0, NULL, &state);
}
hr = SchRpcGetTaskInfo(Task1, 0, &enabled, &state);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "expected ERROR_FILE_NOT_FOUND, got %#x\n", hr);
enabled = state = 0xdeadbeef;
hr = SchRpcGetTaskInfo(Wine_Task1, 0, &enabled, &state);
todo_wine
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
if (hr == S_OK)
{
ok(enabled == 0, "expected 0, got %u\n", enabled);
ok(state == TASK_STATE_UNKNOWN, "expected TASK_STATE_UNKNOWN, got %u\n", state);
}
enabled = state = 0xdeadbeef;
hr = SchRpcGetTaskInfo(Wine_Task1, SCH_FLAG_STATE, &enabled, &state);
todo_wine
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
if (hr == S_OK)
{
ok(enabled == 0, "expected 0, got %u\n", enabled);
ok(state == TASK_STATE_DISABLED, "expected TASK_STATE_DISABLED, got %u\n", state);
}
hr = SchRpcEnableTask(Wine_Task1, 0xdeadbeef);
todo_wine
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
enabled = state = 0xdeadbeef;
hr = SchRpcGetTaskInfo(Wine_Task1, SCH_FLAG_STATE, &enabled, &state);
todo_wine
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
if (hr == S_OK)
{
ok(enabled == 1, "expected 1, got %u\n", enabled);
ok(state == TASK_STATE_READY, "expected TASK_STATE_READY, got %u\n", state);
}
hr = SchRpcDelete(Wine_Task1+1, 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcDelete(Wine_Task2+1, 0);

View file

@ -19,6 +19,7 @@
*/
cpp_quote("#define SCHEDSVC_TRANSPORT {'n','c','a','l','r','p','c',0}")
cpp_quote("#define SCH_FLAG_STATE 0x10000000")
import "oaidl.idl";
import "ocidl.idl";