mstask/tests: Enable compilation with long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d25ee94f0b
commit
c601c7019b
|
@ -1,4 +1,3 @@
|
|||
EXTRADEFS = -DWINE_NO_LONG_TYPES
|
||||
TESTDLL = mstask.dll
|
||||
IMPORTS = ole32 user32
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ static void test_SetApplicationName_GetApplicationName(void)
|
|||
|
||||
/* Attempt getting before setting application name */
|
||||
hres = ITask_GetApplicationName(test_task, &stored_name);
|
||||
ok(hres == S_OK, "GetApplicationName failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetApplicationName failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpiW(stored_name, empty),
|
||||
|
@ -77,10 +77,10 @@ static void test_SetApplicationName_GetApplicationName(void)
|
|||
/* Set application name to a nonexistent application and then get
|
||||
* the application name that is actually stored */
|
||||
hres = ITask_SetApplicationName(test_task, non_application_name);
|
||||
ok(hres == S_OK, "Failed setting name %s: %08x\n",
|
||||
ok(hres == S_OK, "Failed setting name %s: %08lx\n",
|
||||
wine_dbgstr_w(non_application_name), hres);
|
||||
hres = ITask_GetApplicationName(test_task, &stored_name);
|
||||
ok(hres == S_OK, "GetApplicationName failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetApplicationName failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
full_name = path_resolve_name(non_application_name);
|
||||
|
@ -92,10 +92,10 @@ static void test_SetApplicationName_GetApplicationName(void)
|
|||
/* Set a valid application name with program type extension and then
|
||||
* get the stored name */
|
||||
hres = ITask_SetApplicationName(test_task, notepad_exe);
|
||||
ok(hres == S_OK, "Failed setting name %s: %08x\n",
|
||||
ok(hres == S_OK, "Failed setting name %s: %08lx\n",
|
||||
wine_dbgstr_w(notepad_exe), hres);
|
||||
hres = ITask_GetApplicationName(test_task, &stored_name);
|
||||
ok(hres == S_OK, "GetApplicationName failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetApplicationName failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
full_name = path_resolve_name(notepad_exe);
|
||||
|
@ -107,9 +107,9 @@ static void test_SetApplicationName_GetApplicationName(void)
|
|||
/* Set a valid application name without program type extension and
|
||||
* then get the stored name */
|
||||
hres = ITask_SetApplicationName(test_task, notepad);
|
||||
ok(hres == S_OK, "Failed setting name %s: %08x\n", wine_dbgstr_w(notepad), hres);
|
||||
ok(hres == S_OK, "Failed setting name %s: %08lx\n", wine_dbgstr_w(notepad), hres);
|
||||
hres = ITask_GetApplicationName(test_task, &stored_name);
|
||||
ok(hres == S_OK, "GetApplicationName failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetApplicationName failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
full_name = path_resolve_name(notepad_exe); /* XP SP1 appends .exe */
|
||||
|
@ -126,10 +126,10 @@ static void test_SetApplicationName_GetApplicationName(void)
|
|||
* to a nonexistent application and then get the name that is
|
||||
* actually stored */
|
||||
hres = ITask_SetApplicationName(test_task, non_application_name);
|
||||
ok(hres == S_OK, "Failed setting name %s: %08x\n",
|
||||
ok(hres == S_OK, "Failed setting name %s: %08lx\n",
|
||||
wine_dbgstr_w(non_application_name), hres);
|
||||
hres = ITask_GetApplicationName(test_task, &stored_name);
|
||||
ok(hres == S_OK, "GetApplicationName failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetApplicationName failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
full_name = path_resolve_name(non_application_name);
|
||||
|
@ -140,9 +140,9 @@ static void test_SetApplicationName_GetApplicationName(void)
|
|||
|
||||
/* Clear application name */
|
||||
hres = ITask_SetApplicationName(test_task, empty);
|
||||
ok(hres == S_OK, "Failed setting name %s: %08x\n", wine_dbgstr_w(empty), hres);
|
||||
ok(hres == S_OK, "Failed setting name %s: %08lx\n", wine_dbgstr_w(empty), hres);
|
||||
hres = ITask_GetApplicationName(test_task, &stored_name);
|
||||
ok(hres == S_OK, "GetApplicationName failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetApplicationName failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpiW(stored_name, empty),
|
||||
|
@ -165,7 +165,7 @@ static void test_CreateTrigger(void)
|
|||
ok(hres == S_OK, "Failed to setup test_task\n");
|
||||
|
||||
hres = ITask_CreateTrigger(test_task, &trigger_index, &test_trigger);
|
||||
ok(hres == S_OK, "Failed to create trigger: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to create trigger: 0x%08lx\n", hres);
|
||||
|
||||
ITaskTrigger_Release(test_trigger);
|
||||
ITask_Release(test_task);
|
||||
|
@ -186,7 +186,7 @@ static void test_SetParameters_GetParameters(void)
|
|||
|
||||
/* Get parameters before setting them */
|
||||
hres = ITask_GetParameters(test_task, ¶meters);
|
||||
ok(hres == S_OK, "GetParameters failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetParameters failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpW(parameters, empty),
|
||||
|
@ -196,10 +196,10 @@ static void test_SetParameters_GetParameters(void)
|
|||
|
||||
/* Set parameters to a simple string */
|
||||
hres = ITask_SetParameters(test_task, parameters_a);
|
||||
ok(hres == S_OK, "Failed setting parameters %s: %08x\n",
|
||||
ok(hres == S_OK, "Failed setting parameters %s: %08lx\n",
|
||||
wine_dbgstr_w(parameters_a), hres);
|
||||
hres = ITask_GetParameters(test_task, ¶meters);
|
||||
ok(hres == S_OK, "GetParameters failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetParameters failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpW(parameters, parameters_a), "Got %s, expected %s\n",
|
||||
|
@ -209,10 +209,10 @@ static void test_SetParameters_GetParameters(void)
|
|||
|
||||
/* Update parameters to a different simple string */
|
||||
hres = ITask_SetParameters(test_task, parameters_b);
|
||||
ok(hres == S_OK, "Failed setting parameters %s: %08x\n",
|
||||
ok(hres == S_OK, "Failed setting parameters %s: %08lx\n",
|
||||
wine_dbgstr_w(parameters_b), hres);
|
||||
hres = ITask_GetParameters(test_task, ¶meters);
|
||||
ok(hres == S_OK, "GetParameters failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetParameters failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpW(parameters, parameters_b), "Got %s, expected %s\n",
|
||||
|
@ -222,10 +222,10 @@ static void test_SetParameters_GetParameters(void)
|
|||
|
||||
/* Clear parameters */
|
||||
hres = ITask_SetParameters(test_task, empty);
|
||||
ok(hres == S_OK, "Failed setting parameters %s: %08x\n",
|
||||
ok(hres == S_OK, "Failed setting parameters %s: %08lx\n",
|
||||
wine_dbgstr_w(empty), hres);
|
||||
hres = ITask_GetParameters(test_task, ¶meters);
|
||||
ok(hres == S_OK, "GetParameters failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetParameters failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpW(parameters, empty),
|
||||
|
@ -251,7 +251,7 @@ static void test_SetComment_GetComment(void)
|
|||
|
||||
/* Get comment before setting it*/
|
||||
hres = ITask_GetComment(test_task, &comment);
|
||||
ok(hres == S_OK, "GetComment failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetComment failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpW(comment, empty),
|
||||
|
@ -261,10 +261,10 @@ static void test_SetComment_GetComment(void)
|
|||
|
||||
/* Set comment to a simple string */
|
||||
hres = ITask_SetComment(test_task, comment_a);
|
||||
ok(hres == S_OK, "Failed setting comment %s: %08x\n",
|
||||
ok(hres == S_OK, "Failed setting comment %s: %08lx\n",
|
||||
wine_dbgstr_w(comment_a), hres);
|
||||
hres = ITask_GetComment(test_task, &comment);
|
||||
ok(hres == S_OK, "GetComment failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetComment failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpW(comment, comment_a), "Got %s, expected %s\n",
|
||||
|
@ -274,10 +274,10 @@ static void test_SetComment_GetComment(void)
|
|||
|
||||
/* Update comment to a different simple string */
|
||||
hres = ITask_SetComment(test_task, comment_b);
|
||||
ok(hres == S_OK, "Failed setting comment %s: %08x\n",
|
||||
ok(hres == S_OK, "Failed setting comment %s: %08lx\n",
|
||||
wine_dbgstr_w(comment_b), hres);
|
||||
hres = ITask_GetComment(test_task, &comment);
|
||||
ok(hres == S_OK, "GetComment failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetComment failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpW(comment, comment_b), "Got %s, expected %s\n",
|
||||
|
@ -287,10 +287,10 @@ static void test_SetComment_GetComment(void)
|
|||
|
||||
/* Clear comment */
|
||||
hres = ITask_SetComment(test_task, empty);
|
||||
ok(hres == S_OK, "Failed setting comment %s: %08x\n",
|
||||
ok(hres == S_OK, "Failed setting comment %s: %08lx\n",
|
||||
wine_dbgstr_w(empty), hres);
|
||||
hres = ITask_GetComment(test_task, &comment);
|
||||
ok(hres == S_OK, "GetComment failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "GetComment failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpW(comment, empty),
|
||||
|
@ -315,40 +315,40 @@ static void test_SetMaxRunTime_GetMaxRunTime(void)
|
|||
* 3 days * 24 hours * 60 minutes * 60 seconds * 1000 ms = 259200000 */
|
||||
max_run_time = 0;
|
||||
hres = ITask_GetMaxRunTime(test_task, &max_run_time);
|
||||
ok(hres == S_OK, "Failed to get max runtime: 0x%08x\n", hres);
|
||||
ok(max_run_time == 259200000, "Expected 259200000: %d\n", max_run_time);
|
||||
ok(hres == S_OK, "Failed to get max runtime: 0x%08lx\n", hres);
|
||||
ok(max_run_time == 259200000, "Expected 259200000: %ld\n", max_run_time);
|
||||
|
||||
/* Basic set test */
|
||||
max_run_time = 0;
|
||||
hres = ITask_SetMaxRunTime(test_task, 1234);
|
||||
ok(hres == S_OK, "Failed to set max runtime: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set max runtime: 0x%08lx\n", hres);
|
||||
hres = ITask_GetMaxRunTime(test_task, &max_run_time);
|
||||
ok(hres == S_OK, "Failed to get max runtime: 0x%08x\n", hres);
|
||||
ok(max_run_time == 1234, "Expected 1234: %d\n", max_run_time);
|
||||
ok(hres == S_OK, "Failed to get max runtime: 0x%08lx\n", hres);
|
||||
ok(max_run_time == 1234, "Expected 1234: %ld\n", max_run_time);
|
||||
|
||||
/* Verify that time can be set to zero */
|
||||
max_run_time = 1;
|
||||
hres = ITask_SetMaxRunTime(test_task, 0);
|
||||
ok(hres == S_OK, "Failed to set max runtime: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set max runtime: 0x%08lx\n", hres);
|
||||
hres = ITask_GetMaxRunTime(test_task, &max_run_time);
|
||||
ok(hres == S_OK, "Failed to get max runtime: 0x%08x\n", hres);
|
||||
ok(max_run_time == 0, "Expected 0: %d\n", max_run_time);
|
||||
ok(hres == S_OK, "Failed to get max runtime: 0x%08lx\n", hres);
|
||||
ok(max_run_time == 0, "Expected 0: %ld\n", max_run_time);
|
||||
|
||||
/* Check resolution by setting time to one */
|
||||
max_run_time = 0;
|
||||
hres = ITask_SetMaxRunTime(test_task, 1);
|
||||
ok(hres == S_OK, "Failed to set max runtime: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set max runtime: 0x%08lx\n", hres);
|
||||
hres = ITask_GetMaxRunTime(test_task, &max_run_time);
|
||||
ok(hres == S_OK, "Failed to get max runtime: 0x%08x\n", hres);
|
||||
ok(max_run_time == 1, "Expected 1: %d\n", max_run_time);
|
||||
ok(hres == S_OK, "Failed to get max runtime: 0x%08lx\n", hres);
|
||||
ok(max_run_time == 1, "Expected 1: %ld\n", max_run_time);
|
||||
|
||||
/* Verify that time can be set to INFINITE */
|
||||
max_run_time = 0;
|
||||
hres = ITask_SetMaxRunTime(test_task, INFINITE);
|
||||
ok(hres == S_OK, "Failed to set max runtime: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set max runtime: 0x%08lx\n", hres);
|
||||
hres = ITask_GetMaxRunTime(test_task, &max_run_time);
|
||||
ok(hres == S_OK, "Failed to get max runtime: 0x%08x\n", hres);
|
||||
ok(max_run_time == INFINITE, "Expected INFINITE: %d\n", max_run_time);
|
||||
ok(hres == S_OK, "Failed to get max runtime: 0x%08lx\n", hres);
|
||||
ok(max_run_time == INFINITE, "Expected INFINITE: %ld\n", max_run_time);
|
||||
|
||||
ITask_Release(test_task);
|
||||
}
|
||||
|
@ -379,19 +379,19 @@ static void test_SetAccountInformation_GetAccountInformation(void)
|
|||
}
|
||||
ok(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
|
||||
hres == SCHED_E_CANNOT_OPEN_TASK,
|
||||
"Unset account name generated: 0x%08x\n", hres);
|
||||
"Unset account name generated: 0x%08lx\n", hres);
|
||||
|
||||
/* Attempt to set to a dummy account without a password */
|
||||
/* This test passes on WinXP but fails on Win2K */
|
||||
hres = ITask_SetAccountInformation(test_task, dummy_account_name, NULL);
|
||||
ok(hres == S_OK,
|
||||
"Failed setting dummy account with no password: %08x\n", hres);
|
||||
"Failed setting dummy account with no password: %08lx\n", hres);
|
||||
hres = ITask_GetAccountInformation(test_task, &account_name);
|
||||
ok(hres == S_OK ||
|
||||
broken(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
|
||||
hres == SCHED_E_CANNOT_OPEN_TASK ||
|
||||
hres == 0x200), /* win2k */
|
||||
"GetAccountInformation failed: %08x\n", hres);
|
||||
"GetAccountInformation failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpW(account_name, dummy_account_name),
|
||||
|
@ -405,13 +405,13 @@ static void test_SetAccountInformation_GetAccountInformation(void)
|
|||
hres = ITask_SetAccountInformation(test_task, dummy_account_name_b,
|
||||
dummy_account_name_b);
|
||||
ok(hres == S_OK,
|
||||
"Failed setting dummy account with password: %08x\n", hres);
|
||||
"Failed setting dummy account with password: %08lx\n", hres);
|
||||
hres = ITask_GetAccountInformation(test_task, &account_name);
|
||||
ok(hres == S_OK ||
|
||||
broken(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
|
||||
hres == SCHED_E_CANNOT_OPEN_TASK ||
|
||||
hres == 0x200), /* win2k */
|
||||
"GetAccountInformation failed: %08x\n", hres);
|
||||
"GetAccountInformation failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpW(account_name, dummy_account_name_b),
|
||||
|
@ -422,13 +422,13 @@ static void test_SetAccountInformation_GetAccountInformation(void)
|
|||
|
||||
/* Attempt to set to the local system account */
|
||||
hres = ITask_SetAccountInformation(test_task, empty, NULL);
|
||||
ok(hres == S_OK, "Failed setting system account: %08x\n", hres);
|
||||
ok(hres == S_OK, "Failed setting system account: %08lx\n", hres);
|
||||
hres = ITask_GetAccountInformation(test_task, &account_name);
|
||||
ok(hres == S_OK ||
|
||||
broken(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
|
||||
hres == SCHED_E_CANNOT_OPEN_TASK ||
|
||||
hres == 0x200), /* win2k */
|
||||
"GetAccountInformation failed: %08x\n", hres);
|
||||
"GetAccountInformation failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
{
|
||||
ok(!lstrcmpW(account_name, empty),
|
||||
|
@ -456,36 +456,36 @@ static void test_task_state(void)
|
|||
|
||||
flags = 0xdeadbeef;
|
||||
hr = ITask_GetFlags(test_task, &flags);
|
||||
ok(hr == S_OK, "GetFlags error %#x\n", hr);
|
||||
ok(flags == 0, "got %#x\n", flags);
|
||||
ok(hr == S_OK, "GetFlags error %#lx\n", hr);
|
||||
ok(flags == 0, "got %#lx\n", flags);
|
||||
|
||||
if (0) /* crashes under Windows */
|
||||
hr = ITask_GetTaskFlags(test_task, NULL);
|
||||
|
||||
flags = 0xdeadbeef;
|
||||
hr = ITask_GetTaskFlags(test_task, &flags);
|
||||
ok(hr == S_OK, "GetTaskFlags error %#x\n", hr);
|
||||
ok(flags == 0, "got %#x\n", flags);
|
||||
ok(hr == S_OK, "GetTaskFlags error %#lx\n", hr);
|
||||
ok(flags == 0, "got %#lx\n", flags);
|
||||
|
||||
if (0) /* crashes under Windows */
|
||||
hr = ITask_GetStatus(test_task, NULL);
|
||||
|
||||
status = 0xdeadbeef;
|
||||
hr = ITask_GetStatus(test_task, &status);
|
||||
ok(hr == S_OK, "GetStatus error %#x\n", hr);
|
||||
ok(status == SCHED_S_TASK_NOT_SCHEDULED, "got %#x\n", status);
|
||||
ok(hr == S_OK, "GetStatus error %#lx\n", hr);
|
||||
ok(status == SCHED_S_TASK_NOT_SCHEDULED, "got %#lx\n", status);
|
||||
|
||||
if (0) /* crashes under Windows */
|
||||
hr = ITask_GetErrorRetryCount(test_task, NULL);
|
||||
|
||||
hr = ITask_GetErrorRetryCount(test_task, &val1);
|
||||
ok(hr == E_NOTIMPL, "got %#x\n", hr);
|
||||
ok(hr == E_NOTIMPL, "got %#lx\n", hr);
|
||||
|
||||
if (0) /* crashes under Windows */
|
||||
hr = ITask_GetErrorRetryInterval(test_task, NULL);
|
||||
|
||||
hr = ITask_GetErrorRetryInterval(test_task, &val1);
|
||||
ok(hr == E_NOTIMPL, "got %#x\n", hr);
|
||||
ok(hr == E_NOTIMPL, "got %#lx\n", hr);
|
||||
|
||||
if (0) /* crashes under Windows */
|
||||
hr = ITask_GetIdleWait(test_task, NULL, NULL);
|
||||
|
@ -493,7 +493,7 @@ static void test_task_state(void)
|
|||
val1 = 0xdead;
|
||||
val2 = 0xbeef;
|
||||
hr = ITask_GetIdleWait(test_task, &val1, &val2);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(val1 == 10, "got %u\n", val1);
|
||||
ok(val2 == 60, "got %u\n", val2);
|
||||
|
||||
|
@ -502,23 +502,23 @@ static void test_task_state(void)
|
|||
|
||||
val = 0xdeadbeef;
|
||||
hr = ITask_GetPriority(test_task, &val);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(val == NORMAL_PRIORITY_CLASS, "got %#x\n", val);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(val == NORMAL_PRIORITY_CLASS, "got %#lx\n", val);
|
||||
|
||||
if (0) /* crashes under Windows */
|
||||
hr = ITask_GetExitCode(test_task, NULL);
|
||||
|
||||
val = 0xdeadbeef;
|
||||
hr = ITask_GetExitCode(test_task, &val);
|
||||
ok(hr == SCHED_S_TASK_HAS_NOT_RUN, "got %#x\n", hr);
|
||||
ok(val == 0, "got %#x\n", val);
|
||||
ok(hr == SCHED_S_TASK_HAS_NOT_RUN, "got %#lx\n", hr);
|
||||
ok(val == 0, "got %#lx\n", val);
|
||||
|
||||
if (0) /* crashes under Windows */
|
||||
hr = ITask_GetMostRecentRunTime(test_task, NULL);
|
||||
|
||||
memset(&st, 0xff, sizeof(st));
|
||||
hr = ITask_GetMostRecentRunTime(test_task, &st);
|
||||
ok(hr == SCHED_S_TASK_HAS_NOT_RUN, "got %#x\n", hr);
|
||||
ok(hr == SCHED_S_TASK_HAS_NOT_RUN, "got %#lx\n", hr);
|
||||
ok(st.wYear == 0, "got %u\n", st.wYear);
|
||||
ok(st.wMonth == 0, "got %u\n", st.wMonth);
|
||||
ok(st.wDay == 0, "got %u\n", st.wDay);
|
||||
|
@ -535,10 +535,10 @@ static void save_job(ITask *task)
|
|||
IPersistFile *pfile;
|
||||
|
||||
hr = ITask_QueryInterface(task, &IID_IPersistFile, (void **)&pfile);
|
||||
ok(hr == S_OK, "QueryInterface error %#x\n", hr);
|
||||
ok(hr == S_OK, "QueryInterface error %#lx\n", hr);
|
||||
|
||||
hr = IPersistFile_Save(pfile, NULL, FALSE);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
IPersistFile_Release(pfile);
|
||||
}
|
||||
|
@ -559,26 +559,26 @@ static void test_Run(void)
|
|||
|
||||
hr = ITaskScheduler_NewWorkItem(scheduler, wine_test_runW, &CLSID_CTask,
|
||||
&IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
hr = ITask_Run(task);
|
||||
ok(hr == SCHED_E_TASK_NOT_READY, "got %#x\n", hr);
|
||||
ok(hr == SCHED_E_TASK_NOT_READY, "got %#lx\n", hr);
|
||||
|
||||
hr = ITask_Terminate(task);
|
||||
ok(hr == SCHED_E_TASK_NOT_RUNNING, "got %#x\n", hr);
|
||||
ok(hr == SCHED_E_TASK_NOT_RUNNING, "got %#lx\n", hr);
|
||||
|
||||
hr = ITask_GetStatus(task, &status);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(status == SCHED_S_TASK_NOT_SCHEDULED, "got %#x\n", status);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(status == SCHED_S_TASK_NOT_SCHEDULED, "got %#lx\n", status);
|
||||
|
||||
save_job(task);
|
||||
|
||||
hr = ITask_GetStatus(task, &status);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(status == SCHED_S_TASK_NOT_SCHEDULED, "got %#x\n", status);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(status == SCHED_S_TASK_NOT_SCHEDULED, "got %#lx\n", status);
|
||||
|
||||
hr = ITask_CreateTrigger(task, &idx, &trigger);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
memset(&trigger_data, 0, sizeof(trigger_data));
|
||||
trigger_data.cbTriggerSize = sizeof(trigger_data);
|
||||
|
@ -593,32 +593,32 @@ static void test_Run(void)
|
|||
trigger_data.Type.Weekly.WeeksInterval = 1;
|
||||
trigger_data.Type.Weekly.rgfDaysOfTheWeek = 0x7f; /* every day */
|
||||
hr = ITaskTrigger_SetTrigger(trigger, &trigger_data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ITaskTrigger_Release(trigger);
|
||||
|
||||
hr = ITask_SetApplicationName(task, cmdW);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
hr = ITask_SetParameters(task, empty);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
hr = ITask_SetWorkingDirectory(task, empty);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
/* Save the task so that the Scheduler service would notice the changes */
|
||||
save_job(task);
|
||||
|
||||
hr = ITask_GetStatus(task, &status);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(status == SCHED_S_TASK_HAS_NOT_RUN, "got %#x\n", status);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(status == SCHED_S_TASK_HAS_NOT_RUN, "got %#lx\n", status);
|
||||
|
||||
hr = ITask_Run(task);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
/* According to MSDN the task status doesn't update dynamically */
|
||||
hr = ITask_GetStatus(task, &status);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(status == SCHED_S_TASK_HAS_NOT_RUN, "got %#x\n", status);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(status == SCHED_S_TASK_HAS_NOT_RUN, "got %#lx\n", status);
|
||||
|
||||
ITask_Release(task);
|
||||
|
||||
|
@ -632,10 +632,10 @@ static void test_Run(void)
|
|||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
hr = ITaskScheduler_Activate(scheduler, wine_test_runW, &IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == S_OK, "Activate error %#x\n", hr);
|
||||
ok(hr == S_OK, "Activate error %#lx\n", hr);
|
||||
|
||||
hr = ITask_GetStatus(task, &status);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
ITask_Release(task);
|
||||
|
||||
|
@ -645,15 +645,15 @@ static void test_Run(void)
|
|||
}
|
||||
|
||||
hr = ITaskScheduler_Activate(scheduler, wine_test_runW, &IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == S_OK, "Activate error %#x\n", hr);
|
||||
ok(hr == S_OK, "Activate error %#lx\n", hr);
|
||||
|
||||
hr = ITask_GetStatus(task, &status);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
if (status == SCHED_S_TASK_RUNNING)
|
||||
{
|
||||
hr = ITask_Terminate(task);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
ITask_Release(task);
|
||||
|
||||
|
@ -667,10 +667,10 @@ static void test_Run(void)
|
|||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
hr = ITaskScheduler_Activate(scheduler, wine_test_runW, &IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == S_OK, "Activate error %#x\n", hr);
|
||||
ok(hr == S_OK, "Activate error %#lx\n", hr);
|
||||
|
||||
hr = ITask_GetStatus(task, &status);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
ITask_Release(task);
|
||||
|
||||
|
@ -683,7 +683,7 @@ static void test_Run(void)
|
|||
ITask_Release(task);
|
||||
|
||||
hr = taskscheduler_delete(scheduler, wine_test_runW);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
}
|
||||
|
||||
static void test_SetFlags(void)
|
||||
|
@ -694,31 +694,31 @@ static void test_SetFlags(void)
|
|||
|
||||
hr = ITaskScheduler_NewWorkItem(scheduler, task_name, &CLSID_CTask,
|
||||
&IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
hr = ITask_SetFlags(task, 0);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
flags = 0xdeadbeef;
|
||||
hr = ITask_GetFlags(task, &flags);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(flags == 0, "got %#x\n", flags);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(flags == 0, "got %#lx\n", flags);
|
||||
|
||||
hr = ITask_SetFlags(task, 0xffffffff);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
flags = 0xdeadbeef;
|
||||
hr = ITask_GetFlags(task, &flags);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(flags == 0x7fff, "got %#x\n", flags);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(flags == 0x7fff, "got %#lx\n", flags);
|
||||
|
||||
hr = ITask_SetFlags(task, 0x9234);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
flags = 0xdeadbeef;
|
||||
hr = ITask_GetFlags(task, &flags);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(flags == 0x1234, "got %#x\n", flags);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(flags == 0x1234, "got %#lx\n", flags);
|
||||
|
||||
ITask_Release(task);
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ static void test_workitem_data(void)
|
|||
|
||||
hr = ITaskScheduler_NewWorkItem(scheduler, task_name, &CLSID_CTask,
|
||||
&IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
if (0) /* crashes under Windows */
|
||||
hr = ITask_GetWorkItemData(task, &count, NULL);
|
||||
|
@ -743,35 +743,35 @@ static void test_workitem_data(void)
|
|||
count = 0xdead;
|
||||
data = (BYTE *)0xdeadbeef;
|
||||
hr = ITask_GetWorkItemData(task, &count, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(count == 0, "got %u\n", count);
|
||||
ok(data == NULL, "got %p\n", data);
|
||||
|
||||
hr = ITask_SetWorkItemData(task, sizeof(hello), NULL);
|
||||
ok(hr == E_INVALIDARG, "got %#x\n", hr);
|
||||
ok(hr == E_INVALIDARG, "got %#lx\n", hr);
|
||||
|
||||
hr = ITask_SetWorkItemData(task, 0, hello);
|
||||
ok(hr == E_INVALIDARG, "got %#x\n", hr);
|
||||
ok(hr == E_INVALIDARG, "got %#lx\n", hr);
|
||||
|
||||
hr = ITask_SetWorkItemData(task, sizeof(hello), hello);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
count = 0xdead;
|
||||
data = NULL;
|
||||
hr = ITask_GetWorkItemData(task, &count, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(count == sizeof(hello), "got %u\n", count);
|
||||
ok(data != NULL, "got NULL\n");
|
||||
ok(!memcmp(data, hello, sizeof(hello)), "data mismatch\n");
|
||||
CoTaskMemFree(data);
|
||||
|
||||
hr = ITask_SetWorkItemData(task, 0, NULL);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
count = 0xdead;
|
||||
data = (BYTE *)0xdeadbeef;
|
||||
hr = ITask_GetWorkItemData(task, &count, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(count == 0, "got %u\n", count);
|
||||
ok(data == NULL, "got %p\n", data);
|
||||
|
||||
|
@ -785,7 +785,7 @@ START_TEST(task)
|
|||
CoInitialize(NULL);
|
||||
hr = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_ITaskScheduler, (void **)&scheduler);
|
||||
ok(hr == S_OK, "failed to create task scheduler: %#x\n", hr);
|
||||
ok(hr == S_OK, "failed to create task scheduler: %#lx\n", hr);
|
||||
|
||||
test_SetApplicationName_GetApplicationName();
|
||||
test_CreateTrigger();
|
||||
|
|
|
@ -65,7 +65,7 @@ static void test_NewWorkItem(void)
|
|||
/* Create TaskScheduler */
|
||||
hres = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_ITaskScheduler, (void **) &test_task_scheduler);
|
||||
ok(hres == S_OK, "CTaskScheduler CoCreateInstance failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "CTaskScheduler CoCreateInstance failed: %08lx\n", hres);
|
||||
if (hres != S_OK)
|
||||
{
|
||||
skip("Failed to create task scheduler. Skipping tests.\n");
|
||||
|
@ -75,7 +75,7 @@ static void test_NewWorkItem(void)
|
|||
/* Test basic task creation */
|
||||
hres = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name,
|
||||
&CLSID_CTask, &IID_ITask, (IUnknown**)&task);
|
||||
ok(hres == S_OK, "NewNetworkItem failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "NewNetworkItem failed: %08lx\n", hres);
|
||||
if (hres == S_OK)
|
||||
ITask_Release(task);
|
||||
|
||||
|
@ -83,18 +83,18 @@ static void test_NewWorkItem(void)
|
|||
hres = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name,
|
||||
&GUID_BAD, &IID_ITask, (IUnknown**)&task);
|
||||
ok(hres == CLASS_E_CLASSNOTAVAILABLE,
|
||||
"Expected CLASS_E_CLASSNOTAVAILABLE: %08x\n", hres);
|
||||
"Expected CLASS_E_CLASSNOTAVAILABLE: %08lx\n", hres);
|
||||
|
||||
/* Task creation attempt using invalid interface ID */
|
||||
hres = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name,
|
||||
&CLSID_CTask, &GUID_BAD, (IUnknown**)&task);
|
||||
ok(hres == E_NOINTERFACE, "Expected E_NOINTERFACE: %08x\n", hres);
|
||||
ok(hres == E_NOINTERFACE, "Expected E_NOINTERFACE: %08lx\n", hres);
|
||||
|
||||
/* Task creation attempt using invalid work item class and interface ID */
|
||||
hres = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name,
|
||||
&GUID_BAD, &GUID_BAD, (IUnknown**)&task);
|
||||
ok(hres == CLASS_E_CLASSNOTAVAILABLE,
|
||||
"Expected CLASS_E_CLASSNOTAVAILABLE: %08x\n", hres);
|
||||
"Expected CLASS_E_CLASSNOTAVAILABLE: %08lx\n", hres);
|
||||
|
||||
ITaskScheduler_Release(test_task_scheduler);
|
||||
return;
|
||||
|
@ -110,7 +110,7 @@ static void test_Activate(void)
|
|||
/* Create TaskScheduler */
|
||||
hres = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_ITaskScheduler, (void **) &test_task_scheduler);
|
||||
ok(hres == S_OK, "CTaskScheduler CoCreateInstance failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "CTaskScheduler CoCreateInstance failed: %08lx\n", hres);
|
||||
if (hres != S_OK)
|
||||
{
|
||||
skip("Failed to create task scheduler. Skipping tests.\n");
|
||||
|
@ -120,7 +120,7 @@ static void test_Activate(void)
|
|||
/* Attempt to activate a nonexistent task */
|
||||
hres = ITaskScheduler_Activate(test_task_scheduler, not_task_name,
|
||||
&IID_ITask, (IUnknown**)&task);
|
||||
ok(hres == COR_E_FILENOTFOUND, "Expected COR_E_FILENOTFOUND: %08x\n", hres);
|
||||
ok(hres == COR_E_FILENOTFOUND, "Expected COR_E_FILENOTFOUND: %08lx\n", hres);
|
||||
|
||||
ITaskScheduler_Release(test_task_scheduler);
|
||||
return;
|
||||
|
@ -134,7 +134,7 @@ static void test_GetTargetComputer(void)
|
|||
/* Create TaskScheduler */
|
||||
hres = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_ITaskScheduler, (void **) &test_task_scheduler);
|
||||
ok(hres == S_OK, "CTaskScheduler CoCreateInstance failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "CTaskScheduler CoCreateInstance failed: %08lx\n", hres);
|
||||
if (hres != S_OK)
|
||||
{
|
||||
skip("Failed to create task scheduler.\n");
|
||||
|
@ -145,12 +145,12 @@ static void test_GetTargetComputer(void)
|
|||
{
|
||||
/* This crashes on w2k */
|
||||
hres = ITaskScheduler_GetTargetComputer(test_task_scheduler, NULL);
|
||||
ok(hres == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hres);
|
||||
ok(hres == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hres);
|
||||
}
|
||||
|
||||
hres = ITaskScheduler_GetTargetComputer(test_task_scheduler, &oldname);
|
||||
ok((hres == S_OK) && oldname && oldname[0] == '\\' && oldname[1] == '\\' && oldname[2],
|
||||
"got 0x%x and %s (expected S_OK and an unc name)\n", hres, wine_dbgstr_w(oldname));
|
||||
"got 0x%lx and %s (expected S_OK and an unc name)\n", hres, wine_dbgstr_w(oldname));
|
||||
|
||||
CoTaskMemFree(oldname);
|
||||
|
||||
|
@ -175,7 +175,7 @@ static void test_SetTargetComputer(void)
|
|||
/* Create TaskScheduler */
|
||||
hres = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_ITaskScheduler, (void **) &test_task_scheduler);
|
||||
ok(hres == S_OK, "CTaskScheduler CoCreateInstance failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "CTaskScheduler CoCreateInstance failed: %08lx\n", hres);
|
||||
if (hres != S_OK)
|
||||
{
|
||||
skip("Failed to create task scheduler. Skipping tests.\n");
|
||||
|
@ -183,24 +183,24 @@ static void test_SetTargetComputer(void)
|
|||
}
|
||||
|
||||
hres = ITaskScheduler_GetTargetComputer(test_task_scheduler, &oldname);
|
||||
ok(hres == S_OK, "got 0x%x and %s (expected S_OK)\n", hres, wine_dbgstr_w(oldname));
|
||||
ok(hres == S_OK, "got 0x%lx and %s (expected S_OK)\n", hres, wine_dbgstr_w(oldname));
|
||||
|
||||
/* NULL is an alias for the local computer */
|
||||
hres = ITaskScheduler_SetTargetComputer(test_task_scheduler, NULL);
|
||||
ok(hres == S_OK, "got 0x%x (expected S_OK)\n", hres);
|
||||
ok(hres == S_OK, "got 0x%lx (expected S_OK)\n", hres);
|
||||
hres = ITaskScheduler_GetTargetComputer(test_task_scheduler, &name);
|
||||
ok((hres == S_OK && !lstrcmpiW(name, buffer)),
|
||||
"got 0x%x with %s (expected S_OK and %s)\n",
|
||||
"got 0x%lx with %s (expected S_OK and %s)\n",
|
||||
hres, wine_dbgstr_w(name), wine_dbgstr_w(buffer));
|
||||
CoTaskMemFree(name);
|
||||
|
||||
/* The name must be valid */
|
||||
hres = ITaskScheduler_SetTargetComputer(test_task_scheduler, does_not_existW);
|
||||
ok(hres == HRESULT_FROM_WIN32(ERROR_BAD_NETPATH), "got 0x%x (expected 0x80070035)\n", hres);
|
||||
ok(hres == HRESULT_FROM_WIN32(ERROR_BAD_NETPATH), "got 0x%lx (expected 0x80070035)\n", hres);
|
||||
/* the name of the target computer is unchanged */
|
||||
hres = ITaskScheduler_GetTargetComputer(test_task_scheduler, &name);
|
||||
ok((hres == S_OK && !lstrcmpiW(name, buffer)),
|
||||
"got 0x%x with %s (expected S_OK and %s)\n",
|
||||
"got 0x%lx with %s (expected S_OK and %s)\n",
|
||||
hres, wine_dbgstr_w(name), wine_dbgstr_w(buffer));
|
||||
CoTaskMemFree(name);
|
||||
|
||||
|
@ -211,19 +211,19 @@ static void test_SetTargetComputer(void)
|
|||
skip("SetTargetComputer failed with E_ACCESSDENIED (needs admin rights)\n");
|
||||
goto done;
|
||||
}
|
||||
ok(hres == S_OK, "got 0x%x (expected S_OK)\n", hres);
|
||||
ok(hres == S_OK, "got 0x%lx (expected S_OK)\n", hres);
|
||||
|
||||
/* the case is ignored */
|
||||
CharUpperW(buffer);
|
||||
hres = ITaskScheduler_SetTargetComputer(test_task_scheduler, buffer);
|
||||
ok(hres == S_OK, "got 0x%x (expected S_OK)\n", hres);
|
||||
ok(hres == S_OK, "got 0x%lx (expected S_OK)\n", hres);
|
||||
CharLowerW(buffer);
|
||||
hres = ITaskScheduler_SetTargetComputer(test_task_scheduler, buffer);
|
||||
ok(hres == S_OK, "got 0x%x (expected S_OK)\n", hres);
|
||||
ok(hres == S_OK, "got 0x%lx (expected S_OK)\n", hres);
|
||||
|
||||
/* cleanup */
|
||||
hres = ITaskScheduler_SetTargetComputer(test_task_scheduler, oldname);
|
||||
ok(hres == S_OK, "got 0x%x (expected S_OK)\n", hres);
|
||||
ok(hres == S_OK, "got 0x%lx (expected S_OK)\n", hres);
|
||||
|
||||
done:
|
||||
CoTaskMemFree(oldname);
|
||||
|
@ -243,37 +243,37 @@ static void test_Enum(void)
|
|||
|
||||
hr = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_ITaskScheduler, (void **)&scheduler);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
/* cleanup after previous runs */
|
||||
taskscheduler_delete(scheduler, Task1);
|
||||
|
||||
hr = ITaskScheduler_NewWorkItem(scheduler, Task1, &CLSID_CTask, &IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
ITask_Release(task);
|
||||
|
||||
hr = ITaskScheduler_Enum(scheduler, NULL);
|
||||
ok(hr == E_INVALIDARG, "got %#x\n", hr);
|
||||
ok(hr == E_INVALIDARG, "got %#lx\n", hr);
|
||||
|
||||
hr = ITaskScheduler_Enum(scheduler, &tasks);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
names = (void *)0xdeadbeef;
|
||||
fetched = 0xdeadbeef;
|
||||
hr = IEnumWorkItems_Next(tasks, 0, &names, &fetched);
|
||||
ok(hr == E_INVALIDARG, "got %#x\n", hr);
|
||||
ok(hr == E_INVALIDARG, "got %#lx\n", hr);
|
||||
ok(names == (void *)0xdeadbeef, "got %p\n", names);
|
||||
ok(fetched == 0xdeadbeef, "got %#x\n", fetched);
|
||||
ok(fetched == 0xdeadbeef, "got %#lx\n", fetched);
|
||||
|
||||
hr = IEnumWorkItems_Next(tasks, 1, NULL, NULL);
|
||||
ok(hr == E_INVALIDARG, "got %#x\n", hr);
|
||||
ok(hr == E_INVALIDARG, "got %#lx\n", hr);
|
||||
|
||||
names = NULL;
|
||||
hr = IEnumWorkItems_Next(tasks, 1, &names, NULL);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(names != NULL, "got NULL\n");
|
||||
ok(names[0] != NULL, "got NULL\n");
|
||||
CoTaskMemFree(names[0]);
|
||||
|
@ -281,19 +281,19 @@ static void test_Enum(void)
|
|||
|
||||
names = (void *)0xdeadbeef;
|
||||
hr = IEnumWorkItems_Next(tasks, 2, &names, NULL);
|
||||
ok(hr == E_INVALIDARG, "got %#x\n", hr);
|
||||
ok(hr == E_INVALIDARG, "got %#lx\n", hr);
|
||||
ok(names == (void *)0xdeadbeef, "got %p\n", names);
|
||||
|
||||
hr = IEnumWorkItems_Reset(tasks);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
names = NULL;
|
||||
fetched = 0xdeadbeef;
|
||||
hr = IEnumWorkItems_Next(tasks, 1, &names, &fetched);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(names != NULL, "got NULL\n");
|
||||
ok(names[0] != NULL, "got NULL\n");
|
||||
ok(fetched == 1, "got %u\n", fetched);
|
||||
ok(fetched == 1, "got %lu\n", fetched);
|
||||
CoTaskMemFree(names[0]);
|
||||
CoTaskMemFree(names);
|
||||
|
||||
|
@ -301,19 +301,19 @@ static void test_Enum(void)
|
|||
/* do nothing*/;
|
||||
|
||||
hr = IEnumWorkItems_Skip(tasks, 1);
|
||||
ok(hr == S_FALSE, "got %#x\n", hr);
|
||||
ok(hr == S_FALSE, "got %#lx\n", hr);
|
||||
|
||||
names = (void *)0xdeadbeef;
|
||||
fetched = 0xdeadbeef;
|
||||
hr = IEnumWorkItems_Next(tasks, 1, &names, &fetched);
|
||||
ok(hr == S_FALSE, "got %#x\n", hr);
|
||||
ok(hr == S_FALSE, "got %#lx\n", hr);
|
||||
ok(names == NULL, "got %p\n", names);
|
||||
ok(fetched == 0, "got %u\n", fetched);
|
||||
ok(fetched == 0, "got %lu\n", fetched);
|
||||
|
||||
IEnumWorkItems_Release(tasks);
|
||||
|
||||
hr = taskscheduler_delete(scheduler, Task1);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
ITaskScheduler_Release(scheduler);
|
||||
}
|
||||
|
@ -330,31 +330,31 @@ static void test_save_task_curfile(ITask *task)
|
|||
WCHAR *curfile;
|
||||
|
||||
hr = ITask_QueryInterface(task, &IID_IPersistFile, (void **)&pfile);
|
||||
ok(hr == S_OK, "QueryInterface error %#x\n", hr);
|
||||
ok(hr == S_OK, "QueryInterface error %#lx\n", hr);
|
||||
|
||||
curfile = NULL;
|
||||
hr = IPersistFile_GetCurFile(pfile, &curfile);
|
||||
ok(hr == S_OK, "GetCurFile error %#x\n", hr);
|
||||
ok(hr == S_OK, "GetCurFile error %#lx\n", hr);
|
||||
ok(curfile && curfile[0], "curfile should not be NULL\n");
|
||||
|
||||
ok(file_exists(curfile), "curfile should exist\n");
|
||||
|
||||
hr = IPersistFile_Save(pfile, curfile, FALSE);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#x\n", hr);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#lx\n", hr);
|
||||
|
||||
hr = IPersistFile_Save(pfile, curfile, TRUE);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#x\n", hr);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#lx\n", hr);
|
||||
|
||||
hr = IPersistFile_Save(pfile, NULL, FALSE);
|
||||
ok(hr == S_OK, "Save error %#x\n", hr);
|
||||
ok(hr == S_OK, "Save error %#lx\n", hr);
|
||||
|
||||
hr = IPersistFile_Save(pfile, NULL, TRUE);
|
||||
ok(hr == S_OK, "Save error %#x\n", hr);
|
||||
ok(hr == S_OK, "Save error %#lx\n", hr);
|
||||
CoTaskMemFree(curfile);
|
||||
|
||||
curfile = NULL;
|
||||
hr = IPersistFile_GetCurFile(pfile, &curfile);
|
||||
ok(hr == S_OK, "GetCurFile error %#x\n", hr);
|
||||
ok(hr == S_OK, "GetCurFile error %#lx\n", hr);
|
||||
ok(curfile && curfile[0] , "curfile should not be NULL\n");
|
||||
CoTaskMemFree(curfile);
|
||||
|
||||
|
@ -369,27 +369,27 @@ static WCHAR *get_task_curfile(ITask *task, BOOL should_exist, BOOL is_dirty, in
|
|||
CLSID clsid;
|
||||
|
||||
hr = ITask_QueryInterface(task, &IID_IPersistFile, (void **)&pfile);
|
||||
ok_(__FILE__, line)(hr == S_OK, "QueryInterface error %#x\n", hr);
|
||||
ok_(__FILE__, line)(hr == S_OK, "QueryInterface error %#lx\n", hr);
|
||||
|
||||
hr = IPersistFile_IsDirty(pfile);
|
||||
ok_(__FILE__, line)(hr == is_dirty ? S_OK : S_FALSE, "got %#x\n", hr);
|
||||
ok_(__FILE__, line)(hr == is_dirty ? S_OK : S_FALSE, "got %#lx\n", hr);
|
||||
|
||||
curfile = NULL;
|
||||
hr = IPersistFile_GetCurFile(pfile, &curfile);
|
||||
ok_(__FILE__, line)(hr == S_OK, "GetCurFile error %#x\n", hr);
|
||||
ok_(__FILE__, line)(hr == S_OK, "GetCurFile error %#lx\n", hr);
|
||||
ok_(__FILE__, line)(curfile && curfile[0] , "curfile should not be NULL\n");
|
||||
|
||||
hr = IPersistFile_Load(pfile, curfile, STGM_READ);
|
||||
if (should_exist)
|
||||
ok_(__FILE__, line)(hr == S_OK, "Load error %#x\n", hr);
|
||||
ok_(__FILE__, line)(hr == S_OK, "Load error %#lx\n", hr);
|
||||
else
|
||||
ok_(__FILE__, line)(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "wrong error %#x\n", hr);
|
||||
ok_(__FILE__, line)(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "wrong error %#lx\n", hr);
|
||||
|
||||
if (0) /* crashes under Windows */
|
||||
hr = IPersistFile_GetClassID(pfile, NULL);
|
||||
|
||||
hr = IPersistFile_GetClassID(pfile, &clsid);
|
||||
ok_(__FILE__, line)(hr == S_OK, "GetClassID error %#x\n", hr);
|
||||
ok_(__FILE__, line)(hr == S_OK, "GetClassID error %#lx\n", hr);
|
||||
ok_(__FILE__, line)(IsEqualCLSID(&clsid, &CLSID_CTask), "got %s\n", wine_dbgstr_guid(&clsid));
|
||||
|
||||
IPersistFile_Release(pfile);
|
||||
|
@ -427,28 +427,28 @@ static void test_task_storage(void)
|
|||
hr = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskScheduler, (void **)&scheduler);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
win_skip("CoCreateInstance(CLSID_CTaskScheduler) error %#x\n", hr);
|
||||
win_skip("CoCreateInstance(CLSID_CTaskScheduler) error %#lx\n", hr);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = ITaskScheduler_Delete(scheduler, Task1_ext);
|
||||
ok(hr == E_INVALIDARG, "wrong error %#x\n", hr);
|
||||
ok(hr == E_INVALIDARG, "wrong error %#lx\n", hr);
|
||||
|
||||
hr = ITaskScheduler_Delete(scheduler, Task1);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "wrong error %#x\n", hr);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "wrong error %#lx\n", hr);
|
||||
|
||||
hr = ITaskScheduler_NewWorkItem(scheduler, Task1_ext, &CLSID_CTask, &IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == E_INVALIDARG, "wrong error %#x\n", hr);
|
||||
ok(hr == E_INVALIDARG, "wrong error %#lx\n", hr);
|
||||
|
||||
hr = ITaskScheduler_NewWorkItem(scheduler, Task1, &CLSID_CTask, &IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == S_OK, "NewWorkItem error %#x\n", hr);
|
||||
ok(hr == S_OK, "NewWorkItem error %#lx\n", hr);
|
||||
|
||||
curfile = get_task_curfile(task, FALSE, FALSE, __LINE__);
|
||||
ok(!file_exists(curfile), "curfile should not exist\n");
|
||||
ok(!lstrcmpW(curfile, task1_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile));
|
||||
|
||||
hr = ITask_SetComment(task, Task1);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
curfile2 = get_task_curfile(task, FALSE, TRUE, __LINE__);
|
||||
ok(!file_exists(curfile2), "curfile should not exist\n");
|
||||
|
@ -456,7 +456,7 @@ static void test_task_storage(void)
|
|||
CoTaskMemFree(curfile2);
|
||||
|
||||
hr = ITaskScheduler_NewWorkItem(scheduler, Task1, &CLSID_CTask, &IID_ITask, (IUnknown **)&task2);
|
||||
ok(hr == S_OK, "NewWorkItem error %#x\n", hr);
|
||||
ok(hr == S_OK, "NewWorkItem error %#lx\n", hr);
|
||||
ok(task2 != task, "tasks should not be equal\n");
|
||||
|
||||
curfile2 = get_task_curfile(task2, FALSE, FALSE, __LINE__);
|
||||
|
@ -469,32 +469,32 @@ static void test_task_storage(void)
|
|||
|
||||
task2 = (ITask *)0xdeadbeef;
|
||||
hr = ITaskScheduler_Activate(scheduler, Task1, &IID_ITask, (IUnknown **)&task2);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "wrong error %#x\n", hr);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "wrong error %#lx\n", hr);
|
||||
ok(task2 == (ITask *)0xdeadbeef, "task should not be set to NULL\n");
|
||||
|
||||
hr = ITaskScheduler_AddWorkItem(scheduler, Task2, (IScheduledWorkItem *)task);
|
||||
ok(hr == S_OK, "AddWorkItem error %#x\n", hr);
|
||||
ok(hr == S_OK, "AddWorkItem error %#lx\n", hr);
|
||||
curfile = get_task_curfile(task, TRUE, FALSE, __LINE__);
|
||||
ok(file_exists(curfile), "curfile should exist\n");
|
||||
ok(!lstrcmpW(curfile, task2_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile));
|
||||
CoTaskMemFree(curfile);
|
||||
|
||||
hr = ITaskScheduler_AddWorkItem(scheduler, Task3, (IScheduledWorkItem *)task);
|
||||
ok(hr == S_OK, "AddWorkItem error %#x\n", hr);
|
||||
ok(hr == S_OK, "AddWorkItem error %#lx\n", hr);
|
||||
curfile = get_task_curfile(task, TRUE, FALSE, __LINE__);
|
||||
ok(file_exists(curfile), "curfile should exist\n");
|
||||
ok(!lstrcmpW(curfile, task3_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile));
|
||||
CoTaskMemFree(curfile);
|
||||
|
||||
hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task);
|
||||
ok(hr == S_OK, "AddWorkItem error %#x\n", hr);
|
||||
ok(hr == S_OK, "AddWorkItem error %#lx\n", hr);
|
||||
curfile = get_task_curfile(task, TRUE, FALSE, __LINE__);
|
||||
ok(file_exists(curfile), "curfile should exist\n");
|
||||
ok(!lstrcmpW(curfile, task1_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile));
|
||||
CoTaskMemFree(curfile);
|
||||
|
||||
hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#x\n", hr);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#lx\n", hr);
|
||||
|
||||
curfile = get_task_curfile(task, TRUE, FALSE, __LINE__);
|
||||
ok(file_exists(curfile), "curfile should exist\n");
|
||||
|
@ -504,7 +504,7 @@ static void test_task_storage(void)
|
|||
|
||||
task = NULL;
|
||||
hr = ITaskScheduler_Activate(scheduler, Task1, &IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == S_OK, "Activate error %#x\n", hr);
|
||||
ok(hr == S_OK, "Activate error %#lx\n", hr);
|
||||
ok(task != NULL, "task should not be set to NULL\n");
|
||||
|
||||
curfile = get_task_curfile(task, TRUE, FALSE, __LINE__);
|
||||
|
@ -516,11 +516,11 @@ static void test_task_storage(void)
|
|||
test_save_task_curfile(task);
|
||||
|
||||
hr = taskscheduler_delete(scheduler, Task1);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
hr = taskscheduler_delete(scheduler, Task2);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
hr = taskscheduler_delete(scheduler, Task3);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
ITask_Release(task);
|
||||
ITaskScheduler_Release(scheduler);
|
||||
|
|
|
@ -79,15 +79,15 @@ static BOOL compare_trigger_state(TASK_TRIGGER found_state,
|
|||
found_state.wStartMinute, expected_state.wStartMinute);
|
||||
|
||||
ok(found_state.MinutesDuration == expected_state.MinutesDuration,
|
||||
"MinutesDuration: Found %d but expected %d\n",
|
||||
"MinutesDuration: Found %ld but expected %ld\n",
|
||||
found_state.MinutesDuration, expected_state.MinutesDuration);
|
||||
|
||||
ok(found_state.MinutesInterval == expected_state.MinutesInterval,
|
||||
"MinutesInterval: Found %d but expected %d\n",
|
||||
"MinutesInterval: Found %ld but expected %ld\n",
|
||||
found_state.MinutesInterval, expected_state.MinutesInterval);
|
||||
|
||||
ok(found_state.rgFlags == expected_state.rgFlags,
|
||||
"rgFlags: Found %d but expected %d\n",
|
||||
"rgFlags: Found %ld but expected %ld\n",
|
||||
found_state.rgFlags, expected_state.rgFlags);
|
||||
|
||||
ok(found_state.TriggerType == expected_state.TriggerType,
|
||||
|
@ -138,16 +138,16 @@ static void test_SetTrigger_GetTrigger(void)
|
|||
|
||||
hres = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name, &CLSID_CTask,
|
||||
&IID_ITask, (IUnknown **)&test_task);
|
||||
ok(hres == S_OK, "got %#x\n", hres);
|
||||
ok(hres == S_OK, "got %#lx\n", hres);
|
||||
|
||||
hres = ITask_CreateTrigger(test_task, &idx, &test_trigger);
|
||||
ok(hres == S_OK, "got %#x\n", hres);
|
||||
ok(hres == S_OK, "got %#lx\n", hres);
|
||||
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, NULL);
|
||||
ok(hres == E_INVALIDARG, "got %#x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "got %#lx\n", hres);
|
||||
|
||||
hres = ITaskTrigger_GetTrigger(test_trigger, NULL);
|
||||
ok(hres == E_INVALIDARG, "got %#x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "got %#lx\n", hres);
|
||||
|
||||
/* Setup a trigger with base values for this test run */
|
||||
GetLocalTime(&time);
|
||||
|
@ -161,12 +161,12 @@ static void test_SetTrigger_GetTrigger(void)
|
|||
memset(&trigger_state, 0xcf, sizeof(trigger_state));
|
||||
trigger_state.cbTriggerSize = sizeof(trigger_state);
|
||||
hres = ITaskTrigger_GetTrigger(test_trigger, &trigger_state);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08lx\n", hres);
|
||||
compare_trigger_state(trigger_state, empty_trigger_state);
|
||||
|
||||
/* Test setting basic empty trigger */
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &empty_trigger_state);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08lx\n", hres);
|
||||
memset(&trigger_state, 0xcf, sizeof(trigger_state));
|
||||
trigger_state.cbTriggerSize = sizeof(trigger_state);
|
||||
hres = ITaskTrigger_GetTrigger(test_trigger, &trigger_state);
|
||||
|
@ -175,7 +175,7 @@ static void test_SetTrigger_GetTrigger(void)
|
|||
|
||||
/* Test setting basic non-empty trigger */
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08lx\n", hres);
|
||||
memset(&trigger_state, 0xcf, sizeof(trigger_state));
|
||||
trigger_state.cbTriggerSize = sizeof(trigger_state);
|
||||
hres = ITaskTrigger_GetTrigger(test_trigger, &trigger_state);
|
||||
|
@ -190,21 +190,21 @@ static void test_SetTrigger_GetTrigger(void)
|
|||
/* Test setting trigger with invalid cbTriggerSize */
|
||||
normal_trigger_state.cbTriggerSize = sizeof(trigger_state) - 1;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.cbTriggerSize = sizeof(trigger_state) + 1;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.cbTriggerSize = sizeof(trigger_state);
|
||||
|
||||
/* Test setting trigger with invalid Reserved fields */
|
||||
normal_trigger_state.Reserved1 = 80;
|
||||
normal_trigger_state.Reserved2 = 80;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08lx\n", hres);
|
||||
memset(&trigger_state, 0xcf, sizeof(trigger_state));
|
||||
trigger_state.cbTriggerSize = sizeof(trigger_state);
|
||||
hres = ITaskTrigger_GetTrigger(test_trigger, &trigger_state);
|
||||
ok(hres == S_OK, "Expected S_OK: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Expected S_OK: 0x%08lx\n", hres);
|
||||
ok(trigger_state.Reserved1 == 0 && trigger_state.Reserved2 == 0,
|
||||
"Reserved fields should be set to zero\n");
|
||||
normal_trigger_state.Reserved1 = 0;
|
||||
|
@ -213,23 +213,23 @@ static void test_SetTrigger_GetTrigger(void)
|
|||
/* Test setting trigger with invalid month */
|
||||
normal_trigger_state.wBeginMonth = 0;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.wBeginMonth = 13;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.wBeginMonth = 1;
|
||||
|
||||
/* Test setting trigger with invalid begin date */
|
||||
normal_trigger_state.wBeginDay = 0;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.wBeginDay = 32;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.wBeginMonth = 2;
|
||||
normal_trigger_state.wBeginDay = 30;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.wBeginMonth = 1;
|
||||
normal_trigger_state.wBeginDay = 1;
|
||||
|
||||
|
@ -238,11 +238,11 @@ static void test_SetTrigger_GetTrigger(void)
|
|||
normal_trigger_state.wEndMonth = 200;
|
||||
normal_trigger_state.wEndDay = 200;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08lx\n", hres);
|
||||
memset(&trigger_state, 0xcf, sizeof(trigger_state));
|
||||
trigger_state.cbTriggerSize = sizeof(trigger_state);
|
||||
hres = ITaskTrigger_GetTrigger(test_trigger, &trigger_state);
|
||||
ok(hres == S_OK, "Expected S_OK: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Expected S_OK: 0x%08lx\n", hres);
|
||||
ok(trigger_state.wEndYear == 0, "End year should be 0: %d\n",
|
||||
trigger_state.wEndYear);
|
||||
ok(trigger_state.wEndMonth == 200, "End month should be 200: %d\n",
|
||||
|
@ -252,7 +252,7 @@ static void test_SetTrigger_GetTrigger(void)
|
|||
normal_trigger_state.rgFlags =
|
||||
TASK_TRIGGER_FLAG_DISABLED | TASK_TRIGGER_FLAG_HAS_END_DATE;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.rgFlags = TASK_TRIGGER_FLAG_DISABLED;
|
||||
normal_trigger_state.wEndYear = 2980;
|
||||
normal_trigger_state.wEndMonth = 1;
|
||||
|
@ -261,40 +261,40 @@ static void test_SetTrigger_GetTrigger(void)
|
|||
/* Test setting trigger with invalid hour or minute*/
|
||||
normal_trigger_state.wStartHour = 24;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.wStartHour = 60;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.wStartHour = 3;
|
||||
|
||||
/* Test setting trigger with invalid duration / interval pairs */
|
||||
normal_trigger_state.MinutesDuration = 5;
|
||||
normal_trigger_state.MinutesInterval = 5;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.MinutesDuration = 5;
|
||||
normal_trigger_state.MinutesInterval = 6;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.MinutesDuration = 0;
|
||||
normal_trigger_state.MinutesInterval = 6;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
|
||||
ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08lx\n", hres);
|
||||
normal_trigger_state.MinutesDuration = 5;
|
||||
normal_trigger_state.MinutesInterval = 0;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08lx\n", hres);
|
||||
normal_trigger_state.MinutesDuration = 0;
|
||||
normal_trigger_state.MinutesInterval = 0;
|
||||
|
||||
/* Test setting trigger with end date before start date */
|
||||
normal_trigger_state.wEndYear = 1979;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08lx\n", hres);
|
||||
normal_trigger_state.rgFlags =
|
||||
TASK_TRIGGER_FLAG_DISABLED | TASK_TRIGGER_FLAG_HAS_END_DATE;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08lx\n", hres);
|
||||
normal_trigger_state.rgFlags = TASK_TRIGGER_FLAG_DISABLED;
|
||||
normal_trigger_state.wEndYear = 2980;
|
||||
normal_trigger_state.wEndMonth = 1;
|
||||
|
@ -306,11 +306,11 @@ static void test_SetTrigger_GetTrigger(void)
|
|||
normal_trigger_state.Type.Weekly.WeeksInterval = 2;
|
||||
normal_trigger_state.Type.Weekly.rgfDaysOfTheWeek = (TASK_MONDAY | TASK_TUESDAY);
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08lx\n", hres);
|
||||
memset(&trigger_state, 0xcf, sizeof(trigger_state));
|
||||
trigger_state.cbTriggerSize = sizeof(trigger_state);
|
||||
hres = ITaskTrigger_GetTrigger(test_trigger, &trigger_state);
|
||||
ok(hres == S_OK, "Expected S_OK: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Expected S_OK: 0x%08lx\n", hres);
|
||||
ok(trigger_state.Type.Weekly.WeeksInterval == 0xcfcf,
|
||||
"Expected WeeksInterval set remain untouched: %d\n",
|
||||
trigger_state.Type.Weekly.WeeksInterval);
|
||||
|
@ -320,16 +320,16 @@ static void test_SetTrigger_GetTrigger(void)
|
|||
normal_trigger_state.TriggerType = TASK_TIME_TRIGGER_DAILY;
|
||||
normal_trigger_state.Type.Daily.DaysInterval = 1;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == S_OK, "Expected S_OK: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Expected S_OK: 0x%08lx\n", hres);
|
||||
|
||||
/* Test setting trigger with set wRandomMinutesInterval */
|
||||
normal_trigger_state.wRandomMinutesInterval = 5;
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08lx\n", hres);
|
||||
memset(&trigger_state, 0xcf, sizeof(trigger_state));
|
||||
trigger_state.cbTriggerSize = sizeof(trigger_state);
|
||||
hres = ITaskTrigger_GetTrigger(test_trigger, &trigger_state);
|
||||
ok(hres == S_OK, "Expected S_OK: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Expected S_OK: 0x%08lx\n", hres);
|
||||
ok(trigger_state.wRandomMinutesInterval == 0,
|
||||
"wRandomMinutesInterval should be set to zero\n");
|
||||
normal_trigger_state.wRandomMinutesInterval = 0;
|
||||
|
@ -337,7 +337,7 @@ static void test_SetTrigger_GetTrigger(void)
|
|||
/* Test GetTrigger using invalid cbTriggerSiz in pTrigger. In
|
||||
* contrast to available documentation, this succeeds in practice. */
|
||||
hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set trigger: 0x%08lx\n", hres);
|
||||
memset(&trigger_state, 0xcf, sizeof(trigger_state));
|
||||
trigger_state.cbTriggerSize = sizeof(trigger_state) - 1;
|
||||
hres = ITaskTrigger_GetTrigger(test_trigger, &trigger_state);
|
||||
|
@ -366,60 +366,60 @@ static void test_task_trigger(void)
|
|||
|
||||
hr = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name, &CLSID_CTask,
|
||||
&IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
count = 0xdead;
|
||||
hr = ITask_GetTriggerCount(task, &count);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(count == 0, "got %u\n", count);
|
||||
|
||||
hr = ITask_DeleteTrigger(task, 0);
|
||||
ok(hr == SCHED_E_TRIGGER_NOT_FOUND, "got %#x\n", hr);
|
||||
ok(hr == SCHED_E_TRIGGER_NOT_FOUND, "got %#lx\n", hr);
|
||||
|
||||
hr = ITask_GetTrigger(task, 0, &trigger);
|
||||
ok(hr == SCHED_E_TRIGGER_NOT_FOUND, "got %#x\n", hr);
|
||||
ok(hr == SCHED_E_TRIGGER_NOT_FOUND, "got %#lx\n", hr);
|
||||
|
||||
idx = 0xdead;
|
||||
hr = ITask_CreateTrigger(task, &idx, &trigger);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(idx == 0, "got %u\n", idx);
|
||||
|
||||
hr = ITask_GetTrigger(task, 0, &trigger2);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(trigger != trigger2, "%p != %p\n", trigger, trigger2);
|
||||
|
||||
ref = ITaskTrigger_Release(trigger2);
|
||||
ok(ref == 0, "got %u\n", ref);
|
||||
ok(ref == 0, "got %lu\n", ref);
|
||||
|
||||
ref = ITaskTrigger_Release(trigger);
|
||||
ok(ref == 0, "got %u\n", ref);
|
||||
ok(ref == 0, "got %lu\n", ref);
|
||||
|
||||
count = 0xdead;
|
||||
hr = ITask_GetTriggerCount(task, &count);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(count == 1, "got %u\n", count);
|
||||
|
||||
hr = ITask_DeleteTrigger(task, 0);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
idx = 0xdead;
|
||||
hr = ITask_CreateTrigger(task, &idx, &trigger);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(idx == 0, "got %u\n", idx);
|
||||
|
||||
hr = ITask_DeleteTrigger(task, 0);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
count = 0xdead;
|
||||
hr = ITask_GetTriggerCount(task, &count);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(count == 0, "got %u\n", count);
|
||||
|
||||
ref = ITaskTrigger_Release(trigger);
|
||||
ok(ref == 0, "got %u\n", ref);
|
||||
ok(ref == 0, "got %lu\n", ref);
|
||||
|
||||
ref = ITask_Release(task);
|
||||
ok(ref == 0, "got %u\n", ref);
|
||||
ok(ref == 0, "got %lu\n", ref);
|
||||
}
|
||||
|
||||
static void time_add_ms(SYSTEMTIME *st, DWORD ms)
|
||||
|
@ -435,11 +435,11 @@ static void time_add_ms(SYSTEMTIME *st, DWORD ms)
|
|||
st->wDay, st->wMonth, st->wYear, st->wDayOfWeek,
|
||||
st->wHour, st->wMinute, st->wSecond, st->wMilliseconds);
|
||||
ret = SystemTimeToFileTime(st, &ftll.ft);
|
||||
ok(ret, "SystemTimeToFileTime error %u\n", GetLastError());
|
||||
ok(ret, "SystemTimeToFileTime error %lu\n", GetLastError());
|
||||
|
||||
ftll.ll += ms * (ULONGLONG)10000;
|
||||
ret = FileTimeToSystemTime(&ftll.ft, st);
|
||||
ok(ret, "FileTimeToSystemTime error %u\n", GetLastError());
|
||||
ok(ret, "FileTimeToSystemTime error %lu\n", GetLastError());
|
||||
trace("new: %u/%u/%u wday %u %u:%02u:%02u.%03u\n",
|
||||
st->wDay, st->wMonth, st->wYear, st->wDayOfWeek,
|
||||
st->wHour, st->wMinute, st->wSecond, st->wMilliseconds);
|
||||
|
@ -482,37 +482,37 @@ static void test_GetNextRunTime(void)
|
|||
|
||||
hr = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name, &CLSID_CTask,
|
||||
&IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
if (0) /* crashes under Windows */
|
||||
hr = ITask_GetNextRunTime(task, NULL);
|
||||
|
||||
hr = ITask_SetFlags(task, TASK_FLAG_DISABLED);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
memset(&st, 0xff, sizeof(st));
|
||||
hr = ITask_GetNextRunTime(task, &st);
|
||||
ok(hr == SCHED_S_TASK_DISABLED, "got %#x\n", hr);
|
||||
ok(hr == SCHED_S_TASK_DISABLED, "got %#lx\n", hr);
|
||||
ok(!memcmp(&st, &st_empty, sizeof(st)), "got %u/%u/%u wday %u %u:%02u:%02u\n",
|
||||
st.wDay, st.wMonth, st.wYear, st.wDayOfWeek,
|
||||
st.wHour, st.wMinute, st.wSecond);
|
||||
|
||||
hr = ITask_SetFlags(task, 0);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
memset(&st, 0xff, sizeof(st));
|
||||
hr = ITask_GetNextRunTime(task, &st);
|
||||
ok(hr == SCHED_S_TASK_NO_VALID_TRIGGERS, "got %#x\n", hr);
|
||||
ok(hr == SCHED_S_TASK_NO_VALID_TRIGGERS, "got %#lx\n", hr);
|
||||
ok(!memcmp(&st, &st_empty, sizeof(st)), "got %u/%u/%u wday %u %u:%02u:%02u\n",
|
||||
st.wDay, st.wMonth, st.wYear, st.wDayOfWeek,
|
||||
st.wHour, st.wMinute, st.wSecond);
|
||||
|
||||
hr = ITask_CreateTrigger(task, &idx, &trigger);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
memset(&st, 0xff, sizeof(st));
|
||||
hr = ITask_GetNextRunTime(task, &st);
|
||||
ok(hr == SCHED_S_TASK_NO_VALID_TRIGGERS, "got %#x\n", hr);
|
||||
ok(hr == SCHED_S_TASK_NO_VALID_TRIGGERS, "got %#lx\n", hr);
|
||||
ok(!memcmp(&st, &st_empty, sizeof(st)), "got %u/%u/%u wday %u %u:%02u:%02u\n",
|
||||
st.wDay, st.wMonth, st.wYear, st.wDayOfWeek,
|
||||
st.wHour, st.wMinute, st.wSecond);
|
||||
|
@ -520,17 +520,17 @@ static void test_GetNextRunTime(void)
|
|||
/* TASK_TIME_TRIGGER_ONCE */
|
||||
|
||||
hr = ITaskTrigger_GetTrigger(trigger, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
data.rgFlags &= ~TASK_TRIGGER_FLAG_DISABLED;
|
||||
data.TriggerType = TASK_TIME_TRIGGER_ONCE;
|
||||
/* add 5 minutes to avoid races */
|
||||
trigger_add_ms(&data, 5 * 60 * 1000, &cmp);
|
||||
hr = ITaskTrigger_SetTrigger(trigger, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
memset(&st, 0xff, sizeof(st));
|
||||
hr = ITask_GetNextRunTime(task, &st);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(!memcmp(&st, &cmp, sizeof(st)), "got %u/%u/%u wday %u %u:%02u:%02u\n",
|
||||
st.wDay, st.wMonth, st.wYear, st.wDayOfWeek,
|
||||
st.wHour, st.wMinute, st.wSecond);
|
||||
|
@ -538,16 +538,16 @@ static void test_GetNextRunTime(void)
|
|||
/* TASK_TIME_TRIGGER_DAILY */
|
||||
|
||||
hr = ITaskTrigger_GetTrigger(trigger, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
data.rgFlags &= ~TASK_TRIGGER_FLAG_DISABLED;
|
||||
data.TriggerType = TASK_TIME_TRIGGER_DAILY;
|
||||
data.Type.Daily.DaysInterval = 1;
|
||||
hr = ITaskTrigger_SetTrigger(trigger, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
memset(&st, 0xff, sizeof(st));
|
||||
hr = ITask_GetNextRunTime(task, &st);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(!memcmp(&st, &cmp, sizeof(st)), "got %u/%u/%u wday %u %u:%02u:%02u\n",
|
||||
st.wDay, st.wMonth, st.wYear, st.wDayOfWeek,
|
||||
st.wHour, st.wMinute, st.wSecond);
|
||||
|
@ -555,7 +555,7 @@ static void test_GetNextRunTime(void)
|
|||
/* TASK_TIME_TRIGGER_WEEKLY */
|
||||
|
||||
hr = ITaskTrigger_GetTrigger(trigger, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
data.rgFlags &= ~TASK_TRIGGER_FLAG_DISABLED;
|
||||
data.TriggerType = TASK_TIME_TRIGGER_WEEKLY;
|
||||
data.Type.Weekly.WeeksInterval = 1;
|
||||
|
@ -564,11 +564,11 @@ static void test_GetNextRunTime(void)
|
|||
/* bits: TASK_SUNDAY = 1, TASK_MONDAY = 2, TASK_TUESDAY = 4, etc. */
|
||||
data.Type.Weekly.rgfDaysOfTheWeek = 1 << cmp.wDayOfWeek; /* wDayOfWeek is 0 based */
|
||||
hr = ITaskTrigger_SetTrigger(trigger, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
memset(&st, 0xff, sizeof(st));
|
||||
hr = ITask_GetNextRunTime(task, &st);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(!memcmp(&st, &cmp, sizeof(st)), "got %u/%u/%u wday %u %u:%02u:%02u\n",
|
||||
st.wDay, st.wMonth, st.wYear, st.wDayOfWeek,
|
||||
st.wHour, st.wMinute, st.wSecond);
|
||||
|
@ -581,7 +581,7 @@ static void test_GetNextRunTime(void)
|
|||
|
||||
idx = 0xdead;
|
||||
hr = ITask_CreateTrigger(task, &idx, &trigger);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(idx == 1, "got %u\n", idx);
|
||||
|
||||
/* TASK_EVENT_TRIGGER_ON_IDLE = 5
|
||||
|
@ -591,15 +591,15 @@ static void test_GetNextRunTime(void)
|
|||
for (i = 5; i <= 7; i++)
|
||||
{
|
||||
hr = ITaskTrigger_GetTrigger(trigger, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
data.rgFlags &= ~TASK_TRIGGER_FLAG_DISABLED;
|
||||
data.TriggerType = i;
|
||||
hr = ITaskTrigger_SetTrigger(trigger, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
memset(&st, 0xff, sizeof(st));
|
||||
hr = ITask_GetNextRunTime(task, &st);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(!memcmp(&st, &cmp, sizeof(st)), "got %u/%u/%u wday %u %u:%02u:%02u\n",
|
||||
st.wDay, st.wMonth, st.wYear, st.wDayOfWeek,
|
||||
st.wHour, st.wMinute, st.wSecond);
|
||||
|
@ -608,23 +608,23 @@ static void test_GetNextRunTime(void)
|
|||
ITaskTrigger_Release(trigger);
|
||||
|
||||
hr = ITask_DeleteTrigger(task, 0);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
hr = ITask_GetTrigger(task, 0, &trigger);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
for (i = 5; i <= 7; i++)
|
||||
{
|
||||
hr = ITaskTrigger_GetTrigger(trigger, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
data.rgFlags &= ~TASK_TRIGGER_FLAG_DISABLED;
|
||||
data.TriggerType = i;
|
||||
hr = ITaskTrigger_SetTrigger(trigger, &data);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
memset(&st, 0xff, sizeof(st));
|
||||
hr = ITask_GetNextRunTime(task, &st);
|
||||
ok(hr == SCHED_S_EVENT_TRIGGER, "got %#x\n", hr);
|
||||
ok(hr == SCHED_S_EVENT_TRIGGER, "got %#lx\n", hr);
|
||||
ok(!memcmp(&st, &st_empty, sizeof(st)), "got %u/%u/%u wday %u %u:%02u:%02u\n",
|
||||
st.wDay, st.wMonth, st.wYear, st.wDayOfWeek,
|
||||
st.wHour, st.wMinute, st.wSecond);
|
||||
|
@ -661,111 +661,111 @@ static void test_trigger_manager(void)
|
|||
|
||||
hr = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name, &CLSID_CTask,
|
||||
&IID_ITask, (IUnknown **)&task);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(obj_refcount(task) == 1, "got %u\n", obj_refcount(task));
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(obj_refcount(task) == 1, "got %lu\n", obj_refcount(task));
|
||||
|
||||
count = 0xdead;
|
||||
hr = ITask_GetTriggerCount(task, &count);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(count == 0, "got %u\n", count);
|
||||
|
||||
idx = 0xdead;
|
||||
hr = ITask_CreateTrigger(task, &idx, &trigger0);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(idx == 0, "got %u\n", idx);
|
||||
ok(obj_refcount(task) == 2, "got %u\n", obj_refcount(task));
|
||||
ok(obj_refcount(task) == 2, "got %lu\n", obj_refcount(task));
|
||||
|
||||
idx = 0xdead;
|
||||
hr = ITask_CreateTrigger(task, &idx, &trigger1);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(idx == 1, "got %u\n", idx);
|
||||
ok(obj_refcount(task) == 3, "got %u\n", obj_refcount(task));
|
||||
ok(obj_refcount(task) == 3, "got %lu\n", obj_refcount(task));
|
||||
|
||||
count = 0xdead;
|
||||
hr = ITask_GetTriggerCount(task, &count);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(count == 2, "got %u\n", count);
|
||||
|
||||
hr = ITaskTrigger_GetTrigger(trigger0, &state0);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
state0.wBeginYear = 3000;
|
||||
state0.rgFlags = 0;
|
||||
state0.TriggerType = TASK_TIME_TRIGGER_ONCE;
|
||||
hr = ITaskTrigger_SetTrigger(trigger0, &state0);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
hr = get_task_trigger(task, 0, &state);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(state.wBeginYear == 3000, "got %u\n", state.wBeginYear);
|
||||
ok(state.TriggerType == TASK_TIME_TRIGGER_ONCE, "got %u\n", state.TriggerType);
|
||||
|
||||
hr = ITaskTrigger_GetTrigger(trigger1, &state1);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
state1.wBeginYear = 2000;
|
||||
state1.rgFlags = 0;
|
||||
state1.TriggerType = TASK_TIME_TRIGGER_DAILY;
|
||||
hr = ITaskTrigger_SetTrigger(trigger1, &state1);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
hr = get_task_trigger(task, 1, &state);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(state.wBeginYear == 2000, "got %u\n", state.wBeginYear);
|
||||
ok(state.TriggerType == TASK_TIME_TRIGGER_DAILY, "got %u\n", state.TriggerType);
|
||||
|
||||
ref = ITaskTrigger_Release(trigger0);
|
||||
ok(ref == 0, "got %u\n", ref);
|
||||
ok(ref == 0, "got %lu\n", ref);
|
||||
ref = ITaskTrigger_Release(trigger1);
|
||||
ok(ref == 0, "got %u\n", ref);
|
||||
ok(ref == 0, "got %lu\n", ref);
|
||||
|
||||
ok(obj_refcount(task) == 1, "got %u\n", obj_refcount(task));
|
||||
ok(obj_refcount(task) == 1, "got %lu\n", obj_refcount(task));
|
||||
|
||||
hr = get_task_trigger(task, 0, &state);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(state.wBeginYear == 3000, "got %u\n", state.wBeginYear);
|
||||
ok(state.TriggerType == TASK_TIME_TRIGGER_ONCE, "got %u\n", state.TriggerType);
|
||||
|
||||
hr = get_task_trigger(task, 1, &state);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(state.wBeginYear == 2000, "got %u\n", state.wBeginYear);
|
||||
ok(state.TriggerType == TASK_TIME_TRIGGER_DAILY, "got %u\n", state.TriggerType);
|
||||
|
||||
hr = ITask_GetTrigger(task, 0, &trigger0);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
hr = ITask_GetTrigger(task, 1, &trigger1);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
hr = ITask_DeleteTrigger(task, 0);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
hr = get_task_trigger(task, 0, &state);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(state.wBeginYear == 2000, "got %u\n", state.wBeginYear);
|
||||
ok(state.TriggerType == TASK_TIME_TRIGGER_DAILY, "got %u\n", state.TriggerType);
|
||||
|
||||
hr = get_task_trigger(task, 1, &state);
|
||||
ok(hr == SCHED_E_TRIGGER_NOT_FOUND, "got %#x\n", hr);
|
||||
ok(hr == SCHED_E_TRIGGER_NOT_FOUND, "got %#lx\n", hr);
|
||||
|
||||
hr = ITaskTrigger_SetTrigger(trigger0, &state0);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
hr = ITaskTrigger_SetTrigger(trigger1, &state1);
|
||||
ok(hr == E_FAIL, "got %#x\n", hr);
|
||||
ok(hr == E_FAIL, "got %#lx\n", hr);
|
||||
|
||||
count = 0xdead;
|
||||
hr = ITask_GetTriggerCount(task, &count);
|
||||
ok(hr == S_OK, "got %#x\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(count == 1, "got %u\n", count);
|
||||
|
||||
ok(obj_refcount(task) == 3, "got %u\n", obj_refcount(task));
|
||||
ok(obj_refcount(task) == 3, "got %lu\n", obj_refcount(task));
|
||||
|
||||
ref = ITaskTrigger_Release(trigger0);
|
||||
ok(ref == 0, "got %u\n", ref);
|
||||
ok(ref == 0, "got %lu\n", ref);
|
||||
|
||||
ref = ITaskTrigger_Release(trigger1);
|
||||
ok(ref == 0, "got %u\n", ref);
|
||||
ok(ref == 0, "got %lu\n", ref);
|
||||
|
||||
ref = ITask_Release(task);
|
||||
ok(ref == 0, "got %u\n", ref);
|
||||
ok(ref == 0, "got %lu\n", ref);
|
||||
}
|
||||
|
||||
START_TEST(task_trigger)
|
||||
|
@ -776,7 +776,7 @@ START_TEST(task_trigger)
|
|||
|
||||
hr = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_ITaskScheduler, (void **)&test_task_scheduler);
|
||||
ok(hr == S_OK, "error creating TaskScheduler instance %#x\n", hr);
|
||||
ok(hr == S_OK, "error creating TaskScheduler instance %#lx\n", hr);
|
||||
|
||||
test_SetTrigger_GetTrigger();
|
||||
test_task_trigger();
|
||||
|
|
Loading…
Reference in New Issue