devenum: COM cleanup for IMoniker (MediaCatMoniker).
This commit is contained in:
parent
201b72e8b6
commit
25aa60b33c
|
@ -72,7 +72,7 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
const IMonikerVtbl *lpVtbl;
|
||||
IMoniker IMoniker_iface;
|
||||
LONG ref;
|
||||
HKEY hkey;
|
||||
} MediaCatMoniker;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(devenum);
|
||||
|
||||
static ULONG WINAPI DEVENUM_IMediaCatMoniker_AddRef(LPMONIKER iface);
|
||||
static ULONG WINAPI DEVENUM_IPropertyBag_AddRef(LPPROPERTYBAG iface);
|
||||
|
||||
typedef struct
|
||||
|
@ -298,53 +297,51 @@ static HRESULT DEVENUM_IPropertyBag_Construct(HANDLE hkey, IPropertyBag **ppBag)
|
|||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_QueryInterface(
|
||||
LPMONIKER iface,
|
||||
REFIID riid,
|
||||
LPVOID *ppvObj)
|
||||
static inline MediaCatMoniker *impl_from_IMoniker(IMoniker *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, MediaCatMoniker, IMoniker_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_QueryInterface(IMoniker *iface, REFIID riid,
|
||||
void **ppv)
|
||||
{
|
||||
MediaCatMoniker *This = (MediaCatMoniker *)iface;
|
||||
TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
|
||||
|
||||
if (This == NULL || ppvObj == NULL) return E_POINTER;
|
||||
|
||||
*ppvObj = NULL;
|
||||
if (!ppv)
|
||||
return E_POINTER;
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
||||
IsEqualGUID(riid, &IID_IPersist) ||
|
||||
IsEqualGUID(riid, &IID_IPersistStream) ||
|
||||
IsEqualGUID(riid, &IID_IMoniker))
|
||||
{
|
||||
*ppvObj = iface;
|
||||
DEVENUM_IMediaCatMoniker_AddRef(iface);
|
||||
*ppv = iface;
|
||||
IMoniker_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
FIXME("- no interface IID: %s\n", debugstr_guid(riid));
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* DEVENUM_IMediaCatMoniker_AddRef (also IUnknown)
|
||||
*/
|
||||
static ULONG WINAPI DEVENUM_IMediaCatMoniker_AddRef(LPMONIKER iface)
|
||||
static ULONG WINAPI DEVENUM_IMediaCatMoniker_AddRef(IMoniker *iface)
|
||||
{
|
||||
MediaCatMoniker *This = (MediaCatMoniker *)iface;
|
||||
TRACE("\n");
|
||||
MediaCatMoniker *This = impl_from_IMoniker(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
return InterlockedIncrement(&This->ref);
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* DEVENUM_IMediaCatMoniker_Release (also IUnknown)
|
||||
*/
|
||||
static ULONG WINAPI DEVENUM_IMediaCatMoniker_Release(LPMONIKER iface)
|
||||
static ULONG WINAPI DEVENUM_IMediaCatMoniker_Release(IMoniker *iface)
|
||||
{
|
||||
MediaCatMoniker *This = (MediaCatMoniker *)iface;
|
||||
ULONG ref;
|
||||
TRACE("\n");
|
||||
MediaCatMoniker *This = impl_from_IMoniker(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
ref = InterlockedDecrement(&This->ref);
|
||||
if (ref == 0) {
|
||||
RegCloseKey(This->hkey);
|
||||
CoTaskMemFree(This);
|
||||
|
@ -353,11 +350,10 @@ static ULONG WINAPI DEVENUM_IMediaCatMoniker_Release(LPMONIKER iface)
|
|||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetClassID(
|
||||
LPMONIKER iface,
|
||||
CLSID* pClassID)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetClassID(IMoniker *iface, CLSID *pClassID)
|
||||
{
|
||||
MediaCatMoniker *This = (MediaCatMoniker *)iface;
|
||||
MediaCatMoniker *This = impl_from_IMoniker(iface);
|
||||
|
||||
FIXME("(%p)->(%p): stub\n", This, pClassID);
|
||||
|
||||
if (pClassID == NULL)
|
||||
|
@ -366,30 +362,28 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetClassID(
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsDirty(LPMONIKER iface)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsDirty(IMoniker *iface)
|
||||
{
|
||||
FIXME("(%p)->(): stub\n", iface);
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Load(LPMONIKER iface, IStream* pStm)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Load(IMoniker *iface, IStream *pStm)
|
||||
{
|
||||
FIXME("(%p)->(%p): stub\n", iface, pStm);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Save(LPMONIKER iface, IStream* pStm, BOOL fClearDirty)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
|
||||
{
|
||||
FIXME("(%p)->(%p, %s): stub\n", iface, pStm, fClearDirty ? "true" : "false");
|
||||
|
||||
return STG_E_CANTSAVE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetSizeMax(
|
||||
LPMONIKER iface,
|
||||
ULARGE_INTEGER* pcbSize)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
|
||||
{
|
||||
FIXME("(%p)->(%p): stub\n", iface, pcbSize);
|
||||
|
||||
|
@ -398,25 +392,19 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetSizeMax(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToObject(
|
||||
LPMONIKER iface,
|
||||
IBindCtx* pbc,
|
||||
IMoniker* pmkToLeft,
|
||||
REFIID riidResult,
|
||||
void** ppvResult)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToObject(IMoniker *iface, IBindCtx *pbc,
|
||||
IMoniker *pmkToLeft, REFIID riidResult, void **ppvResult)
|
||||
{
|
||||
MediaCatMoniker *This = impl_from_IMoniker(iface);
|
||||
IUnknown * pObj = NULL;
|
||||
IPropertyBag * pProp = NULL;
|
||||
CLSID clsID;
|
||||
VARIANT var;
|
||||
HRESULT res = E_FAIL;
|
||||
|
||||
MediaCatMoniker *This = (MediaCatMoniker *)iface;
|
||||
|
||||
VariantInit(&var);
|
||||
|
||||
TRACE("(%p)->(%p, %p, %s, %p)\n", This, pbc, pmkToLeft, debugstr_guid(riidResult), ppvResult);
|
||||
|
||||
VariantInit(&var);
|
||||
*ppvResult = NULL;
|
||||
|
||||
if(pmkToLeft==NULL)
|
||||
|
@ -470,14 +458,11 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToObject(
|
|||
return res;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToStorage(
|
||||
LPMONIKER iface,
|
||||
IBindCtx* pbc,
|
||||
IMoniker* pmkToLeft,
|
||||
REFIID riid,
|
||||
void** ppvObj)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToStorage(IMoniker *iface, IBindCtx *pbc,
|
||||
IMoniker *pmkToLeft, REFIID riid, void **ppvObj)
|
||||
{
|
||||
MediaCatMoniker *This = (MediaCatMoniker *)iface;
|
||||
MediaCatMoniker *This = impl_from_IMoniker(iface);
|
||||
|
||||
TRACE("(%p)->(%p, %p, %s, %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObj);
|
||||
|
||||
*ppvObj = NULL;
|
||||
|
@ -495,12 +480,8 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToStorage(
|
|||
return MK_E_NOSTORAGE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Reduce(
|
||||
LPMONIKER iface,
|
||||
IBindCtx* pbc,
|
||||
DWORD dwReduceHowFar,
|
||||
IMoniker** ppmkToLeft,
|
||||
IMoniker** ppmkReduced)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Reduce(IMoniker *iface, IBindCtx *pbc,
|
||||
DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
|
||||
{
|
||||
TRACE("(%p)->(%p, %d, %p, %p)\n", iface, pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced);
|
||||
|
||||
|
@ -511,11 +492,8 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Reduce(
|
|||
return MK_S_REDUCED_TO_SELF;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_ComposeWith(
|
||||
LPMONIKER iface,
|
||||
IMoniker* pmkRight,
|
||||
BOOL fOnlyIfNotGeneric,
|
||||
IMoniker** ppmkComposite)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
|
||||
BOOL fOnlyIfNotGeneric, IMoniker **ppmkComposite)
|
||||
{
|
||||
FIXME("(%p)->(%p, %s, %p): stub\n", iface, pmkRight, fOnlyIfNotGeneric ? "true" : "false", ppmkComposite);
|
||||
|
||||
|
@ -525,10 +503,8 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_ComposeWith(
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Enum(
|
||||
LPMONIKER iface,
|
||||
BOOL fForward,
|
||||
IEnumMoniker** ppenumMoniker)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Enum(IMoniker *iface, BOOL fForward,
|
||||
IEnumMoniker **ppenumMoniker)
|
||||
{
|
||||
FIXME("(%p)->(%s, %p): stub\n", iface, fForward ? "true" : "false", ppenumMoniker);
|
||||
|
||||
|
@ -537,18 +513,14 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Enum(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsEqual(
|
||||
LPMONIKER iface,
|
||||
IMoniker* pmkOtherMoniker)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
|
||||
{
|
||||
FIXME("(%p)->(%p): stub\n", iface, pmkOtherMoniker);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Hash(
|
||||
LPMONIKER iface,
|
||||
DWORD* pdwHash)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Hash(IMoniker *iface, DWORD *pdwHash)
|
||||
{
|
||||
TRACE("(%p)->(%p)\n", iface, pdwHash);
|
||||
|
||||
|
@ -557,22 +529,16 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Hash(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsRunning(
|
||||
LPMONIKER iface,
|
||||
IBindCtx* pbc,
|
||||
IMoniker* pmkToLeft,
|
||||
IMoniker* pmkNewlyRunning)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsRunning(IMoniker *iface, IBindCtx *pbc,
|
||||
IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning)
|
||||
{
|
||||
FIXME("(%p)->(%p, %p, %p): stub\n", iface, pbc, pmkToLeft, pmkNewlyRunning);
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetTimeOfLastChange(
|
||||
LPMONIKER iface,
|
||||
IBindCtx* pbc,
|
||||
IMoniker* pmkToLeft,
|
||||
FILETIME* pFileTime)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
|
||||
IMoniker *pmkToLeft, FILETIME *pFileTime)
|
||||
{
|
||||
TRACE("(%p)->(%p, %p, %p)\n", iface, pbc, pmkToLeft, pFileTime);
|
||||
|
||||
|
@ -582,9 +548,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetTimeOfLastChange(
|
|||
return MK_E_UNAVAILABLE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Inverse(
|
||||
LPMONIKER iface,
|
||||
IMoniker** ppmk)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Inverse(IMoniker *iface, IMoniker **ppmk)
|
||||
{
|
||||
TRACE("(%p)->(%p)\n", iface, ppmk);
|
||||
|
||||
|
@ -593,10 +557,8 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Inverse(
|
|||
return MK_E_NOINVERSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_CommonPrefixWith(
|
||||
LPMONIKER iface,
|
||||
IMoniker* pmkOtherMoniker,
|
||||
IMoniker** ppmkPrefix)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_CommonPrefixWith(IMoniker *iface,
|
||||
IMoniker *pmkOtherMoniker, IMoniker **ppmkPrefix)
|
||||
{
|
||||
TRACE("(%p)->(%p, %p)\n", iface, pmkOtherMoniker, ppmkPrefix);
|
||||
|
||||
|
@ -605,10 +567,8 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_CommonPrefixWith(
|
|||
return MK_E_NOPREFIX;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_RelativePathTo(
|
||||
LPMONIKER iface,
|
||||
IMoniker* pmkOther,
|
||||
IMoniker** ppmkRelPath)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
|
||||
IMoniker **ppmkRelPath)
|
||||
{
|
||||
TRACE("(%p)->(%p, %p)\n", iface, pmkOther, ppmkRelPath);
|
||||
|
||||
|
@ -617,13 +577,10 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_RelativePathTo(
|
|||
return MK_S_HIM;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetDisplayName(
|
||||
LPMONIKER iface,
|
||||
IBindCtx* pbc,
|
||||
IMoniker* pmkToLeft,
|
||||
LPOLESTR* ppszDisplayName)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
|
||||
IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
|
||||
{
|
||||
MediaCatMoniker *This = (MediaCatMoniker *)iface;
|
||||
MediaCatMoniker *This = impl_from_IMoniker(iface);
|
||||
WCHAR wszBuffer[MAX_PATH];
|
||||
static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
|
||||
LONG received = sizeof(wszFriendlyName);
|
||||
|
@ -643,13 +600,8 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetDisplayName(
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_ParseDisplayName(
|
||||
LPMONIKER iface,
|
||||
IBindCtx* pbc,
|
||||
IMoniker* pmkToLeft,
|
||||
LPOLESTR pszDisplayName,
|
||||
ULONG* pchEaten,
|
||||
IMoniker** ppmkOut)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
|
||||
IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
|
||||
{
|
||||
FIXME("(%p)->(%p, %p, %s, %p, %p)\n", iface, pbc, pmkToLeft, debugstr_w(pszDisplayName), pchEaten, ppmkOut);
|
||||
|
||||
|
@ -659,9 +611,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_ParseDisplayName(
|
|||
return MK_E_SYNTAX;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsSystemMoniker(
|
||||
LPMONIKER iface,
|
||||
DWORD* pdwMksys)
|
||||
static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
|
||||
{
|
||||
TRACE("(%p)->(%p)\n", iface, pdwMksys);
|
||||
|
||||
|
@ -702,11 +652,11 @@ MediaCatMoniker * DEVENUM_IMediaCatMoniker_Construct(void)
|
|||
if (!pMoniker)
|
||||
return NULL;
|
||||
|
||||
pMoniker->lpVtbl = &IMoniker_Vtbl;
|
||||
pMoniker->IMoniker_iface.lpVtbl = &IMoniker_Vtbl;
|
||||
pMoniker->ref = 0;
|
||||
pMoniker->hkey = NULL;
|
||||
|
||||
DEVENUM_IMediaCatMoniker_AddRef((LPMONIKER)pMoniker);
|
||||
DEVENUM_IMediaCatMoniker_AddRef(&pMoniker->IMoniker_iface);
|
||||
|
||||
DEVENUM_LockModule();
|
||||
|
||||
|
@ -790,10 +740,10 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt,
|
|||
|
||||
if (RegOpenKeyW(This->hkey, buffer, &pMoniker->hkey) != ERROR_SUCCESS)
|
||||
{
|
||||
DEVENUM_IMediaCatMoniker_Release((LPMONIKER)pMoniker);
|
||||
IMoniker_Release(&pMoniker->IMoniker_iface);
|
||||
break;
|
||||
}
|
||||
rgelt[fetched] = (LPMONIKER)pMoniker;
|
||||
rgelt[fetched] = &pMoniker->IMoniker_iface;
|
||||
fetched++;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,10 +136,10 @@ static HRESULT WINAPI DEVENUM_IParseDisplayName_ParseDisplayName(
|
|||
strcatW(wszRegKeyName, pszBetween);
|
||||
|
||||
if (RegCreateKeyW(hbasekey, wszRegKeyName, &pMoniker->hkey) == ERROR_SUCCESS)
|
||||
*ppmkOut = (LPMONIKER)pMoniker;
|
||||
*ppmkOut = &pMoniker->IMoniker_iface;
|
||||
else
|
||||
{
|
||||
IMoniker_Release((LPMONIKER)pMoniker);
|
||||
IMoniker_Release(&pMoniker->IMoniker_iface);
|
||||
res = MK_E_NOOBJECT;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue