Commit 9445c6b6 authored by Anton Romanov's avatar Anton Romanov Committed by Alexandre Julliard

wmp: Implement IConnectionPoint[Container] and add _WMPOCXEvents.

parent 2c163225
MODULE = wmp.dll MODULE = wmp.dll
IMPORTS = user32 gdi32 oleaut32 IMPORTS = oleaut32 ole32 user32 gdi32
C_SRCS = \ C_SRCS = \
events.c \
oleobj.c \ oleobj.c \
player.c \ player.c \
wmp_main.c wmp_main.c
......
...@@ -307,6 +307,7 @@ static ULONG WINAPI OleObject_Release(IOleObject *iface) ...@@ -307,6 +307,7 @@ static ULONG WINAPI OleObject_Release(IOleObject *iface)
if(!ref) { if(!ref) {
release_client_site(This); release_client_site(This);
ConnectionPointContainer_Destroy(This);
heap_free(This); heap_free(This);
} }
...@@ -875,55 +876,6 @@ static const IPersistStreamInitVtbl PersistStreamInitVtbl = { ...@@ -875,55 +876,6 @@ static const IPersistStreamInitVtbl PersistStreamInitVtbl = {
PersistStreamInit_InitNew PersistStreamInit_InitNew
}; };
static inline WindowsMediaPlayer *impl_from_IConnectionPointContainer(IConnectionPointContainer *iface)
{
return CONTAINING_RECORD(iface, WindowsMediaPlayer, IConnectionPointContainer_iface);
}
static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
REFIID riid, LPVOID *ppv)
{
WindowsMediaPlayer *This = impl_from_IConnectionPointContainer(iface);
return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv);
}
static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
{
WindowsMediaPlayer *This = impl_from_IConnectionPointContainer(iface);
return IOleObject_AddRef(&This->IOleObject_iface);
}
static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
{
WindowsMediaPlayer *This = impl_from_IConnectionPointContainer(iface);
return IOleObject_Release(&This->IOleObject_iface);
}
static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface,
IEnumConnectionPoints **ppEnum)
{
WindowsMediaPlayer *This = impl_from_IConnectionPointContainer(iface);
FIXME("(%p)->(%p)\n", This, ppEnum);
return E_NOTIMPL;
}
static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface,
REFIID riid, IConnectionPoint **ppCP)
{
WindowsMediaPlayer *This = impl_from_IConnectionPointContainer(iface);
FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppCP);
return CONNECT_E_NOCONNECTION;
}
static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl =
{
ConnectionPointContainer_QueryInterface,
ConnectionPointContainer_AddRef,
ConnectionPointContainer_Release,
ConnectionPointContainer_EnumConnectionPoints,
ConnectionPointContainer_FindConnectionPoint
};
HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory *iface, IUnknown *outer,
REFIID riid, void **ppv) REFIID riid, void **ppv)
{ {
...@@ -942,13 +894,13 @@ HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, ...@@ -942,13 +894,13 @@ HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory *iface, IUnknown *outer,
wmp->IProvideClassInfo2_iface.lpVtbl = &ProvideClassInfo2Vtbl; wmp->IProvideClassInfo2_iface.lpVtbl = &ProvideClassInfo2Vtbl;
wmp->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl; wmp->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl;
wmp->IOleInPlaceObjectWindowless_iface.lpVtbl = &OleInPlaceObjectWindowlessVtbl; wmp->IOleInPlaceObjectWindowless_iface.lpVtbl = &OleInPlaceObjectWindowlessVtbl;
wmp->IConnectionPointContainer_iface.lpVtbl = &ConnectionPointContainerVtbl;
wmp->IOleControl_iface.lpVtbl = &OleControlVtbl; wmp->IOleControl_iface.lpVtbl = &OleControlVtbl;
wmp->ref = 1; wmp->ref = 1;
init_player_ifaces(wmp); init_player_ifaces(wmp);
ConnectionPointContainer_Init(wmp);
hdc = GetDC(0); hdc = GetDC(0);
dpi_x = GetDeviceCaps(hdc, LOGPIXELSX); dpi_x = GetDeviceCaps(hdc, LOGPIXELSX);
dpi_y = GetDeviceCaps(hdc, LOGPIXELSY); dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
......
...@@ -495,6 +495,43 @@ static const IDispatchVtbl DispatchVtbl = { ...@@ -495,6 +495,43 @@ static const IDispatchVtbl DispatchVtbl = {
static IDispatch Dispatch = { &DispatchVtbl }; static IDispatch Dispatch = { &DispatchVtbl };
static HRESULT WINAPI WMPOCXEvents_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
{
*ppv = NULL;
if(IsEqualGUID(&IID__WMPOCXEvents, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
*ppv = iface;
return S_OK;
}
ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
return E_NOINTERFACE;
}
static HRESULT WINAPI WMPOCXEvents_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
switch(dispIdMember) {
default:
ok(0, "unexpected call Invoke(%d)\n", dispIdMember);
}
return E_NOTIMPL;
}
static IDispatchVtbl WMPOcxEventsVtbl = {
WMPOCXEvents_QueryInterface,
Dispatch_AddRef,
Dispatch_Release,
Dispatch_GetTypeInfoCount,
Dispatch_GetTypeInfo,
Dispatch_GetIDsOfNames,
WMPOCXEvents_Invoke,
};
static IDispatch WMPOCXEvents = { &WMPOcxEventsVtbl };
static HRESULT WINAPI InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv) static HRESULT WINAPI InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
{ {
return cs_qi(riid, ppv); return cs_qi(riid, ppv);
...@@ -788,6 +825,35 @@ static HRESULT cs_qi(REFIID riid, void **ppv) ...@@ -788,6 +825,35 @@ static HRESULT cs_qi(REFIID riid, void **ppv)
return S_OK; return S_OK;
} }
static void test_ConnectionPoint(IOleObject *unk)
{
IConnectionPointContainer *container;
IConnectionPoint *point;
HRESULT hres;
static DWORD dw = 100;
hres = IOleObject_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
if(FAILED(hres))
return;
hres = IConnectionPointContainer_FindConnectionPoint(container, &IID__WMPOCXEvents, &point);
IConnectionPointContainer_Release(container);
ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
if(FAILED(hres))
return;
hres = IConnectionPoint_Advise(point, (IUnknown*)&WMPOCXEvents, &dw);
ok(hres == S_OK, "Advise failed: %08x\n", hres);
ok(dw == 1, "dw=%d, expected 1\n", dw);
hres = IConnectionPoint_Unadvise(point, dw);
ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
IConnectionPoint_Release(point);
}
static void test_wmp_ifaces(IOleObject *oleobj) static void test_wmp_ifaces(IOleObject *oleobj)
{ {
IWMPSettings *settings, *settings_qi; IWMPSettings *settings, *settings_qi;
...@@ -913,7 +979,7 @@ static void test_IConnectionPointContainer(IOleObject *oleobj) ...@@ -913,7 +979,7 @@ static void test_IConnectionPointContainer(IOleObject *oleobj)
point = NULL; point = NULL;
hres = IConnectionPointContainer_FindConnectionPoint(container, &IID__WMPOCXEvents, &point); hres = IConnectionPointContainer_FindConnectionPoint(container, &IID__WMPOCXEvents, &point);
todo_wine ok(hres == S_OK, "got: %08x\n", hres); ok(hres == S_OK, "got: %08x\n", hres);
if(point) if(point)
IConnectionPoint_Release(point); IConnectionPoint_Release(point);
...@@ -1113,6 +1179,8 @@ static void test_wmp(void) ...@@ -1113,6 +1179,8 @@ static void test_wmp(void)
ok(hres == E_FAIL || broken(hres == S_OK), "GetClientSite failed: %08x\n", hres); ok(hres == E_FAIL || broken(hres == S_OK), "GetClientSite failed: %08x\n", hres);
ok(!client_site, "client_site = %p\n", client_site); ok(!client_site, "client_site = %p\n", client_site);
test_ConnectionPoint(oleobj);
IPersistStreamInit_Release(psi); IPersistStreamInit_Release(psi);
IOleInPlaceObject_Release(ipobj); IOleInPlaceObject_Release(ipobj);
......
...@@ -19,9 +19,21 @@ ...@@ -19,9 +19,21 @@
#define COBJMACROS #define COBJMACROS
#include "windows.h" #include "windows.h"
#include "wine/heap.h"
#include "ole2.h" #include "ole2.h"
#include "wmp.h" #include "wmp.h"
typedef struct {
IConnectionPoint IConnectionPoint_iface;
IConnectionPointContainer *container;
IDispatch **sinks;
DWORD sinks_size;
IID iid;
} ConnectionPoint;
struct WindowsMediaPlayer { struct WindowsMediaPlayer {
IOleObject IOleObject_iface; IOleObject IOleObject_iface;
IProvideClassInfo2 IProvideClassInfo2_iface; IProvideClassInfo2 IProvideClassInfo2_iface;
...@@ -38,9 +50,13 @@ struct WindowsMediaPlayer { ...@@ -38,9 +50,13 @@ struct WindowsMediaPlayer {
IOleClientSite *client_site; IOleClientSite *client_site;
HWND hwnd; HWND hwnd;
SIZEL extent; SIZEL extent;
ConnectionPoint *wmpocx;
}; };
void init_player_ifaces(WindowsMediaPlayer*) DECLSPEC_HIDDEN; void init_player_ifaces(WindowsMediaPlayer*) DECLSPEC_HIDDEN;
void ConnectionPointContainer_Init(WindowsMediaPlayer *wmp) DECLSPEC_HIDDEN;
void ConnectionPointContainer_Destroy(WindowsMediaPlayer *wmp) DECLSPEC_HIDDEN;
HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment