[PATCH 3/7] schedsvc: Remove job from the list when job file is deleted.
Dmitry Timoshkov
dmitry at baikal.ru
Tue Apr 17 02:12:08 CDT 2018
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
dlls/schedsvc/atsvc.c | 28 ++++++++++++++++++++++++++++
dlls/schedsvc/schedsvc_private.h | 1 +
dlls/schedsvc/svc_main.c | 8 ++++++++
3 files changed, 37 insertions(+)
diff --git a/dlls/schedsvc/atsvc.c b/dlls/schedsvc/atsvc.c
index 1482dfdf8c..97ca75e21d 100644
--- a/dlls/schedsvc/atsvc.c
+++ b/dlls/schedsvc/atsvc.c
@@ -327,6 +327,34 @@ void add_job(const WCHAR *name)
}
}
+static struct job_t *find_job(DWORD jobid, const WCHAR *name)
+{
+ struct job_t *job;
+
+ LIST_FOR_EACH_ENTRY(job, &at_job_list, struct job_t, entry)
+ {
+ if ((name && !lstrcmpiW(job->name, name)) || job->info.JobId == jobid)
+ return job;
+ }
+
+ return NULL;
+}
+
+void remove_job(const WCHAR *name)
+{
+ struct job_t *job;
+
+ EnterCriticalSection(&at_job_list_section);
+ job = find_job(0, name);
+ if (job)
+ {
+ list_remove(&job->entry);
+ heap_free(job->name);
+ heap_free(job);
+ }
+ LeaveCriticalSection(&at_job_list_section);
+}
+
DWORD __cdecl NetrJobAdd(ATSVC_HANDLE server_name, AT_INFO *info, DWORD *jobid)
{
FIXME("%s,%p,%p: stub\n", debugstr_w(server_name), info, jobid);
diff --git a/dlls/schedsvc/schedsvc_private.h b/dlls/schedsvc/schedsvc_private.h
index 1e5d575d70..215bba003e 100644
--- a/dlls/schedsvc/schedsvc_private.h
+++ b/dlls/schedsvc/schedsvc_private.h
@@ -24,6 +24,7 @@
void schedsvc_auto_start(void) DECLSPEC_HIDDEN;
void add_job(const WCHAR *name) DECLSPEC_HIDDEN;
+void remove_job(const WCHAR *name) DECLSPEC_HIDDEN;
static inline WCHAR *heap_strdupW(const WCHAR *src)
{
diff --git a/dlls/schedsvc/svc_main.c b/dlls/schedsvc/svc_main.c
index 0835d71b42..1ccc34529b 100644
--- a/dlls/schedsvc/svc_main.c
+++ b/dlls/schedsvc/svc_main.c
@@ -91,6 +91,14 @@ static DWORD WINAPI tasks_monitor_thread(void *arg)
add_job(path);
break;
+ case FILE_ACTION_REMOVED:
+ TRACE("FILE_ACTION_REMOVED %s\n", debugstr_w(info.data.FileName));
+ GetWindowsDirectoryW(path, MAX_PATH);
+ lstrcatW(path, tasksW);
+ lstrcatW(path, info.data.FileName);
+ remove_job(path);
+ break;
+
default:
FIXME("%s: action %#x not handled\n", debugstr_w(info.data.FileName), info.data.Action);
break;
--
2.16.3
More information about the wine-devel
mailing list