From 9713e0e74dd51bcac391ac36cba9590aba086bca Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Tue, 6 Mar 2018 10:00:57 -0600 Subject: [PATCH] wmp: Add semistub IWMPSettings invokeURLs, enableErrorDialogs and autoStart properties implementation. WPF's MediaPlayer class expects those not to fail. Signed-off-by: Anton Romanov Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/wmp/oleobj.c | 2 +- dlls/wmp/player.c | 43 ++++++++++++++++++++++++++++++----------- dlls/wmp/tests/oleobj.c | 29 +++++++++++++++++++++++++++ dlls/wmp/wmp_private.h | 7 ++++++- 4 files changed, 68 insertions(+), 13 deletions(-) diff --git a/dlls/wmp/oleobj.c b/dlls/wmp/oleobj.c index 1baf45a439b..25787fa7597 100644 --- a/dlls/wmp/oleobj.c +++ b/dlls/wmp/oleobj.c @@ -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); diff --git a/dlls/wmp/player.c b/dlls/wmp/player.c index d15538a7211..2628fa4b5de 100644 --- a/dlls/wmp/player.c +++ b/dlls/wmp/player.c @@ -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; } diff --git a/dlls/wmp/tests/oleobj.c b/dlls/wmp/tests/oleobj.c index a004337749c..42ed858b857 100644 --- a/dlls/wmp/tests/oleobj.c +++ b/dlls/wmp/tests/oleobj.c @@ -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); diff --git a/dlls/wmp/wmp_private.h b/dlls/wmp/wmp_private.h index 65de6bbd09b..a3baaf72062 100644 --- a/dlls/wmp/wmp_private.h +++ b/dlls/wmp/wmp_private.h @@ -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;