schedsvc/tests: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2020-12-13 21:46:22 +01:00 committed by Alexandre Julliard
parent f211bd0a4e
commit beacd4baf7
2 changed files with 80 additions and 90 deletions

View File

@ -52,7 +52,7 @@ static LONG CALLBACK rpc_exception_filter(EXCEPTION_POINTERS *ptrs)
START_TEST(atsvcapi)
{
static unsigned char ncalrpc[] = "ncalrpc";
static WCHAR task1W[] = { 'T','a','s','k','1','.','e','x','e',0 };
static WCHAR task1W[] = L"Task1.exe";
HRESULT hr;
unsigned char *binding_str;
WCHAR server_name[MAX_COMPUTERNAME_LENGTH + 1];

View File

@ -42,19 +42,6 @@ static LONG CALLBACK rpc_exception_filter(EXCEPTION_POINTERS *ptrs)
START_TEST(rpcapi)
{
static unsigned char ncalrpc[] = "ncalrpc";
static const WCHAR empty[] = { 0 };
static const WCHAR Wine[] = { '\\','W','i','n','e',0 };
static const WCHAR Wine_Folder1[] = { '\\','W','i','n','e','\\','F','o','l','d','e','r','1',0 };
static const WCHAR Wine_Folder2[] = { '\\','W','i','n','e','\\','F','o','l','d','e','r','2',0 };
static const WCHAR Folder1[] = { 'F','o','l','d','e','r','1',0 };
static const WCHAR Folder2[] = { 'F','o','l','d','e','r','2',0 };
static const WCHAR Wine_Task1[] = { '\\','W','i','n','e','\\','T','a','s','k','1',0 };
static const WCHAR Wine_Task2[] = { '\\','W','i','n','e','\\','T','a','s','k','2',0 };
static const WCHAR Wine_Task3[] = { '\\','W','i','n','e','\\','T','a','s','k','3',0 };
static const WCHAR Wine_Folder1_Task1[] = { '\\','W','i','n','e','\\','F','o','l','d','e','r','1','\\','T','a','s','k','1',0 };
static const WCHAR Task1[] = { 'T','a','s','k','1',0 };
static const WCHAR Task2[] = { 'T','a','s','k','2',0 };
static const WCHAR Task3[] = { 'T','a','s','k','3',0 };
static const char xml1[] =
"<?xml version=\"1.0\"?>\n"
"<Task xmlns=\"http://schemas.microsoft.com/windows/2004/02/mit/task\">\n"
@ -121,49 +108,49 @@ START_TEST(rpcapi)
SetUnhandledExceptionFilter(old_exception_filter);
hr = SchRpcCreateFolder(Wine_Folder1, NULL, 1);
hr = SchRpcCreateFolder(L"\\Wine\\Folder1", NULL, 1);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
hr = SchRpcCreateFolder(Wine_Folder1, NULL, 0);
hr = SchRpcCreateFolder(L"\\Wine\\Folder1", NULL, 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcCreateFolder(Wine_Folder1, NULL, 0);
hr = SchRpcCreateFolder(L"\\Wine\\Folder1", NULL, 0);
ok(hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS), "expected ERROR_ALREADY_EXISTS, got %#x\n", hr);
hr = SchRpcCreateFolder(Wine_Folder2+1, empty, 0);
hr = SchRpcCreateFolder(L"Wine\\Folder2", L"", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcDelete(Wine+1, 0);
hr = SchRpcDelete(L"Wine", 0);
ok(hr == HRESULT_FROM_WIN32(ERROR_DIR_NOT_EMPTY), "expected ERROR_DIR_NOT_EMPTY, got %#x\n", hr);
hr = SchRpcDelete(Wine_Folder1+1, 1);
hr = SchRpcDelete(L"Wine\\Folder1", 1);
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
hr = SchRpcDelete(Wine_Folder1+1, 0);
hr = SchRpcDelete(L"Wine\\Folder1", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcDelete(Wine_Folder2, 0);
hr = SchRpcDelete(L"\\Wine\\Folder2", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcDelete(Wine, 0);
hr = SchRpcDelete(L"\\Wine", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcDelete(Wine, 0);
hr = SchRpcDelete(L"\\Wine", 0);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
broken(hr == S_OK), /* Early versions of Win 10 */
"expected ERROR_FILE_NOT_FOUND, got %#x\n", hr);
hr = SchRpcDelete(empty, 0);
hr = SchRpcDelete(L"", 0);
ok(hr == E_ACCESSDENIED /* win7 */ || hr == E_INVALIDARG /* vista */, "expected E_ACCESSDENIED, got %#x\n", hr);
hr = SchRpcCreateFolder(Wine, NULL, 0);
hr = SchRpcCreateFolder(L"\\Wine", NULL, 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
MultiByteToWideChar(CP_ACP, 0, xml1, -1, xmlW, ARRAY_SIZE(xmlW));
path = NULL;
info = NULL;
hr = SchRpcRegisterTask(Wine+1, xmlW, TASK_VALIDATE_ONLY, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
hr = SchRpcRegisterTask(L"Wine", xmlW, TASK_VALIDATE_ONLY, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(!path, "expected NULL, path %p\n", path);
ok(!info, "expected NULL, info %p\n", info);
@ -172,12 +159,13 @@ START_TEST(rpcapi)
{
path = NULL;
info = NULL;
hr = SchRpcRegisterTask(Wine_Task1, xmlW, create_new_task[i].flags, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
hr = SchRpcRegisterTask(L"\\Wine\\Task1", xmlW, create_new_task[i].flags, NULL,
TASK_LOGON_NONE, 0, NULL, &path, &info);
ok(hr == create_new_task[i].hr, "%u: expected %#x, got %#x\n", i, create_new_task[i].hr, hr);
if (hr == S_OK)
{
hr = SchRpcDelete(Wine_Task1, 0);
hr = SchRpcDelete(L"\\Wine\\Task1", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(!info, "expected NULL, info %p\n", info);
MIDL_user_free(path);
@ -186,7 +174,7 @@ START_TEST(rpcapi)
path = NULL;
info = NULL;
hr = SchRpcRegisterTask(Wine_Task1, xmlW, TASK_VALIDATE_ONLY, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
hr = SchRpcRegisterTask(L"\\Wine\\Task1", xmlW, TASK_VALIDATE_ONLY, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(!path, "expected NULL, path %p\n", path);
ok(!info, "expected NULL, info %p\n", info);
@ -200,9 +188,9 @@ START_TEST(rpcapi)
path = NULL;
info = NULL;
hr = SchRpcRegisterTask(Wine_Folder1_Task1+1, xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
hr = SchRpcRegisterTask(L"Wine\\Folder1\\Task1", xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(!lstrcmpW(path, Wine_Folder1_Task1) /* win7 */ || !lstrcmpW(path, Wine_Folder1_Task1+1) /* vista */,
ok(!lstrcmpW(path, L"\\Wine\\Folder1\\Task1") /* win7 */ || !lstrcmpW(path, L"Wine\\Folder1\\Task1") /* vista */,
"expected \\Wine\\Folder1\\Task1, task actual path %s\n", wine_dbgstr_w(path));
ok(!info, "expected NULL, info %p\n", info);
MIDL_user_free(path);
@ -211,11 +199,13 @@ START_TEST(rpcapi)
{
path = NULL;
info = NULL;
hr = SchRpcRegisterTask(Wine_Folder1_Task1+1, xmlW, open_existing_task[i].flags, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
hr = SchRpcRegisterTask(L"Wine\\Folder1\\Task1", xmlW, open_existing_task[i].flags, NULL,
TASK_LOGON_NONE, 0, NULL, &path, &info);
ok(hr == open_existing_task[i].hr, "%u: expected %#x, got %#x\n", i, open_existing_task[i].hr, hr);
if (hr == S_OK)
{
ok(!lstrcmpW(path, Wine_Folder1_Task1) /* win7 */ || !lstrcmpW(path, Wine_Folder1_Task1+1) /* vista */,
ok(!lstrcmpW(path, L"\\Wine\\Folder1\\Task1") /* win7 */ ||
!lstrcmpW(path, L"Wine\\Folder1\\Task1") /* vista */,
"expected \\Wine\\Folder1\\Task1, task actual path %s\n", wine_dbgstr_w(path));
MIDL_user_free(path);
}
@ -226,55 +216,55 @@ START_TEST(rpcapi)
path = NULL;
info = NULL;
hr = SchRpcRegisterTask(Wine_Folder1_Task1+1, xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
hr = SchRpcRegisterTask(L"Wine\\Folder1\\Task1", xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
ok(hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS), "expected ERROR_ALREADY_EXISTS, got %#x\n", hr);
ok(!path, "expected NULL, path %p\n", path);
ok(!info, "expected NULL, info %p\n", info);
count = 0;
xml = NULL;
hr = SchRpcRetrieveTask(Wine_Folder1_Task1, empty, &count, &xml);
hr = SchRpcRetrieveTask(L"\\Wine\\Folder1\\Task1", L"", &count, &xml);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
if (hr == S_OK) trace("%s\n", wine_dbgstr_w(xml));
MIDL_user_free(xml);
hr = SchRpcDelete(Wine_Folder1_Task1+1, 0);
hr = SchRpcDelete(L"Wine\\Folder1\\Task1", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcDelete(Wine_Folder1+1, 0);
hr = SchRpcDelete(L"Wine\\Folder1", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcDelete(Wine+1, 0);
hr = SchRpcDelete(L"Wine", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
start_index = 0;
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumFolders(Wine, TASK_ENUM_HIDDEN, &start_index, 0, &count, &names);
hr = SchRpcEnumFolders(L"\\Wine", TASK_ENUM_HIDDEN, &start_index, 0, &count, &names);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "expected ERROR_FILE_NOT_FOUND, got %#x\n", hr);
ok(!count, "expected 0, got %u\n", count);
ok(!start_index, "expected 0, got %u\n", start_index);
ok(!names, "expected NULL, got %p\n", names);
hr = SchRpcCreateFolder(Wine, NULL, 0);
hr = SchRpcCreateFolder(L"\\Wine", NULL, 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
start_index = 0;
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumFolders(Wine, 0, &start_index, 0, &count, &names);
hr = SchRpcEnumFolders(L"\\Wine", 0, &start_index, 0, &count, &names);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(!count, "expected 0, got %u\n", count);
ok(!start_index, "expected 0, got %u\n", start_index);
ok(!names, "expected NULL, got %p\n", names);
hr = SchRpcCreateFolder(Wine_Folder1, NULL, 0);
hr = SchRpcCreateFolder(L"\\Wine\\Folder1", NULL, 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcCreateFolder(Wine_Folder2, NULL, 0);
hr = SchRpcCreateFolder(L"\\Wine\\Folder2", NULL, 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
start_index = 0;
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumFolders(Wine, 0, &start_index, 0, &count, &names);
hr = SchRpcEnumFolders(L"\\Wine", 0, &start_index, 0, &count, &names);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(count == 2, "expected 2, got %u\n", count);
ok(start_index == 2, "expected 2, got %u\n", start_index);
@ -282,9 +272,9 @@ START_TEST(rpcapi)
enumed = 0;
for (i = 0; i < count; i++)
{
if (!lstrcmpW(names[i], Folder1))
if (!lstrcmpW(names[i], L"Folder1"))
enumed += 1;
else if (!lstrcmpW(names[i], Folder2))
else if (!lstrcmpW(names[i], L"Folder2"))
enumed += 2;
MIDL_user_free(names[i]);
}
@ -294,19 +284,19 @@ START_TEST(rpcapi)
start_index = 0;
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumFolders(Wine, 0, &start_index, 1, &count, &names);
hr = SchRpcEnumFolders(L"\\Wine", 0, &start_index, 1, &count, &names);
ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr);
ok(count == 1, "expected 1, got %u\n", count);
ok(start_index == 1, "expected 1, got %u\n", start_index);
ok(names != NULL, "names should not be NULL\n");
ok(!lstrcmpW(names[0], Folder1) || !lstrcmpW(names[0], Folder2), "got %s\n", wine_dbgstr_w(names[0]));
ok(!lstrcmpW(names[0], L"Folder1") || !lstrcmpW(names[0], L"Folder2"), "got %s\n", wine_dbgstr_w(names[0]));
MIDL_user_free(names[0]);
MIDL_user_free(names);
start_index = 0;
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumFolders(Wine, 0, &start_index, 2, &count, &names);
hr = SchRpcEnumFolders(L"\\Wine", 0, &start_index, 2, &count, &names);
ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr);
ok(count == 2, "expected 2, got %u\n", count);
ok(start_index == 2, "expected 2, got %u\n", start_index);
@ -314,9 +304,9 @@ START_TEST(rpcapi)
enumed = 0;
for (i = 0; i < count; i++)
{
if (!lstrcmpW(names[i], Folder1))
if (!lstrcmpW(names[i], L"Folder1"))
enumed += 1;
else if (!lstrcmpW(names[i], Folder2))
else if (!lstrcmpW(names[i], L"Folder2"))
enumed += 2;
MIDL_user_free(names[i]);
}
@ -326,7 +316,7 @@ START_TEST(rpcapi)
start_index = 0;
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumFolders(Wine, 0, &start_index, 10, &count, &names);
hr = SchRpcEnumFolders(L"\\Wine", 0, &start_index, 10, &count, &names);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(count == 2, "expected 2, got %u\n", count);
ok(start_index == 2, "expected 2, got %u\n", start_index);
@ -334,9 +324,9 @@ START_TEST(rpcapi)
enumed = 0;
for (i = 0; i < count; i++)
{
if (!lstrcmpW(names[i], Folder1))
if (!lstrcmpW(names[i], L"Folder1"))
enumed += 1;
else if (!lstrcmpW(names[i], Folder2))
else if (!lstrcmpW(names[i], L"Folder2"))
enumed += 2;
MIDL_user_free(names[i]);
}
@ -346,21 +336,21 @@ START_TEST(rpcapi)
start_index = 10;
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumFolders(Wine, 0, &start_index, 0, &count, &names);
hr = SchRpcEnumFolders(L"\\Wine", 0, &start_index, 0, &count, &names);
ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr);
ok(!count, "expected 0, got %u\n", count);
ok(start_index == 10, "expected 10, got %u\n", start_index);
ok(!names, "expected NULL, got %p\n", names);
hr = SchRpcDelete(Wine_Folder1+1, 0);
hr = SchRpcDelete(L"Wine\\Folder1", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcDelete(Wine_Folder2, 0);
hr = SchRpcDelete(L"\\Wine\\Folder2", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
start_index = 0;
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumTasks(Wine_Folder1, TASK_ENUM_HIDDEN, &start_index, 0, &count, &names);
hr = SchRpcEnumTasks(L"\\Wine\\Folder1", TASK_ENUM_HIDDEN, &start_index, 0, &count, &names);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "expected ERROR_FILE_NOT_FOUND, got %#x\n", hr);
ok(!count, "expected 0, got %u\n", count);
ok(!start_index, "expected 0, got %u\n", start_index);
@ -368,25 +358,25 @@ START_TEST(rpcapi)
path = NULL;
info = NULL;
hr = SchRpcRegisterTask(Wine_Task1+1, xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
hr = SchRpcRegisterTask(L"Wine\\Task1", xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(!lstrcmpW(path, Wine_Task1) /* win7 */ || !lstrcmpW(path, Wine_Task1+1) /* vista */,
ok(!lstrcmpW(path, L"\\Wine\\Task1") /* win7 */ || !lstrcmpW(path, L"Wine\\Task1") /* vista */,
"expected \\Wine\\Task1, task actual path %s\n", wine_dbgstr_w(path));
ok(!info, "expected NULL, info %p\n", info);
MIDL_user_free(path);
path = NULL;
info = NULL;
hr = SchRpcRegisterTask(Wine_Task2, xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
hr = SchRpcRegisterTask(L"\\Wine\\Task2", xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(!lstrcmpW(path, Wine_Task2), "expected \\Wine\\Task2, task actual path %s\n", wine_dbgstr_w(path));
ok(!lstrcmpW(path, L"\\Wine\\Task2"), "expected \\Wine\\Task2, task actual path %s\n", wine_dbgstr_w(path));
ok(!info, "expected NULL, info %p\n", info);
MIDL_user_free(path);
start_index = 0;
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumTasks(Wine, 0, &start_index, 0, &count, &names);
hr = SchRpcEnumTasks(L"\\Wine", 0, &start_index, 0, &count, &names);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(count == 2, "expected 2, got %u\n", count);
ok(start_index == 2, "expected 2, got %u\n", start_index);
@ -394,9 +384,9 @@ START_TEST(rpcapi)
enumed = 0;
for (i = 0; i < count; i++)
{
if (!lstrcmpW(names[i], Task1))
if (!lstrcmpW(names[i], L"Task1"))
enumed += 1;
else if (!lstrcmpW(names[i], Task2))
else if (!lstrcmpW(names[i], L"Task2"))
enumed += 2;
MIDL_user_free(names[i]);
}
@ -406,13 +396,13 @@ START_TEST(rpcapi)
start_index = 0;
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumTasks(Wine, 0, &start_index, 1, &count, &names);
hr = SchRpcEnumTasks(L"\\Wine", 0, &start_index, 1, &count, &names);
ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr);
ok(count == 1, "expected 1, got %u\n", count);
ok(start_index == 1, "expected 1, got %u\n", start_index);
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),
ok(!lstrcmpW(names[0], L"Task1") || !lstrcmpW(names[0], L"Task2"),
"expected Task1, got %s\n", wine_dbgstr_w(names[0]));
MIDL_user_free(names[0]);
MIDL_user_free(names);
@ -420,7 +410,7 @@ START_TEST(rpcapi)
start_index = 0;
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumTasks(Wine, 0, &start_index, 2, &count, &names);
hr = SchRpcEnumTasks(L"\\Wine", 0, &start_index, 2, &count, &names);
ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr);
ok(count == 2, "expected 2, got %u\n", count);
ok(start_index == 2, "expected 2, got %u\n", start_index);
@ -428,9 +418,9 @@ START_TEST(rpcapi)
enumed = 0;
for (i = 0; i < count; i++)
{
if (!lstrcmpW(names[i], Task1))
if (!lstrcmpW(names[i], L"Task1"))
enumed += 1;
else if (!lstrcmpW(names[i], Task2))
else if (!lstrcmpW(names[i], L"Task2"))
enumed += 2;
MIDL_user_free(names[i]);
}
@ -440,7 +430,7 @@ START_TEST(rpcapi)
start_index = 0;
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumTasks(Wine, 0, &start_index, 10, &count, &names);
hr = SchRpcEnumTasks(L"\\Wine", 0, &start_index, 10, &count, &names);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(count == 2, "expected 2, got %u\n", count);
ok(start_index == 2, "expected 2, got %u\n", start_index);
@ -448,9 +438,9 @@ START_TEST(rpcapi)
enumed = 0;
for (i = 0; i < count; i++)
{
if (!lstrcmpW(names[i], Task1))
if (!lstrcmpW(names[i], L"Task1"))
enumed += 1;
else if (!lstrcmpW(names[i], Task2))
else if (!lstrcmpW(names[i], L"Task2"))
enumed += 2;
MIDL_user_free(names[i]);
}
@ -459,22 +449,22 @@ START_TEST(rpcapi)
path = NULL;
info = NULL;
hr = SchRpcRegisterTask(Wine_Task3+1, xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
hr = SchRpcRegisterTask(L"Wine\\Task3", xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(!lstrcmpW(path, Wine_Task3) /* win7 */ || !lstrcmpW(path, Wine_Task3+1) /* vista */,
ok(!lstrcmpW(path, L"\\Wine\\Task3") /* win7 */ || !lstrcmpW(path, L"Wine\\Task3") /* vista */,
"expected \\Wine\\Task3, task actual path %s\n", wine_dbgstr_w(path));
ok(!info, "expected NULL, info %p\n", info);
MIDL_user_free(path);
count = 0xdeadbeef;
names = NULL;
hr = SchRpcEnumTasks(Wine+1, 0, &start_index, 10, &count, &names);
hr = SchRpcEnumTasks(L"Wine", 0, &start_index, 10, &count, &names);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
ok(count == 1, "expected 1, got %u\n", count);
ok(start_index == 3, "expected 3, got %u\n", start_index);
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) || !lstrcmpW(names[0], Task3),
ok(!lstrcmpW(names[0], L"Task1") || !lstrcmpW(names[0], L"Task2") || !lstrcmpW(names[0], L"Task3"),
"expected Task3, got %s\n", wine_dbgstr_w(names[0]));
MIDL_user_free(names[0]);
MIDL_user_free(names);
@ -482,45 +472,45 @@ START_TEST(rpcapi)
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(L"Task1", 0, NULL, NULL);
hr = SchRpcGetTaskInfo(L"Task1", 0, &enabled, NULL);
hr = SchRpcGetTaskInfo(L"Task1", 0, NULL, &state);
}
hr = SchRpcGetTaskInfo(Task1, 0, &enabled, &state);
hr = SchRpcGetTaskInfo(L"Task1", 0, &enabled, &state);
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);
hr = SchRpcGetTaskInfo(L"\\Wine\\Task1", 0, &enabled, &state);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
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);
hr = SchRpcGetTaskInfo(L"\\Wine\\Task1", SCH_FLAG_STATE, &enabled, &state);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
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);
hr = SchRpcEnableTask(L"\\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);
hr = SchRpcGetTaskInfo(L"\\Wine\\Task1", SCH_FLAG_STATE, &enabled, &state);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
todo_wine
ok(enabled == 1, "expected 1, got %u\n", enabled);
todo_wine
ok(state == TASK_STATE_READY, "expected TASK_STATE_READY, got %u\n", state);
hr = SchRpcDelete(Wine_Task1+1, 0);
hr = SchRpcDelete(L"Wine\\Task1", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcDelete(Wine_Task2+1, 0);
hr = SchRpcDelete(L"Wine\\Task2", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcDelete(Wine_Task3+1, 0);
hr = SchRpcDelete(L"Wine\\Task3", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
hr = SchRpcDelete(Wine, 0);
hr = SchRpcDelete(L"\\Wine", 0);
ok(hr == S_OK, "expected S_OK, got %#x\n", hr);
path = NULL;