schedsvc: Read parameters and current directory from the job file.

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-31 12:20:46 +08:00 committed by Alexandre Julliard
parent 5f895673df
commit bfb0474e77
1 changed files with 23 additions and 4 deletions

View File

@ -59,6 +59,8 @@ struct job_t
{ {
struct list entry; struct list entry;
WCHAR *name; WCHAR *name;
WCHAR *params;
WCHAR *curdir;
AT_ENUM info; AT_ENUM info;
FIXDLEN_DATA data; FIXDLEN_DATA data;
USHORT instance_count; USHORT instance_count;
@ -76,7 +78,7 @@ static CRITICAL_SECTION_DEBUG cs_debug =
}; };
static CRITICAL_SECTION at_job_list_section = { &cs_debug, -1, 0, 0, 0, 0 }; static CRITICAL_SECTION at_job_list_section = { &cs_debug, -1, 0, 0, 0, 0 };
static DWORD load_unicode_strings(const char *data, DWORD limit, AT_ENUM *info) static DWORD load_unicode_strings(const char *data, DWORD limit, struct job_t *job)
{ {
DWORD i, data_size = 0; DWORD i, data_size = 0;
USHORT len; USHORT len;
@ -101,8 +103,23 @@ static DWORD load_unicode_strings(const char *data, DWORD limit, AT_ENUM *info)
TRACE("string %u: %s\n", i, wine_dbgstr_wn((const WCHAR *)data, len)); TRACE("string %u: %s\n", i, wine_dbgstr_wn((const WCHAR *)data, len));
if (i == 0) switch (i)
info->Command = heap_strdupW((const WCHAR *)data); {
case 0:
job->info.Command = heap_strdupW((const WCHAR *)data);
break;
case 1:
job->params = heap_strdupW((const WCHAR *)data);
break;
case 2:
job->curdir = heap_strdupW((const WCHAR *)data);
break;
default:
break;
}
data += len * sizeof(WCHAR); data += len * sizeof(WCHAR);
data_size += len * sizeof(WCHAR); data_size += len * sizeof(WCHAR);
@ -162,7 +179,7 @@ static BOOL load_job_data(const char *data, DWORD size, struct job_t *info)
TRACE("instance count %u\n", info->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->info); unicode_strings_size = load_unicode_strings(data + fixed->name_size_offset, size - fixed->name_size_offset, info);
else else
{ {
TRACE("invalid name_size_offset\n"); TRACE("invalid name_size_offset\n");
@ -324,6 +341,8 @@ static void free_job(struct job_t *job)
{ {
free_job_info(&job->info); free_job_info(&job->info);
heap_free(job->name); heap_free(job->name);
heap_free(job->params);
heap_free(job->curdir);
heap_free(job); heap_free(job);
} }