Signed-off-by: Gijs Vermeulen gijsvrm@codeweavers.com --- dlls/wmp/player.c | 19 +++++++++++++++---- dlls/wmp/tests/oleobj.c | 4 +--- 2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/dlls/wmp/player.c b/dlls/wmp/player.c index de0f15bece..9437124cbd 100644 --- a/dlls/wmp/player.c +++ b/dlls/wmp/player.c @@ -286,11 +286,18 @@ static HRESULT WINAPI WMPPlayer4_get_network(IWMPPlayer4 *iface, IWMPNetwork **p return S_OK; }
-static HRESULT WINAPI WMPPlayer4_get_currentPlaylist(IWMPPlayer4 *iface, IWMPPlaylist **ppPL) +static HRESULT WINAPI WMPPlayer4_get_currentPlaylist(IWMPPlayer4 *iface, IWMPPlaylist **playlist) { WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface); - FIXME("(%p)->(%p)\n", This, ppPL); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, playlist); + + *playlist = NULL; + + if (This->playlist == NULL) + return S_FALSE; + + return create_playlist(This->playlist->name, This->playlist->url, playlist); }
static HRESULT WINAPI WMPPlayer4_put_currentPlaylist(IWMPPlayer4 *iface, IWMPPlaylist *pPL) @@ -2197,6 +2204,8 @@ void unregister_player_msg_class(void) { BOOL init_player(WindowsMediaPlayer *wmp) { IWMPPlaylist *playlist; + BSTR name; + static const WCHAR nameW[] = {'P','l','a','y','l','i','s','t','1',0};
InitOnceExecuteOnce(&class_init_once, register_player_msg_class, NULL, NULL); wmp->msg_window = CreateWindowW( MAKEINTRESOURCEW(player_msg_class), NULL, 0, 0, @@ -2216,10 +2225,12 @@ BOOL init_player(WindowsMediaPlayer *wmp) wmp->IWMPControls_iface.lpVtbl = &WMPControlsVtbl; wmp->IWMPNetwork_iface.lpVtbl = &WMPNetworkVtbl;
- if (SUCCEEDED(create_playlist(NULL, NULL, &playlist))) + name = SysAllocString(nameW); + if (SUCCEEDED(create_playlist(name, NULL, &playlist))) wmp->playlist = unsafe_impl_from_IWMPPlaylist(playlist); else wmp->playlist = NULL; + SysFreeString(name);
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 dbd9e936ed..db466bf6d4 100644 --- a/dlls/wmp/tests/oleobj.c +++ b/dlls/wmp/tests/oleobj.c @@ -945,12 +945,10 @@ static void test_wmp_ifaces(IOleObject *oleobj)
playlist = NULL; hres = IWMPPlayer4_get_currentPlaylist(player4, &playlist); -todo_wine { ok(hres == S_OK, "IWMPPlayer4_get_currentPlaylist failed: %08x\n", hres); ok(playlist != NULL, "playlist != NULL\n"); -}
- if (playlist) IWMPPlaylist_Release(playlist); + IWMPPlaylist_Release(playlist);
media = NULL; hres = IWMPPlayer4_QueryInterface(player4, &IID_IWMPMedia, (void**)&media);
Signed-off-by: Gijs Vermeulen gijsvrm@codeweavers.com --- dlls/wmp/player.c | 19 +++++++++++++------ dlls/wmp/wmp_private.h | 3 ++- 2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/wmp/player.c b/dlls/wmp/player.c index 9437124cbd..cd729cbabf 100644 --- a/dlls/wmp/player.c +++ b/dlls/wmp/player.c @@ -297,7 +297,7 @@ static HRESULT WINAPI WMPPlayer4_get_currentPlaylist(IWMPPlayer4 *iface, IWMPPla if (This->playlist == NULL) return S_FALSE;
- return create_playlist(This->playlist->name, This->playlist->url, playlist); + return create_playlist(This->playlist->name, This->playlist->url, This->playlist->count, playlist); }
static HRESULT WINAPI WMPPlayer4_put_currentPlaylist(IWMPPlayer4 *iface, IWMPPlaylist *pPL) @@ -355,7 +355,8 @@ static HRESULT WINAPI WMPPlayer4_newPlaylist(IWMPPlayer4 *iface, BSTR name, BSTR
TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(name), debugstr_w(url), playlist);
- return create_playlist(name, url, playlist); + /* FIXME: count should be the number of items in the playlist */ + return create_playlist(name, url, 0, playlist); }
static HRESULT WINAPI WMPPlayer4_newMedia(IWMPPlayer4 *iface, BSTR url, IWMPMedia **media) @@ -2036,8 +2037,13 @@ static HRESULT WINAPI WMPPlaylist_Invoke(IWMPPlaylist *iface, DISPID dispIdMembe static HRESULT WINAPI WMPPlaylist_get_count(IWMPPlaylist *iface, LONG *count) { WMPPlaylist *This = impl_from_IWMPPlaylist(iface); - FIXME("(%p)->(%p)\n", This, count); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, count); + + if (!count) return E_POINTER; + *count = This->count; + + return S_OK; }
static HRESULT WINAPI WMPPlaylist_get_name(IWMPPlaylist *iface, BSTR *name) @@ -2226,7 +2232,7 @@ BOOL init_player(WindowsMediaPlayer *wmp) wmp->IWMPNetwork_iface.lpVtbl = &WMPNetworkVtbl;
name = SysAllocString(nameW); - if (SUCCEEDED(create_playlist(name, NULL, &playlist))) + if (SUCCEEDED(create_playlist(name, NULL, 0, &playlist))) wmp->playlist = unsafe_impl_from_IWMPPlaylist(playlist); else wmp->playlist = NULL; @@ -2325,7 +2331,7 @@ HRESULT create_media_from_url(BSTR url, double duration, IWMPMedia **ppMedia) return E_OUTOFMEMORY; }
-HRESULT create_playlist(BSTR name, BSTR url, IWMPPlaylist **ppPlaylist) +HRESULT create_playlist(BSTR name, BSTR url, LONG count, IWMPPlaylist **ppPlaylist) { WMPPlaylist *playlist;
@@ -2337,6 +2343,7 @@ HRESULT create_playlist(BSTR name, BSTR url, IWMPPlaylist **ppPlaylist) playlist->url = url ? heap_strdupW(url) : heap_strdupW(emptyW); playlist->name = name ? heap_strdupW(name) : heap_strdupW(emptyW); playlist->ref = 1; + playlist->count = count;
if (playlist->url) { diff --git a/dlls/wmp/wmp_private.h b/dlls/wmp/wmp_private.h index 32b4e1f6ae..e1a1e036cd 100644 --- a/dlls/wmp/wmp_private.h +++ b/dlls/wmp/wmp_private.h @@ -65,6 +65,7 @@ typedef struct { IWMPPlaylist IWMPPlaylist_iface;
LONG ref; + LONG count;
WCHAR *url; WCHAR *name; @@ -116,7 +117,7 @@ void destroy_player(WindowsMediaPlayer*) DECLSPEC_HIDDEN; WMPMedia *unsafe_impl_from_IWMPMedia(IWMPMedia *iface) DECLSPEC_HIDDEN; WMPPlaylist *unsafe_impl_from_IWMPPlaylist(IWMPPlaylist *iface) DECLSPEC_HIDDEN; HRESULT create_media_from_url(BSTR url, double duration, IWMPMedia **ppMedia) DECLSPEC_HIDDEN; -HRESULT create_playlist(BSTR name, BSTR url, IWMPPlaylist **ppPlaylist) DECLSPEC_HIDDEN; +HRESULT create_playlist(BSTR name, BSTR url, LONG count, IWMPPlaylist **ppPlaylist) DECLSPEC_HIDDEN; void ConnectionPointContainer_Init(WindowsMediaPlayer *wmp) DECLSPEC_HIDDEN; void ConnectionPointContainer_Destroy(WindowsMediaPlayer *wmp) DECLSPEC_HIDDEN; void call_sink(ConnectionPoint *This, DISPID dispid, DISPPARAMS *dispparams) DECLSPEC_HIDDEN;
Signed-off-by: Gijs Vermeulen gijsvrm@codeweavers.com --- dlls/wmp/player.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wmp/player.c b/dlls/wmp/player.c index cd729cbabf..f8467605c8 100644 --- a/dlls/wmp/player.c +++ b/dlls/wmp/player.c @@ -2120,7 +2120,7 @@ static HRESULT WINAPI WMPPlaylist_appendItem(IWMPPlaylist *iface, IWMPMedia *med { WMPPlaylist *This = impl_from_IWMPPlaylist(iface); FIXME("(%p)->(%p)\n", This, media); - return E_NOTIMPL; + return S_OK; }
static HRESULT WINAPI WMPPlaylist_removeItem(IWMPPlaylist *iface, IWMPMedia *media)
Signed-off-by: Gijs Vermeulen gijsvrm@codeweavers.com --- dlls/wmp/player.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/wmp/player.c b/dlls/wmp/player.c index f8467605c8..03a7d26003 100644 --- a/dlls/wmp/player.c +++ b/dlls/wmp/player.c @@ -2049,15 +2049,22 @@ static HRESULT WINAPI WMPPlaylist_get_count(IWMPPlaylist *iface, LONG *count) static HRESULT WINAPI WMPPlaylist_get_name(IWMPPlaylist *iface, BSTR *name) { WMPPlaylist *This = impl_from_IWMPPlaylist(iface); - FIXME("(%p)->(%p)\n", This, name); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, name); + + return return_bstr(This->name, name); }
static HRESULT WINAPI WMPPlaylist_put_name(IWMPPlaylist *iface, BSTR name) { WMPPlaylist *This = impl_from_IWMPPlaylist(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(name)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(name)); + + if (!name) return E_POINTER; + + This->name = heap_strdupW(name); + return S_OK; }
static HRESULT WINAPI WMPPlaylist_get_attributeCount(IWMPPlaylist *iface, LONG *count)
Signed-off-by: Gijs Vermeulen gijsvrm@codeweavers.com --- dlls/wmp/tests/media.c | 73 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+)
diff --git a/dlls/wmp/tests/media.c b/dlls/wmp/tests/media.c index 7e76aee744..fee18fd556 100644 --- a/dlls/wmp/tests/media.c +++ b/dlls/wmp/tests/media.c @@ -666,6 +666,78 @@ static void test_player_url(void) IWMPPlayer4_Release(player); }
+static void test_playlist(void) +{ + IWMPPlayer4 *player; + IWMPPlaylist *playlist, *playlist2; + HRESULT hr; + BSTR str, str2; + LONG count; + static const WCHAR nameW[] = {'P','l','a','y','l','i','s','t','1',0}; + + hr = CoCreateInstance(&CLSID_WindowsMediaPlayer, NULL, CLSCTX_INPROC_SERVER, &IID_IWMPPlayer4, (void **)&player); + if (hr == REGDB_E_CLASSNOTREG) + { + win_skip("CLSID_WindowsMediaPlayer is not registered.\n"); + return; + } + ok(hr == S_OK, "Failed to create media player instance, hr %#x.\n", hr); + + playlist = NULL; + hr = IWMPPlayer4_get_currentPlaylist(player, &playlist); + ok(hr == S_OK, "IWMPPlayer4_get_currentPlaylist failed: %08x\n", hr); + ok(playlist != NULL, "playlist == NULL\n"); + + if (0) /* fails on non-English locales */ + { + hr = IWMPPlaylist_get_name(playlist, &str); + ok(hr == S_OK, "Failed to get playlist name, hr %#x.\n", hr); + ok(!lstrcmpW(str, nameW), "Expected %s, got %s\n", wine_dbgstr_w(nameW), wine_dbgstr_w(str)); + SysFreeString(str); + } + + hr = IWMPPlaylist_get_count(playlist, NULL); + ok(hr == E_POINTER, "Failed to get count, hr %#x.\n", hr); + + count = -1; + hr = IWMPPlaylist_get_count(playlist, &count); + ok(hr == S_OK, "Failed to get count, hr %#x.\n", hr); + ok(count == 0, "Expected 0, got %d\n", count); + + IWMPPlaylist_Release(playlist); + + /* newPlaylist doesn't change current playlist */ + hr = IWMPPlayer4_newPlaylist(player, NULL, NULL, &playlist); + ok(hr == S_OK, "Failed to create a playlist, hr %#x.\n", hr); + + playlist2 = NULL; + hr = IWMPPlayer4_get_currentPlaylist(player, &playlist2); + ok(hr == S_OK, "IWMPPlayer4_get_currentPlaylist failed: %08x\n", hr); + ok(playlist2 != NULL && playlist2 != playlist, "Unexpected playlist instance\n"); + + IWMPPlaylist_Release(playlist2); + + /* different playlists can have the same name */ + str = SysAllocString(nameW); + hr = IWMPPlaylist_put_name(playlist, str); + ok(hr == S_OK, "Failed to get playlist name, hr %#x.\n", hr); + + playlist2 = NULL; + hr = IWMPPlayer4_newPlaylist(player, str, NULL, &playlist2); + ok(hr == S_OK, "Failed to create a playlist, hr %#x.\n", hr); + hr = IWMPPlaylist_get_name(playlist2, &str2); + ok(hr == S_OK, "Failed to get playlist name, hr %#x.\n", hr); + ok(playlist != playlist2, "Expected playlists to be different"); + ok(!lstrcmpW(str, str2), "Expected names to be the same\n"); + SysFreeString(str); + SysFreeString(str2); + + IWMPPlaylist_Release(playlist2); + + IWMPPlaylist_Release(playlist); + IWMPPlayer4_Release(player); +} + START_TEST(media) { CoInitialize(NULL); @@ -674,6 +746,7 @@ START_TEST(media) playing_event = CreateEventW(NULL, FALSE, FALSE, NULL); completed_event = CreateEventW(NULL, FALSE, FALSE, NULL);
+ test_playlist(); test_media_item(); test_player_url(); if (test_wmp()) {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=55120
Your paranoid android.
=== w2003std (task log) ===
Task errors: The task timed out