[PATCH 1/3] oleaut32: Finish COM cleanup for ITypeInfo objects
Andrew Eikum
aeikum at codeweavers.com
Thu May 9 15:23:12 CDT 2013
---
dlls/oleaut32/typelib.c | 90 +++++++++++++++++++++++++++----------------------
1 file changed, 50 insertions(+), 40 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index f13024e..b20d587 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -1128,6 +1128,16 @@ static inline ITypeInfoImpl *info_impl_from_ITypeComp( ITypeComp *iface )
return CONTAINING_RECORD(iface, ITypeInfoImpl, ITypeComp_iface);
}
+static inline ITypeInfoImpl *impl_from_ITypeInfo2( ITypeInfo2 *iface )
+{
+ return CONTAINING_RECORD(iface, ITypeInfoImpl, ITypeInfo2_iface);
+}
+
+static inline ITypeInfoImpl *impl_from_ITypeInfo( ITypeInfo *iface )
+{
+ return impl_from_ITypeInfo2((ITypeInfo2*)iface);
+}
+
static const ITypeInfo2Vtbl tinfvt;
static const ITypeCompVtbl tcompvt;
@@ -5065,7 +5075,7 @@ static HRESULT WINAPI ITypeInfo_fnQueryInterface(
REFIID riid,
VOID **ppvObject)
{
- ITypeLibImpl *This = (ITypeLibImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TRACE("(%p)->(IID: %s)\n",This,debugstr_guid(riid));
@@ -5088,7 +5098,7 @@ static HRESULT WINAPI ITypeInfo_fnQueryInterface(
*/
static ULONG WINAPI ITypeInfo_fnAddRef( ITypeInfo2 *iface)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->ref is %u\n",This, ref);
@@ -5170,7 +5180,7 @@ static void ITypeInfoImpl_Destroy(ITypeInfoImpl *This)
*/
static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%u)\n",This, ref);
@@ -5196,7 +5206,7 @@ static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface,
LPTYPEATTR *ppTypeAttr)
{
- const ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
SIZE_T size;
TRACE("(%p)\n",This);
@@ -5234,7 +5244,7 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface,
static HRESULT WINAPI ITypeInfo_fnGetTypeComp( ITypeInfo2 *iface,
ITypeComp * *ppTComp)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TRACE("(%p)->(%p)\n", This, ppTComp);
@@ -5367,7 +5377,7 @@ static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_pt
HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, const FUNCDESC **ppFuncDesc )
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo(iface);
if (index >= This->TypeAttr.cFuncs)
return TYPE_E_ELEMENTNOTFOUND;
@@ -5381,7 +5391,7 @@ HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, const F
static HRESULT ITypeInfoImpl_GetInternalDispatchFuncDesc( ITypeInfo *iface,
UINT index, const FUNCDESC **ppFuncDesc, UINT *funcs, UINT *hrefoffset)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo(iface);
HRESULT hr;
UINT implemented_funcs = 0;
@@ -5461,7 +5471,7 @@ static inline void ITypeInfoImpl_FuncDescAddHrefOffset( LPFUNCDESC pFuncDesc, UI
static HRESULT WINAPI ITypeInfo_fnGetFuncDesc( ITypeInfo2 *iface, UINT index,
LPFUNCDESC *ppFuncDesc)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
const FUNCDESC *internal_funcdesc;
HRESULT hr;
UINT hrefoffset = 0;
@@ -5554,7 +5564,7 @@ static HRESULT TLB_AllocAndInitVarDesc( const VARDESC *src, VARDESC **dest_ptr )
static HRESULT WINAPI ITypeInfo_fnGetVarDesc( ITypeInfo2 *iface, UINT index,
LPVARDESC *ppVarDesc)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
const TLBVarDesc *pVDesc = &This->vardescs[index];
TRACE("(%p) index %d\n", This, index);
@@ -5574,7 +5584,7 @@ static HRESULT WINAPI ITypeInfo_fnGetVarDesc( ITypeInfo2 *iface, UINT index,
static HRESULT WINAPI ITypeInfo_fnGetNames( ITypeInfo2 *iface, MEMBERID memid,
BSTR *rgBstrNames, UINT cMaxNames, UINT *pcNames)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
const TLBFuncDesc *pFDesc;
const TLBVarDesc *pVDesc;
int i;
@@ -5641,7 +5651,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeOfImplType(
UINT index,
HREFTYPE *pRefType)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
HRESULT hr = S_OK;
TRACE("(%p) index %d\n", This, index);
@@ -5695,7 +5705,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeOfImplType(
static HRESULT WINAPI ITypeInfo_fnGetImplTypeFlags( ITypeInfo2 *iface,
UINT index, INT *pImplTypeFlags)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TRACE("(%p) index %d\n", This, index);
@@ -5719,7 +5729,7 @@ static HRESULT WINAPI ITypeInfo_fnGetImplTypeFlags( ITypeInfo2 *iface,
static HRESULT WINAPI ITypeInfo_fnGetIDsOfNames( ITypeInfo2 *iface,
LPOLESTR *rgszNames, UINT cNames, MEMBERID *pMemId)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
const TLBVarDesc *pVDesc;
HRESULT ret=S_OK;
UINT i, fdc;
@@ -6317,7 +6327,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
EXCEPINFO *pExcepInfo,
UINT *pArgErr)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
int i;
unsigned int var_index;
TYPEKIND type_kind;
@@ -6848,7 +6858,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDocumentation( ITypeInfo2 *iface,
MEMBERID memid, BSTR *pBstrName, BSTR *pBstrDocString,
DWORD *pdwHelpContext, BSTR *pBstrHelpFile)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
const TLBFuncDesc *pFDesc;
const TLBVarDesc *pVDesc;
TRACE("(%p) memid %d Name(%p) DocString(%p)"
@@ -6915,7 +6925,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDllEntry( ITypeInfo2 *iface, MEMBERID memid
INVOKEKIND invKind, BSTR *pBstrDllName, BSTR *pBstrName,
WORD *pwOrdinal)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
const TLBFuncDesc *pFDesc;
TRACE("(%p)->(memid %x, %d, %p, %p, %p)\n", This, memid, invKind, pBstrDllName, pBstrName, pwOrdinal);
@@ -6957,7 +6967,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDllEntry( ITypeInfo2 *iface, MEMBERID memid
static HRESULT ITypeInfoImpl_GetDispatchRefTypeInfo( ITypeInfo *iface,
HREFTYPE *hRefType, ITypeInfo **ppTInfo)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo(iface);
HRESULT hr;
TRACE("%p, 0x%x\n", iface, *hRefType);
@@ -6994,7 +7004,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo(
HREFTYPE hRefType,
ITypeInfo **ppTInfo)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
HRESULT result = E_FAIL;
if ((This->hreftype != -1) && (This->hreftype == hRefType))
@@ -7107,7 +7117,7 @@ end:
static HRESULT WINAPI ITypeInfo_fnAddressOfMember( ITypeInfo2 *iface,
MEMBERID memid, INVOKEKIND invKind, PVOID *ppv)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
HRESULT hr;
BSTR dll, entry;
WORD ordinal;
@@ -7166,7 +7176,7 @@ static HRESULT WINAPI ITypeInfo_fnAddressOfMember( ITypeInfo2 *iface,
static HRESULT WINAPI ITypeInfo_fnCreateInstance( ITypeInfo2 *iface,
IUnknown *pOuterUnk, REFIID riid, VOID **ppvObj)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
HRESULT hr;
TYPEATTR *pTA;
@@ -7220,7 +7230,7 @@ end:
static HRESULT WINAPI ITypeInfo_fnGetMops( ITypeInfo2 *iface, MEMBERID memid,
BSTR *pBstrMops)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
FIXME("(%p %d) stub!\n", This, memid);
*pBstrMops = NULL;
return S_OK;
@@ -7234,7 +7244,7 @@ static HRESULT WINAPI ITypeInfo_fnGetMops( ITypeInfo2 *iface, MEMBERID memid,
static HRESULT WINAPI ITypeInfo_fnGetContainingTypeLib( ITypeInfo2 *iface,
ITypeLib * *ppTLib, UINT *pIndex)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
/* If a pointer is null, we simply ignore it, the ATL in particular passes pIndex as 0 */
if (pIndex) {
@@ -7259,7 +7269,7 @@ static HRESULT WINAPI ITypeInfo_fnGetContainingTypeLib( ITypeInfo2 *iface,
static void WINAPI ITypeInfo_fnReleaseTypeAttr( ITypeInfo2 *iface,
TYPEATTR* pTypeAttr)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TRACE("(%p)->(%p)\n", This, pTypeAttr);
heap_free(pTypeAttr);
}
@@ -7272,7 +7282,7 @@ static void WINAPI ITypeInfo_fnReleaseFuncDesc(
ITypeInfo2 *iface,
FUNCDESC *pFuncDesc)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
SHORT i;
TRACE("(%p)->(%p)\n", This, pFuncDesc);
@@ -7291,7 +7301,7 @@ static void WINAPI ITypeInfo_fnReleaseFuncDesc(
static void WINAPI ITypeInfo_fnReleaseVarDesc( ITypeInfo2 *iface,
VARDESC *pVarDesc)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TRACE("(%p)->(%p)\n", This, pVarDesc);
TLB_FreeElemDesc(&pVarDesc->elemdescVar);
@@ -7308,7 +7318,7 @@ static void WINAPI ITypeInfo_fnReleaseVarDesc( ITypeInfo2 *iface,
static HRESULT WINAPI ITypeInfo2_fnGetTypeKind( ITypeInfo2 * iface,
TYPEKIND *pTypeKind)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
*pTypeKind=This->TypeAttr.typekind;
TRACE("(%p) type 0x%0x\n", This,*pTypeKind);
return S_OK;
@@ -7323,7 +7333,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetTypeKind( ITypeInfo2 * iface,
*/
static HRESULT WINAPI ITypeInfo2_fnGetTypeFlags( ITypeInfo2 *iface, ULONG *pTypeFlags)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
*pTypeFlags=This->TypeAttr.wTypeFlags;
TRACE("(%p) flags 0x%x\n", This,*pTypeFlags);
return S_OK;
@@ -7337,7 +7347,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetTypeFlags( ITypeInfo2 *iface, ULONG *pType
static HRESULT WINAPI ITypeInfo2_fnGetFuncIndexOfMemId( ITypeInfo2 * iface,
MEMBERID memid, INVOKEKIND invKind, UINT *pFuncIndex)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
UINT fdc;
HRESULT result;
@@ -7366,7 +7376,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncIndexOfMemId( ITypeInfo2 * iface,
static HRESULT WINAPI ITypeInfo2_fnGetVarIndexOfMemId( ITypeInfo2 * iface,
MEMBERID memid, UINT *pVarIndex)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TLBVarDesc *pVarInfo;
TRACE("%p %d %p\n", iface, memid, pVarIndex);
@@ -7389,7 +7399,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetCustData(
REFGUID guid,
VARIANT *pVarVal)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TLBCustData *pCData;
TRACE("%p %s %p\n", This, debugstr_guid(guid), pVarVal);
@@ -7414,7 +7424,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncCustData(
REFGUID guid,
VARIANT *pVarVal)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TLBCustData *pCData;
TLBFuncDesc *pFDesc = &This->funcdescs[index];
@@ -7444,7 +7454,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetParamCustData(
REFGUID guid,
VARIANT *pVarVal)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TLBCustData *pCData;
TLBFuncDesc *pFDesc = &This->funcdescs[indexFunc];
@@ -7477,7 +7487,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetVarCustData(
REFGUID guid,
VARIANT *pVarVal)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TLBCustData *pCData;
TLBVarDesc *pVDesc = &This->vardescs[index];
@@ -7506,7 +7516,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetImplTypeCustData(
REFGUID guid,
VARIANT *pVarVal)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TLBCustData *pCData;
TLBImplType *pRDesc = &This->impltypes[index];
@@ -7540,7 +7550,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetDocumentation2(
DWORD *pdwHelpStringContext,
BSTR *pbstrHelpStringDll)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
const TLBFuncDesc *pFDesc;
const TLBVarDesc *pVDesc;
TRACE("(%p) memid %d lcid(0x%x) HelpString(%p) "
@@ -7596,7 +7606,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllCustData(
ITypeInfo2 * iface,
CUSTDATA *pCustData)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TRACE("%p %p\n", This, pCustData);
@@ -7613,7 +7623,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllFuncCustData(
UINT index,
CUSTDATA *pCustData)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TLBFuncDesc *pFDesc = &This->funcdescs[index];
TRACE("%p %u %p\n", This, index, pCustData);
@@ -7632,7 +7642,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllFuncCustData(
static HRESULT WINAPI ITypeInfo2_fnGetAllParamCustData( ITypeInfo2 * iface,
UINT indexFunc, UINT indexParam, CUSTDATA *pCustData)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TLBFuncDesc *pFDesc = &This->funcdescs[indexFunc];
TRACE("%p %u %u %p\n", This, indexFunc, indexParam, pCustData);
@@ -7654,7 +7664,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllParamCustData( ITypeInfo2 * iface,
static HRESULT WINAPI ITypeInfo2_fnGetAllVarCustData( ITypeInfo2 * iface,
UINT index, CUSTDATA *pCustData)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TLBVarDesc * pVDesc = &This->vardescs[index];
TRACE("%p %u %p\n", This, index, pCustData);
@@ -7675,7 +7685,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllImplTypeCustData(
UINT index,
CUSTDATA *pCustData)
{
- ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
+ ITypeInfoImpl *This = impl_from_ITypeInfo2(iface);
TLBImplType *pRDesc = &This->impltypes[index];
TRACE("%p %u %p\n", This, index, pCustData);
--
1.8.2.2
More information about the wine-patches
mailing list