schedsvc: Remove job from the list when job file is deleted.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-04-17 15:12:08 +08:00 committed by Alexandre Julliard
parent 2b8d47694d
commit c85bc14d55
3 changed files with 37 additions and 0 deletions

View File

@ -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);

View File

@ -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)
{

View File

@ -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;