taskschd: IRegistrationInfo::put_Source() should accept NULL input.

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-02 13:27:05 +08:00 committed by Alexandre Julliard
parent eb39956bdd
commit f6d6365430
2 changed files with 20 additions and 6 deletions

View File

@ -767,15 +767,14 @@ static HRESULT WINAPI RegistrationInfo_get_Source(IRegistrationInfo *iface, BSTR
static HRESULT WINAPI RegistrationInfo_put_Source(IRegistrationInfo *iface, BSTR source) static HRESULT WINAPI RegistrationInfo_put_Source(IRegistrationInfo *iface, BSTR source)
{ {
registration_info *reginfo = impl_from_IRegistrationInfo(iface); registration_info *reginfo = impl_from_IRegistrationInfo(iface);
WCHAR *str = NULL;
TRACE("%p,%s\n", iface, debugstr_w(source)); TRACE("%p,%s\n", iface, debugstr_w(source));
if (!source) return E_INVALIDARG; if (source && !(str = heap_strdupW(source))) return E_OUTOFMEMORY;
heap_free(reginfo->source); heap_free(reginfo->source);
reginfo->source = heap_strdupW(source); reginfo->source = str;
/* FIXME: update XML on the server side */ return S_OK;
return reginfo->source ? S_OK : E_OUTOFMEMORY;
} }
static const IRegistrationInfoVtbl RegistrationInfo_vtbl = static const IRegistrationInfoVtbl RegistrationInfo_vtbl =
@ -3341,6 +3340,12 @@ static HRESULT read_registration_info(IXmlReader *reader, IRegistrationInfo *inf
if (hr == S_OK) if (hr == S_OK)
IRegistrationInfo_put_URI(info, value); IRegistrationInfo_put_URI(info, value);
} }
else if (!lstrcmpW(name, Source))
{
hr = read_text_value(reader, &value);
if (hr == S_OK)
IRegistrationInfo_put_Source(info, value);
}
else else
FIXME("unhandled RegistrationInfo element %s\n", debugstr_w(name)); FIXME("unhandled RegistrationInfo element %s\n", debugstr_w(name));

View File

@ -1429,6 +1429,7 @@ static void test_TaskDefinition(void)
" <Date>2018-04-02T11:22:33</Date>\n" " <Date>2018-04-02T11:22:33</Date>\n"
" <Documentation>doc</Documentation>\n" " <Documentation>doc</Documentation>\n"
" <URI>uri</URI>\n" " <URI>uri</URI>\n"
" <Source>source</Source>\n"
" </RegistrationInfo>\n" " </RegistrationInfo>\n"
" <Settings>\n" " <Settings>\n"
" <Enabled>false</Enabled>\n" " <Enabled>false</Enabled>\n"
@ -1513,6 +1514,7 @@ static void test_TaskDefinition(void)
static const WCHAR dateW[] = { '2','0','1','8','-','0','4','-','0','2','T','1','1',':','2','2',':','3','3',0 }; static const WCHAR dateW[] = { '2','0','1','8','-','0','4','-','0','2','T','1','1',':','2','2',':','3','3',0 };
static const WCHAR docW[] = { 'd','o','c',0 }; static const WCHAR docW[] = { 'd','o','c',0 };
static const WCHAR uriW[] = { 'u','r','i',0 }; static const WCHAR uriW[] = { 'u','r','i',0 };
static const WCHAR sourceW[] = { 's','o','u','r','c','e',0 };
static WCHAR Task1[] = { '"','T','a','s','k','1','"',0 }; static WCHAR Task1[] = { '"','T','a','s','k','1','"',0 };
static struct settings def_settings = { { 0 }, { 'P','T','7','2','H',0 }, { 0 }, static struct settings def_settings = { { 0 }, { 'P','T','7','2','H',0 }, { 0 },
0, 7, TASK_INSTANCES_IGNORE_NEW, TASK_COMPATIBILITY_V2, VARIANT_TRUE, VARIANT_TRUE, 0, 7, TASK_INSTANCES_IGNORE_NEW, TASK_COMPATIBILITY_V2, VARIANT_TRUE, VARIANT_TRUE,
@ -1674,9 +1676,17 @@ todo_wine
ok(hr == S_OK, "get_URI error %#x\n", hr); ok(hr == S_OK, "get_URI error %#x\n", hr);
ok(!bstr, "expected NULL, got %s\n", wine_dbgstr_w(bstr)); ok(!bstr, "expected NULL, got %s\n", wine_dbgstr_w(bstr));
hr = IRegistrationInfo_get_Source(reginfo, &bstr);
ok(hr == S_OK, "get_Source error %#x\n", hr);
ok(!lstrcmpW(bstr, sourceW), "expected %s, got %s\n", wine_dbgstr_w(sourceW), wine_dbgstr_w(bstr));
SysFreeString(bstr);
hr = IRegistrationInfo_put_Source(reginfo, NULL);
ok(hr == S_OK, "put_Source error %#x\n", hr);
bstr = (BSTR)0xdeadbeef;
hr = IRegistrationInfo_get_Source(reginfo, &bstr); hr = IRegistrationInfo_get_Source(reginfo, &bstr);
ok(hr == S_OK, "get_Source error %#x\n", hr); ok(hr == S_OK, "get_Source error %#x\n", hr);
ok(!bstr, "expected NULL, got %s\n", wine_dbgstr_w(bstr)); ok(!bstr, "expected NULL, got %s\n", wine_dbgstr_w(bstr));
V_VT(&var) = VT_BSTR; V_VT(&var) = VT_BSTR;
V_BSTR(&var) = NULL; V_BSTR(&var) = NULL;
hr = IRegistrationInfo_get_SecurityDescriptor(reginfo, &var); hr = IRegistrationInfo_get_SecurityDescriptor(reginfo, &var);
@ -1695,7 +1705,6 @@ if (hr == S_OK)
hr = IRegistrationInfo_get_Description(reginfo, &bstr); hr = IRegistrationInfo_get_Description(reginfo, &bstr);
ok(hr == S_OK, "get_Description error %#x\n", hr); ok(hr == S_OK, "get_Description error %#x\n", hr);
if (hr == S_OK)
ok(!bstr, "expected NULL, got %s\n", wine_dbgstr_w(bstr)); ok(!bstr, "expected NULL, got %s\n", wine_dbgstr_w(bstr));
hr = ITaskDefinition_get_Triggers(taskdef, &trigger_col); hr = ITaskDefinition_get_Triggers(taskdef, &trigger_col);