*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* --------------------------------------------------------------------------------------
* Known problems:
#include <stdio.h>
#include <ctype.h>
+#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
+
#include "winerror.h"
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
-#include "winreg.h"
#include "winuser.h"
#include "wine/unicode.h"
#include "objbase.h"
-#include "heap.h"
-#include "ole2disp.h"
#include "typelib.h"
#include "wine/debug.h"
-#include "variant.h"
WINE_DEFAULT_DEBUG_CHANNEL(typelib2);
/* WINE_DEFAULT_DEBUG_CHANNEL(ole); */
int guid;
LCID lcid;
int version;
- char filename[0]; /* preceeded by two bytes of encoded (length << 2) + flags in the low two bits. */
+ char filename[0]; /* preceded by two bytes of encoded (length << 2) + flags in the low two bits. */
} MSFT_ImpFile;
typedef struct tagICreateTypeLib2Impl
{
- ICOM_VFIELD(ICreateTypeLib2);
- ICOM_VTABLE(ITypeLib2) *lpVtblTypeLib2;
+ const ICreateTypeLib2Vtbl *lpVtbl;
+ const ITypeLib2Vtbl *lpVtblTypeLib2;
- UINT ref;
+ LONG ref;
WCHAR *filename;
struct tagICreateTypeInfo2Impl *last_typeinfo;
} ICreateTypeLib2Impl;
-#define _ITypeLib2_Offset(impl) ((int)(&(((impl*)0)->lpVtblTypeLib2)))
-#define ICOM_THIS_From_ITypeLib2(impl, iface) impl* This = (impl*)(((char*)iface)-_ITypeLib2_Offset(impl))
+static inline ICreateTypeLib2Impl *impl_from_ITypeLib2( ITypeLib2 *iface )
+{
+ return (ICreateTypeLib2Impl *)((char*)iface - FIELD_OFFSET(ICreateTypeLib2Impl, lpVtblTypeLib2));
+}
typedef struct tagICreateTypeInfo2Impl
{
- ICOM_VFIELD(ICreateTypeInfo2);
- ICOM_VTABLE(ITypeInfo2) *lpVtblTypeInfo2;
+ const ICreateTypeInfo2Vtbl *lpVtbl;
+ const ITypeInfo2Vtbl *lpVtblTypeInfo2;
- UINT ref;
+ LONG ref;
ICreateTypeLib2Impl *typelib;
MSFT_TypeInfoBase *typeinfo;
struct tagICreateTypeInfo2Impl *next_typeinfo;
} ICreateTypeInfo2Impl;
-#define _ITypeInfo2_Offset(impl) ((int)(&(((impl*)0)->lpVtblTypeInfo2)))
-#define ICOM_THIS_From_ITypeInfo2(impl, iface) impl* This = (impl*)(((char*)iface)-_ITypeInfo2_Offset(impl))
+static inline ICreateTypeInfo2Impl *impl_from_ITypeInfo2( ITypeInfo2 *iface )
+{
+ return (ICreateTypeInfo2Impl *)((char*)iface - FIELD_OFFSET(ICreateTypeInfo2Impl, lpVtblTypeInfo2));
+}
static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface);
This->typelib_header.res44 = 0x20;
This->typelib_header.res48 = 0x80;
This->typelib_header.dispatchpos = -1;
- This->typelib_header.res50 = 0;
+ This->typelib_header.nimpinfos = 0;
}
/****************************************************************************
hash = 0;
for (i = 0; i < 8; i ++) {
- hash ^= ((short *)guid)[i];
+ hash ^= ((const short *)guid)[i];
}
- return (hash & 0xf) | ((hash & 0x10) & (0 - !!(hash & 0xe0)));
+ return hash & 0x1f;
}
/****************************************************************************
}
}
+ impinfo->flags |= This->typelib_header.nimpinfos++;
+
offset = ctl2_alloc_segment(This, MSFT_SEG_IMPORTINFO, sizeof(MSFT_ImpInfo), 0);
if (offset == -1) return -1;
break;
case VT_CARRAY:
+ {
/* FIXME: Make with the error checking. */
- FIXME("Array vartype, hacking badly.\n");
+ int num_dims = tdesc->u.lpadesc->cDims, elements = 1, dim;
ctl2_encode_typedesc(This, &tdesc->u.lpadesc->tdescElem, &target_type, width, alignment, NULL);
- arrayoffset = ctl2_alloc_segment(This, MSFT_SEG_ARRAYDESC, 16, 0);
+ arrayoffset = ctl2_alloc_segment(This, MSFT_SEG_ARRAYDESC, (2 + 2 * num_dims) * sizeof(int), 0);
arraydata = (void *)&This->typelib_segment_data[MSFT_SEG_ARRAYDESC][arrayoffset];
arraydata[0] = target_type;
- arraydata[1] = 0x00080001;
- arraydata[2] = 0x8;
- arraydata[3] = 0;
-
+ arraydata[1] = num_dims;
+ arraydata[1] |= ((num_dims * 2 * sizeof(int)) << 16);
+ arraydata += 2;
+
+ for(dim = 0; dim < num_dims; dim++) {
+ arraydata[0] = tdesc->u.lpadesc->rgbounds[dim].cElements;
+ arraydata[1] = tdesc->u.lpadesc->rgbounds[dim].lLbound;
+ elements *= tdesc->u.lpadesc->rgbounds[dim].cElements;
+ arraydata += 2;
+ }
typeoffset = ctl2_alloc_segment(This, MSFT_SEG_TYPEDESC, 8, 0);
typedata = (void *)&This->typelib_segment_data[MSFT_SEG_TYPEDESC][typeoffset];
typedata[1] = arrayoffset;
*encoded_tdesc = typeoffset;
- *width = 8;
- *alignment = 1;
- *decoded_size = sizeof(ARRAYDESC);
+ *width = *width * elements;
+ *decoded_size = sizeof(ARRAYDESC) + (num_dims - 1) * sizeof(SAFEARRAYBOUND);
break;
-
+ }
case VT_USERDEFINED:
TRACE("USERDEFINED.\n");
for (typeoffset = 0; typeoffset < This->typelib_segdir[MSFT_SEG_TYPEDESC].length; typeoffset += 8) {
REFIID riid,
VOID **ppvObject)
{
- ICOM_THIS( ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
TRACE("(%p)->(IID: %s)\n",This,debugstr_guid(riid));
*/
static ULONG WINAPI ICreateTypeInfo2_fnAddRef(ICreateTypeInfo2 *iface)
{
- ICOM_THIS( ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
+ ULONG ref = InterlockedIncrement(&This->ref);
- TRACE("(%p)->ref was %u\n",This, This->ref);
+ TRACE("(%p)->ref was %u\n",This, ref - 1);
- return ++(This->ref);
+ return ref;
}
/******************************************************************************
*/
static ULONG WINAPI ICreateTypeInfo2_fnRelease(ICreateTypeInfo2 *iface)
{
- ICOM_THIS( ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
+ ULONG ref = InterlockedDecrement(&This->ref);
- --(This->ref);
+ TRACE("(%p)->(%u)\n",This, ref);
- TRACE("(%p)->(%u)\n",This, This->ref);
-
- if (!This->ref) {
+ if (!ref) {
if (This->typelib) {
ICreateTypeLib2_fnRelease((ICreateTypeLib2 *)This->typelib);
This->typelib = NULL;
return 0;
}
- return This->ref;
+ return ref;
}
*/
static HRESULT WINAPI ICreateTypeInfo2_fnSetGuid(ICreateTypeInfo2 *iface, REFGUID guid)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
MSFT_GuidEntry guidentry;
int offset;
*/
static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeFlags(ICreateTypeInfo2 *iface, UINT uTypeFlags)
{
- ICOM_THIS( ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
TRACE("(%p,0x%x)\n", iface, uTypeFlags);
guidoffset = ctl2_alloc_guid(This->typelib, &foo);
if (guidoffset == -1) return E_OUTOFMEMORY;
- impinfo.res0 = 0x03010000;
+ impinfo.flags = TKIND_INTERFACE << 24 | MSFT_IMPINFO_OFFSET_IS_GUID;
impinfo.oImpFile = fileoffset;
impinfo.oGuid = guidoffset;
ctl2_alloc_importinfo(This->typelib, &impinfo);
This->typelib->typelib_header.dispatchpos = 1;
- This->typelib->typelib_header.res50 = 1;
This->typeinfo->typekind |= 0x10;
This->typeinfo->typekind &= ~0x0f;
ICreateTypeInfo2* iface,
LPOLESTR pStrDoc)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
int offset;
ICreateTypeInfo2* iface,
DWORD dwHelpContext)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
- TRACE("(%p,%ld)\n", iface, dwHelpContext);
+ TRACE("(%p,%d)\n", iface, dwHelpContext);
This->typeinfo->helpcontext = dwHelpContext;
WORD wMajorVerNum,
WORD wMinorVerNum)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
TRACE("(%p,%d,%d)\n", iface, wMajorVerNum, wMinorVerNum);
ITypeInfo* pTInfo,
HREFTYPE* phRefType)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
ITypeLib *container;
- int index;
+ UINT index;
HRESULT res;
TRACE("(%p,%p,%p)\n", iface, pTInfo, phRefType);
UINT index,
FUNCDESC* pFuncDesc)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
int offset;
int *typedata;
int decoded_size;
FIXME("(%p,%d,%p), stub!\n", iface, index, pFuncDesc);
- FIXME("{%ld,%p,%p,%d,%d,%d,%d,%d,%d,%d,{%d},%d}\n", pFuncDesc->memid, pFuncDesc->lprgscode, pFuncDesc->lprgelemdescParam, pFuncDesc->funckind, pFuncDesc->invkind, pFuncDesc->callconv, pFuncDesc->cParams, pFuncDesc->cParamsOpt, pFuncDesc->oVft, pFuncDesc->cScodes, pFuncDesc->elemdescFunc.tdesc.vt, pFuncDesc->wFuncFlags);
+ FIXME("{%d,%p,%p,%d,%d,%d,%d,%d,%d,%d,{%d},%d}\n", pFuncDesc->memid, pFuncDesc->lprgscode, pFuncDesc->lprgelemdescParam, pFuncDesc->funckind, pFuncDesc->invkind, pFuncDesc->callconv, pFuncDesc->cParams, pFuncDesc->cParamsOpt, pFuncDesc->oVft, pFuncDesc->cScodes, pFuncDesc->elemdescFunc.tdesc.vt, pFuncDesc->wFuncFlags);
/* FIXME("{%d, %d}\n", pFuncDesc->lprgelemdescParam[0].tdesc.vt, pFuncDesc->lprgelemdescParam[1].tdesc.vt); */
/* return E_OUTOFMEMORY; */
UINT index,
HREFTYPE hRefType)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
- TRACE("(%p,%d,%ld)\n", iface, index, hRefType);
+ TRACE("(%p,%d,%d)\n", iface, index, hRefType);
if ((This->typeinfo->typekind & 15) == TKIND_COCLASS) {
int offset;
UINT index,
INT implTypeFlags)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
int offset;
MSFT_RefRecord *ref;
ICreateTypeInfo2* iface,
WORD cbAlignment)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
TRACE("(%p,%d)\n", iface, cbAlignment);
UINT index,
VARDESC* pVarDesc)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
int offset;
INT *typedata;
int var_datawidth;
int alignment;
TRACE("(%p,%d,%p), stub!\n", iface, index, pVarDesc);
- TRACE("%ld, %p, %ld, {{%lx, %d}, {%p, %x}}, 0x%x, %d\n", pVarDesc->memid, pVarDesc->lpstrSchema, pVarDesc->u.oInst,
+ TRACE("%d, %p, %d, {{%x, %d}, {%p, %x}}, 0x%x, %d\n", pVarDesc->memid, pVarDesc->lpstrSchema, pVarDesc->u.oInst,
pVarDesc->elemdescVar.tdesc.u.hreftype, pVarDesc->elemdescVar.tdesc.vt,
pVarDesc->elemdescVar.u.paramdesc.pparamdescex, pVarDesc->elemdescVar.u.paramdesc.wParamFlags,
pVarDesc->wVarFlags, pVarDesc->varkind);
LPOLESTR* rgszNames,
UINT cNames)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
int i;
int offset;
UINT index,
LPOLESTR szName)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
int offset;
char *namedata;
ICreateTypeInfo2* iface,
TYPEDESC* pTDescAlias)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
int encoded_typedesc;
int width;
UINT index,
LPOLESTR szDocString)
{
- ICOM_THIS(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
FIXME("(%p,%d,%s), stub!\n", iface, index, debugstr_w(szDocString));
UINT index,
DWORD dwHelpContext)
{
- FIXME("(%p,%d,%ld), stub!\n", iface, index, dwHelpContext);
+ FIXME("(%p,%d,%d), stub!\n", iface, index, dwHelpContext);
return E_OUTOFMEMORY;
}
UINT index,
DWORD dwHelpContext)
{
- FIXME("(%p,%d,%ld), stub!\n", iface, index, dwHelpContext);
+ FIXME("(%p,%d,%d), stub!\n", iface, index, dwHelpContext);
return E_OUTOFMEMORY;
}
MEMBERID memid, /* [I] The member id of the function to delete. */
INVOKEKIND invKind) /* [I] The invocation type of the function to delete. (?) */
{
- FIXME("(%p,%ld,%d), stub!\n", iface, memid, invKind);
+ FIXME("(%p,%d,%d), stub!\n", iface, memid, invKind);
return E_OUTOFMEMORY;
}
ICreateTypeInfo2* iface, /* [I] The typeinfo from which to delete the variable description. */
MEMBERID memid) /* [I] The member id of the variable description to delete. */
{
- FIXME("(%p,%ld), stub!\n", iface, memid);
+ FIXME("(%p,%d), stub!\n", iface, memid);
return E_OUTOFMEMORY;
}
static HRESULT WINAPI ICreateTypeInfo2_fnSetParamCustData(
ICreateTypeInfo2* iface, /* [I] The typeinfo in which to set the custom data. */
UINT indexFunc, /* [I] The index of the function on which the parameter resides. */
- UINT indexParam, /* [I] The index of the paramter on which to set the custom data. */
+ UINT indexParam, /* [I] The index of the parameter on which to set the custom data. */
REFGUID guid, /* [I] The GUID used as a key to retrieve the custom data. */
VARIANT* pVarVal) /* [I] The custom data. */
{
ICreateTypeInfo2* iface, /* [I] The typeinfo on which to set the help string context. */
ULONG dwHelpStringContext) /* [I] The help string context. */
{
- FIXME("(%p,%ld), stub!\n", iface, dwHelpStringContext);
+ FIXME("(%p,%d), stub!\n", iface, dwHelpStringContext);
return E_OUTOFMEMORY;
}
UINT index, /* [I] The index for the function on which to set the help string context. */
ULONG dwHelpStringContext) /* [I] The help string context. */
{
- FIXME("(%p,%d,%ld), stub!\n", iface, index, dwHelpStringContext);
+ FIXME("(%p,%d,%d), stub!\n", iface, index, dwHelpStringContext);
return E_OUTOFMEMORY;
}
UINT index, /* [I] The index of the variable on which to set the help string context. */
ULONG dwHelpStringContext) /* [I] The help string context */
{
- FIXME("(%p,%d,%ld), stub!\n", iface, index, dwHelpStringContext);
+ FIXME("(%p,%d,%d), stub!\n", iface, index, dwHelpStringContext);
return E_OUTOFMEMORY;
}
*/
static HRESULT WINAPI ITypeInfo2_fnQueryInterface(ITypeInfo2 * iface, REFIID riid, LPVOID * ppv)
{
- ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
return ICreateTypeInfo2_QueryInterface((ICreateTypeInfo2 *)This, riid, ppv);
}
*/
static ULONG WINAPI ITypeInfo2_fnAddRef(ITypeInfo2 * iface)
{
- ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
return ICreateTypeInfo2_AddRef((ICreateTypeInfo2 *)This);
}
*/
static ULONG WINAPI ITypeInfo2_fnRelease(ITypeInfo2 * iface)
{
- ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
return ICreateTypeInfo2_Release((ICreateTypeInfo2 *)This);
}
UINT cMaxNames,
UINT* pcNames)
{
- FIXME("(%p,%ld,%p,%d,%p), stub!\n", iface, memid, rgBstrNames, cMaxNames, pcNames);
+ FIXME("(%p,%d,%p,%d,%p), stub!\n", iface, memid, rgBstrNames, cMaxNames, pcNames);
return E_OUTOFMEMORY;
}
EXCEPINFO* pExcepInfo,
UINT* puArgErr)
{
- FIXME("(%p,%p,%ld,%x,%p,%p,%p,%p), stub!\n", iface, pvInstance, memid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+ FIXME("(%p,%p,%d,%x,%p,%p,%p,%p), stub!\n", iface, pvInstance, memid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
return E_OUTOFMEMORY;
}
DWORD* pdwHelpContext,
BSTR* pBstrHelpFile)
{
- FIXME("(%p,%ld,%p,%p,%p,%p), stub!\n", iface, memid, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
+ FIXME("(%p,%d,%p,%p,%p,%p), stub!\n", iface, memid, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
return E_OUTOFMEMORY;
}
BSTR* pBstrName,
WORD* pwOrdinal)
{
- FIXME("(%p,%ld,%d,%p,%p,%p), stub!\n", iface, memid, invKind, pBstrDllName, pBstrName, pwOrdinal);
+ FIXME("(%p,%d,%d,%p,%p,%p), stub!\n", iface, memid, invKind, pBstrDllName, pBstrName, pwOrdinal);
return E_OUTOFMEMORY;
}
HREFTYPE hRefType,
ITypeInfo** ppTInfo)
{
- FIXME("(%p,%ld,%p), stub!\n", iface, hRefType, ppTInfo);
+ FIXME("(%p,%d,%p), stub!\n", iface, hRefType, ppTInfo);
return E_OUTOFMEMORY;
}
INVOKEKIND invKind,
PVOID* ppv)
{
- FIXME("(%p,%ld,%d,%p), stub!\n", iface, memid, invKind, ppv);
+ FIXME("(%p,%d,%d,%p), stub!\n", iface, memid, invKind, ppv);
return E_OUTOFMEMORY;
}
MEMBERID memid,
BSTR* pBstrMops)
{
- FIXME("(%p,%ld,%p), stub!\n", iface, memid, pBstrMops);
+ FIXME("(%p,%d,%p), stub!\n", iface, memid, pBstrMops);
return E_OUTOFMEMORY;
}
ITypeLib** ppTLib,
UINT* pIndex)
{
- ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface);
+ ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
TRACE("(%p,%p,%p)\n", iface, ppTLib, pIndex);
INVOKEKIND invKind, /* [I] The invocation kind for the function. */
UINT* pFuncIndex) /* [O] The index of the function. */
{
- FIXME("(%p,%ld,%d,%p), stub!\n", iface, memid, invKind, pFuncIndex);
+ FIXME("(%p,%d,%d,%p), stub!\n", iface, memid, invKind, pFuncIndex);
return E_OUTOFMEMORY;
}
MEMBERID memid, /* [I] The member id for the variable. */
UINT* pVarIndex) /* [O] The index of the variable. */
{
- FIXME("(%p,%ld,%p), stub!\n", iface, memid, pVarIndex);
+ FIXME("(%p,%d,%p), stub!\n", iface, memid, pVarIndex);
return E_OUTOFMEMORY;
}
DWORD* pdwHelpStringContext, /* [O] The help string context. */
BSTR* pbstrHelpStringDll) /* [O] The help file name. */
{
- FIXME("(%p,%ld,%ld,%p,%p,%p), stub!\n", iface, memid, lcid, pbstrHelpString, pdwHelpStringContext, pbstrHelpStringDll);
+ FIXME("(%p,%d,%d,%p,%p,%p), stub!\n", iface, memid, lcid, pbstrHelpString, pdwHelpStringContext, pbstrHelpStringDll);
return E_OUTOFMEMORY;
}
/*================== ICreateTypeInfo2 & ITypeInfo2 VTABLEs And Creation ===================================*/
-static ICOM_VTABLE(ICreateTypeInfo2) ctypeinfo2vt =
+static const ICreateTypeInfo2Vtbl ctypeinfo2vt =
{
- ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
ICreateTypeInfo2_fnQueryInterface,
ICreateTypeInfo2_fnAddRef,
ICreateTypeInfo2_fnSetName
};
-static ICOM_VTABLE(ITypeInfo2) typeinfo2vt =
+static const ITypeInfo2Vtbl typeinfo2vt =
{
- ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
ITypeInfo2_fnQueryInterface,
ITypeInfo2_fnAddRef,
REFIID riid,
VOID **ppvObject)
{
- ICOM_THIS( ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
TRACE("(%p)->(IID: %s)\n",This,debugstr_guid(riid));
*/
static ULONG WINAPI ICreateTypeLib2_fnAddRef(ICreateTypeLib2 *iface)
{
- ICOM_THIS( ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
+ ULONG ref = InterlockedIncrement(&This->ref);
- TRACE("(%p)->ref was %u\n",This, This->ref);
+ TRACE("(%p)->ref was %u\n",This, ref - 1);
- return ++(This->ref);
+ return ref;
}
/******************************************************************************
*/
static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
{
- ICOM_THIS( ICreateTypeLib2Impl, iface);
-
- --(This->ref);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
+ ULONG ref = InterlockedDecrement(&This->ref);
- TRACE("(%p)->(%u)\n",This, This->ref);
+ TRACE("(%p)->(%u)\n",This, ref);
- if (!This->ref) {
+ if (!ref) {
int i;
for (i = 0; i < MSFT_SEG_MAX; i++) {
- if (This->typelib_segment_data[i]) {
- HeapFree(GetProcessHeap(), 0, This->typelib_segment_data[i]);
- This->typelib_segment_data[i] = NULL;
- }
+ HeapFree(GetProcessHeap(), 0, This->typelib_segment_data[i]);
+ This->typelib_segment_data[i] = NULL;
}
- if (This->filename) {
- HeapFree(GetProcessHeap(), 0, This->filename);
- This->filename = NULL;
- }
+ HeapFree(GetProcessHeap(), 0, This->filename);
+ This->filename = NULL;
while (This->typeinfos) {
ICreateTypeInfo2Impl *typeinfo = This->typeinfos;
This->typeinfos = typeinfo->next_typeinfo;
- if (typeinfo->typedata) HeapFree(GetProcessHeap(), 0, typeinfo->typedata);
+ HeapFree(GetProcessHeap(), 0, typeinfo->typedata);
HeapFree(GetProcessHeap(), 0, typeinfo);
}
return 0;
}
- return This->ref;
+ return ref;
}
TYPEKIND tkind,
ICreateTypeInfo **ppCTInfo)
{
- ICOM_THIS(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
TRACE("(%p,%s,%d,%p)\n", iface, debugstr_w(szName), tkind, ppCTInfo);
ICreateTypeLib2 * iface,
LPOLESTR szName)
{
- ICOM_THIS(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
int offset;
*/
static HRESULT WINAPI ICreateTypeLib2_fnSetVersion(ICreateTypeLib2 * iface, WORD wMajorVerNum, WORD wMinorVerNum)
{
- ICOM_THIS(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
TRACE("(%p,%d,%d)\n", iface, wMajorVerNum, wMinorVerNum);
*/
static HRESULT WINAPI ICreateTypeLib2_fnSetGuid(ICreateTypeLib2 * iface, REFGUID guid)
{
- ICOM_THIS(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
MSFT_GuidEntry guidentry;
int offset;
*/
static HRESULT WINAPI ICreateTypeLib2_fnSetDocString(ICreateTypeLib2 * iface, LPOLESTR szDoc)
{
- ICOM_THIS(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
int offset;
*/
static HRESULT WINAPI ICreateTypeLib2_fnSetHelpFileName(ICreateTypeLib2 * iface, LPOLESTR szHelpFileName)
{
- ICOM_THIS(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
int offset;
*/
static HRESULT WINAPI ICreateTypeLib2_fnSetHelpContext(ICreateTypeLib2 * iface, DWORD dwHelpContext)
{
- FIXME("(%p,%ld), stub!\n", iface, dwHelpContext);
+ FIXME("(%p,%d), stub!\n", iface, dwHelpContext);
return E_OUTOFMEMORY;
}
*/
static HRESULT WINAPI ICreateTypeLib2_fnSetLcid(ICreateTypeLib2 * iface, LCID lcid)
{
- ICOM_THIS(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
- TRACE("(%p,%ld)\n", iface, lcid);
+ TRACE("(%p,%d)\n", iface, lcid);
This->typelib_header.lcid2 = lcid;
*/
static HRESULT WINAPI ICreateTypeLib2_fnSetLibFlags(ICreateTypeLib2 * iface, UINT uLibFlags)
{
- ICOM_THIS(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
TRACE("(%p,0x%x)\n", iface, uLibFlags);
static int ctl2_write_chunk(HANDLE hFile, void *segment, int length)
{
- if (!WriteFile(hFile, segment, length, NULL, 0)) {CloseHandle(hFile); return 0;}
+ DWORD dwWritten;
+ if (!WriteFile(hFile, segment, length, &dwWritten, 0)) {
+ CloseHandle(hFile);
+ return 0;
+ }
return -1;
}
static int ctl2_write_segment(ICreateTypeLib2Impl *This, HANDLE hFile, int segment)
{
+ DWORD dwWritten;
if (!WriteFile(hFile, This->typelib_segment_data[segment],
- This->typelib_segdir[segment].length, NULL, 0)) {
+ This->typelib_segdir[segment].length, &dwWritten, 0)) {
CloseHandle(hFile);
return 0;
}
*/
static HRESULT WINAPI ICreateTypeLib2_fnSaveAllChanges(ICreateTypeLib2 * iface)
{
- ICOM_THIS( ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
int retval;
int filepos;
REFGUID guid, /* [I] The GUID used as a key to retrieve the custom data. */
VARIANT *pVarVal) /* [I] The custom data itself. */
{
- ICOM_THIS(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(guid), pVarVal);
ICreateTypeLib2 * iface, /* [I] The type library to set the help string context for. */
ULONG dwHelpStringContext) /* [I] The help string context. */
{
- FIXME("(%p,%ld), stub!\n", iface, dwHelpStringContext);
+ FIXME("(%p,%d), stub!\n", iface, dwHelpStringContext);
return E_OUTOFMEMORY;
}
*/
static HRESULT WINAPI ITypeLib2_fnQueryInterface(ITypeLib2 * iface, REFIID riid, LPVOID * ppv)
{
- ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
return ICreateTypeLib2_QueryInterface((ICreateTypeLib2 *)This, riid, ppv);
}
*/
static ULONG WINAPI ITypeLib2_fnAddRef(ITypeLib2 * iface)
{
- ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
return ICreateTypeLib2_AddRef((ICreateTypeLib2 *)This);
}
*/
static ULONG WINAPI ITypeLib2_fnRelease(ITypeLib2 * iface)
{
- ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
return ICreateTypeLib2_Release((ICreateTypeLib2 *)This);
}
static UINT WINAPI ITypeLib2_fnGetTypeInfoCount(
ITypeLib2 * iface)
{
- ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
TRACE("(%p)\n", iface);
UINT index,
ITypeInfo** ppTInfo)
{
- ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
TRACE("(%p,%d,%p)\n", iface, index, ppTInfo);
UINT index,
TYPEKIND* pTKind)
{
- ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
TRACE("(%p,%d,%p)\n", iface, index, pTKind);
REFGUID guid,
ITypeInfo** ppTinfo)
{
- ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
int guidoffset;
int typeinfo;
ITypeLib2 * iface,
TLIBATTR** ppTLibAttr)
{
-/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
- FIXME("(%p,%p), stub!\n", iface, ppTLibAttr);
+ FIXME("(%p,%p), stub!\n", This, ppTLibAttr);
return E_OUTOFMEMORY;
}
ITypeLib2 * iface,
ITypeComp** ppTComp)
{
-/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
- FIXME("(%p,%p), stub!\n", iface, ppTComp);
+ FIXME("(%p,%p), stub!\n", This, ppTComp);
return E_OUTOFMEMORY;
}
DWORD* pdwHelpContext,
BSTR* pBstrHelpFile)
{
-/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
- FIXME("(%p,%d,%p,%p,%p,%p), stub!\n", iface, index, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
+ FIXME("(%p,%d,%p,%p,%p,%p), stub!\n", This, index, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
return E_OUTOFMEMORY;
}
ULONG lHashVal,
BOOL* pfName)
{
- ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
char *encoded_name;
int nameoffset;
MSFT_NameIntro *nameintro;
- TRACE("(%p,%s,%lx,%p)\n", iface, debugstr_w(szNameBuf), lHashVal, pfName);
+ TRACE("(%p,%s,%x,%p)\n", iface, debugstr_w(szNameBuf), lHashVal, pfName);
ctl2_encode_name(This, szNameBuf, &encoded_name);
nameoffset = ctl2_find_name(This, encoded_name);
MEMBERID* rgMemId,
USHORT* pcFound)
{
-/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
- FIXME("(%p,%s,%lx,%p,%p,%p), stub!\n", iface, debugstr_w(szNameBuf), lHashVal, ppTInfo, rgMemId, pcFound);
+ FIXME("(%p,%s,%x,%p,%p,%p), stub!\n", This, debugstr_w(szNameBuf), lHashVal, ppTInfo, rgMemId, pcFound);
return E_OUTOFMEMORY;
}
ITypeLib2 * iface,
TLIBATTR* pTLibAttr)
{
-/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
- FIXME("(%p,%p), stub!\n", iface, pTLibAttr);
+ FIXME("(%p,%p), stub!\n", This, pTLibAttr);
}
/******************************************************************************
REFGUID guid, /* [I] The GUID under which the custom data is stored. */
VARIANT* pVarVal) /* [O] The custom data. */
{
-/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
- FIXME("(%p,%s,%p), stub!\n", iface, debugstr_guid(guid), pVarVal);
+ FIXME("(%p,%s,%p), stub!\n", This, debugstr_guid(guid), pVarVal);
return E_OUTOFMEMORY;
}
ULONG* pcUniqueNames, /* [O] The number of unique names in the type library. */
ULONG* pcchUniqueNames) /* [O] The number of changed (?) characters in names in the type library. */
{
-/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
- FIXME("(%p,%p,%p), stub!\n", iface, pcUniqueNames, pcchUniqueNames);
+ FIXME("(%p,%p,%p), stub!\n", This, pcUniqueNames, pcchUniqueNames);
return E_OUTOFMEMORY;
}
DWORD* pdwHelpStringContext,
BSTR* pbstrHelpStringDll)
{
-/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
- FIXME("(%p,%d,%ld,%p,%p,%p), stub!\n", iface, index, lcid, pbstrHelpString, pdwHelpStringContext, pbstrHelpStringDll);
+ FIXME("(%p,%d,%d,%p,%p,%p), stub!\n", This, index, lcid, pbstrHelpString, pdwHelpStringContext, pbstrHelpStringDll);
return E_OUTOFMEMORY;
}
ITypeLib2 * iface, /* [I] The type library in which to find the custom data. */
CUSTDATA* pCustData) /* [O] The structure in which to place the custom data. */
{
-/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */
+ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
- FIXME("(%p,%p), stub!\n", iface, pCustData);
+ FIXME("(%p,%p), stub!\n", This, pCustData);
return E_OUTOFMEMORY;
}
/*================== ICreateTypeLib2 & ITypeLib2 VTABLEs And Creation ===================================*/
-static ICOM_VTABLE(ICreateTypeLib2) ctypelib2vt =
+static const ICreateTypeLib2Vtbl ctypelib2vt =
{
- ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
ICreateTypeLib2_fnQueryInterface,
ICreateTypeLib2_fnAddRef,
ICreateTypeLib2_fnSetHelpStringDll
};
-static ICOM_VTABLE(ITypeLib2) typelib2vt =
+static const ITypeLib2Vtbl typelib2vt =
{
- ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
ITypeLib2_fnQueryInterface,
ITypeLib2_fnAddRef,
*ppctlib = ICreateTypeLib2_Constructor(syskind, szFile);
return (*ppctlib)? S_OK: E_OUTOFMEMORY;
}
+
+/******************************************************************************
+ * ClearCustData (OLEAUT32.171)
+ *
+ * Clear a custom data types' data.
+ *
+ * PARAMS
+ * lpCust [I] The custom data type instance
+ *
+ * RETURNS
+ * Nothing.
+ */
+void WINAPI ClearCustData(LPCUSTDATA lpCust)
+{
+ if (lpCust && lpCust->cCustData)
+ {
+ if (lpCust->prgCustData)
+ {
+ DWORD i;
+
+ for (i = 0; i < lpCust->cCustData; i++)
+ VariantClear(&lpCust->prgCustData[i].varValue);
+
+ /* FIXME - Should be using a per-thread IMalloc */
+ HeapFree(GetProcessHeap(), 0, lpCust->prgCustData);
+ lpCust->prgCustData = NULL;
+ }
+ lpCust->cCustData = 0;
+ }
+}