[PATCH 2/2] mscoree: There can be only one QI implementation i a COM object!

Michael Stefaniuc mstefani at redhat.com
Fri Sep 9 03:02:04 CDT 2016


On 09/09/2016 02:45 AM, Vincent Povirk wrote:
> These look like 2 separate COM objects to me. They have different
> IUnknown pointers and a different set of implemented interfaces. Is
> there a reason to link them?
Uhm... those are two different interfaces but they were already
implemented in the same COM object aka struct ConfigFileHandler.
See my first patch were the AddRef and Release methods were already
forwarded from ISAXErrorHandler to ISAXContentHandler. So I just cleaned
up COM for the single COM object.

The alternative is to split the struct ConfigFileHandler. But as this is
not part of the API/ABI and the applications cannot get to those COM
interfaces it doesn't matters. Also the ISAXXMLReader just needs the two
COM interfaces, how those are implemented it doesn't matters either.

bye
	michael

> 
> On Thu, Sep 8, 2016 at 2:25 PM, Michael Stefaniuc <mstefani at redhat.de> wrote:
>> Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
>> ---
>>  dlls/mscoree/config.c | 29 +++++++++--------------------
>>  1 file changed, 9 insertions(+), 20 deletions(-)
>>
>> diff --git a/dlls/mscoree/config.c b/dlls/mscoree/config.c
>> index b8bf882..a52a521 100644
>> --- a/dlls/mscoree/config.c
>> +++ b/dlls/mscoree/config.c
>> @@ -73,18 +73,19 @@ static inline ConfigFileHandler *impl_from_ISAXErrorHandler(ISAXErrorHandler *if
>>  static HRESULT WINAPI ConfigFileHandler_QueryInterface(ISAXContentHandler *iface,
>>      REFIID riid, void **ppvObject)
>>  {
>> -    if (IsEqualGUID(riid, &IID_ISAXContentHandler) ||
>> -        IsEqualGUID(riid, &IID_IUnknown))
>> -    {
>> -        *ppvObject = iface;
>> -    }
>> +    ConfigFileHandler *This = impl_from_ISAXContentHandler(iface);
>> +
>> +    if (IsEqualGUID(riid, &IID_ISAXContentHandler) || IsEqualGUID(riid, &IID_IUnknown))
>> +        *ppvObject = &This->ISAXContentHandler_iface;
>> +    else if (IsEqualGUID(riid, &IID_ISAXErrorHandler))
>> +        *ppvObject = &This->ISAXErrorHandler_iface;
>>      else
>>      {
>>          WARN("Unsupported interface %s\n", debugstr_guid(riid));
>>          return E_NOINTERFACE;
>>      }
>>
>> -    ISAXContentHandler_AddRef(iface);
>> +    IUnknown_AddRef((IUnknown*)*ppvObject);
>>
>>      return S_OK;
>>  }
>> @@ -377,20 +378,8 @@ static const struct ISAXContentHandlerVtbl ConfigFileHandlerVtbl =
>>  static HRESULT WINAPI ConfigFileHandler_Error_QueryInterface(ISAXErrorHandler *iface,
>>      REFIID riid, void **ppvObject)
>>  {
>> -    if (IsEqualGUID(riid, &IID_ISAXErrorHandler) ||
>> -        IsEqualGUID(riid, &IID_IUnknown))
>> -    {
>> -        *ppvObject = iface;
>> -    }
>> -    else
>> -    {
>> -        WARN("Unsupported interface %s\n", debugstr_guid(riid));
>> -        return E_NOINTERFACE;
>> -    }
>> -
>> -    ISAXErrorHandler_AddRef(iface);
>> -
>> -    return S_OK;
>> +    ConfigFileHandler *This = impl_from_ISAXErrorHandler(iface);
>> +    return ISAXContentHandler_QueryInterface(&This->ISAXContentHandler_iface, riid, ppvObject);
>>  }
>>
>>  static ULONG WINAPI ConfigFileHandler_Error_AddRef(ISAXErrorHandler *iface)
>> --
>> 2.7.4
>>
>>
> 
> 


-- 
Michael Stefaniuc                           Tel.: +49-711-96437-199
Manager, APAC/EMEA IT Network               Fax.: +49-711-96437-111
--------------------------------------------------------------------
Reg. Adresse: Red Hat GmbH, Werner-von-Siemens-Ring 14, 85630 Grasbrunn
Handelsregister: Amtsgericht Muenchen HRB 153243
Geschäftsführer: Charles Cachera, Michael Cunningham, Michael O'Neill,
                 Eric Shander



More information about the wine-devel mailing list