Commit 810ec233 authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

oleaut32: Implement ICreateTypeInfo::SetTypeDescAlias.

parent 56aa7d01
...@@ -1160,7 +1160,7 @@ typedef struct tagITypeInfoImpl ...@@ -1160,7 +1160,7 @@ typedef struct tagITypeInfoImpl
WORD wTypeFlags; WORD wTypeFlags;
WORD wMajorVerNum; WORD wMajorVerNum;
WORD wMinorVerNum; WORD wMinorVerNum;
TYPEDESC tdescAlias; TYPEDESC *tdescAlias;
IDLDESC idldescType; IDLDESC idldescType;
ITypeLibImpl * pTypeLib; /* back pointer to typelib */ ITypeLibImpl * pTypeLib; /* back pointer to typelib */
...@@ -2331,8 +2331,7 @@ static int MSFT_CustData( TLBContext *pcx, int offset, struct list *custdata_lis ...@@ -2331,8 +2331,7 @@ static int MSFT_CustData( TLBContext *pcx, int offset, struct list *custdata_lis
return count; return count;
} }
static void MSFT_GetTdesc(TLBContext *pcx, INT type, TYPEDESC *pTd, static void MSFT_GetTdesc(TLBContext *pcx, INT type, TYPEDESC *pTd)
ITypeInfoImpl *pTI)
{ {
if(type <0) if(type <0)
pTd->vt=type & VT_TYPEMASK; pTd->vt=type & VT_TYPEMASK;
...@@ -2464,8 +2463,7 @@ MSFT_DoFuncs(TLBContext* pcx, ...@@ -2464,8 +2463,7 @@ MSFT_DoFuncs(TLBContext* pcx,
MSFT_GetTdesc(pcx, MSFT_GetTdesc(pcx,
pFuncRec->DataType, pFuncRec->DataType,
&ptfd->funcdesc.elemdescFunc.tdesc, &ptfd->funcdesc.elemdescFunc.tdesc);
pTI);
/* do the parameters/arguments */ /* do the parameters/arguments */
if(pFuncRec->nrargs) if(pFuncRec->nrargs)
...@@ -2487,8 +2485,7 @@ MSFT_DoFuncs(TLBContext* pcx, ...@@ -2487,8 +2485,7 @@ MSFT_DoFuncs(TLBContext* pcx,
MSFT_GetTdesc(pcx, MSFT_GetTdesc(pcx,
paraminfo.DataType, paraminfo.DataType,
&elemdesc->tdesc, &elemdesc->tdesc);
pTI);
elemdesc->u.paramdesc.wParamFlags = paraminfo.Flags; elemdesc->u.paramdesc.wParamFlags = paraminfo.Flags;
...@@ -2592,7 +2589,7 @@ static void MSFT_DoVars(TLBContext *pcx, ITypeInfoImpl *pTI, int cFuncs, ...@@ -2592,7 +2589,7 @@ static void MSFT_DoVars(TLBContext *pcx, ITypeInfoImpl *pTI, int cFuncs,
ptvd->vardesc.varkind = pVarRec->VarKind; ptvd->vardesc.varkind = pVarRec->VarKind;
ptvd->vardesc.wVarFlags = pVarRec->Flags; ptvd->vardesc.wVarFlags = pVarRec->Flags;
MSFT_GetTdesc(pcx, pVarRec->DataType, MSFT_GetTdesc(pcx, pVarRec->DataType,
&ptvd->vardesc.elemdescVar.tdesc, pTI); &ptvd->vardesc.elemdescVar.tdesc);
/* ptvd->vardesc.lpstrSchema; is reserved (SDK) FIXME?? */ /* ptvd->vardesc.lpstrSchema; is reserved (SDK) FIXME?? */
if(pVarRec->VarKind == VAR_CONST ){ if(pVarRec->VarKind == VAR_CONST ){
ptvd->vardesc.u.lpvarValue = heap_alloc_zero(sizeof(VARIANT)); ptvd->vardesc.u.lpvarValue = heap_alloc_zero(sizeof(VARIANT));
...@@ -2633,7 +2630,7 @@ static void MSFT_DoImplTypes(TLBContext *pcx, ITypeInfoImpl *pTI, int count, ...@@ -2633,7 +2630,7 @@ static void MSFT_DoImplTypes(TLBContext *pcx, ITypeInfoImpl *pTI, int count,
static void TLB_fix_32on64_typeinfo(ITypeInfoImpl *info) static void TLB_fix_32on64_typeinfo(ITypeInfoImpl *info)
{ {
if(info->typekind == TKIND_ALIAS){ if(info->typekind == TKIND_ALIAS){
switch(info->tdescAlias.vt){ switch(info->tdescAlias->vt){
case VT_BSTR: case VT_BSTR:
case VT_DISPATCH: case VT_DISPATCH:
case VT_UNKNOWN: case VT_UNKNOWN:
...@@ -2646,7 +2643,7 @@ static void TLB_fix_32on64_typeinfo(ITypeInfoImpl *info) ...@@ -2646,7 +2643,7 @@ static void TLB_fix_32on64_typeinfo(ITypeInfoImpl *info)
break; break;
case VT_CARRAY: case VT_CARRAY:
case VT_USERDEFINED: case VT_USERDEFINED:
TLB_size_instance(info, SYS_WIN64, &info->tdescAlias, &info->cbSizeInstance, &info->cbAlignment); TLB_size_instance(info, SYS_WIN64, info->tdescAlias, &info->cbSizeInstance, &info->cbAlignment);
break; break;
case VT_VARIANT: case VT_VARIANT:
info->cbSizeInstance = sizeof(VARIANT); info->cbSizeInstance = sizeof(VARIANT);
...@@ -2701,9 +2698,12 @@ static ITypeInfoImpl * MSFT_DoTypeInfo( ...@@ -2701,9 +2698,12 @@ static ITypeInfoImpl * MSFT_DoTypeInfo(
ptiRet->wMinorVerNum=HIWORD(tiBase.version); ptiRet->wMinorVerNum=HIWORD(tiBase.version);
ptiRet->cImplTypes=tiBase.cImplTypes; ptiRet->cImplTypes=tiBase.cImplTypes;
ptiRet->cbSizeVft=tiBase.cbSizeVft; /* FIXME: this is only the non inherited part */ ptiRet->cbSizeVft=tiBase.cbSizeVft; /* FIXME: this is only the non inherited part */
if(ptiRet->typekind == TKIND_ALIAS) if(ptiRet->typekind == TKIND_ALIAS){
MSFT_GetTdesc(pcx, tiBase.datatype1, TYPEDESC tmp;
&ptiRet->tdescAlias, ptiRet); MSFT_GetTdesc(pcx, tiBase.datatype1, &tmp);
ptiRet->tdescAlias = heap_alloc(TLB_SizeTypeDesc(&tmp, TRUE));
TLB_CopyTypeDesc(NULL, &tmp, ptiRet->tdescAlias);
}
/* FIXME: */ /* FIXME: */
/* IDLDESC idldescType; *//* never saw this one != zero */ /* IDLDESC idldescType; *//* never saw this one != zero */
...@@ -4308,9 +4308,10 @@ static void SLTG_ProcessAlias(char *pBlk, ITypeInfoImpl *pTI, ...@@ -4308,9 +4308,10 @@ static void SLTG_ProcessAlias(char *pBlk, ITypeInfoImpl *pTI,
sltg_ref_lookup_t *ref_lookup = NULL; sltg_ref_lookup_t *ref_lookup = NULL;
if (pTITail->simple_alias) { if (pTITail->simple_alias) {
/* if simple alias, no more processing required */ /* if simple alias, no more processing required */
pTI->tdescAlias.vt = pTITail->tdescalias_vt; pTI->tdescAlias = heap_alloc_zero(sizeof(TYPEDESC));
return; pTI->tdescAlias->vt = pTITail->tdescalias_vt;
return;
} }
if(pTIHeader->href_table != 0xffffffff) { if(pTIHeader->href_table != 0xffffffff) {
...@@ -4321,7 +4322,8 @@ static void SLTG_ProcessAlias(char *pBlk, ITypeInfoImpl *pTI, ...@@ -4321,7 +4322,8 @@ static void SLTG_ProcessAlias(char *pBlk, ITypeInfoImpl *pTI,
/* otherwise it is an offset to a type */ /* otherwise it is an offset to a type */
pType = (WORD *)(pBlk + pTITail->tdescalias_vt); pType = (WORD *)(pBlk + pTITail->tdescalias_vt);
SLTG_DoType(pType, pBlk, &pTI->tdescAlias, ref_lookup); pTI->tdescAlias = heap_alloc(sizeof(TYPEDESC));
SLTG_DoType(pType, pBlk, pTI->tdescAlias, ref_lookup);
heap_free(ref_lookup); heap_free(ref_lookup);
} }
...@@ -4800,8 +4802,10 @@ static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface) ...@@ -4800,8 +4802,10 @@ static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface)
heap_free(ref_type); heap_free(ref_type);
} }
for (i = 0; i < This->TypeInfoCount; ++i) for (i = 0; i < This->TypeInfoCount; ++i){
heap_free(This->typeinfos[i]->tdescAlias);
ITypeInfoImpl_Destroy(This->typeinfos[i]); ITypeInfoImpl_Destroy(This->typeinfos[i]);
}
heap_free(This->typeinfos); heap_free(This->typeinfos);
heap_free(This); heap_free(This);
return 0; return 0;
...@@ -5678,8 +5682,8 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface, ...@@ -5678,8 +5682,8 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface,
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
size = sizeof(**ppTypeAttr); size = sizeof(**ppTypeAttr);
if (This->typekind == TKIND_ALIAS) if (This->typekind == TKIND_ALIAS && This->tdescAlias)
size += TLB_SizeTypeDesc(&This->tdescAlias, FALSE); size += TLB_SizeTypeDesc(This->tdescAlias, FALSE);
*ppTypeAttr = heap_alloc(size); *ppTypeAttr = heap_alloc(size);
if (!*ppTypeAttr) if (!*ppTypeAttr)
...@@ -5700,12 +5704,15 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface, ...@@ -5700,12 +5704,15 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface,
(*ppTypeAttr)->wTypeFlags = This->wTypeFlags; (*ppTypeAttr)->wTypeFlags = This->wTypeFlags;
(*ppTypeAttr)->wMajorVerNum = This->wMajorVerNum; (*ppTypeAttr)->wMajorVerNum = This->wMajorVerNum;
(*ppTypeAttr)->wMinorVerNum = This->wMinorVerNum; (*ppTypeAttr)->wMinorVerNum = This->wMinorVerNum;
(*ppTypeAttr)->tdescAlias = This->tdescAlias;
(*ppTypeAttr)->idldescType = This->idldescType; (*ppTypeAttr)->idldescType = This->idldescType;
if (This->typekind == TKIND_ALIAS) if (This->tdescAlias)
TLB_CopyTypeDesc(&(*ppTypeAttr)->tdescAlias, TLB_CopyTypeDesc(&(*ppTypeAttr)->tdescAlias,
&This->tdescAlias, *ppTypeAttr + 1); This->tdescAlias, *ppTypeAttr + 1);
else{
(*ppTypeAttr)->tdescAlias.vt = VT_EMPTY;
(*ppTypeAttr)->tdescAlias.u.lptdesc = NULL;
}
if((*ppTypeAttr)->typekind == TKIND_DISPATCH) { if((*ppTypeAttr)->typekind == TKIND_DISPATCH) {
/* This should include all the inherited funcs */ /* This should include all the inherited funcs */
...@@ -9122,14 +9129,18 @@ static DWORD WMSFT_append_typedesc(TYPEDESC *desc, WMSFT_TLBFile *file, DWORD *o ...@@ -9122,14 +9129,18 @@ static DWORD WMSFT_append_typedesc(TYPEDESC *desc, WMSFT_TLBFile *file, DWORD *o
INT16 junk2; INT16 junk2;
DWORD offs = 0; DWORD offs = 0;
DWORD encoded[2]; DWORD encoded[2];
VARTYPE vt = desc->vt & VT_TYPEMASK, subtype; VARTYPE vt, subtype;
char *data; char *data;
if(!desc)
return -1;
if(!out_mix) if(!out_mix)
out_mix = &junk; out_mix = &junk;
if(!out_size) if(!out_size)
out_size = &junk2; out_size = &junk2;
vt = desc->vt & VT_TYPEMASK;
switch(vt){ switch(vt){
case VT_INT: case VT_INT:
subtype = VT_I4; subtype = VT_I4;
...@@ -9619,7 +9630,7 @@ static DWORD WMSFT_compile_typeinfo(ITypeInfoImpl *info, INT16 index, WMSFT_TLBF ...@@ -9619,7 +9630,7 @@ static DWORD WMSFT_compile_typeinfo(ITypeInfoImpl *info, INT16 index, WMSFT_TLBF
if(info->typekind == TKIND_COCLASS){ if(info->typekind == TKIND_COCLASS){
base->datatype1 = WMSFT_compile_typeinfo_ref(info, file); base->datatype1 = WMSFT_compile_typeinfo_ref(info, file);
}else if(info->typekind == TKIND_ALIAS){ }else if(info->typekind == TKIND_ALIAS){
base->datatype1 = WMSFT_append_typedesc(&info->tdescAlias, file, NULL, NULL); base->datatype1 = WMSFT_append_typedesc(info->tdescAlias, file, NULL, NULL);
}else if(info->typekind == TKIND_MODULE){ }else if(info->typekind == TKIND_MODULE){
if(info->DllName) if(info->DllName)
base->datatype1 = info->DllName->offset; base->datatype1 = info->DllName->offset;
...@@ -10684,8 +10695,25 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeDescAlias(ICreateTypeInfo2 *ifac ...@@ -10684,8 +10695,25 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeDescAlias(ICreateTypeInfo2 *ifac
TYPEDESC *tdescAlias) TYPEDESC *tdescAlias)
{ {
ITypeInfoImpl *This = info_impl_from_ICreateTypeInfo2(iface); ITypeInfoImpl *This = info_impl_from_ICreateTypeInfo2(iface);
FIXME("%p %p - stub\n", This, tdescAlias); HRESULT hr;
return E_NOTIMPL;
TRACE("%p %p\n", This, tdescAlias);
if(!tdescAlias)
return E_INVALIDARG;
if(This->typekind != TKIND_ALIAS)
return TYPE_E_BADMODULEKIND;
hr = TLB_size_instance(This, This->pTypeLib->syskind, tdescAlias, &This->cbSizeInstance, &This->cbAlignment);
if(FAILED(hr))
return hr;
heap_free(This->tdescAlias);
This->tdescAlias = heap_alloc(TLB_SizeTypeDesc(tdescAlias, TRUE));
TLB_CopyTypeDesc(NULL, tdescAlias, This->tdescAlias);
return S_OK;
} }
static HRESULT WINAPI ICreateTypeInfo2_fnDefineFuncAsDllEntry(ICreateTypeInfo2 *iface, static HRESULT WINAPI ICreateTypeInfo2_fnDefineFuncAsDllEntry(ICreateTypeInfo2 *iface,
......
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