The rule, as I understand it, is that all interfaces should return the same pointer when queried for IUnknown. It doesn't have to be discoverable by any other IID.
I'm not sure if that applies to interfaces generally or just IUnknown. Mono's COM code (and probably .NET's as well) relies on it for IUnknown.
On Tue, May 14, 2019 at 5:01 AM Dmitry Timoshkov dmitry@baikal.ru wrote:
"Vincent Povirk (they/them)" vincent@codeweavers.com wrote:
+static HRESULT WINAPI IMILBitmapScaler_QueryInterface(IMILBitmapScaler *iface, REFIID iid,
- void **ppv)
+{
- BitmapScaler *This = impl_from_IMILBitmapScaler(iface);
- TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
- if (!ppv) return E_INVALIDARG;
- if (IsEqualIID(&IID_IUnknown, iid) ||
IsEqualIID(&IID_IMILBitmapScaler, iid) ||
IsEqualIID(&IID_IMILBitmapSource, iid))
- {
IUnknown_AddRef(&This->IMILBitmapScaler_iface);
This violates COM rules by returning a different IUnknown pointer depending on the interface queried. Does native do that?
I've added more tests for IMILBitmapScaler_QueryInterface() behaviour, and under Windows for IID_IUnknown it returns some strange interface pointer that doesn't match other public interfaces. Then I added the same test for IWICBitmap_QueryInterface() and it also returns some strange interface for IID_IUnknown. So both QI implementations in Wine have similar problems when queried for IID_IUnknown. Or do you mean some other COM rule violation in the comment above?
-- Dmitry.