Commit 39f0b276 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

taskschd: Don't accept task XML with an invalid boolean value.

parent d2fc6b31
...@@ -1553,8 +1553,8 @@ static HRESULT read_variantbool_value(IXmlReader *reader, VARIANT_BOOL *vbool) ...@@ -1553,8 +1553,8 @@ static HRESULT read_variantbool_value(IXmlReader *reader, VARIANT_BOOL *vbool)
*vbool = VARIANT_FALSE; *vbool = VARIANT_FALSE;
else else
{ {
FIXME("unexpected bool value %s\n", debugstr_w(value)); WARN("unexpected bool value %s\n", debugstr_w(value));
return E_FAIL; return SCHED_E_INVALIDVALUE;
} }
return S_OK; return S_OK;
...@@ -1826,62 +1826,62 @@ static HRESULT read_settings(IXmlReader *reader, ITaskSettings *taskset) ...@@ -1826,62 +1826,62 @@ static HRESULT read_settings(IXmlReader *reader, ITaskSettings *taskset)
else if (!lstrcmpW(name, DisallowStartIfOnBatteries)) else if (!lstrcmpW(name, DisallowStartIfOnBatteries))
{ {
hr = read_variantbool_value(reader, &bool_val); hr = read_variantbool_value(reader, &bool_val);
if (hr == S_OK) if (hr != S_OK) return hr;
ITaskSettings_put_DisallowStartIfOnBatteries(taskset, bool_val); ITaskSettings_put_DisallowStartIfOnBatteries(taskset, bool_val);
} }
else if (!lstrcmpW(name, AllowStartOnDemand)) else if (!lstrcmpW(name, AllowStartOnDemand))
{ {
hr = read_variantbool_value(reader, &bool_val); hr = read_variantbool_value(reader, &bool_val);
if (hr == S_OK) if (hr != S_OK) return hr;
ITaskSettings_put_AllowDemandStart(taskset, bool_val); ITaskSettings_put_AllowDemandStart(taskset, bool_val);
} }
else if (!lstrcmpW(name, StopIfGoingOnBatteries)) else if (!lstrcmpW(name, StopIfGoingOnBatteries))
{ {
hr = read_variantbool_value(reader, &bool_val); hr = read_variantbool_value(reader, &bool_val);
if (hr == S_OK) if (hr != S_OK) return hr;
ITaskSettings_put_StopIfGoingOnBatteries(taskset, bool_val); ITaskSettings_put_StopIfGoingOnBatteries(taskset, bool_val);
} }
else if (!lstrcmpW(name, AllowHardTerminate)) else if (!lstrcmpW(name, AllowHardTerminate))
{ {
hr = read_variantbool_value(reader, &bool_val); hr = read_variantbool_value(reader, &bool_val);
if (hr == S_OK) if (hr != S_OK) return hr;
ITaskSettings_put_AllowHardTerminate(taskset, bool_val); ITaskSettings_put_AllowHardTerminate(taskset, bool_val);
} }
else if (!lstrcmpW(name, StartWhenAvailable)) else if (!lstrcmpW(name, StartWhenAvailable))
{ {
hr = read_variantbool_value(reader, &bool_val); hr = read_variantbool_value(reader, &bool_val);
if (hr == S_OK) if (hr != S_OK) return hr;
ITaskSettings_put_StartWhenAvailable(taskset, bool_val); ITaskSettings_put_StartWhenAvailable(taskset, bool_val);
} }
else if (!lstrcmpW(name, RunOnlyIfNetworkAvailable)) else if (!lstrcmpW(name, RunOnlyIfNetworkAvailable))
{ {
hr = read_variantbool_value(reader, &bool_val); hr = read_variantbool_value(reader, &bool_val);
if (hr == S_OK) if (hr != S_OK) return hr;
ITaskSettings_put_RunOnlyIfNetworkAvailable(taskset, bool_val); ITaskSettings_put_RunOnlyIfNetworkAvailable(taskset, bool_val);
} }
else if (!lstrcmpW(name, Enabled)) else if (!lstrcmpW(name, Enabled))
{ {
hr = read_variantbool_value(reader, &bool_val); hr = read_variantbool_value(reader, &bool_val);
if (hr == S_OK) if (hr != S_OK) return hr;
ITaskSettings_put_Enabled(taskset, bool_val); ITaskSettings_put_Enabled(taskset, bool_val);
} }
else if (!lstrcmpW(name, Hidden)) else if (!lstrcmpW(name, Hidden))
{ {
hr = read_variantbool_value(reader, &bool_val); hr = read_variantbool_value(reader, &bool_val);
if (hr == S_OK) if (hr != S_OK) return hr;
ITaskSettings_put_Hidden(taskset, bool_val); ITaskSettings_put_Hidden(taskset, bool_val);
} }
else if (!lstrcmpW(name, RunOnlyIfIdle)) else if (!lstrcmpW(name, RunOnlyIfIdle))
{ {
hr = read_variantbool_value(reader, &bool_val); hr = read_variantbool_value(reader, &bool_val);
if (hr == S_OK) if (hr != S_OK) return hr;
ITaskSettings_put_RunOnlyIfIdle(taskset, bool_val); ITaskSettings_put_RunOnlyIfIdle(taskset, bool_val);
} }
else if (!lstrcmpW(name, WakeToRun)) else if (!lstrcmpW(name, WakeToRun))
{ {
hr = read_variantbool_value(reader, &bool_val); hr = read_variantbool_value(reader, &bool_val);
if (hr == S_OK) if (hr != S_OK) return hr;
ITaskSettings_put_WakeToRun(taskset, bool_val); ITaskSettings_put_WakeToRun(taskset, bool_val);
} }
else if (!lstrcmpW(name, ExecutionTimeLimit)) else if (!lstrcmpW(name, ExecutionTimeLimit))
{ {
......
...@@ -1246,7 +1246,6 @@ todo_wine ...@@ -1246,7 +1246,6 @@ todo_wine
MultiByteToWideChar(CP_ACP, 0, xml7, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0])); MultiByteToWideChar(CP_ACP, 0, xml7, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0]));
hr = ITaskDefinition_put_XmlText(taskdef, xmlW); hr = ITaskDefinition_put_XmlText(taskdef, xmlW);
todo_wine
ok(hr == SCHED_E_INVALIDVALUE, "expected SCHED_E_INVALIDVALUE, got %#x\n", hr); ok(hr == SCHED_E_INVALIDVALUE, "expected SCHED_E_INVALIDVALUE, got %#x\n", hr);
ITaskDefinition_Release(taskdef); ITaskDefinition_Release(taskdef);
......
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