Hi Anton,
On 2/7/18 6:40 AM, Anton Romanov wrote:
On 02/02/2018 07:00 AM, Anton Romanov wrote:
TRACE("(%p)->(IID_IWMPPlayer4 %p)\n", This, ppv); *ppv = &This->IWMPPlayer4_iface;
- }else if(IsEqualGUID(riid, &IID_IWMPPlayer)) {
TRACE("(%p)->(IID_IWMPPlayer %p)\n", This, ppv);
*ppv = &This->IWMPPlayer4_iface;
You can't do that. IWMPPlayer4 doesn't inherit from IWMPPlayer, so it's not the same interface. Also a short test (just calling QueryInterface() and checking the result) would be nice.
Btw, even though IWMPPlayer does not inherit it "duplicates the methods of IWMPPlayer, IWMPPlayer2, and IWMPPlayer3, inherits the methods of IWMPCore3, and exposes additional methods" (c) MSDN. So, is there really a need to duplicate a vtbl?
For this to work, vtbls of IWMPPlayer and IWMPPlayer4 would need to compatible (as in IWMPPlayerVtbl would have to be a prefix of IWMPPlayer4Vtbl). In this case it's not: IWMPPlayer4 has get_dvd() (from IWMPCore2) where IWMPPlayer has get_enabled().
Given that, for this to work we need separated vtbls. MSDN in such case is mostly targeted for C++ where compiler takes care of that, but we need to forward calls explicitly. Note that implementing IWMPPlayer on top of IWMPPlayer4 is trivial - just call proper IWMPPlayer4 function.
Jacek