Dmitry Timoshkov : taskschd: IRegistrationInfo::put_Documentation() should accept NULL input.
Alexandre Julliard
julliard at winehq.org
Mon Apr 2 16:32:52 CDT 2018
Module: wine
Branch: master
Commit: 62ea04298bdacb4d15c97d66b1949949025a41c9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=62ea04298bdacb4d15c97d66b1949949025a41c9
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Mon Apr 2 13:27:01 2018 +0800
taskschd: IRegistrationInfo::put_Documentation() should accept NULL input.
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at 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 c226446..3a3b5e1 100644
--- a/dlls/taskschd/task.c
+++ b/dlls/taskschd/task.c
@@ -689,15 +689,14 @@ static HRESULT WINAPI RegistrationInfo_get_Documentation(IRegistrationInfo *ifac
static HRESULT WINAPI RegistrationInfo_put_Documentation(IRegistrationInfo *iface, BSTR doc)
{
registration_info *reginfo = impl_from_IRegistrationInfo(iface);
+ WCHAR *str = NULL;
TRACE("%p,%s\n", iface, debugstr_w(doc));
- if (!doc) return E_INVALIDARG;
-
+ if (doc && !(str = heap_strdupW(doc))) return E_OUTOFMEMORY;
heap_free(reginfo->documentation);
- reginfo->documentation = heap_strdupW(doc);
- /* FIXME: update XML on the server side */
- return reginfo->documentation ? S_OK : E_OUTOFMEMORY;
+ reginfo->documentation = str;
+ return S_OK;
}
static HRESULT WINAPI RegistrationInfo_get_XmlText(IRegistrationInfo *iface, BSTR *xml)
@@ -3331,6 +3330,12 @@ static HRESULT read_registration_info(IXmlReader *reader, IRegistrationInfo *inf
if (hr == S_OK)
IRegistrationInfo_put_Date(info, value);
}
+ else if (!lstrcmpW(name, Documentation))
+ {
+ hr = read_text_value(reader, &value);
+ if (hr == S_OK)
+ IRegistrationInfo_put_Documentation(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 2e6a8c4..b499f0b 100644
--- a/dlls/taskschd/tests/scheduler.c
+++ b/dlls/taskschd/tests/scheduler.c
@@ -1427,6 +1427,7 @@ static void test_TaskDefinition(void)
" <Author>author</Author>\n"
" <Version>1.0</Version>\n"
" <Date>2018-04-02T11:22:33</Date>\n"
+ " <Documentation>doc</Documentation>\n"
" </RegistrationInfo>\n"
" <Settings>\n"
" <Enabled>false</Enabled>\n"
@@ -1509,6 +1510,7 @@ static void test_TaskDefinition(void)
static const WCHAR authorW[] = { 'a','u','t','h','o','r',0 };
static const WCHAR versionW[] = { '1','.','0',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 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,
@@ -1650,7 +1652,15 @@ todo_wine
hr = IRegistrationInfo_get_Documentation(reginfo, &bstr);
ok(hr == S_OK, "get_Documentation error %#x\n", hr);
+ ok(!lstrcmpW(bstr, docW), "expected %s, got %s\n", wine_dbgstr_w(docW), wine_dbgstr_w(bstr));
+ SysFreeString(bstr);
+ hr = IRegistrationInfo_put_Documentation(reginfo, NULL);
+ ok(hr == S_OK, "put_Documentation error %#x\n", hr);
+ bstr = (BSTR)0xdeadbeef;
+ hr = IRegistrationInfo_get_Documentation(reginfo, &bstr);
+ ok(hr == S_OK, "get_Documentation error %#x\n", hr);
ok(!bstr, "expected NULL, got %s\n", wine_dbgstr_w(bstr));
+
hr = IRegistrationInfo_get_URI(reginfo, &bstr);
ok(hr == S_OK, "get_URI error %#x\n", hr);
ok(!bstr, "expected NULL, got %s\n", wine_dbgstr_w(bstr));
More information about the wine-cvs
mailing list