Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47152
This is initial part which ignores the options.
-- v2: schtasks: Ignore /tr /sc /rl options in create command.
From: Vijay Kiran Kamuju infyquest@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47152 --- programs/schtasks/schtasks.c | 81 ++++++++++++++++++++++-------- programs/schtasks/tests/schtasks.c | 9 ++++ 2 files changed, 69 insertions(+), 21 deletions(-)
diff --git a/programs/schtasks/schtasks.c b/programs/schtasks/schtasks.c index c9434801db8..54c1bea1b33 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,32 +287,39 @@ 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); + IRegisteredTask_Release(task); + } return 0; }
diff --git a/programs/schtasks/tests/schtasks.c b/programs/schtasks/tests/schtasks.c index 3ed2378c90c..d14a0ffd1a1 100644 --- a/programs/schtasks/tests/schtasks.c +++ b/programs/schtasks/tests/schtasks.c @@ -248,18 +248,27 @@ 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 /create /tn wine\winetest"); 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 */ + r = run_command("schtasks /Delete /f /tn wine\winetest"); ok(r == 0, "r = %lu\n", r);
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=143390
Your paranoid android.
=== debian11 (32 bit report) ===
schtasks.exe: schtasks.c:267: Test failed: r = 0 schtasks.c:270: Test failed: r = 0
=== debian11 (32 bit ar:MA report) ===
schtasks.exe: schtasks.c:267: Test failed: r = 0 schtasks.c:270: Test failed: r = 0
=== debian11 (32 bit de report) ===
schtasks.exe: schtasks.c:267: Test failed: r = 0 schtasks.c:270: Test failed: r = 0
=== debian11 (32 bit fr report) ===
schtasks.exe: schtasks.c:267: Test failed: r = 0 schtasks.c:270: Test failed: r = 0
=== debian11 (32 bit he:IL report) ===
schtasks.exe: schtasks.c:267: Test failed: r = 0 schtasks.c:270: Test failed: r = 0
=== debian11 (32 bit hi:IN report) ===
schtasks.exe: schtasks.c:267: Test failed: r = 0 schtasks.c:270: Test failed: r = 0
=== debian11 (32 bit ja:JP report) ===
schtasks.exe: schtasks.c:267: Test failed: r = 0 schtasks.c:270: Test failed: r = 0
=== debian11 (32 bit zh:CN report) ===
schtasks.exe: schtasks.c:267: Test failed: r = 0 schtasks.c:270: Test failed: r = 0
=== debian11b (32 bit WoW report) ===
schtasks.exe: schtasks.c:267: Test failed: r = 0 schtasks.c:270: Test failed: r = 0
=== debian11b (64 bit WoW report) ===
schtasks.exe: schtasks.c:267: Test failed: r = 0 schtasks.c:270: Test failed: r = 0