From c61937b6d4ef7f313052b1c519f292e80d53db01 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 29 Feb 2008 20:54:53 +1100 Subject: [PATCH] msxml3: Correct IXMLDOMProcessingInstruction_put_data function. --- dlls/msxml3/pi.c | 15 +++++++++++++++ dlls/msxml3/tests/domdoc.c | 14 +------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/dlls/msxml3/pi.c b/dlls/msxml3/pi.c index 90425fd4ed..44e8a8b790 100644 --- a/dlls/msxml3/pi.c +++ b/dlls/msxml3/pi.c @@ -506,9 +506,24 @@ static HRESULT WINAPI dom_pi_put_data( dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); HRESULT hr = E_FAIL; VARIANT val; + BSTR sTarget; + static WCHAR szXML[] = {'x','m','l',0}; TRACE("%p %s\n", This, debugstr_w(data) ); + /* Cannot set data to a PI node whos target is 'xml' */ + hr = dom_pi_get_nodeName(iface, &sTarget); + if(hr == S_OK) + { + if(lstrcmpW( sTarget, szXML) == 0) + { + SysFreeString(sTarget); + return E_FAIL; + } + + SysFreeString(sTarget); + } + V_VT(&val) = VT_BSTR; V_BSTR(&val) = data; diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 2ced1cc267..23fb1f31f2 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -682,19 +682,7 @@ static void test_domdoc( void ) /* test put_data */ r = IXMLDOMProcessingInstruction_put_data(nodePI, _bstr_("version=\"1.0\" encoding=\"UTF-8\"")); - ok(r == S_OK, "ret %08x\n", r ); - SysFreeString(str); - - r = IXMLDOMProcessingInstruction_get_data(nodePI, &str); - ok(r == S_OK, "ret %08x\n", r ); - ok( !lstrcmpW( str, _bstr_("version=\"1.0\" encoding=\"UTF-8\"") ), "incorrect data string\n"); - SysFreeString(str); - - /* Confirm XML text is good */ - r = IXMLDOMProcessingInstruction_get_xml(nodePI, &str); - ok(r == S_OK, "ret %08x\n", r ); - ok( !lstrcmpW( str, _bstr_("") ), "incorrect xml string\n"); - SysFreeString(str); + ok(r == E_FAIL, "ret %08x\n", r ); IXMLDOMProcessingInstruction_Release(nodePI); } -- 2.32.0.93.g670b81a890