Commits

Anonymous committed 98baa6c

Made QueryInterface set out-param to NULL on failure.

By COM rules, all [out] parameters must be set to NULL explicitly when the method returns a failure code.
See:
http://msdn.microsoft.com/en-us/library/ms686638%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms810016.aspx

Comments (0)

Files changed (1)

include/comet/impqi.h

 			impl::interface_finder<ITF_LIST>::find_interface(this, iid, p);
 
 			if (!p) {
-				if (riid != IID_IUnknown) return E_NOINTERFACE;
+				if (riid != IID_IUnknown) {
+					*ppv = 0;
+					return E_NOINTERFACE;
+				}
 				p = get_unknown();
 //				p = static_cast< ::IUnknown* >(static_cast< typename ITF_LIST::head * >(this));
 			}
 			impl::interface_finder<ITF_LIST>::find_interface(this, iid, p);
 
 			if (!p) {
-				if (riid != IID_IUnknown) return E_NOINTERFACE;
+				if (riid != IID_IUnknown) {
+					*ppv = 0;
+					return E_NOINTERFACE;
+				}
 //				p = cast_to_unknown(this);
 				p = static_cast< ::IUnknown* >(static_cast<typename ITF_LIST::head*>(this));
 			}