Commit b3f064cc authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

Fixed error handling in Graphbuilder_RenderFile.

Improved traces.
parent 921be0a8
...@@ -717,10 +717,11 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_QueryInterface( ...@@ -717,10 +717,11 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_QueryInterface(
static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(LPENUMMONIKER iface) static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(LPENUMMONIKER iface)
{ {
EnumMonikerImpl *This = (EnumMonikerImpl *)iface; EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("\n"); TRACE("(%p)->() AddRef from %ld\n", iface, ref - 1);
return InterlockedIncrement(&This->ref); return ref;
} }
/********************************************************************** /**********************************************************************
...@@ -729,17 +730,18 @@ static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(LPENUMMONIKER iface) ...@@ -729,17 +730,18 @@ static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(LPENUMMONIKER iface)
static ULONG WINAPI DEVENUM_IEnumMoniker_Release(LPENUMMONIKER iface) static ULONG WINAPI DEVENUM_IEnumMoniker_Release(LPENUMMONIKER iface)
{ {
EnumMonikerImpl *This = (EnumMonikerImpl *)iface; EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("\n"); TRACE("(%p)->() Release from %ld\n", iface, ref + 1);
if (!InterlockedDecrement(&This->ref)) if (!ref)
{ {
RegCloseKey(This->hkey); RegCloseKey(This->hkey);
CoTaskMemFree(This); CoTaskMemFree(This);
DEVENUM_UnlockModule(); DEVENUM_UnlockModule();
return 0; return 0;
} }
return This->ref; return ref;
} }
static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(LPENUMMONIKER iface, ULONG celt, IMoniker ** rgelt, ULONG * pceltFetched) static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(LPENUMMONIKER iface, ULONG celt, IMoniker ** rgelt, ULONG * pceltFetched)
...@@ -750,7 +752,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(LPENUMMONIKER iface, ULONG celt, ...@@ -750,7 +752,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(LPENUMMONIKER iface, ULONG celt,
MediaCatMoniker * pMoniker; MediaCatMoniker * pMoniker;
EnumMonikerImpl *This = (EnumMonikerImpl *)iface; EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
TRACE("(%ld, %p, %p)\n", celt, rgelt, pceltFetched); TRACE("(%p)->(%ld, %p, %p)\n", iface, celt, rgelt, pceltFetched);
while (fetched < celt) while (fetched < celt)
{ {
...@@ -789,7 +791,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Skip(LPENUMMONIKER iface, ULONG celt) ...@@ -789,7 +791,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Skip(LPENUMMONIKER iface, ULONG celt)
{ {
EnumMonikerImpl *This = (EnumMonikerImpl *)iface; EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
TRACE("(%ld)\n", celt); TRACE("(%p)->(%ld)\n", iface, celt);
This->index += celt; This->index += celt;
...@@ -800,7 +802,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Reset(LPENUMMONIKER iface) ...@@ -800,7 +802,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Reset(LPENUMMONIKER iface)
{ {
EnumMonikerImpl *This = (EnumMonikerImpl *)iface; EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
TRACE("()\n"); TRACE("(%p)->()\n", iface);
This->index = 0; This->index = 0;
...@@ -809,7 +811,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Reset(LPENUMMONIKER iface) ...@@ -809,7 +811,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Reset(LPENUMMONIKER iface)
static HRESULT WINAPI DEVENUM_IEnumMoniker_Clone(LPENUMMONIKER iface, IEnumMoniker ** ppenum) static HRESULT WINAPI DEVENUM_IEnumMoniker_Clone(LPENUMMONIKER iface, IEnumMoniker ** ppenum)
{ {
FIXME("(%p): stub\n", ppenum); FIXME("(%p)->(%p): stub\n", iface, ppenum);
return E_NOTIMPL; return E_NOTIMPL;
} }
......
...@@ -106,12 +106,15 @@ static HRESULT WINAPI EnumMonikerImpl_QueryInterface( ...@@ -106,12 +106,15 @@ static HRESULT WINAPI EnumMonikerImpl_QueryInterface(
static ULONG WINAPI EnumMonikerImpl_AddRef(LPENUMMONIKER iface) static ULONG WINAPI EnumMonikerImpl_AddRef(LPENUMMONIKER iface)
{ {
EnumMonikerImpl *This = (EnumMonikerImpl *)iface; EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
ULONG ref;
TRACE("\n");
if (This == NULL) return E_POINTER; if (This == NULL) return E_POINTER;
return InterlockedIncrement(&This->ref); ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->() AddRef from %ld\n", iface, ref - 1);
return ref;
} }
/********************************************************************** /**********************************************************************
...@@ -122,7 +125,7 @@ static ULONG WINAPI EnumMonikerImpl_Release(LPENUMMONIKER iface) ...@@ -122,7 +125,7 @@ static ULONG WINAPI EnumMonikerImpl_Release(LPENUMMONIKER iface)
EnumMonikerImpl *This = (EnumMonikerImpl *)iface; EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("\n"); TRACE("(%p)->() Release from %ld\n", iface, ref + 1);
if (!ref) if (!ref)
{ {
...@@ -139,7 +142,7 @@ static HRESULT WINAPI EnumMonikerImpl_Next(LPENUMMONIKER iface, ULONG celt, IMon ...@@ -139,7 +142,7 @@ static HRESULT WINAPI EnumMonikerImpl_Next(LPENUMMONIKER iface, ULONG celt, IMon
ULONG fetched; ULONG fetched;
EnumMonikerImpl *This = (EnumMonikerImpl *)iface; EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
TRACE("(%ld, %p, %p)\n", celt, rgelt, pceltFetched); TRACE("(%p)->(%ld, %p, %p)\n", iface, celt, rgelt, pceltFetched);
for (fetched = 0; (This->index + fetched < This->nMonikerCount) && (fetched < celt); fetched++) for (fetched = 0; (This->index + fetched < This->nMonikerCount) && (fetched < celt); fetched++)
{ {
...@@ -149,6 +152,8 @@ static HRESULT WINAPI EnumMonikerImpl_Next(LPENUMMONIKER iface, ULONG celt, IMon ...@@ -149,6 +152,8 @@ static HRESULT WINAPI EnumMonikerImpl_Next(LPENUMMONIKER iface, ULONG celt, IMon
This->index += fetched; This->index += fetched;
TRACE("-- fetched %ld\n", fetched);
if (pceltFetched) if (pceltFetched)
*pceltFetched = fetched; *pceltFetched = fetched;
...@@ -162,7 +167,7 @@ static HRESULT WINAPI EnumMonikerImpl_Skip(LPENUMMONIKER iface, ULONG celt) ...@@ -162,7 +167,7 @@ static HRESULT WINAPI EnumMonikerImpl_Skip(LPENUMMONIKER iface, ULONG celt)
{ {
EnumMonikerImpl *This = (EnumMonikerImpl *)iface; EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
TRACE("(%ld)\n", celt); TRACE("(%p)->(%ld)\n", iface, celt);
This->index += celt; This->index += celt;
...@@ -173,7 +178,7 @@ static HRESULT WINAPI EnumMonikerImpl_Reset(LPENUMMONIKER iface) ...@@ -173,7 +178,7 @@ static HRESULT WINAPI EnumMonikerImpl_Reset(LPENUMMONIKER iface)
{ {
EnumMonikerImpl *This = (EnumMonikerImpl *)iface; EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
TRACE("()\n"); TRACE("(%p)->()\n", iface);
This->index = 0; This->index = 0;
...@@ -182,7 +187,7 @@ static HRESULT WINAPI EnumMonikerImpl_Reset(LPENUMMONIKER iface) ...@@ -182,7 +187,7 @@ static HRESULT WINAPI EnumMonikerImpl_Reset(LPENUMMONIKER iface)
static HRESULT WINAPI EnumMonikerImpl_Clone(LPENUMMONIKER iface, IEnumMoniker ** ppenum) static HRESULT WINAPI EnumMonikerImpl_Clone(LPENUMMONIKER iface, IEnumMoniker ** ppenum)
{ {
FIXME("(%p): stub\n", ppenum); FIXME("(%p)->(%p): stub\n", iface, ppenum);
return E_NOTIMPL; return E_NOTIMPL;
} }
......
...@@ -875,7 +875,10 @@ static HRESULT WINAPI Graphbuilder_RenderFile(IGraphBuilder *iface, ...@@ -875,7 +875,10 @@ static HRESULT WINAPI Graphbuilder_RenderFile(IGraphBuilder *iface,
tab[0] = mt.majortype; tab[0] = mt.majortype;
tab[1] = mt.subtype; tab[1] = mt.subtype;
hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, 0, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL); hr = IFilterMapper2_EnumMatchingFilters(This->pFilterMapper2, &pEnumMoniker, 0, FALSE, 0, TRUE, 1, tab, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
} else { }
if (FAILED(hr))
{
if (preader) { if (preader) {
IGraphBuilder_RemoveFilter(iface, preader); IGraphBuilder_RemoveFilter(iface, preader);
IBaseFilter_Release(preader); IBaseFilter_Release(preader);
...@@ -883,6 +886,7 @@ static HRESULT WINAPI Graphbuilder_RenderFile(IGraphBuilder *iface, ...@@ -883,6 +886,7 @@ static HRESULT WINAPI Graphbuilder_RenderFile(IGraphBuilder *iface,
return hr; return hr;
} }
hr = E_FAIL;
while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK) while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) == S_OK)
{ {
VARIANT var; VARIANT var;
......
...@@ -950,6 +950,15 @@ static HRESULT WINAPI FilterMapper2_EnumMatchingFilters( ...@@ -950,6 +950,15 @@ static HRESULT WINAPI FilterMapper2_EnumMatchingFilters(
hrSub = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBag); hrSub = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBag);
if (TRACE_ON(quartz))
{
VARIANT temp;
V_VT(&temp) = VT_EMPTY;
IPropertyBag_Read(pPropBag, wszFriendlyName, &temp, NULL);
TRACE("Considering filter %s\n", debugstr_w(V_UNION(&temp, bstrVal)));
VariantClear(&temp);
}
if (SUCCEEDED(hrSub)) if (SUCCEEDED(hrSub))
hrSub = FM2_ReadFilterData(pPropBag, &rf2); hrSub = FM2_ReadFilterData(pPropBag, &rf2);
......
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