Module: wine Branch: master Commit: 8ad8d05af05a34807d6bd97147561b96a247f17e URL: https://source.winehq.org/git/wine.git/?a=commit;h=8ad8d05af05a34807d6bd9714...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Mon Apr 2 13:26:56 2018 +0800
taskschd: IRegistrationInfo::put_Version() should accept NULL input.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/taskschd/task.c | 15 ++++++++++----- dlls/taskschd/tests/scheduler.c | 10 ++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/dlls/taskschd/task.c b/dlls/taskschd/task.c index 7ae478f..02e7cae 100644 --- a/dlls/taskschd/task.c +++ b/dlls/taskschd/task.c @@ -635,15 +635,14 @@ static HRESULT WINAPI RegistrationInfo_get_Version(IRegistrationInfo *iface, BST static HRESULT WINAPI RegistrationInfo_put_Version(IRegistrationInfo *iface, BSTR version) { registration_info *reginfo = impl_from_IRegistrationInfo(iface); + WCHAR *str = NULL;
TRACE("%p,%s\n", iface, debugstr_w(version));
- if (!version) return E_INVALIDARG; - + if (version && !(str = heap_strdupW(version))) return E_OUTOFMEMORY; heap_free(reginfo->version); - reginfo->version = heap_strdupW(version); - /* FIXME: update XML on the server side */ - return reginfo->version ? S_OK : E_OUTOFMEMORY; + reginfo->version = str; + return S_OK; }
static HRESULT WINAPI RegistrationInfo_get_Date(IRegistrationInfo *iface, BSTR *date) @@ -3321,6 +3320,12 @@ static HRESULT read_registration_info(IXmlReader *reader, IRegistrationInfo *inf if (hr == S_OK) IRegistrationInfo_put_Description(info, value); } + else if (!lstrcmpW(name, Version)) + { + hr = read_text_value(reader, &value); + if (hr == S_OK) + IRegistrationInfo_put_Version(info, value); + } else FIXME("unhandled RegistrationInfo element %s\n", debugstr_w(name));
diff --git a/dlls/taskschd/tests/scheduler.c b/dlls/taskschd/tests/scheduler.c index d006dff..c46d849 100644 --- a/dlls/taskschd/tests/scheduler.c +++ b/dlls/taskschd/tests/scheduler.c @@ -1425,6 +1425,7 @@ static void test_TaskDefinition(void) " <RegistrationInfo>\n" " <Description>"Task1"</Description>\n" " <Author>author</Author>\n" + " <Version>1.0</Version>\n" " </RegistrationInfo>\n" " <Settings>\n" " <Enabled>false</Enabled>\n" @@ -1505,6 +1506,7 @@ static void test_TaskDefinition(void) " </Actions>\n" "</Task>\n"; static const WCHAR authorW[] = { 'a','u','t','h','o','r',0 }; + static const WCHAR versionW[] = { '1','.','0',0 }; static WCHAR Task1[] = { '"','T','a','s','k','1','"',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, @@ -1624,7 +1626,15 @@ todo_wine
hr = IRegistrationInfo_get_Version(reginfo, &bstr); ok(hr == S_OK, "get_Version error %#x\n", hr); + ok(!lstrcmpW(bstr, versionW), "expected %s, got %s\n", wine_dbgstr_w(versionW), wine_dbgstr_w(bstr)); + SysFreeString(bstr); + hr = IRegistrationInfo_put_Version(reginfo, NULL); + ok(hr == S_OK, "put_Version error %#x\n", hr); + bstr = (BSTR)0xdeadbeef; + hr = IRegistrationInfo_get_Version(reginfo, &bstr); + ok(hr == S_OK, "get_Version error %#x\n", hr); ok(!bstr, "expected NULL, got %s\n", wine_dbgstr_w(bstr)); + hr = IRegistrationInfo_get_Date(reginfo, &bstr); ok(hr == S_OK, "get_Date error %#x\n", hr); ok(!bstr, "expected NULL, got %s\n", wine_dbgstr_w(bstr));