mstask: Implemented (Set|Get)MaxRunTime.
This commit is contained in:
parent
37708b1e5c
commit
a597d9eaed
|
@ -61,6 +61,7 @@ typedef struct
|
|||
LPWSTR applicationName;
|
||||
LPWSTR parameters;
|
||||
LPWSTR comment;
|
||||
DWORD maxRunTime;
|
||||
} TaskImpl;
|
||||
extern HRESULT TaskConstructor(LPCWSTR pwszTaskName, LPVOID *ppObj);
|
||||
|
||||
|
|
|
@ -540,16 +540,24 @@ static HRESULT WINAPI MSTASK_ITask_SetMaxRunTime(
|
|||
ITask* iface,
|
||||
DWORD dwMaxRunTime)
|
||||
{
|
||||
FIXME("(%p, %d): stub\n", iface, dwMaxRunTime);
|
||||
return E_NOTIMPL;
|
||||
TaskImpl *This = (TaskImpl *)iface;
|
||||
|
||||
TRACE("(%p, %d)\n", iface, dwMaxRunTime);
|
||||
|
||||
This->maxRunTime = dwMaxRunTime;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI MSTASK_ITask_GetMaxRunTime(
|
||||
ITask* iface,
|
||||
DWORD *pdwMaxRunTime)
|
||||
{
|
||||
FIXME("(%p, %p): stub\n", iface, pdwMaxRunTime);
|
||||
return E_NOTIMPL;
|
||||
TaskImpl *This = (TaskImpl *)iface;
|
||||
|
||||
TRACE("(%p, %p)\n", iface, pdwMaxRunTime);
|
||||
|
||||
*pdwMaxRunTime = This->maxRunTime;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI MSTASK_IPersistFile_QueryInterface(
|
||||
|
@ -721,6 +729,9 @@ HRESULT TaskConstructor(LPCWSTR pwszTaskName, LPVOID *ppObj)
|
|||
This->parameters = NULL;
|
||||
This->comment = NULL;
|
||||
|
||||
/* Default time is 3 days = 259200000 ms */
|
||||
This->maxRunTime = 259200000;
|
||||
|
||||
*ppObj = &This->lpVtbl;
|
||||
InterlockedIncrement(&dll_ref);
|
||||
return S_OK;
|
||||
|
|
|
@ -388,40 +388,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);
|
||||
todo_wine ok(hres == S_OK, "Failed to get max runtime: 0x%08x\n", hres);
|
||||
todo_wine ok(max_run_time == 259200000, "Expected 259200000: %d\n", 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);
|
||||
|
||||
/* Basic set test */
|
||||
max_run_time = 0;
|
||||
hres = ITask_SetMaxRunTime(test_task, 1234);
|
||||
todo_wine ok(hres == S_OK, "Failed to set max runtime: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set max runtime: 0x%08x\n", hres);
|
||||
hres = ITask_GetMaxRunTime(test_task, &max_run_time);
|
||||
todo_wine ok(hres == S_OK, "Failed to get max runtime: 0x%08x\n", hres);
|
||||
todo_wine ok(max_run_time == 1234, "Expected 1234: %d\n", 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);
|
||||
|
||||
/* Verify that time can be set to zero */
|
||||
max_run_time = 1;
|
||||
hres = ITask_SetMaxRunTime(test_task, 0);
|
||||
todo_wine ok(hres == S_OK, "Failed to set max runtime: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set max runtime: 0x%08x\n", hres);
|
||||
hres = ITask_GetMaxRunTime(test_task, &max_run_time);
|
||||
todo_wine ok(hres == S_OK, "Failed to get max runtime: 0x%08x\n", hres);
|
||||
todo_wine ok(max_run_time == 0, "Expected 0: %d\n", 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);
|
||||
|
||||
/* Check resolution by setting time to one */
|
||||
max_run_time = 0;
|
||||
hres = ITask_SetMaxRunTime(test_task, 1);
|
||||
todo_wine ok(hres == S_OK, "Failed to set max runtime: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set max runtime: 0x%08x\n", hres);
|
||||
hres = ITask_GetMaxRunTime(test_task, &max_run_time);
|
||||
todo_wine ok(hres == S_OK, "Failed to get max runtime: 0x%08x\n", hres);
|
||||
todo_wine ok(max_run_time == 1, "Expected 1: %d\n", 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);
|
||||
|
||||
/* Verify that time can be set to INFINITE */
|
||||
max_run_time = 0;
|
||||
hres = ITask_SetMaxRunTime(test_task, INFINITE);
|
||||
todo_wine ok(hres == S_OK, "Failed to set max runtime: 0x%08x\n", hres);
|
||||
ok(hres == S_OK, "Failed to set max runtime: 0x%08x\n", hres);
|
||||
hres = ITask_GetMaxRunTime(test_task, &max_run_time);
|
||||
todo_wine ok(hres == S_OK, "Failed to get max runtime: 0x%08x\n", hres);
|
||||
todo_wine ok(max_run_time == INFINITE, "Expected INFINITE: %d\n", 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);
|
||||
|
||||
cleanup_task();
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue