From 7152be13fb2625dfd67c04a766786525ad6242a8 Mon Sep 17 00:00:00 2001 From: Mike Nordell Date: Mon, 17 Sep 2012 20:27:02 +0000 Subject: [PATCH] MS-compatible but interface contract violating return value for QueryInterface with NULL ppvObject. svn path=/trunk/; revision=57317 --- reactos/dll/win32/msxml3/msxml3_ros.diff | 21 +++++++++++---------- reactos/dll/win32/msxml3/nodelist.c | 6 +++++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/reactos/dll/win32/msxml3/msxml3_ros.diff b/reactos/dll/win32/msxml3/msxml3_ros.diff index ed356fa7125..f3957ba8d09 100644 --- a/reactos/dll/win32/msxml3/msxml3_ros.diff +++ b/reactos/dll/win32/msxml3/msxml3_ros.diff @@ -24,17 +24,18 @@ Index: msxml3.spec Index: nodelist.c =================================================================== ---- nodelist.c (revision 57307) +--- nodelist.c (revision 57316) +++ nodelist.c (working copy) -@@ -87,6 +87,11 @@ +@@ -89,7 +89,11 @@ - TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); + if (!ppvObject) + { +- return E_POINTER; ++ /* NOTE: Interface documentation for IUnknown explicitly states ++ * this case should return E_POINTER. Empirical data proves ++ * MS violates this contract and instead return E_INVALIDARG. ++ */ ++ return E_INVALIDARG; + } -+ if (!ppvObject) -+ { -+ return E_POINTER; -+ } -+ if ( IsEqualGUID( riid, &IID_IUnknown ) || - IsEqualGUID( riid, &IID_IDispatch ) || - IsEqualGUID( riid, &IID_IXMLDOMNodeList ) ) diff --git a/reactos/dll/win32/msxml3/nodelist.c b/reactos/dll/win32/msxml3/nodelist.c index f39546c884a..c3dcacfef10 100644 --- a/reactos/dll/win32/msxml3/nodelist.c +++ b/reactos/dll/win32/msxml3/nodelist.c @@ -89,7 +89,11 @@ static HRESULT WINAPI xmlnodelist_QueryInterface( if (!ppvObject) { - return E_POINTER; + /* NOTE: Interface documentation for IUnknown explicitly states + * this case should return E_POINTER. Empirical data proves + * MS violates this contract and instead return E_INVALIDARG. + */ + return E_INVALIDARG; } if ( IsEqualGUID( riid, &IID_IUnknown ) ||