From 9b9b07e4cdbf61daf1fb6fdc4695d5df5e1bf1a3 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Wed, 9 Apr 2014 18:50:49 +0900 Subject: [PATCH] schedsvc: Add some tests for SchRpcGetTaskInfo. --- dlls/schedsvc/tests/rpcapi.c | 50 ++++++++++++++++++++++++++++++++++-- include/wine/schrpc.idl | 1 + 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/dlls/schedsvc/tests/rpcapi.c b/dlls/schedsvc/tests/rpcapi.c index 2ef50c99b48..480aa83653d 100644 --- a/dlls/schedsvc/tests/rpcapi.c +++ b/dlls/schedsvc/tests/rpcapi.c @@ -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); diff --git a/include/wine/schrpc.idl b/include/wine/schrpc.idl index 55acb3846de..4af709d8dd0 100644 --- a/include/wine/schrpc.idl +++ b/include/wine/schrpc.idl @@ -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";