Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47152
This is initial part which ignores the options.
-- v12: schtasks: Stub implementation of /sc option in create command.
From: Vijay Kiran Kamuju infyquest@gmail.com
--- programs/schtasks/schtasks.c | 84 ++++++++++++++++++++++-------- programs/schtasks/tests/schtasks.c | 22 +++++++- 2 files changed, 82 insertions(+), 24 deletions(-)
diff --git a/programs/schtasks/schtasks.c b/programs/schtasks/schtasks.c index c9434801db8..785552335d7 100644 --- a/programs/schtasks/schtasks.c +++ b/programs/schtasks/schtasks.c @@ -201,6 +201,7 @@ static int create_command(int argc, WCHAR *argv[]) VARIANT empty; BSTR str, xml; HRESULT hres; + BOOL xml_mode = FALSE, tr_mode = FALSE;
while (argc) { if (!wcsicmp(argv[0], L"/xml")) { @@ -215,6 +216,7 @@ static int create_command(int argc, WCHAR *argv[]) }
xml_file = argv[1]; + xml_mode = TRUE; argc -= 2; argv += 2; } else if (!wcsicmp(argv[0], L"/tn")) { @@ -231,6 +233,36 @@ static int create_command(int argc, WCHAR *argv[]) task_name = argv[1]; argc -= 2; argv += 2; + } else if (!wcsicmp(argv[0], L"/tr")) { + if (argc < 2) { + FIXME("Missing /tr value\n"); + return 1; + } + + FIXME("Unsupported /tr option %s\n", debugstr_w(argv[1])); + tr_mode = TRUE; + argc -= 2; + argv += 2; + } else if (!wcsicmp(argv[0], L"/sc")) { + if (argc < 2) { + FIXME("Missing /sc value\n"); + return 1; + } + + FIXME("Unsupported /sc option %s\n", debugstr_w(argv[1])); + tr_mode = TRUE; + argc -= 2; + argv += 2; + } else if (!wcsicmp(argv[0], L"/rl")) { + if (argc < 2) { + FIXME("Missing /rl value\n"); + return 1; + } + + FIXME("Unsupported /rl option %s\n", debugstr_w(argv[1])); + tr_mode = TRUE; + argc -= 2; + argv += 2; } else if (!wcsicmp(argv[0], L"/f")) { flags = TASK_CREATE_OR_UPDATE; argc--; @@ -255,33 +287,41 @@ static int create_command(int argc, WCHAR *argv[]) return 1; }
- if (!xml_file) { - FIXME("Missing /xml argument\n"); - return E_FAIL; - } + if (xml_mode) { + if (tr_mode) { + FIXME("/xml option can only be used with /ru /f /tn\n"); + return E_FAIL; + }
- xml = read_file_to_bstr(xml_file); - if (!xml) - return 1; + if (!xml_file) { + FIXME("Missing /xml argument\n"); + return E_FAIL; + }
- root = get_tasks_root_folder(); - if (!root) { - SysFreeString(xml); - return 1; - } + xml = read_file_to_bstr(xml_file); + if (!xml) + return 1;
- V_VT(&empty) = VT_EMPTY; - str = SysAllocString(task_name); - hres = ITaskFolder_RegisterTask(root, str, xml, flags, empty, empty, + root = get_tasks_root_folder(); + if (!root) { + SysFreeString(xml); + return 1; + } + + V_VT(&empty) = VT_EMPTY; + str = SysAllocString(task_name); + hres = ITaskFolder_RegisterTask(root, str, xml, flags, empty, empty, TASK_LOGON_NONE, empty, &task); - SysFreeString(str); - SysFreeString(xml); - ITaskFolder_Release(root); - if (FAILED(hres)) - return 1; + SysFreeString(str); + SysFreeString(xml); + ITaskFolder_Release(root); + if (FAILED(hres)) + return 1;
- IRegisteredTask_Release(task); - return 0; + IRegisteredTask_Release(task); + return 0; + } + return E_FAIL; }
static int delete_command(int argc, WCHAR *argv[]) diff --git a/programs/schtasks/tests/schtasks.c b/programs/schtasks/tests/schtasks.c index 3ed2378c90c..dd7d331f368 100644 --- a/programs/schtasks/tests/schtasks.c +++ b/programs/schtasks/tests/schtasks.c @@ -248,20 +248,38 @@ START_TEST(schtasks) r = run_command("schtasks /create /xml test.xml /tn wine\winetest"); ok(r == 0, "r = %lu\n", r);
+ r = run_command("schtasks /create /xml test.xml /tn wine\winetest /tr c:\windows\hh.exe"); + ok(r == E_FAIL, "r = %lu\n", r); + r = run_command("schtasks /change /tn wine\winetest /enable"); ok(r == 0, "r = %lu\n", r);
r = run_command("schtasks /create /xml test.xml /f /tn wine\winetest"); ok(r == 0, "r = %lu\n", r); /* task already exists, but /f argument provided */
+ r = run_command("schtasks /create /xml test.xml /f /tn wine\winetest /tr c:\windows\hh.exe"); + ok(r == E_FAIL, "r = %lu\n", r); /* task already exists, but /f argument provided */ + r = run_command("schtasks /create /xml test.xml /tn wine\winetest"); ok(r == 1, "r = %lu\n", r); /* task already exists */
+ r = run_command("schtasks /Delete /f /tn wine\winetest"); + ok(r == 0, "r = %lu\n", r); + r = run_command("schtasks /create /tn wine\winetest"); ok(r == E_FAIL, "r = %lx\n", r); /* missing arguments */
- r = run_command("schtasks /Delete /f /tn wine\winetest"); - ok(r == 0, "r = %lu\n", r); + r = run_command("schtasks /create /tn wine\winetest /tr c:\windows\hh.exe"); + ok(r == E_FAIL, "r = %lx\n", r); /* missing arguments */ + + r = run_command("schtasks /create /tn wine\winetest /tr c:\windows\hh.exe /sc wine"); + ok(r == E_FAIL, "r = %lx\n", r); /* invalid schedule */ + + r = run_command("schtasks /create /tn wine\winetest /tr c:\windows\hh.exe /sc daily"); + todo_wine ok(r == 0, "r = %lx\n", r); /* daily schedule */ + + r = run_command("schtasks /DELETE /f /tn wine\winetest"); + todo_wine ok(r == 0, "r = %lu\n", r);
r = DeleteFileA("test.xml"); ok(r, "DeleteFileA failed: %lu\n", GetLastError());
From: Vijay Kiran Kamuju infyquest@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47152 --- programs/schtasks/schtasks.c | 45 ++++++++++++++++++++++++++++-- programs/schtasks/tests/schtasks.c | 22 ++++++++++++++- 2 files changed, 63 insertions(+), 4 deletions(-)
diff --git a/programs/schtasks/schtasks.c b/programs/schtasks/schtasks.c index 785552335d7..ddd2ee723e1 100644 --- a/programs/schtasks/schtasks.c +++ b/programs/schtasks/schtasks.c @@ -194,7 +194,7 @@ static int change_command(int argc, WCHAR *argv[])
static int create_command(int argc, WCHAR *argv[]) { - const WCHAR *task_name = NULL, *xml_file = NULL; + const WCHAR *task_name = NULL, *xml_file = NULL, *task_run = NULL, *schedule = NULL; ITaskFolder *root = NULL; LONG flags = TASK_CREATE; IRegisteredTask *task; @@ -240,6 +240,7 @@ static int create_command(int argc, WCHAR *argv[]) }
FIXME("Unsupported /tr option %s\n", debugstr_w(argv[1])); + task_run = argv[1]; tr_mode = TRUE; argc -= 2; argv += 2; @@ -249,7 +250,7 @@ static int create_command(int argc, WCHAR *argv[]) return 1; }
- FIXME("Unsupported /sc option %s\n", debugstr_w(argv[1])); + schedule = argv[1]; tr_mode = TRUE; argc -= 2; argv += 2; @@ -284,7 +285,7 @@ static int create_command(int argc, WCHAR *argv[])
if (!task_name) { FIXME("Missing /tn argument\n"); - return 1; + return E_FAIL; }
if (xml_mode) { @@ -321,6 +322,44 @@ static int create_command(int argc, WCHAR *argv[]) IRegisteredTask_Release(task); return 0; } + + if (tr_mode) { + if (!task_run) { + FIXME("Missing /tr argument\n"); + return E_FAIL; + } + + if (!schedule) { + FIXME("Missing /sc argument\n"); + return E_FAIL; + } else if (!wcsicmp(schedule, L"minute")){ + FIXME("Unsupported /sc minute\n"); + } else if (!wcsicmp(schedule, L"hourly")){ + FIXME("Unsupported /sc hourly\n"); + } else if (!wcsicmp(schedule, L"daily")){ + FIXME("Unsupported /sc daily\n"); + } else if (!wcsicmp(schedule, L"weekly")){ + FIXME("Unsupported /sc weekly\n"); + } else if (!wcsicmp(schedule, L"monthly")){ + FIXME("Unsupported /sc monthly\n"); + } else if (!wcsicmp(schedule, L"once")){ + FIXME("Unsupported /sc once\n"); + } else if (!wcsicmp(schedule, L"onstart")){ + FIXME("Unsupported /sc onstart\n"); + } else if (!wcsicmp(schedule, L"onlogon")){ + FIXME("Unsupported /sc onlogon\n"); + } else if (!wcsicmp(schedule, L"onidle")){ + FIXME("Unsupported /sc onidle\n"); + } else if (!wcsicmp(schedule, L"onevent")){ + FIXME("Unsupported /sc onevent\n"); + } else { + FIXME("Invalid schedule type %s\n", debugstr_w(schedule)); + return E_FAIL; + } + + return 0; + } + return E_FAIL; }
diff --git a/programs/schtasks/tests/schtasks.c b/programs/schtasks/tests/schtasks.c index dd7d331f368..5b35e278940 100644 --- a/programs/schtasks/tests/schtasks.c +++ b/programs/schtasks/tests/schtasks.c @@ -245,9 +245,23 @@ START_TEST(schtasks)
create_file("test.xml", xml_a);
+ create_file("empty.xml", ""); + + r = run_command("schtasks /create /xml test.xml"); + ok(r == E_FAIL, "r = %lx\n", r); /* missing arguments */ + + r = run_command("schtasks /create /xml test.xml /tn"); + ok(r == E_FAIL, "r = %lx\n", r); /* missing arguments */ + + r = run_command("schtasks /create /xml /tn wine\winetest"); + ok(r == E_FAIL, "r = %lx\n", r); /* missing arguments */ + r = run_command("schtasks /create /xml test.xml /tn wine\winetest"); ok(r == 0, "r = %lu\n", r);
+ r = run_command("schtasks /create /xml empty.xml /tn wine\winetest"); + ok(r == 1, "r = %lu\n", r); + r = run_command("schtasks /create /xml test.xml /tn wine\winetest /tr c:\windows\hh.exe"); ok(r == E_FAIL, "r = %lu\n", r);
@@ -269,6 +283,9 @@ START_TEST(schtasks) r = run_command("schtasks /create /tn wine\winetest"); ok(r == E_FAIL, "r = %lx\n", r); /* missing arguments */
+ r = run_command("schtasks /create /tn"); + ok(r == E_FAIL, "r = %lx\n", r); /* missing arguments */ + r = run_command("schtasks /create /tn wine\winetest /tr c:\windows\hh.exe"); ok(r == E_FAIL, "r = %lx\n", r); /* missing arguments */
@@ -276,11 +293,14 @@ START_TEST(schtasks) ok(r == E_FAIL, "r = %lx\n", r); /* invalid schedule */
r = run_command("schtasks /create /tn wine\winetest /tr c:\windows\hh.exe /sc daily"); - todo_wine ok(r == 0, "r = %lx\n", r); /* daily schedule */ + ok(r == 0, "r = %lx\n", r); /* daily schedule */
r = run_command("schtasks /DELETE /f /tn wine\winetest"); todo_wine ok(r == 0, "r = %lu\n", r);
+ r = DeleteFileA("empty.xml"); + ok(r, "DeleteFileA failed: %lu\n", GetLastError()); + r = DeleteFileA("test.xml"); ok(r, "DeleteFileA failed: %lu\n", GetLastError());
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=143559
Your paranoid android.
=== debian11 (32 bit report) ===
schtasks.exe: schtasks.c:254: Test failed: r = 1 schtasks.c:257: Test failed: r = 1 schtasks.c:287: Test failed: r = 1
=== debian11 (32 bit ar:MA report) ===
schtasks.exe: schtasks.c:254: Test failed: r = 1 schtasks.c:257: Test failed: r = 1 schtasks.c:287: Test failed: r = 1
=== debian11 (32 bit de report) ===
schtasks.exe: schtasks.c:254: Test failed: r = 1 schtasks.c:257: Test failed: r = 1 schtasks.c:287: Test failed: r = 1
=== debian11 (32 bit fr report) ===
schtasks.exe: schtasks.c:254: Test failed: r = 1 schtasks.c:257: Test failed: r = 1 schtasks.c:287: Test failed: r = 1
=== debian11 (32 bit he:IL report) ===
schtasks.exe: schtasks.c:254: Test failed: r = 1 schtasks.c:257: Test failed: r = 1 schtasks.c:287: Test failed: r = 1
=== debian11 (32 bit hi:IN report) ===
schtasks.exe: schtasks.c:254: Test failed: r = 1 schtasks.c:257: Test failed: r = 1 schtasks.c:287: Test failed: r = 1
=== debian11 (32 bit ja:JP report) ===
schtasks.exe: schtasks.c:254: Test failed: r = 1 schtasks.c:257: Test failed: r = 1 schtasks.c:287: Test failed: r = 1
=== debian11 (32 bit zh:CN report) ===
schtasks.exe: schtasks.c:254: Test failed: r = 1 schtasks.c:257: Test failed: r = 1 schtasks.c:287: Test failed: r = 1
=== debian11b (32 bit WoW report) ===
schtasks.exe: schtasks.c:254: Test failed: r = 1 schtasks.c:257: Test failed: r = 1 schtasks.c:287: Test failed: r = 1
=== debian11b (64 bit WoW report) ===
schtasks.exe: schtasks.c:254: Test failed: r = 1 schtasks.c:257: Test failed: r = 1 schtasks.c:287: Test failed: r = 1