schedsvc: Read more task fields from the job file.

Print a FIXME() when the service detects a client action.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-05-11 12:36:50 +08:00 committed by Alexandre Julliard
parent 3310cd5385
commit a66c6a0968
1 changed files with 15 additions and 8 deletions

View File

@ -60,6 +60,8 @@ struct job_t
struct list entry; struct list entry;
WCHAR *name; WCHAR *name;
AT_ENUM info; AT_ENUM info;
FIXDLEN_DATA data;
USHORT instance_count;
}; };
static LONG current_jobid = 1; static LONG current_jobid = 1;
@ -109,13 +111,12 @@ static DWORD load_unicode_strings(const char *data, DWORD limit, AT_ENUM *info)
return data_size; return data_size;
} }
/* FIXME: read more data, currently only Command is handled */ static BOOL load_job_data(const char *data, DWORD size, struct job_t *info)
static BOOL load_job_data(const char *data, DWORD size, AT_ENUM *info)
{ {
const FIXDLEN_DATA *fixed; const FIXDLEN_DATA *fixed;
const SYSTEMTIME *st; const SYSTEMTIME *st;
DWORD unicode_strings_size, data_size, triggers_size; DWORD unicode_strings_size, data_size, triggers_size;
USHORT instance_count, triggers_count, i; USHORT triggers_count, i;
const USHORT *signature; const USHORT *signature;
const TASK_TRIGGER *trigger; const TASK_TRIGGER *trigger;
@ -128,6 +129,7 @@ static BOOL load_job_data(const char *data, DWORD size, AT_ENUM *info)
} }
fixed = (const FIXDLEN_DATA *)data; fixed = (const FIXDLEN_DATA *)data;
info->data = *fixed;
TRACE("product_version %04x\n", fixed->product_version); TRACE("product_version %04x\n", fixed->product_version);
TRACE("file_version %04x\n", fixed->file_version); TRACE("file_version %04x\n", fixed->file_version);
@ -156,11 +158,11 @@ static BOOL load_job_data(const char *data, DWORD size, AT_ENUM *info)
return FALSE; return FALSE;
} }
instance_count = *(const USHORT *)(data + sizeof(*fixed)); info->instance_count = *(const USHORT *)(data + sizeof(*fixed));
TRACE("instance count %u\n", instance_count); TRACE("instance count %u\n", info->instance_count);
if (fixed->name_size_offset + sizeof(USHORT) < size) if (fixed->name_size_offset + sizeof(USHORT) < size)
unicode_strings_size = load_unicode_strings(data + fixed->name_size_offset, size - fixed->name_size_offset, info); unicode_strings_size = load_unicode_strings(data + fixed->name_size_offset, size - fixed->name_size_offset, &info->info);
else else
{ {
TRACE("invalid name_size_offset\n"); TRACE("invalid name_size_offset\n");
@ -269,7 +271,7 @@ static BOOL load_job_data(const char *data, DWORD size, AT_ENUM *info)
return TRUE; return TRUE;
} }
static BOOL load_job(const WCHAR *name, AT_ENUM *info) static BOOL load_job(const WCHAR *name, struct job_t *info)
{ {
HANDLE file, mapping; HANDLE file, mapping;
DWORD size, try; DWORD size, try;
@ -332,12 +334,17 @@ void add_job(const WCHAR *name)
job = heap_alloc_zero(sizeof(*job)); job = heap_alloc_zero(sizeof(*job));
if (!job) return; if (!job) return;
if (!load_job(name, &job->info)) if (!load_job(name, job))
{ {
free_job(job); free_job(job);
return; return;
} }
if (job->data.flags & 0x08000000)
FIXME("Terminate(%s): not implemented\n", debugstr_w(job->info.Command));
else if (job->data.flags & 0x04000000)
FIXME("Run(%s): not implemented\n", debugstr_w(job->info.Command));
EnterCriticalSection(&at_job_list_section); EnterCriticalSection(&at_job_list_section);
job->name = heap_strdupW(name); job->name = heap_strdupW(name);
job->info.JobId = current_jobid++; job->info.JobId = current_jobid++;