HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory *iface, IUnknown *outer,
REFIID riid, void **ppv)
{
@@ -941,22 +894,25 @@ HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory *iface, IUnknown *outer,
wmp->IProvideClassInfo2_iface.lpVtbl = &ProvideClassInfo2Vtbl;
wmp->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl;
wmp->IOleInPlaceObjectWindowless_iface.lpVtbl = &OleInPlaceObjectWindowlessVtbl;
- wmp->IConnectionPointContainer_iface.lpVtbl = &ConnectionPointContainerVtbl;
wmp->IOleControl_iface.lpVtbl = &OleControlVtbl;
wmp->ref = 1;
- init_player_ifaces(wmp);
-
- hdc = GetDC(0);
- dpi_x = GetDeviceCaps(hdc, LOGPIXELSX);
- dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(0, hdc);
+ hres = init_player(wmp);
+ if (hres == S_OK) {
+ ConnectionPointContainer_Init(wmp);
+ hdc = GetDC(0);
+ dpi_x = GetDeviceCaps(hdc, LOGPIXELSX);
+ dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
+ ReleaseDC(0, hdc);
- wmp->extent.cx = MulDiv(192, 2540, dpi_x);
- wmp->extent.cy = MulDiv(192, 2540, dpi_y);
+ wmp->extent.cx = MulDiv(192, 2540, dpi_x);
+ wmp->extent.cy = MulDiv(192, 2540, dpi_y);
- hres = IOleObject_QueryInterface(&wmp->IOleObject_iface, riid, ppv);
- IOleObject_Release(&wmp->IOleObject_iface);
+ hres = IOleObject_QueryInterface(&wmp->IOleObject_iface, riid, ppv);
+ IOleObject_Release(&wmp->IOleObject_iface);
+ }
+ if(hres != S_OK)
+ destroy_player(wmp);
return hres;