Commit 4c08276e authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

taskschd: Return appropriate error code for a malformed XML.

parent 39f0b276
......@@ -1916,7 +1916,7 @@ static HRESULT read_settings(IXmlReader *reader, ITaskSettings *taskset)
}
WARN("Settings was not terminated\n");
return E_FAIL;
return SCHED_E_MALFORMEDXML;
}
static HRESULT read_registration_info(IXmlReader *reader, IRegistrationInfo *info)
......@@ -1981,7 +1981,7 @@ static HRESULT read_registration_info(IXmlReader *reader, IRegistrationInfo *inf
}
WARN("RegistrationInfo was not terminated\n");
return E_FAIL;
return SCHED_E_MALFORMEDXML;
}
static HRESULT read_task_attributes(IXmlReader *reader, ITaskDefinition *taskdef)
......@@ -2119,7 +2119,7 @@ static HRESULT read_task(IXmlReader *reader, ITaskDefinition *taskdef)
}
WARN("Task was not terminated\n");
return E_FAIL;
return SCHED_E_MALFORMEDXML;
}
static HRESULT read_xml(IXmlReader *reader, ITaskDefinition *taskdef)
......@@ -2165,7 +2165,7 @@ static HRESULT read_xml(IXmlReader *reader, ITaskDefinition *taskdef)
}
WARN("Task definition was not found\n");
return E_FAIL;
return SCHED_E_MALFORMEDXML;
}
static HRESULT WINAPI TaskDefinition_put_XmlText(ITaskDefinition *iface, BSTR xml)
......
......@@ -1153,8 +1153,12 @@ static void test_TaskDefinition(void)
static const char xml6[] =
"<Task xmlns=\"http://schemas.microsoft.com/windows/2004/02/mit/task\">\n"
" <RegistrationInfo/>\n"
" <Settings/>\n"
" <Actions>\n"
" <Exec>\n"
" <Command>\"task1.exe\"</Command>\n"
" </Exec>\n"
" </Actions>\n"
" <Settings>\n"
"</Task>\n";
static const char xml7[] =
"<Task xmlns=\"http://schemas.microsoft.com/windows/2004/02/mit/task\">\n"
......@@ -1241,13 +1245,16 @@ todo_wine
MultiByteToWideChar(CP_ACP, 0, xml6, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0]));
hr = ITaskDefinition_put_XmlText(taskdef, xmlW);
todo_wine
ok(hr == SCHED_E_MALFORMEDXML, "expected SCHED_E_MALFORMEDXML, got %#x\n", hr);
MultiByteToWideChar(CP_ACP, 0, xml7, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0]));
hr = ITaskDefinition_put_XmlText(taskdef, xmlW);
ok(hr == SCHED_E_INVALIDVALUE, "expected SCHED_E_INVALIDVALUE, got %#x\n", hr);
xmlW[0] = 0;
hr = ITaskDefinition_put_XmlText(taskdef, xmlW);
ok(hr == SCHED_E_MALFORMEDXML, "expected SCHED_E_MALFORMEDXML, got %#x\n", hr);
ITaskDefinition_Release(taskdef);
ITaskService_Release(service);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment