Hi Nikolay,
On 11/21/11 08:24, Nikolay Sivov wrote:
> Added common ISupportErrorInfo implementation
+/* common ISupportErrorInfo implementation */
+typedef struct {
+ ISupportErrorInfo ISupportErrorInfo_iface;
+ LONG ref;
+
+ const tid_t* iids;
+} SupportErrorInfo;
+
+static inline SupportErrorInfo *impl_from_ISupportErrorInfo(ISupportErrorInfo *iface)
+{
+ return CONTAINING_RECORD(iface, SupportErrorInfo, ISupportErrorInfo_iface);
+}
+
+static HRESULT WINAPI SupportErrorInfo_QueryInterface(ISupportErrorInfo *iface, REFIID riid, void **obj)
+{
+ SupportErrorInfo *This = impl_from_ISupportErrorInfo(iface);
+ TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
+
+ *obj = NULL;
+
+ if (IsEqualGUID(riid,&IID_IUnknown) || IsEqualGUID(riid,&IID_ISupportErrorInfo)) {
+ *obj = iface;
+ ISupportErrorInfo_AddRef(iface);
+ return S_OK;
+ }
+
+ return E_NOINTERFACE;
+}
This doesn't seem to be the right approach. You need to return here
interfaces of an object that inherits your ISupportErrorInfo
implementation - that's the COM rule. Also you probably don't want to
create new SupportErrorInfo instance on each QI call. I'd suggest
DispatchEx-like approach in this case (or even abuse DispatchEx object
and add ISupportErrorInfo there).
Jacek