mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Sync to Wine-20050111:
Eric Pouech <pouech-eric@wanadoo.fr> - Removed excessive statement (break after return or goto, not useful break, not needed vars...) - Fixed some errors in function prototypes. - Some missing const correctness fixes. Francois Gouget <fgouget@free.fr> - Assorted spelling fixes. Robert Shearman <rob@codeweavers.com> - Make the DECIMAL_SETZERO macro take a DECIMAL instead of a DECIMAL* as in the Microsoft headers and fix up the only caller. Michael Stefaniuc <mstefani@redhat.de> - Do not check for non NULL pointer before HeapFree'ing it. It's redundant. Bill Medland <billmedland@mercuryspeed.com> - Fully initialise the structure to prevent ill-defined behaviour. Jon Griffiths <jon_p_griffiths@yahoo.com> - Remove unneeded headers to reduce unneeded rebuilds. Robert Shearman <rob@codeweavers.com> - Implement RPC_E_DISCONNECTED in proxies. Dmitry Timoshkov <dmitry@codeweavers.com> - Add Russian translations. Huw Davies <huw@codeweavers.com> - The value of a packed VARIANT can be up to 1L << 26 - 1. - Fix comment to reflect reality and indeed the code. - Remove the remaining dependencies on internal structures from Invoke. - GetTypeAttr should deep copy the typedesc. - Fix return value of GetVarIndexOfMemId. - Remove Invoke's dependence on the internal TLBFuncDesc structure. - Fix memory leaks in some failure cases. - GetFuncIndexOfMemId should respect invkind and return TYPE_E_ELEMENTNOTFOUND if the function cannot be found. - Allocate the TYPEATTR rather than copying it. - For a dual interface the dispinterface's cfuncs should include the inherited functions, cbSizeVft should just be the size of IDispatch's vtbl and we should strip TYPEFLAG_FOLEAUTOMATION. - Fix typelib generation of CARRAYs. Paul Vriens <Paul.Vriens@xs4all.nl> - use Interlocked* functions in AddRef and Release. - store the result of the Interlocked functions and use only this. Walt Ogburn <reuben@ugcs.caltech.edu> - In OlePictureImpl_Load, always use DIB_RGB_COLORS because no indexed palette has been defined. Alexandre Julliard <julliard@winehq.org> - Another warning fix. - Avoid warnings. svn path=/trunk/; revision=12987
This commit is contained in:
parent
a30c1830c0
commit
edc6b71a42
11 changed files with 252 additions and 198 deletions
|
@ -33,7 +33,6 @@
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
|
|
||||||
#include "ole2disp.h"
|
#include "ole2disp.h"
|
||||||
#include "olectl.h"
|
|
||||||
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,13 @@
|
||||||
#include "oleaut32_No.rc"
|
#include "oleaut32_No.rc"
|
||||||
#include "oleaut32_Pl.rc"
|
#include "oleaut32_Pl.rc"
|
||||||
#include "oleaut32_Pt.rc"
|
#include "oleaut32_Pt.rc"
|
||||||
|
#include "oleaut32_Ru.rc"
|
||||||
#include "oleaut32_Sv.rc"
|
#include "oleaut32_Sv.rc"
|
||||||
#include "oleaut32_Th.rc"
|
#include "oleaut32_Th.rc"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME:
|
* FIXME:
|
||||||
* Finnish, Greek, Hebrew, Japanese, Korean, Portuguese,
|
* Finnish, Greek, Hebrew, Japanese, Korean, Portuguese,
|
||||||
* Russian, Turkish, Slovenian (at least) are localised in XP Home.
|
* Turkish, Slovenian (at least) are localised in XP Home.
|
||||||
* I expect Chinese etc are localised in Asian Editions also.
|
* I expect Chinese etc are localised in Asian Editions also.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -454,8 +454,7 @@ static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc)
|
||||||
{
|
{
|
||||||
TRACE("(%p)\n", fontDesc);
|
TRACE("(%p)\n", fontDesc);
|
||||||
|
|
||||||
if (fontDesc->description.lpstrName!=0)
|
HeapFree(GetProcessHeap(), 0, fontDesc->description.lpstrName);
|
||||||
HeapFree(GetProcessHeap(), 0, fontDesc->description.lpstrName);
|
|
||||||
|
|
||||||
if (fontDesc->gdiFont!=0)
|
if (fontDesc->gdiFont!=0)
|
||||||
DeleteObject(fontDesc->gdiFont);
|
DeleteObject(fontDesc->gdiFont);
|
||||||
|
@ -1594,8 +1593,7 @@ static HRESULT WINAPI OLEFontImpl_Load(
|
||||||
if (cbRead!=bStringSize)
|
if (cbRead!=bStringSize)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if (this->description.lpstrName!=0)
|
HeapFree(GetProcessHeap(), 0, this->description.lpstrName);
|
||||||
HeapFree(GetProcessHeap(), 0, this->description.lpstrName);
|
|
||||||
|
|
||||||
len = MultiByteToWideChar( CP_ACP, 0, readBuffer, bStringSize, NULL, 0 );
|
len = MultiByteToWideChar( CP_ACP, 0, readBuffer, bStringSize, NULL, 0 );
|
||||||
this->description.lpstrName = HeapAlloc( GetProcessHeap(), 0, (len+1) * sizeof(WCHAR) );
|
this->description.lpstrName = HeapAlloc( GetProcessHeap(), 0, (len+1) * sizeof(WCHAR) );
|
||||||
|
|
|
@ -301,7 +301,7 @@ static void OLEPictureImpl_Destroy(OLEPictureImpl* Obj)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Obj->data) HeapFree(GetProcessHeap(), 0, Obj->data);
|
HeapFree(GetProcessHeap(), 0, Obj->data);
|
||||||
HeapFree(GetProcessHeap(), 0, Obj);
|
HeapFree(GetProcessHeap(), 0, Obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1172,7 +1172,6 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
|
||||||
FIXME("Trying to load GIF, but no support for libgif/libungif compiled in.\n");
|
FIXME("Trying to load GIF, but no support for libgif/libungif compiled in.\n");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
#endif
|
#endif
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 0xd8ff: { /* JPEG */
|
case 0xd8ff: { /* JPEG */
|
||||||
#ifdef HAVE_JPEGLIB_H
|
#ifdef HAVE_JPEGLIB_H
|
||||||
|
|
|
@ -154,7 +154,7 @@ static inline DWORD SAFEARRAY_GetHiddenDWORD(SAFEARRAY* psa)
|
||||||
/* Get the number of cells in a SafeArray */
|
/* Get the number of cells in a SafeArray */
|
||||||
static ULONG SAFEARRAY_GetCellCount(const SAFEARRAY *psa)
|
static ULONG SAFEARRAY_GetCellCount(const SAFEARRAY *psa)
|
||||||
{
|
{
|
||||||
SAFEARRAYBOUND* psab = psa->rgsabound;
|
const SAFEARRAYBOUND* psab = psa->rgsabound;
|
||||||
USHORT cCount = psa->cDims;
|
USHORT cCount = psa->cDims;
|
||||||
ULONG ulNumCells = 1;
|
ULONG ulNumCells = 1;
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,8 @@
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
|
|
||||||
#include "ole2.h"
|
#include "ole2.h"
|
||||||
#include "wine/unicode.h"
|
|
||||||
#include "ole2disp.h"
|
|
||||||
#include "typelib.h"
|
#include "typelib.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "winternl.h"
|
|
||||||
|
|
||||||
static const WCHAR riidW[5] = {'r','i','i','d',0};
|
static const WCHAR riidW[5] = {'r','i','i','d',0};
|
||||||
static const WCHAR pdispparamsW[] = {'p','d','i','s','p','p','a','r','a','m','s',0};
|
static const WCHAR pdispparamsW[] = {'p','d','i','s','p','p','a','r','a','m','s',0};
|
||||||
|
@ -1159,7 +1156,6 @@ _get_funcdesc(
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return E_FAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD
|
static DWORD
|
||||||
|
@ -1185,6 +1181,13 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!tpinfo->chanbuf)
|
||||||
|
{
|
||||||
|
WARN("Tried to use disconnected proxy\n");
|
||||||
|
LeaveCriticalSection(&tpinfo->crit);
|
||||||
|
return RPC_E_DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
if (relaydeb) {
|
if (relaydeb) {
|
||||||
TRACE_(olerelay)("->");
|
TRACE_(olerelay)("->");
|
||||||
if (iname)
|
if (iname)
|
||||||
|
@ -1471,6 +1474,7 @@ PSFacBuf_CreateProxy(
|
||||||
proxy->ref = 2;
|
proxy->ref = 2;
|
||||||
proxy->tinfo = tinfo;
|
proxy->tinfo = tinfo;
|
||||||
memcpy(&proxy->iid,riid,sizeof(*riid));
|
memcpy(&proxy->iid,riid,sizeof(*riid));
|
||||||
|
proxy->chanbuf = 0;
|
||||||
*ppv = (LPVOID)proxy;
|
*ppv = (LPVOID)proxy;
|
||||||
*ppProxy = (IRpcProxyBuffer *)&(proxy->lpvtbl2);
|
*ppProxy = (IRpcProxyBuffer *)&(proxy->lpvtbl2);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -74,7 +74,6 @@
|
||||||
|
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
#include "objbase.h"
|
#include "objbase.h"
|
||||||
#include "ole2disp.h"
|
|
||||||
#include "typelib.h"
|
#include "typelib.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "variant.h"
|
#include "variant.h"
|
||||||
|
@ -848,7 +847,7 @@ typedef struct tagITypeLibImpl
|
||||||
{
|
{
|
||||||
ITypeLib2Vtbl *lpVtbl;
|
ITypeLib2Vtbl *lpVtbl;
|
||||||
ITypeCompVtbl *lpVtblTypeComp;
|
ITypeCompVtbl *lpVtblTypeComp;
|
||||||
UINT ref;
|
ULONG ref;
|
||||||
TLIBATTR LibAttr; /* guid,lcid,syskind,version,flags */
|
TLIBATTR LibAttr; /* guid,lcid,syskind,version,flags */
|
||||||
|
|
||||||
/* strings can be stored in tlb as multibyte strings BUT they are *always*
|
/* strings can be stored in tlb as multibyte strings BUT they are *always*
|
||||||
|
@ -959,7 +958,7 @@ typedef struct tagITypeInfoImpl
|
||||||
{
|
{
|
||||||
ITypeInfo2Vtbl *lpVtbl;
|
ITypeInfo2Vtbl *lpVtbl;
|
||||||
ITypeCompVtbl *lpVtblTypeComp;
|
ITypeCompVtbl *lpVtblTypeComp;
|
||||||
UINT ref;
|
ULONG ref;
|
||||||
TYPEATTR TypeAttr ; /* _lots_ of type information. */
|
TYPEATTR TypeAttr ; /* _lots_ of type information. */
|
||||||
ITypeLibImpl * pTypeLib; /* back pointer to typelib */
|
ITypeLibImpl * pTypeLib; /* back pointer to typelib */
|
||||||
int index; /* index in this typelib; */
|
int index; /* index in this typelib; */
|
||||||
|
@ -989,7 +988,7 @@ typedef struct tagITypeInfoImpl
|
||||||
static struct ITypeInfo2Vtbl tinfvt;
|
static struct ITypeInfo2Vtbl tinfvt;
|
||||||
static struct ITypeCompVtbl tcompvt;
|
static struct ITypeCompVtbl tcompvt;
|
||||||
|
|
||||||
static ITypeInfo2 * WINAPI ITypeInfo_Constructor();
|
static ITypeInfo2 * WINAPI ITypeInfo_Constructor(void);
|
||||||
|
|
||||||
typedef struct tagTLBContext
|
typedef struct tagTLBContext
|
||||||
{
|
{
|
||||||
|
@ -1277,7 +1276,7 @@ static void dump_DispParms(DISPPARAMS * pdp)
|
||||||
|
|
||||||
static void dump_TypeInfo(ITypeInfoImpl * pty)
|
static void dump_TypeInfo(ITypeInfoImpl * pty)
|
||||||
{
|
{
|
||||||
TRACE("%p ref=%u\n", pty, pty->ref);
|
TRACE("%p ref=%lu\n", pty, pty->ref);
|
||||||
TRACE("attr:%s\n", debugstr_guid(&(pty->TypeAttr.guid)));
|
TRACE("attr:%s\n", debugstr_guid(&(pty->TypeAttr.guid)));
|
||||||
TRACE("kind:%s\n", typekind_desc[pty->TypeAttr.typekind]);
|
TRACE("kind:%s\n", typekind_desc[pty->TypeAttr.typekind]);
|
||||||
TRACE("fct:%u var:%u impl:%u\n",
|
TRACE("fct:%u var:%u impl:%u\n",
|
||||||
|
@ -1331,6 +1330,50 @@ static void TLB_Free(void * ptr)
|
||||||
HeapFree(GetProcessHeap(), 0, ptr);
|
HeapFree(GetProcessHeap(), 0, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* deep copy a typedesc */
|
||||||
|
static void copy_typedesc(TYPEDESC *out, const TYPEDESC *in)
|
||||||
|
{
|
||||||
|
out->vt = in->vt;
|
||||||
|
switch(in->vt) {
|
||||||
|
case VT_PTR:
|
||||||
|
out->u.lptdesc = HeapAlloc(GetProcessHeap(), 0, sizeof(TYPEDESC));
|
||||||
|
copy_typedesc(out->u.lptdesc, in->u.lptdesc);
|
||||||
|
break;
|
||||||
|
case VT_USERDEFINED:
|
||||||
|
out->u.hreftype = in->u.hreftype;
|
||||||
|
break;
|
||||||
|
case VT_CARRAY:
|
||||||
|
out->u.lpadesc = HeapAlloc(GetProcessHeap(), 0, sizeof(ARRAYDESC) +
|
||||||
|
(in->u.lpadesc->cDims - 1) * sizeof(SAFEARRAYBOUND));
|
||||||
|
copy_typedesc(&out->u.lpadesc->tdescElem, &in->u.lpadesc->tdescElem);
|
||||||
|
out->u.lpadesc->cDims = in->u.lpadesc->cDims;
|
||||||
|
memcpy(out->u.lpadesc->rgbounds, in->u.lpadesc->rgbounds, in->u.lpadesc->cDims * sizeof(SAFEARRAYBOUND));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free()s any allocated memory pointed to by the tdesc. NB does not
|
||||||
|
free the tdesc itself - this is because the tdesc is typically part
|
||||||
|
of a larger structure */
|
||||||
|
static void free_deep_typedesc(TYPEDESC *tdesc)
|
||||||
|
{
|
||||||
|
switch(tdesc->vt) {
|
||||||
|
case VT_PTR:
|
||||||
|
free_deep_typedesc(tdesc->u.lptdesc);
|
||||||
|
HeapFree(GetProcessHeap(), 0, tdesc->u.lptdesc);
|
||||||
|
tdesc->u.lptdesc = NULL;
|
||||||
|
break;
|
||||||
|
case VT_CARRAY:
|
||||||
|
free_deep_typedesc(&tdesc->u.lpadesc->tdescElem);
|
||||||
|
HeapFree(GetProcessHeap(), 0, tdesc->u.lpadesc);
|
||||||
|
tdesc->u.lpadesc = NULL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
*
|
*
|
||||||
|
@ -1473,7 +1516,7 @@ static void MSFT_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx )
|
||||||
|
|
||||||
if(offset <0) { /* data are packed in here */
|
if(offset <0) { /* data are packed in here */
|
||||||
V_VT(pVar) = (offset & 0x7c000000 )>> 26;
|
V_VT(pVar) = (offset & 0x7c000000 )>> 26;
|
||||||
V_UNION(pVar, iVal) = offset & 0xffff;
|
V_UNION(pVar, iVal) = offset & 0x3ffffff;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MSFT_ReadLEWords(&(V_VT(pVar)), sizeof(VARTYPE), pcx,
|
MSFT_ReadLEWords(&(V_VT(pVar)), sizeof(VARTYPE), pcx,
|
||||||
|
@ -1604,7 +1647,7 @@ MSFT_DoFuncs(TLBContext* pcx,
|
||||||
* of this (first) part excluding this field. Then follow the records,
|
* of this (first) part excluding this field. Then follow the records,
|
||||||
* for each member there is one record.
|
* for each member there is one record.
|
||||||
*
|
*
|
||||||
* First entry is always the length of the record (excluding this
|
* First entry is always the length of the record (including this
|
||||||
* length word).
|
* length word).
|
||||||
* Rest of the record depends on the type of the member. If there is
|
* Rest of the record depends on the type of the member. If there is
|
||||||
* a field indicating the member type (function variable intereface etc)
|
* a field indicating the member type (function variable intereface etc)
|
||||||
|
@ -3391,10 +3434,11 @@ static HRESULT WINAPI ITypeLib2_fnQueryInterface(
|
||||||
static ULONG WINAPI ITypeLib2_fnAddRef( ITypeLib2 *iface)
|
static ULONG WINAPI ITypeLib2_fnAddRef( ITypeLib2 *iface)
|
||||||
{
|
{
|
||||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||||
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->ref was %u\n",This, This->ref);
|
TRACE("(%p)->ref was %lu\n",This, ref - 1);
|
||||||
|
|
||||||
return ++(This->ref);
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ITypeLib::Release
|
/* ITypeLib::Release
|
||||||
|
@ -3402,12 +3446,11 @@ static ULONG WINAPI ITypeLib2_fnAddRef( ITypeLib2 *iface)
|
||||||
static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface)
|
static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface)
|
||||||
{
|
{
|
||||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
--(This->ref);
|
TRACE("(%p)->(%lu)\n",This, ref);
|
||||||
|
|
||||||
TRACE("(%p)->(%u)\n",This, This->ref);
|
if (!ref)
|
||||||
|
|
||||||
if (!This->ref)
|
|
||||||
{
|
{
|
||||||
/* remove cache entry */
|
/* remove cache entry */
|
||||||
TRACE("removing from cache list\n");
|
TRACE("removing from cache list\n");
|
||||||
|
@ -3450,7 +3493,7 @@ static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return This->ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ITypeLib::GetTypeInfoCount
|
/* ITypeLib::GetTypeInfoCount
|
||||||
|
@ -4067,12 +4110,12 @@ static HRESULT WINAPI ITypeInfo_fnQueryInterface(
|
||||||
static ULONG WINAPI ITypeInfo_fnAddRef( ITypeInfo2 *iface)
|
static ULONG WINAPI ITypeInfo_fnAddRef( ITypeInfo2 *iface)
|
||||||
{
|
{
|
||||||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||||
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
++(This->ref);
|
|
||||||
ITypeLib2_AddRef((ITypeLib2*)This->pTypeLib);
|
ITypeLib2_AddRef((ITypeLib2*)This->pTypeLib);
|
||||||
|
|
||||||
TRACE("(%p)->ref is %u\n",This, This->ref);
|
TRACE("(%p)->ref is %lu\n",This, ref);
|
||||||
return This->ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ITypeInfo::Release
|
/* ITypeInfo::Release
|
||||||
|
@ -4080,12 +4123,11 @@ static ULONG WINAPI ITypeInfo_fnAddRef( ITypeInfo2 *iface)
|
||||||
static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
|
static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
|
||||||
{
|
{
|
||||||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
--(This->ref);
|
TRACE("(%p)->(%lu)\n",This, ref);
|
||||||
|
|
||||||
TRACE("(%p)->(%u)\n",This, This->ref);
|
if (ref) {
|
||||||
|
|
||||||
if (This->ref) {
|
|
||||||
/* We don't release ITypeLib when ref=0 becouse
|
/* We don't release ITypeLib when ref=0 becouse
|
||||||
it means that funtion is called by ITypeLi2_Release */
|
it means that funtion is called by ITypeLi2_Release */
|
||||||
ITypeLib2_Release((ITypeLib2*)This->pTypeLib);
|
ITypeLib2_Release((ITypeLib2*)This->pTypeLib);
|
||||||
|
@ -4113,7 +4155,7 @@ static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
|
||||||
HeapFree(GetProcessHeap(),0,This);
|
HeapFree(GetProcessHeap(),0,This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return This->ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ITypeInfo::GetTypeAttr
|
/* ITypeInfo::GetTypeAttr
|
||||||
|
@ -4127,8 +4169,18 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface,
|
||||||
{
|
{
|
||||||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||||
TRACE("(%p)\n",This);
|
TRACE("(%p)\n",This);
|
||||||
/* FIXME: must do a copy here */
|
*ppTypeAttr = HeapAlloc(GetProcessHeap(), 0, sizeof(**ppTypeAttr));
|
||||||
*ppTypeAttr=&This->TypeAttr;
|
memcpy(*ppTypeAttr, &This->TypeAttr, sizeof(**ppTypeAttr));
|
||||||
|
|
||||||
|
if(This->TypeAttr.typekind == TKIND_ALIAS) /* need to deep copy typedesc */
|
||||||
|
copy_typedesc(&(*ppTypeAttr)->tdescAlias, &This->TypeAttr.tdescAlias);
|
||||||
|
|
||||||
|
if((*ppTypeAttr)->typekind == TKIND_DISPATCH && (*ppTypeAttr)->wTypeFlags & TYPEFLAG_FDUAL) {
|
||||||
|
(*ppTypeAttr)->cFuncs = (*ppTypeAttr)->cbSizeVft / 4; /* This should include all the inherited
|
||||||
|
funcs */
|
||||||
|
(*ppTypeAttr)->cbSizeVft = 28; /* This is always the size of IDispatch's vtbl */
|
||||||
|
(*ppTypeAttr)->wTypeFlags &= ~TYPEFLAG_FOLEAUTOMATION;
|
||||||
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4683,9 +4735,9 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
UINT *pArgErr)
|
UINT *pArgErr)
|
||||||
{
|
{
|
||||||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||||
TLBFuncDesc * pFDesc;
|
|
||||||
TLBVarDesc * pVDesc;
|
|
||||||
int i;
|
int i;
|
||||||
|
unsigned int func_index, var_index;
|
||||||
|
TYPEKIND type_kind;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
TRACE("(%p)(%p,id=%ld,flags=0x%08x,%p,%p,%p,%p) partial stub!\n",
|
TRACE("(%p)(%p,id=%ld,flags=0x%08x,%p,%p,%p,%p) partial stub!\n",
|
||||||
|
@ -4693,31 +4745,30 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
);
|
);
|
||||||
dump_DispParms(pDispParams);
|
dump_DispParms(pDispParams);
|
||||||
|
|
||||||
for(pFDesc=This->funclist; pFDesc; pFDesc=pFDesc->next)
|
hres = ITypeInfo2_GetFuncIndexOfMemId(iface, memid, dwFlags, &func_index);
|
||||||
if (pFDesc->funcdesc.memid == memid) {
|
if (SUCCEEDED(hres)) {
|
||||||
if (pFDesc->funcdesc.invkind & dwFlags)
|
FUNCDESC *func_desc;
|
||||||
break;
|
|
||||||
}
|
hres = ITypeInfo2_GetFuncDesc(iface, func_index, &func_desc);
|
||||||
|
if(FAILED(hres)) return hres;
|
||||||
if (pFDesc) {
|
|
||||||
if (TRACE_ON(typelib)) dump_TLBFuncDescOne(pFDesc);
|
switch (func_desc->funckind) {
|
||||||
/* dump_FUNCDESC(&pFDesc->funcdesc);*/
|
|
||||||
switch (pFDesc->funcdesc.funckind) {
|
|
||||||
case FUNC_PUREVIRTUAL:
|
case FUNC_PUREVIRTUAL:
|
||||||
case FUNC_VIRTUAL: {
|
case FUNC_VIRTUAL: {
|
||||||
DWORD res;
|
DWORD res;
|
||||||
int numargs, numargs2, argspos, args2pos;
|
int numargs, numargs2, argspos, args2pos;
|
||||||
DWORD *args , *args2;
|
DWORD *args , *args2;
|
||||||
VARIANT *rgvarg = HeapAlloc(GetProcessHeap(),0,sizeof(VARIANT)*pFDesc->funcdesc.cParams);
|
VARIANT *rgvarg = HeapAlloc(GetProcessHeap(), 0, sizeof(VARIANT) * func_desc->cParams);
|
||||||
memcpy(rgvarg,pDispParams->rgvarg,sizeof(VARIANT)*pDispParams->cArgs);
|
memcpy(rgvarg,pDispParams->rgvarg,sizeof(VARIANT)*pDispParams->cArgs);
|
||||||
|
|
||||||
|
hres = S_OK;
|
||||||
numargs = 1; numargs2 = 0;
|
numargs = 1; numargs2 = 0;
|
||||||
for (i=0;i<pFDesc->funcdesc.cParams;i++) {
|
for (i = 0; i < func_desc->cParams; i++) {
|
||||||
if (i<pDispParams->cArgs)
|
if (i<pDispParams->cArgs)
|
||||||
numargs += _argsize(pFDesc->funcdesc.lprgelemdescParam[i].tdesc.vt);
|
numargs += _argsize(func_desc->lprgelemdescParam[i].tdesc.vt);
|
||||||
else {
|
else {
|
||||||
numargs += 1; /* sizeof(lpvoid) */
|
numargs += 1; /* sizeof(lpvoid) */
|
||||||
numargs2 += _argsize(pFDesc->funcdesc.lprgelemdescParam[i].tdesc.vt);
|
numargs2 += _argsize(func_desc->lprgelemdescParam[i].tdesc.vt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4726,14 +4777,14 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
|
|
||||||
args[0] = (DWORD)pIUnk;
|
args[0] = (DWORD)pIUnk;
|
||||||
argspos = 1; args2pos = 0;
|
argspos = 1; args2pos = 0;
|
||||||
for (i=0;i<pFDesc->funcdesc.cParams;i++) {
|
for (i = 0; i < func_desc->cParams; i++) {
|
||||||
int arglen = _argsize(pFDesc->funcdesc.lprgelemdescParam[i].tdesc.vt);
|
int arglen = _argsize(func_desc->lprgelemdescParam[i].tdesc.vt);
|
||||||
if (i<pDispParams->cArgs) {
|
if (i<pDispParams->cArgs) {
|
||||||
VARIANT *arg = &rgvarg[pDispParams->cArgs-i-1];
|
VARIANT *arg = &rgvarg[pDispParams->cArgs-i-1];
|
||||||
TYPEDESC *tdesc = &pFDesc->funcdesc.lprgelemdescParam[i].tdesc;
|
TYPEDESC *tdesc = &func_desc->lprgelemdescParam[i].tdesc;
|
||||||
USHORT paramFlags = pFDesc->funcdesc.lprgelemdescParam[i].u.paramdesc.wParamFlags;
|
USHORT paramFlags = func_desc->lprgelemdescParam[i].u.paramdesc.wParamFlags;
|
||||||
if (paramFlags & PARAMFLAG_FOPT) {
|
if (paramFlags & PARAMFLAG_FOPT) {
|
||||||
if(i < pFDesc->funcdesc.cParams-pFDesc->funcdesc.cParamsOpt)
|
if(i < func_desc->cParams - func_desc->cParamsOpt)
|
||||||
ERR("Parameter has PARAMFLAG_FOPT flag but is not one of last cParamOpt parameters\n");
|
ERR("Parameter has PARAMFLAG_FOPT flag but is not one of last cParamOpt parameters\n");
|
||||||
if(V_VT(arg) == VT_EMPTY
|
if(V_VT(arg) == VT_EMPTY
|
||||||
|| ((V_VT(arg) & VT_BYREF) && !V_BYREF(arg))) {
|
|| ((V_VT(arg) & VT_BYREF) && !V_BYREF(arg))) {
|
||||||
|
@ -4748,23 +4799,23 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hres = _copy_arg(iface, tdesc, &args[argspos], arg, tdesc->vt);
|
hres = _copy_arg(iface, tdesc, &args[argspos], arg, tdesc->vt);
|
||||||
if (FAILED(hres)) return hres;
|
if (FAILED(hres)) goto func_fail;
|
||||||
argspos += arglen;
|
argspos += arglen;
|
||||||
} else if(pFDesc->funcdesc.lprgelemdescParam[i].u.paramdesc.wParamFlags & PARAMFLAG_FOPT) {
|
} else if(func_desc->lprgelemdescParam[i].u.paramdesc.wParamFlags & PARAMFLAG_FOPT) {
|
||||||
VARIANT *arg = &rgvarg[i];
|
VARIANT *arg = &rgvarg[i];
|
||||||
TYPEDESC *tdesc = &pFDesc->funcdesc.lprgelemdescParam[i].tdesc;
|
TYPEDESC *tdesc = &func_desc->lprgelemdescParam[i].tdesc;
|
||||||
if(i < pFDesc->funcdesc.cParams-pFDesc->funcdesc.cParamsOpt)
|
if(i < func_desc->cParams - func_desc->cParamsOpt)
|
||||||
ERR("Parameter has PARAMFLAG_FOPT flag but is not one of last cParamOpt parameters\n");
|
ERR("Parameter has PARAMFLAG_FOPT flag but is not one of last cParamOpt parameters\n");
|
||||||
if(pFDesc->funcdesc.lprgelemdescParam[i].u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
|
if(func_desc->lprgelemdescParam[i].u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
|
||||||
FIXME("PARAMFLAG_FHASDEFAULT flag not supported\n");
|
FIXME("PARAMFLAG_FHASDEFAULT flag not supported\n");
|
||||||
V_VT(arg) = VT_ERROR;
|
V_VT(arg) = VT_ERROR;
|
||||||
V_ERROR(arg) = DISP_E_PARAMNOTFOUND;
|
V_ERROR(arg) = DISP_E_PARAMNOTFOUND;
|
||||||
arglen = _argsize(VT_ERROR);
|
arglen = _argsize(VT_ERROR);
|
||||||
hres = _copy_arg(iface, tdesc, &args[argspos], arg, tdesc->vt);
|
hres = _copy_arg(iface, tdesc, &args[argspos], arg, tdesc->vt);
|
||||||
if (FAILED(hres)) return hres;
|
if (FAILED(hres)) goto func_fail;
|
||||||
argspos += arglen;
|
argspos += arglen;
|
||||||
} else {
|
} else {
|
||||||
TYPEDESC *tdesc = &(pFDesc->funcdesc.lprgelemdescParam[i].tdesc);
|
TYPEDESC *tdesc = &(func_desc->lprgelemdescParam[i].tdesc);
|
||||||
if (tdesc->vt != VT_PTR)
|
if (tdesc->vt != VT_PTR)
|
||||||
FIXME("set %d to pointer for get (type is %d)\n",i,tdesc->vt);
|
FIXME("set %d to pointer for get (type is %d)\n",i,tdesc->vt);
|
||||||
/*FIXME: give pointers for the rest, so propertyget works*/
|
/*FIXME: give pointers for the rest, so propertyget works*/
|
||||||
|
@ -4774,32 +4825,28 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
if ((tdesc->vt == VT_PTR) &&
|
if ((tdesc->vt == VT_PTR) &&
|
||||||
(tdesc->u.lptdesc->vt == VT_VARIANT) &&
|
(tdesc->u.lptdesc->vt == VT_VARIANT) &&
|
||||||
pVarResult
|
pVarResult
|
||||||
)
|
)
|
||||||
args[argspos]= (DWORD)pVarResult;
|
args[argspos]= (DWORD)pVarResult;
|
||||||
argspos += 1;
|
argspos += 1;
|
||||||
args2pos += arglen;
|
args2pos += arglen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pFDesc->funcdesc.cParamsOpt < 0)
|
if (func_desc->cParamsOpt < 0)
|
||||||
FIXME("Does not support optional parameters (%d)\n",
|
FIXME("Does not support optional parameters (%d)\n", func_desc->cParamsOpt);
|
||||||
pFDesc->funcdesc.cParamsOpt
|
|
||||||
);
|
|
||||||
|
|
||||||
res = _invoke((*(FARPROC**)pIUnk)[pFDesc->funcdesc.oVft/4],
|
res = _invoke((*(FARPROC**)pIUnk)[func_desc->oVft/4],
|
||||||
pFDesc->funcdesc.callconv,
|
func_desc->callconv,
|
||||||
numargs,
|
numargs,
|
||||||
args
|
args
|
||||||
);
|
);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, rgvarg);
|
|
||||||
|
|
||||||
if (pVarResult && (dwFlags & (DISPATCH_PROPERTYGET))) {
|
if (pVarResult && (dwFlags & (DISPATCH_PROPERTYGET))) {
|
||||||
args2pos = 0;
|
args2pos = 0;
|
||||||
for (i=0;i<pFDesc->funcdesc.cParams-pDispParams->cArgs;i++) {
|
for (i = 0; i < func_desc->cParams - pDispParams->cArgs; i++) {
|
||||||
int arglen = _argsize(pFDesc->funcdesc.lprgelemdescParam[i].tdesc.vt);
|
int arglen = _argsize(func_desc->lprgelemdescParam[i].tdesc.vt);
|
||||||
TYPEDESC *tdesc = &(pFDesc->funcdesc.lprgelemdescParam[i+pDispParams->cArgs].tdesc);
|
TYPEDESC *tdesc = &(func_desc->lprgelemdescParam[i + pDispParams->cArgs].tdesc);
|
||||||
TYPEDESC i4_tdesc;
|
TYPEDESC i4_tdesc;
|
||||||
i4_tdesc.vt = VT_I4;
|
i4_tdesc.vt = VT_I4;
|
||||||
|
|
||||||
/* If we are a pointer to a variant, we are done already */
|
/* If we are a pointer to a variant, we are done already */
|
||||||
if ((tdesc->vt==VT_PTR)&&(tdesc->u.lptdesc->vt==VT_VARIANT))
|
if ((tdesc->vt==VT_PTR)&&(tdesc->u.lptdesc->vt==VT_VARIANT))
|
||||||
|
@ -4815,16 +4862,16 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
TYPEATTR *tattr;
|
TYPEATTR *tattr;
|
||||||
|
|
||||||
hres = ITypeInfo_GetRefTypeInfo(iface,tdesc->u.hreftype,&tinfo2);
|
hres = ITypeInfo_GetRefTypeInfo(iface,tdesc->u.hreftype,&tinfo2);
|
||||||
if (hres) {
|
if (FAILED(hres)) {
|
||||||
FIXME("Could not get typeinfo of hreftype %lx for VT_USERDEFINED, while coercing. Copying 4 byte.\n",tdesc->u.hreftype);
|
FIXME("Could not get typeinfo of hreftype %lx for VT_USERDEFINED, while coercing. Copying 4 byte.\n",tdesc->u.hreftype);
|
||||||
return E_FAIL;
|
goto func_fail;
|
||||||
}
|
}
|
||||||
ITypeInfo_GetTypeAttr(tinfo2,&tattr);
|
ITypeInfo_GetTypeAttr(tinfo2,&tattr);
|
||||||
switch (tattr->typekind) {
|
switch (tattr->typekind) {
|
||||||
case TKIND_ENUM:
|
case TKIND_ENUM:
|
||||||
/* force the return type to be VT_I4 */
|
/* force the return type to be VT_I4 */
|
||||||
tdesc = &i4_tdesc;
|
tdesc = &i4_tdesc;
|
||||||
break;
|
break;
|
||||||
case TKIND_ALIAS:
|
case TKIND_ALIAS:
|
||||||
TRACE("TKIND_ALIAS to vt 0x%x\n",tattr->tdescAlias.vt);
|
TRACE("TKIND_ALIAS to vt 0x%x\n",tattr->tdescAlias.vt);
|
||||||
tdesc = &(tattr->tdescAlias);
|
tdesc = &(tattr->tdescAlias);
|
||||||
|
@ -4859,57 +4906,67 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
args2pos += arglen;
|
args2pos += arglen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func_fail:
|
||||||
|
HeapFree(GetProcessHeap(), 0, rgvarg);
|
||||||
HeapFree(GetProcessHeap(),0,args2);
|
HeapFree(GetProcessHeap(),0,args2);
|
||||||
HeapFree(GetProcessHeap(),0,args);
|
HeapFree(GetProcessHeap(),0,args);
|
||||||
return S_OK;
|
break;
|
||||||
}
|
}
|
||||||
case FUNC_DISPATCH: {
|
case FUNC_DISPATCH: {
|
||||||
IDispatch *disp;
|
IDispatch *disp;
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
hr = IUnknown_QueryInterface((LPUNKNOWN)pIUnk,&IID_IDispatch,(LPVOID*)&disp);
|
hres = IUnknown_QueryInterface((LPUNKNOWN)pIUnk,&IID_IDispatch,(LPVOID*)&disp);
|
||||||
if (hr) {
|
if (SUCCEEDED(hres)) {
|
||||||
|
FIXME("Calling Invoke in IDispatch iface. untested!\n");
|
||||||
|
hres = IDispatch_Invoke(
|
||||||
|
disp,memid,&IID_NULL,LOCALE_USER_DEFAULT,dwFlags,pDispParams,
|
||||||
|
pVarResult,pExcepInfo,pArgErr
|
||||||
|
);
|
||||||
|
if (FAILED(hres))
|
||||||
|
FIXME("IDispatch::Invoke failed with %08lx. (Could be not a real error?)\n", hres);
|
||||||
|
IDispatch_Release(disp);
|
||||||
|
} else
|
||||||
FIXME("FUNC_DISPATCH used on object without IDispatch iface?\n");
|
FIXME("FUNC_DISPATCH used on object without IDispatch iface?\n");
|
||||||
return hr;
|
break;
|
||||||
}
|
|
||||||
FIXME("Calling Invoke in IDispatch iface. untested!\n");
|
|
||||||
hr = IDispatch_Invoke(
|
|
||||||
disp,memid,&IID_NULL,LOCALE_USER_DEFAULT,dwFlags,pDispParams,
|
|
||||||
pVarResult,pExcepInfo,pArgErr
|
|
||||||
);
|
|
||||||
if (hr)
|
|
||||||
FIXME("IDispatch::Invoke failed with %08lx. (Could be not a real error?)\n",hr);
|
|
||||||
IDispatch_Release(disp);
|
|
||||||
return hr;
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
FIXME("Unknown function invocation type %d\n",pFDesc->funcdesc.funckind);
|
FIXME("Unknown function invocation type %d\n", func_desc->funckind);
|
||||||
return E_FAIL;
|
hres = E_FAIL;
|
||||||
}
|
break;
|
||||||
} else {
|
|
||||||
for(pVDesc=This->varlist; pVDesc; pVDesc=pVDesc->next) {
|
|
||||||
if (pVDesc->vardesc.memid == memid) {
|
|
||||||
FIXME("varseek: Found memid name %s, but variable-based invoking not supported\n",debugstr_w(((LPWSTR)pVDesc->Name)));
|
|
||||||
dump_TLBVarDesc(pVDesc);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* not found, look for it in inherited interfaces */
|
|
||||||
if (This->TypeAttr.cImplTypes &&
|
|
||||||
(This->TypeAttr.typekind==TKIND_INTERFACE || This->TypeAttr.typekind==TKIND_DISPATCH)) {
|
|
||||||
/* recursive search */
|
|
||||||
ITypeInfo *pTInfo;
|
|
||||||
HRESULT hr;
|
|
||||||
hr=ITypeInfo_GetRefTypeInfo(iface, This->impltypelist->hRef, &pTInfo);
|
|
||||||
if(SUCCEEDED(hr)){
|
|
||||||
hr=ITypeInfo_Invoke(pTInfo,pIUnk,memid,dwFlags,pDispParams,pVarResult,pExcepInfo,pArgErr);
|
|
||||||
ITypeInfo_Release(pTInfo);
|
|
||||||
return hr;
|
|
||||||
}
|
}
|
||||||
WARN("Could not search inherited interface!\n");
|
|
||||||
|
ITypeInfo2_ReleaseFuncDesc(iface, func_desc);
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
} else if(SUCCEEDED(hres = ITypeInfo2_GetVarIndexOfMemId(iface, memid, &var_index))) {
|
||||||
|
VARDESC *var_desc;
|
||||||
|
|
||||||
|
hres = ITypeInfo2_GetVarDesc(iface, var_index, &var_desc);
|
||||||
|
if(FAILED(hres)) return hres;
|
||||||
|
|
||||||
|
FIXME("varseek: Found memid, but variable-based invoking not supported\n");
|
||||||
|
dump_VARDESC(var_desc);
|
||||||
|
ITypeInfo2_ReleaseVarDesc(iface, var_desc);
|
||||||
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
ERR("did not find member id %d, flags %d!\n", (int)memid, dwFlags);
|
|
||||||
|
/* not found, look for it in inherited interfaces */
|
||||||
|
ITypeInfo2_GetTypeKind(iface, &type_kind);
|
||||||
|
if(type_kind == TKIND_INTERFACE || type_kind == TKIND_DISPATCH) {
|
||||||
|
HREFTYPE ref_type;
|
||||||
|
if(SUCCEEDED(ITypeInfo2_GetRefTypeOfImplType(iface, 0, &ref_type))) {
|
||||||
|
/* recursive search */
|
||||||
|
ITypeInfo *pTInfo;
|
||||||
|
hres = ITypeInfo_GetRefTypeInfo(iface, ref_type, &pTInfo);
|
||||||
|
if(SUCCEEDED(hres)){
|
||||||
|
hres = ITypeInfo_Invoke(pTInfo,pIUnk,memid,dwFlags,pDispParams,pVarResult,pExcepInfo,pArgErr);
|
||||||
|
ITypeInfo_Release(pTInfo);
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
WARN("Could not search inherited interface!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ERR("did not find member id %08lx, flags %d!\n", memid, dwFlags);
|
||||||
return DISP_E_MEMBERNOTFOUND;
|
return DISP_E_MEMBERNOTFOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5176,6 +5233,9 @@ static void WINAPI ITypeInfo_fnReleaseTypeAttr( ITypeInfo2 *iface,
|
||||||
{
|
{
|
||||||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||||
TRACE("(%p)->(%p)\n", This, pTypeAttr);
|
TRACE("(%p)->(%p)\n", This, pTypeAttr);
|
||||||
|
if(This->TypeAttr.typekind == TKIND_ALIAS)
|
||||||
|
free_deep_typedesc(&pTypeAttr->tdescAlias);
|
||||||
|
HeapFree(GetProcessHeap(), 0, pTypeAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ITypeInfo::ReleaseFuncDesc
|
/* ITypeInfo::ReleaseFuncDesc
|
||||||
|
@ -5242,18 +5302,18 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncIndexOfMemId( ITypeInfo2 * iface,
|
||||||
TLBFuncDesc *pFuncInfo;
|
TLBFuncDesc *pFuncInfo;
|
||||||
int i;
|
int i;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
/* FIXME: should check for invKind??? */
|
|
||||||
for(i=0, pFuncInfo=This->funclist;pFuncInfo &&
|
for(i = 0, pFuncInfo = This->funclist; pFuncInfo; i++, pFuncInfo=pFuncInfo->next)
|
||||||
memid != pFuncInfo->funcdesc.memid; i++, pFuncInfo=pFuncInfo->next);
|
if(memid == pFuncInfo->funcdesc.memid && (invKind & pFuncInfo->funcdesc.invkind))
|
||||||
if(pFuncInfo){
|
break;
|
||||||
*pFuncIndex=i;
|
if(pFuncInfo) {
|
||||||
result= S_OK;
|
*pFuncIndex = i;
|
||||||
}else{
|
result = S_OK;
|
||||||
*pFuncIndex=0;
|
} else
|
||||||
result=E_INVALIDARG;
|
result = TYPE_E_ELEMENTNOTFOUND;
|
||||||
}
|
|
||||||
TRACE("(%p) memid 0x%08lx invKind 0x%04x -> %s\n", This,
|
TRACE("(%p) memid 0x%08lx invKind 0x%04x -> %s\n", This,
|
||||||
memid, invKind, SUCCEEDED(result)? "SUCCES":"FAILED");
|
memid, invKind, SUCCEEDED(result) ? "SUCCESS" : "FAILED");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5273,15 +5333,14 @@ static HRESULT WINAPI ITypeInfo2_fnGetVarIndexOfMemId( ITypeInfo2 * iface,
|
||||||
for(i=0, pVarInfo=This->varlist; pVarInfo &&
|
for(i=0, pVarInfo=This->varlist; pVarInfo &&
|
||||||
memid != pVarInfo->vardesc.memid; i++, pVarInfo=pVarInfo->next)
|
memid != pVarInfo->vardesc.memid; i++, pVarInfo=pVarInfo->next)
|
||||||
;
|
;
|
||||||
if(pVarInfo){
|
if(pVarInfo) {
|
||||||
*pVarIndex=i;
|
*pVarIndex = i;
|
||||||
result= S_OK;
|
result = S_OK;
|
||||||
}else{
|
} else
|
||||||
*pVarIndex=0;
|
result = TYPE_E_ELEMENTNOTFOUND;
|
||||||
result=E_INVALIDARG;
|
|
||||||
}
|
|
||||||
TRACE("(%p) memid 0x%08lx -> %s\n", This,
|
TRACE("(%p) memid 0x%08lx -> %s\n", This,
|
||||||
memid, SUCCEEDED(result)? "SUCCES":"FAILED");
|
memid, SUCCEEDED(result) ? "SUCCESS" : "FAILED");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
#include "objbase.h"
|
#include "objbase.h"
|
||||||
#include "ole2disp.h"
|
#include "ole2disp.h"
|
||||||
#include "typelib.h"
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||||
|
|
|
@ -48,10 +48,8 @@
|
||||||
|
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
#include "objbase.h"
|
#include "objbase.h"
|
||||||
#include "ole2disp.h"
|
|
||||||
#include "typelib.h"
|
#include "typelib.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "variant.h"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(typelib2);
|
WINE_DEFAULT_DEBUG_CHANNEL(typelib2);
|
||||||
/* WINE_DEFAULT_DEBUG_CHANNEL(ole); */
|
/* WINE_DEFAULT_DEBUG_CHANNEL(ole); */
|
||||||
|
@ -150,7 +148,7 @@ typedef struct tagICreateTypeLib2Impl
|
||||||
ICreateTypeLib2Vtbl *lpVtbl;
|
ICreateTypeLib2Vtbl *lpVtbl;
|
||||||
ITypeLib2Vtbl *lpVtblTypeLib2;
|
ITypeLib2Vtbl *lpVtblTypeLib2;
|
||||||
|
|
||||||
UINT ref;
|
ULONG ref;
|
||||||
|
|
||||||
WCHAR *filename;
|
WCHAR *filename;
|
||||||
|
|
||||||
|
@ -176,7 +174,7 @@ typedef struct tagICreateTypeInfo2Impl
|
||||||
ICreateTypeInfo2Vtbl *lpVtbl;
|
ICreateTypeInfo2Vtbl *lpVtbl;
|
||||||
ITypeInfo2Vtbl *lpVtblTypeInfo2;
|
ITypeInfo2Vtbl *lpVtblTypeInfo2;
|
||||||
|
|
||||||
UINT ref;
|
ULONG ref;
|
||||||
|
|
||||||
ICreateTypeLib2Impl *typelib;
|
ICreateTypeLib2Impl *typelib;
|
||||||
MSFT_TypeInfoBase *typeinfo;
|
MSFT_TypeInfoBase *typeinfo;
|
||||||
|
@ -979,18 +977,25 @@ static int ctl2_encode_typedesc(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VT_CARRAY:
|
case VT_CARRAY:
|
||||||
|
{
|
||||||
/* FIXME: Make with the error checking. */
|
/* 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);
|
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 = (void *)&This->typelib_segment_data[MSFT_SEG_ARRAYDESC][arrayoffset];
|
||||||
|
|
||||||
arraydata[0] = target_type;
|
arraydata[0] = target_type;
|
||||||
arraydata[1] = 0x00080001;
|
arraydata[1] = num_dims;
|
||||||
arraydata[2] = 0x8;
|
arraydata[1] |= ((num_dims * 2 * sizeof(int)) << 16);
|
||||||
arraydata[3] = 0;
|
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);
|
typeoffset = ctl2_alloc_segment(This, MSFT_SEG_TYPEDESC, 8, 0);
|
||||||
typedata = (void *)&This->typelib_segment_data[MSFT_SEG_TYPEDESC][typeoffset];
|
typedata = (void *)&This->typelib_segment_data[MSFT_SEG_TYPEDESC][typeoffset];
|
||||||
|
|
||||||
|
@ -998,12 +1003,11 @@ static int ctl2_encode_typedesc(
|
||||||
typedata[1] = arrayoffset;
|
typedata[1] = arrayoffset;
|
||||||
|
|
||||||
*encoded_tdesc = typeoffset;
|
*encoded_tdesc = typeoffset;
|
||||||
*width = 8;
|
*width = *width * elements;
|
||||||
*alignment = 1;
|
*decoded_size = sizeof(ARRAYDESC) + (num_dims - 1) * sizeof(SAFEARRAYBOUND);
|
||||||
*decoded_size = sizeof(ARRAYDESC);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case VT_USERDEFINED:
|
case VT_USERDEFINED:
|
||||||
TRACE("USERDEFINED.\n");
|
TRACE("USERDEFINED.\n");
|
||||||
for (typeoffset = 0; typeoffset < This->typelib_segdir[MSFT_SEG_TYPEDESC].length; typeoffset += 8) {
|
for (typeoffset = 0; typeoffset < This->typelib_segdir[MSFT_SEG_TYPEDESC].length; typeoffset += 8) {
|
||||||
|
@ -1138,10 +1142,11 @@ static HRESULT WINAPI ICreateTypeInfo2_fnQueryInterface(
|
||||||
static ULONG WINAPI ICreateTypeInfo2_fnAddRef(ICreateTypeInfo2 *iface)
|
static ULONG WINAPI ICreateTypeInfo2_fnAddRef(ICreateTypeInfo2 *iface)
|
||||||
{
|
{
|
||||||
ICreateTypeInfo2Impl *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 %lu\n",This, ref - 1);
|
||||||
|
|
||||||
return ++(This->ref);
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -1152,12 +1157,11 @@ static ULONG WINAPI ICreateTypeInfo2_fnAddRef(ICreateTypeInfo2 *iface)
|
||||||
static ULONG WINAPI ICreateTypeInfo2_fnRelease(ICreateTypeInfo2 *iface)
|
static ULONG WINAPI ICreateTypeInfo2_fnRelease(ICreateTypeInfo2 *iface)
|
||||||
{
|
{
|
||||||
ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
|
ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
--(This->ref);
|
TRACE("(%p)->(%lu)\n",This, ref);
|
||||||
|
|
||||||
TRACE("(%p)->(%u)\n",This, This->ref);
|
if (!ref) {
|
||||||
|
|
||||||
if (!This->ref) {
|
|
||||||
if (This->typelib) {
|
if (This->typelib) {
|
||||||
ICreateTypeLib2_fnRelease((ICreateTypeLib2 *)This->typelib);
|
ICreateTypeLib2_fnRelease((ICreateTypeLib2 *)This->typelib);
|
||||||
This->typelib = NULL;
|
This->typelib = NULL;
|
||||||
|
@ -1168,7 +1172,7 @@ static ULONG WINAPI ICreateTypeInfo2_fnRelease(ICreateTypeInfo2 *iface)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return This->ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3005,10 +3009,11 @@ static HRESULT WINAPI ICreateTypeLib2_fnQueryInterface(
|
||||||
static ULONG WINAPI ICreateTypeLib2_fnAddRef(ICreateTypeLib2 *iface)
|
static ULONG WINAPI ICreateTypeLib2_fnAddRef(ICreateTypeLib2 *iface)
|
||||||
{
|
{
|
||||||
ICreateTypeLib2Impl *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 %lu\n",This, ref - 1);
|
||||||
|
|
||||||
return ++(This->ref);
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -3019,30 +3024,25 @@ static ULONG WINAPI ICreateTypeLib2_fnAddRef(ICreateTypeLib2 *iface)
|
||||||
static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
|
static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
|
||||||
{
|
{
|
||||||
ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
|
ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
--(This->ref);
|
TRACE("(%p)->(%lu)\n",This, ref);
|
||||||
|
|
||||||
TRACE("(%p)->(%u)\n",This, This->ref);
|
if (!ref) {
|
||||||
|
|
||||||
if (!This->ref) {
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MSFT_SEG_MAX; i++) {
|
for (i = 0; i < MSFT_SEG_MAX; i++) {
|
||||||
if (This->typelib_segment_data[i]) {
|
HeapFree(GetProcessHeap(), 0, This->typelib_segment_data[i]);
|
||||||
HeapFree(GetProcessHeap(), 0, This->typelib_segment_data[i]);
|
This->typelib_segment_data[i] = NULL;
|
||||||
This->typelib_segment_data[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (This->filename) {
|
HeapFree(GetProcessHeap(), 0, This->filename);
|
||||||
HeapFree(GetProcessHeap(), 0, This->filename);
|
This->filename = NULL;
|
||||||
This->filename = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (This->typeinfos) {
|
while (This->typeinfos) {
|
||||||
ICreateTypeInfo2Impl *typeinfo = This->typeinfos;
|
ICreateTypeInfo2Impl *typeinfo = This->typeinfos;
|
||||||
This->typeinfos = typeinfo->next_typeinfo;
|
This->typeinfos = typeinfo->next_typeinfo;
|
||||||
if (typeinfo->typedata) HeapFree(GetProcessHeap(), 0, typeinfo->typedata);
|
HeapFree(GetProcessHeap(), 0, typeinfo->typedata);
|
||||||
HeapFree(GetProcessHeap(), 0, typeinfo);
|
HeapFree(GetProcessHeap(), 0, typeinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3050,7 +3050,7 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return This->ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1310,12 +1310,10 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
|
||||||
case FMT_NUM_YES_NO:
|
case FMT_NUM_YES_NO:
|
||||||
boolFlag = VAR_BOOLYESNO;
|
boolFlag = VAR_BOOLYESNO;
|
||||||
goto VARIANT_FormatNumber_Bool;
|
goto VARIANT_FormatNumber_Bool;
|
||||||
break;
|
|
||||||
|
|
||||||
case FMT_NUM_ON_OFF:
|
case FMT_NUM_ON_OFF:
|
||||||
boolFlag = VAR_BOOLONOFF;
|
boolFlag = VAR_BOOLONOFF;
|
||||||
goto VARIANT_FormatNumber_Bool;
|
goto VARIANT_FormatNumber_Bool;
|
||||||
break;
|
|
||||||
|
|
||||||
case FMT_NUM_TRUE_FALSE:
|
case FMT_NUM_TRUE_FALSE:
|
||||||
boolFlag = VAR_LOCALBOOL;
|
boolFlag = VAR_LOCALBOOL;
|
||||||
|
@ -1452,7 +1450,6 @@ VARIANT_FormatNumber_Bool:
|
||||||
ERR("Unknown token 0x%02x!\n", *pToken);
|
ERR("Unknown token 0x%02x!\n", *pToken);
|
||||||
hRes = E_INVALIDARG;
|
hRes = E_INVALIDARG;
|
||||||
goto VARIANT_FormatNumber_Exit;
|
goto VARIANT_FormatNumber_Exit;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (localeValue)
|
if (localeValue)
|
||||||
{
|
{
|
||||||
|
@ -1762,7 +1759,6 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
|
||||||
ERR("Unknown token 0x%02x!\n", *pToken);
|
ERR("Unknown token 0x%02x!\n", *pToken);
|
||||||
hRes = E_INVALIDARG;
|
hRes = E_INVALIDARG;
|
||||||
goto VARIANT_FormatDate_Exit;
|
goto VARIANT_FormatDate_Exit;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (localeValue)
|
if (localeValue)
|
||||||
{
|
{
|
||||||
|
@ -1916,7 +1912,6 @@ static HRESULT VARIANT_FormatString(LPVARIANT pVarIn, LPOLESTR lpszFormat,
|
||||||
ERR("Unknown token 0x%02x!\n", *pToken);
|
ERR("Unknown token 0x%02x!\n", *pToken);
|
||||||
hRes = E_INVALIDARG;
|
hRes = E_INVALIDARG;
|
||||||
goto VARIANT_FormatString_Exit;
|
goto VARIANT_FormatString_Exit;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
pToken++;
|
pToken++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -764,24 +764,24 @@ static inline size_t VARIANT_DataSize(const VARIANT* pv)
|
||||||
switch (V_TYPE(pv))
|
switch (V_TYPE(pv))
|
||||||
{
|
{
|
||||||
case VT_I1:
|
case VT_I1:
|
||||||
case VT_UI1: return sizeof(BYTE); break;
|
case VT_UI1: return sizeof(BYTE);
|
||||||
case VT_I2:
|
case VT_I2:
|
||||||
case VT_UI2: return sizeof(SHORT); break;
|
case VT_UI2: return sizeof(SHORT);
|
||||||
case VT_INT:
|
case VT_INT:
|
||||||
case VT_UINT:
|
case VT_UINT:
|
||||||
case VT_I4:
|
case VT_I4:
|
||||||
case VT_UI4: return sizeof(LONG); break;
|
case VT_UI4: return sizeof(LONG);
|
||||||
case VT_I8:
|
case VT_I8:
|
||||||
case VT_UI8: return sizeof(LONGLONG); break;
|
case VT_UI8: return sizeof(LONGLONG);
|
||||||
case VT_R4: return sizeof(float); break;
|
case VT_R4: return sizeof(float);
|
||||||
case VT_R8: return sizeof(double); break;
|
case VT_R8: return sizeof(double);
|
||||||
case VT_DATE: return sizeof(DATE); break;
|
case VT_DATE: return sizeof(DATE);
|
||||||
case VT_BOOL: return sizeof(VARIANT_BOOL); break;
|
case VT_BOOL: return sizeof(VARIANT_BOOL);
|
||||||
case VT_DISPATCH:
|
case VT_DISPATCH:
|
||||||
case VT_UNKNOWN:
|
case VT_UNKNOWN:
|
||||||
case VT_BSTR: return sizeof(void*); break;
|
case VT_BSTR: return sizeof(void*);
|
||||||
case VT_CY: return sizeof(CY); break;
|
case VT_CY: return sizeof(CY);
|
||||||
case VT_ERROR: return sizeof(SCODE); break;
|
case VT_ERROR: return sizeof(SCODE);
|
||||||
}
|
}
|
||||||
TRACE("Shouldn't be called for vt %s%s!\n", debugstr_VT(pv), debugstr_VF(pv));
|
TRACE("Shouldn't be called for vt %s%s!\n", debugstr_VT(pv), debugstr_VF(pv));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3925,7 +3925,7 @@ HRESULT WINAPI VarNeg(LPVARIANT pVarIn, LPVARIANT pVarOut)
|
||||||
* Failure: An HRESULT error code indicating the error.
|
* Failure: An HRESULT error code indicating the error.
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* - Strictly speaking, this function performs a bitwise ones compliment
|
* - Strictly speaking, this function performs a bitwise ones complement
|
||||||
* on the variants value (after possibly converting to VT_I4, see below).
|
* on the variants value (after possibly converting to VT_I4, see below).
|
||||||
* This only behaves like a boolean not operation if the value in
|
* This only behaves like a boolean not operation if the value in
|
||||||
* pVarIn is either VARIANT_TRUE or VARIANT_FALSE and the type is signed.
|
* pVarIn is either VARIANT_TRUE or VARIANT_FALSE and the type is signed.
|
||||||
|
|
Loading…
Reference in a new issue