wmp: Add semistub IWMPSettings invokeURLs, enableErrorDialogs and autoStart properties implementation.

WPF's MediaPlayer class expects those not to fail.

Signed-off-by: Anton Romanov <theli.ua@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Anton Romanov 2018-03-06 10:00:57 -06:00 committed by Alexandre Julliard
parent 4559c06032
commit 9713e0e74d
4 changed files with 68 additions and 13 deletions

View File

@ -898,7 +898,7 @@ HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory *iface, IUnknown *outer,
wmp->ref = 1;
init_player_ifaces(wmp);
init_player(wmp);
ConnectionPointContainer_Init(wmp);
hdc = GetDC(0);

View File

@ -756,15 +756,19 @@ static HRESULT WINAPI WMPSettings_get_isAvailable(IWMPSettings *iface, BSTR item
static HRESULT WINAPI WMPSettings_get_autoStart(IWMPSettings *iface, VARIANT_BOOL *p)
{
WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
if (!p)
return E_POINTER;
*p = This->auto_start;
return S_OK;
}
static HRESULT WINAPI WMPSettings_put_autoStart(IWMPSettings *iface, VARIANT_BOOL v)
{
WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
FIXME("(%p)->(%x)\n", This, v);
return E_NOTIMPL;
TRACE("(%p)->(%x)\n", This, v);
This->auto_start = v;
return S_OK;
}
static HRESULT WINAPI WMPSettings_get_baseURL(IWMPSettings *iface, BSTR *p)
@ -798,15 +802,22 @@ static HRESULT WINAPI WMPSettings_put_defaultFrame(IWMPSettings *iface, BSTR v)
static HRESULT WINAPI WMPSettings_get_invokeURLs(IWMPSettings *iface, VARIANT_BOOL *p)
{
WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
if (!p)
return E_POINTER;
*p = This->invoke_urls;
return S_OK;
}
static HRESULT WINAPI WMPSettings_put_invokeURLs(IWMPSettings *iface, VARIANT_BOOL v)
{
WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
/* Leaving as FIXME as we don't currently use this */
FIXME("(%p)->(%x)\n", This, v);
return E_NOTIMPL;
This->invoke_urls = v;
return S_OK;
}
static HRESULT WINAPI WMPSettings_get_mute(IWMPSettings *iface, VARIANT_BOOL *p)
@ -896,15 +907,22 @@ static HRESULT WINAPI WMPSettings_setMode(IWMPSettings *iface, BSTR mode, VARIAN
static HRESULT WINAPI WMPSettings_get_enableErrorDialogs(IWMPSettings *iface, VARIANT_BOOL *p)
{
WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
if (!p)
return E_POINTER;
*p = This->enable_error_dialogs;
return S_OK;
}
static HRESULT WINAPI WMPSettings_put_enableErrorDialogs(IWMPSettings *iface, VARIANT_BOOL v)
{
WindowsMediaPlayer *This = impl_from_IWMPSettings(iface);
/* Leaving as FIXME as we don't currently use this */
FIXME("(%p)->(%x)\n", This, v);
return E_NOTIMPL;
This->enable_error_dialogs = v;
return S_OK;
}
static const IWMPSettingsVtbl WMPSettingsVtbl = {
@ -1139,10 +1157,13 @@ static const IWMPControlsVtbl WMPControlsVtbl = {
WMPControls_playItem,
};
void init_player_ifaces(WindowsMediaPlayer *wmp)
void init_player(WindowsMediaPlayer *wmp)
{
wmp->IWMPPlayer4_iface.lpVtbl = &WMPPlayer4Vtbl;
wmp->IWMPPlayer_iface.lpVtbl = &WMPPlayerVtbl;
wmp->IWMPSettings_iface.lpVtbl = &WMPSettingsVtbl;
wmp->IWMPControls_iface.lpVtbl = &WMPControlsVtbl;
wmp->invoke_urls = VARIANT_TRUE;
wmp->auto_start = VARIANT_TRUE;
}

View File

@ -860,6 +860,7 @@ static void test_wmp_ifaces(IOleObject *oleobj)
IWMPPlayer4 *player4;
IWMPPlayer *player;
IWMPControls *controls;
VARIANT_BOOL vbool;
HRESULT hres;
hres = IOleObject_QueryInterface(oleobj, &IID_IWMPPlayer4, (void**)&player4);
@ -887,6 +888,34 @@ static void test_wmp_ifaces(IOleObject *oleobj)
ok(settings == settings_qi, "settings != settings_qi\n");
IWMPSettings_Release(settings_qi);
/* Test few settings put/gets */
hres = IWMPSettings_get_autoStart(settings, &vbool);
ok(hres == S_OK, "Could not get autoStart from IWMPSettings: %08x\n", hres);
ok(vbool == VARIANT_TRUE, "autoStart = %x\n", vbool);
hres = IWMPSettings_put_autoStart(settings, VARIANT_FALSE);
ok(hres == S_OK, "Could not put autoStart in IWMPSettings: %08x\n", hres);
hres = IWMPSettings_get_autoStart(settings, &vbool);
ok(hres == S_OK, "Could not get autoStart from IWMPSettings: %08x\n", hres);
ok(!vbool, "autoStart = %x\n", vbool);
hres = IWMPSettings_get_invokeURLs(settings, &vbool);
ok(hres == S_OK, "Could not get invokeURLs from IWMPSettings: %08x\n", hres);
ok(vbool == VARIANT_TRUE, "invokeURLs = %x\n", vbool);
hres = IWMPSettings_put_invokeURLs(settings, VARIANT_FALSE);
ok(hres == S_OK, "Could not put invokeURLs in IWMPSettings: %08x\n", hres);
hres = IWMPSettings_get_invokeURLs(settings, &vbool);
ok(hres == S_OK, "Could not get invokeURLs from IWMPSettings: %08x\n", hres);
ok(!vbool, "invokeURLs = %x\n", vbool);
hres = IWMPSettings_get_enableErrorDialogs(settings, &vbool);
ok(hres == S_OK, "Could not get enableErrorDialogs from IWMPSettings: %08x\n", hres);
ok(vbool == VARIANT_FALSE, "enableErrorDialogs = %x\n", vbool);
hres = IWMPSettings_put_enableErrorDialogs(settings, VARIANT_TRUE);
ok(hres == S_OK, "Could not put enableErrorDialogs in IWMPSettings: %08x\n", hres);
hres = IWMPSettings_get_enableErrorDialogs(settings, &vbool);
ok(hres == S_OK, "Could not get enableErrorDialogs from IWMPSettings: %08x\n", hres);
ok(vbool == VARIANT_TRUE, "enableErrorDialogs = %x\n", vbool);
IWMPSettings_Release(settings);
IWMPPlayer4_Release(player4);

View File

@ -52,10 +52,15 @@ struct WindowsMediaPlayer {
HWND hwnd;
SIZEL extent;
/* Settings */
VARIANT_BOOL auto_start;
VARIANT_BOOL invoke_urls;
VARIANT_BOOL enable_error_dialogs;
ConnectionPoint *wmpocx;
};
void init_player_ifaces(WindowsMediaPlayer*) DECLSPEC_HIDDEN;
void init_player(WindowsMediaPlayer*) DECLSPEC_HIDDEN;
void ConnectionPointContainer_Init(WindowsMediaPlayer *wmp) DECLSPEC_HIDDEN;
void ConnectionPointContainer_Destroy(WindowsMediaPlayer *wmp) DECLSPEC_HIDDEN;