[PATCH 3/4] schedsvc: Add support for running a task.

Dmitry Timoshkov dmitry at baikal.ru
Wed May 16 04:47:39 CDT 2018


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/schedsvc/atsvc.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/dlls/schedsvc/atsvc.c b/dlls/schedsvc/atsvc.c
index 7b3e4979fd..630e634a8f 100644
--- a/dlls/schedsvc/atsvc.c
+++ b/dlls/schedsvc/atsvc.c
@@ -146,7 +146,32 @@ void check_task_state(void)
             update_job_status(job);
         }
         else if (job->data.flags & 0x04000000)
-            FIXME("Run(%s): not implemented\n", debugstr_w(job->info.Command));
+        {
+            TRACE("running process %s\n", debugstr_w(job->info.Command));
+
+            if (job->instance_count >= MAX_INSTANCE_COUNT)
+                ERR("total instance count exceeded %u\n", MAX_INSTANCE_COUNT);
+            else
+            {
+                STARTUPINFOW si;
+                PROCESS_INFORMATION pi;
+
+                memset(&si, 0, sizeof(si));
+                si.cb = sizeof(si);
+                /* FIXME: also specify the target directory */
+                if (CreateProcessW(job->info.Command, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
+                {
+                    CloseHandle(pi.hThread);
+                    job->process[job->instance_count++] = pi.hProcess;
+                }
+
+                job->data.exit_code = 0;
+                job->data.status = SCHED_S_TASK_RUNNING;
+                job->data.flags &= ~0x04000000;
+                job->instance_count++;
+                update_job_status(job);
+            }
+        }
     }
 
     LeaveCriticalSection(&at_job_list_section);
-- 
2.16.3




More information about the wine-devel mailing list