Sync to Wine-20050211

James Hawkins <truiken@gmail.com>
- Use Interlocked* instead of ++/-- in AddRef/Release.
- Use only stored result of Interlocked* in AddRef/Release.
- Expand TRACEs to display the ref count.
Alex Villacis Lasso <a_villacis@palosanto.com>
- Initialize temporary variants before calling VariantChangeTypeEx.
- When parsing an hex/oct integer value, copy value verbatim in VARIANT,
  rather than a negated value. Add test case for this behavior.
Vincent Beron <vberon@mecano.gme.usherb.ca>
- Remove message telling users to copy native stdole32.tlb over as we
  now provide it.
- Better trace in LoadTypeLib.
- Change debug messages type to reflect we provide stdole32.tlb.
Robert Shearman <rob@codeweavers.com>
- Move OLE automation interface registration to oleaut32.
- Add IRemUnknown to list of interfaces to register.
Mike Hearn <mh@codeweavers.com>
- Change some FIXMEs to ERRs to reflect the fact that nothing needs
  fixing.
- Fix some memory leaks on error paths in _marshal_interface.
- Fix a typo, propagate errors better from inside the typelib
  marshaller.
- Return OLE automation build value as win2k by default.
Rein Klazes <wijn@wanadoo.nl>
- SafeArrayDestroy() returns success when called with a NULL
  pointer. Added to the test cases.
Paul Vriens <Paul.Vriens@xs4all.nl>
- Add WinXP to OaBuildVersion.

svn path=/trunk/; revision=13533
This commit is contained in:
Gé van Geldorp 2005-02-13 21:03:37 +00:00
parent f4477fcb16
commit 5faf6ad9c1
10 changed files with 515 additions and 149 deletions

View file

@ -196,8 +196,11 @@ static HRESULT WINAPI ConnectionPointImpl_QueryInterface(
static ULONG WINAPI ConnectionPointImpl_AddRef(IConnectionPoint* iface)
{
ConnectionPointImpl *This = (ConnectionPointImpl *)iface;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
return InterlockedIncrement(&This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%ld)\n", This, refCount - 1);
return refCount;
}
/************************************************************************
@ -209,20 +212,16 @@ static ULONG WINAPI ConnectionPointImpl_Release(
IConnectionPoint* iface)
{
ConnectionPointImpl *This = (ConnectionPointImpl *)iface;
ULONG ref;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
ULONG refCount = InterlockedDecrement(&This->ref);
/*
* Decrease the reference count on this object.
*/
ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%ld)\n", This, refCount + 1);
/*
* If the reference count goes down to 0, perform suicide.
*/
if (ref == 0) ConnectionPointImpl_Destroy(This);
if (!refCount) ConnectionPointImpl_Destroy(This);
return ref;
return refCount;
}
/************************************************************************
@ -470,11 +469,12 @@ static HRESULT WINAPI EnumConnectionsImpl_QueryInterface(
static ULONG WINAPI EnumConnectionsImpl_AddRef(IEnumConnections* iface)
{
EnumConnectionsImpl *This = (EnumConnectionsImpl *)iface;
ULONG ref;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
ref = InterlockedIncrement(&This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%ld)\n", This, refCount - 1);
IUnknown_AddRef(This->pUnk);
return ref;
return refCount;
}
/************************************************************************
@ -485,22 +485,18 @@ static ULONG WINAPI EnumConnectionsImpl_AddRef(IEnumConnections* iface)
static ULONG WINAPI EnumConnectionsImpl_Release(IEnumConnections* iface)
{
EnumConnectionsImpl *This = (EnumConnectionsImpl *)iface;
ULONG ref;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%ld)\n", This, refCount + 1);
IUnknown_Release(This->pUnk);
/*
* Decrease the reference count on this object.
*/
ref = InterlockedDecrement(&This->ref);
/*
* If the reference count goes down to 0, perform suicide.
*/
if (ref == 0) EnumConnectionsImpl_Destroy(This);
if (!refCount) EnumConnectionsImpl_Destroy(This);
return ref;
return refCount;
}
/************************************************************************

View file

@ -256,9 +256,11 @@ static HRESULT WINAPI StdDispatch_QueryInterface(
static ULONG WINAPI StdDispatch_AddRef(LPDISPATCH iface)
{
StdDispatch *This = (StdDispatch *)iface;
TRACE("()\n");
ULONG refCount = InterlockedIncrement(&This->ref);
return InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
return refCount;
}
/******************************************************************************
@ -269,18 +271,17 @@ static ULONG WINAPI StdDispatch_AddRef(LPDISPATCH iface)
static ULONG WINAPI StdDispatch_Release(LPDISPATCH iface)
{
StdDispatch *This = (StdDispatch *)iface;
ULONG ref;
TRACE("(%p)->()\n", This);
ULONG refCount = InterlockedDecrement(&This->ref);
ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (ref == 0)
if (!refCount)
{
ITypeInfo_Release(This->pTypeInfo);
CoTaskMemFree(This);
}
return ref;
return refCount;
}
/******************************************************************************

View file

@ -563,10 +563,11 @@ ULONG WINAPI OaBuildVersion()
case 0x80000a04: /* WIN98 */
case 0x00000004: /* NT40 */
case 0x00000005: /* W2K */
case 0x00000105: /* WinXP */
return MAKELONG(0xffff, 40);
default:
ERR("Version value not known yet. Please investigate it !\n");
return 0x0;
FIXME("Version value not known yet. Please investigate it !\n");
return MAKELONG(0xffff, 40); /* for now return the same value as for w2k */
}
}

View file

@ -1214,7 +1214,7 @@ static HRESULT WINAPI OLEFontImpl_GetTypeInfo(
return E_FAIL;
hres = LoadTypeLib(stdole32tlb, &tl);
if (FAILED(hres)) {
FIXME("Could not load the stdole32.tlb?\n");
ERR("Could not load the stdole32.tlb?\n");
return hres;
}
hres = ITypeLib_GetTypeInfoOfGuid(tl, &IID_IDispatch, ppTInfo);

View file

@ -409,8 +409,11 @@ static ULONG WINAPI OLEPictureImpl_AddRef(
IPicture* iface)
{
OLEPictureImpl *This = (OLEPictureImpl *)iface;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
return InterlockedIncrement(&This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%ld)\n", This, refCount - 1);
return refCount;
}
/************************************************************************
@ -422,20 +425,16 @@ static ULONG WINAPI OLEPictureImpl_Release(
IPicture* iface)
{
OLEPictureImpl *This = (OLEPictureImpl *)iface;
ULONG ret;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
ULONG refCount = InterlockedDecrement(&This->ref);
/*
* Decrease the reference count on this object.
*/
ret = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%ld)\n", This, refCount + 1);
/*
* If the reference count goes down to 0, perform suicide.
*/
if (ret==0) OLEPictureImpl_Destroy(This);
if (!refCount) OLEPictureImpl_Destroy(This);
return ret;
return refCount;
}

View file

@ -545,7 +545,358 @@ static struct regsvr_coclass const coclass_list[] = {
* interface list
*/
/* FIXME: these interfaces should be defined in ocidl.idl */
static IID const IID_IFontEventsDisp = {
0x4EF6100A, 0xAF88, 0x11D0, {0x98,0x46,0x00,0xC0,0x4F,0xC2,0x99,0x93} };
static IID const IID_IProvideMultipleClassInfo = {
0xA7ABA9C1, 0x8983, 0x11CF, {0x8F,0x20,0x00,0x80,0x5F,0x2C,0xD0,0x64} };
static struct regsvr_interface const interface_list[] = {
{ &IID_IDispatch,
"IDispatch",
NULL,
7,
&CLSID_PSDispatch,
&CLSID_PSDispatch
},
{ &IID_ITypeInfo,
"ITypeInfo",
NULL,
22,
NULL,
&CLSID_PSTypeInfo
},
{ &IID_ITypeLib,
"ITypeLib",
NULL,
13,
NULL,
&CLSID_PSTypeLib
},
{ &IID_ITypeComp,
"ITypeComp",
NULL,
5,
NULL,
&CLSID_PSTypeComp
},
{ &IID_IEnumVARIANT,
"IEnumVARIANT",
NULL,
15,
NULL,
&CLSID_PSEnumVariant
},
{ &IID_ICreateTypeInfo,
"ICreateTypeInfo",
NULL,
26,
NULL,
NULL
},
{ &IID_ICreateTypeLib,
"ICreateTypeLib",
NULL,
13,
NULL,
NULL
},
{ &IID_ITypeInfo2,
"ITypeInfo2",
NULL,
32,
NULL,
&CLSID_PSDispatch
},
{ &IID_ITypeLib2,
"ITypeLib2",
NULL,
16,
NULL,
&CLSID_PSDispatch
},
{ &IID_IPropertyPage2,
"IPropertyPage2",
NULL,
15,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IErrorInfo,
"IErrorInfo",
NULL,
8,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_ICreateErrorInfo,
"ICreateErrorInfo",
NULL,
8,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPersistPropertyBag2,
"IPersistPropertyBag2",
NULL,
8,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPropertyBag2,
"IPropertyBag2",
NULL,
8,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IErrorLog,
"IErrorLog",
NULL,
4,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPerPropertyBrowsing,
"IPerPropertyBrowsing",
NULL,
7,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPersistPropertyBag,
"IPersistPropertyBag",
NULL,
7,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IAdviseSinkEx,
"IAdviseSinkEx",
NULL,
9,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IFontEventsDisp,
"IFontEventsDisp",
NULL,
7,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPropertyBag,
"IPropertyBag",
NULL,
5,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPointerInactive,
"IPointerInactive",
NULL,
6,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_ISimpleFrameSite,
"ISimpleFrameSite",
NULL,
5,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPicture,
"IPicture",
NULL,
17,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPictureDisp,
"IPictureDisp",
NULL,
7,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPersistStreamInit,
"IPersistStreamInit",
NULL,
9,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IOleUndoUnit,
"IOleUndoUnit",
NULL,
7,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPropertyNotifySink,
"IPropertyNotifySink",
NULL,
5,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IOleInPlaceSiteEx,
"IOleInPlaceSiteEx",
NULL,
18,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IOleParentUndoUnit,
"IOleParentUndoUnit",
NULL,
12,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IProvideClassInfo2,
"IProvideClassInfo2",
NULL,
5,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IProvideMultipleClassInfo,
"IProvideMultipleClassInfo",
NULL,
7,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IProvideClassInfo,
"IProvideClassInfo",
NULL,
4,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IConnectionPointContainer,
"IConnectionPointContainer",
NULL,
5,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IEnumConnectionPoints,
"IEnumConnectionPoints",
NULL,
7,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IConnectionPoint,
"IConnectionPoint",
NULL,
8,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IEnumConnections,
"IEnumConnections",
NULL,
7,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IOleControl,
"IOleControl",
NULL,
7,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IOleControlSite,
"IOleControlSite",
NULL,
10,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_ISpecifyPropertyPages,
"ISpecifyPropertyPages",
NULL,
4,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPropertyPageSite,
"IPropertyPageSite",
NULL,
7,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPropertyPage,
"IPropertyPage",
NULL,
14,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IClassFactory2,
"IClassFactory2",
NULL,
8,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IEnumOleUndoUnits,
"IEnumOleUndoUnits",
NULL,
7,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IPersistMemory,
"IPersistMemory",
NULL,
9,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IFont,
"IFont",
NULL,
27,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IFontDisp,
"IFontDisp",
NULL,
7,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IQuickActivate,
"IQuickActivate",
NULL,
6,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IOleUndoManager,
"IOleUndoManager",
NULL,
15,
NULL,
&CLSID_PSFactoryBuffer
},
{ &IID_IObjectWithSite,
"IObjectWithSite",
NULL,
5,
NULL,
&CLSID_PSFactoryBuffer
},
{ NULL } /* list terminator */
};

View file

@ -1337,7 +1337,7 @@ HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
TRACE("(%p)\n", psa);
if(!psa)
return E_INVALIDARG;
return S_OK;
if(psa->cLocks > 0)
return DISP_E_ARRAYISLOCKED;

View file

@ -116,34 +116,50 @@ _unmarshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN *pUnk) {
DWORD xsize;
TRACE("...%s...\n",debugstr_guid(riid));
*pUnk = NULL;
hres = xbuf_get(buf,(LPBYTE)&xsize,sizeof(xsize));
if (hres) return hres;
if (hres) {
ERR("xbuf_get failed\n");
return hres;
}
if (xsize == 0) return S_OK;
hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
if (hres) {
FIXME("Stream create failed %lx\n",hres);
ERR("Stream create failed %lx\n",hres);
return hres;
}
hres = IStream_Write(pStm,buf->base+buf->curoff,xsize,&res);
if (hres) { FIXME("stream write %lx\n",hres); return hres; }
if (hres) {
ERR("stream write %lx\n",hres);
return hres;
}
memset(&seekto,0,sizeof(seekto));
hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos);
if (hres) { FIXME("Failed Seek %lx\n",hres); return hres;}
if (hres) {
ERR("Failed Seek %lx\n",hres);
return hres;
}
hres = CoUnmarshalInterface(pStm,riid,(LPVOID*)pUnk);
if (hres) {
FIXME("Marshalling interface %s failed with %lx\n",debugstr_guid(riid),hres);
ERR("Unmarshalling interface %s failed with %lx\n",debugstr_guid(riid),hres);
return hres;
}
IStream_Release(pStm);
return xbuf_skip(buf,xsize);
}
static HRESULT
_marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
LPUNKNOWN newiface;
LPBYTE tempbuf;
IStream *pStm;
LPUNKNOWN newiface = NULL;
LPBYTE tempbuf = NULL;
IStream *pStm = NULL;
STATSTG ststg;
ULARGE_INTEGER newpos;
LARGE_INTEGER seekto;
@ -151,45 +167,67 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
DWORD xsize;
HRESULT hres;
hres = S_OK;
if (!pUnk)
hres = E_FAIL;
if (!pUnk) {
ERR("pUnk is NULL?\n");
goto fail;
}
TRACE("...%s...\n",debugstr_guid(riid));
hres=IUnknown_QueryInterface(pUnk,riid,(LPVOID*)&newiface);
hres = IUnknown_QueryInterface(pUnk,riid,(LPVOID*)&newiface);
if (hres) {
TRACE("%p does not support iface %s\n",pUnk,debugstr_guid(riid));
WARN("%p does not support iface %s\n",pUnk,debugstr_guid(riid));
goto fail;
}
hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
if (hres) {
FIXME("Stream create failed %lx\n",hres);
ERR("Stream create failed %lx\n",hres);
goto fail;
}
hres = CoMarshalInterface(pStm,riid,newiface,0,NULL,0);
IUnknown_Release(newiface);
if (hres) {
FIXME("Marshalling interface %s failed with %lx\n",
debugstr_guid(riid),hres
);
ERR("Marshalling interface %s failed with %lx\n", debugstr_guid(riid), hres);
goto fail;
}
hres = IStream_Stat(pStm,&ststg,0);
if (hres) {
ERR("Stream stat failed\n");
goto fail;
}
tempbuf = HeapAlloc(GetProcessHeap(), 0, ststg.cbSize.u.LowPart);
memset(&seekto,0,sizeof(seekto));
hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos);
if (hres) { FIXME("Failed Seek %lx\n",hres); goto fail;}
if (hres) {
ERR("Failed Seek %lx\n",hres);
goto fail;
}
hres = IStream_Read(pStm,tempbuf,ststg.cbSize.u.LowPart,&res);
if (hres) { FIXME("Failed Read %lx\n",hres); goto fail;}
IStream_Release(pStm);
if (hres) {
ERR("Failed Read %lx\n",hres);
goto fail;
}
xsize = ststg.cbSize.u.LowPart;
xbuf_add(buf,(LPBYTE)&xsize,sizeof(xsize));
hres = xbuf_add(buf,tempbuf,ststg.cbSize.u.LowPart);
HeapFree(GetProcessHeap(),0,tempbuf);
IUnknown_Release(newiface);
IStream_Release(pStm);
return hres;
fail:
xsize = 0;
xbuf_add(buf,(LPBYTE)&xsize,sizeof(xsize));
if (pStm) IUnknown_Release(pStm);
if (newiface) IUnknown_Release(newiface);
HeapFree(GetProcessHeap(), 0, tempbuf);
return hres;
}
@ -225,20 +263,20 @@ _get_typeinfo_for_iid(REFIID riid, ITypeInfo**ti) {
);
if (RegOpenKeyA(HKEY_CLASSES_ROOT,interfacekey,&ikey)) {
FIXME("No %s key found.\n",interfacekey);
ERR("No %s key found.\n",interfacekey);
return E_FAIL;
}
type = (1<<REG_SZ);
tlguidlen = sizeof(tlguid);
if (RegQueryValueExA(ikey,NULL,NULL,&type,tlguid,&tlguidlen)) {
FIXME("Getting typelib guid failed.\n");
ERR("Getting typelib guid failed.\n");
RegCloseKey(ikey);
return E_FAIL;
}
type = (1<<REG_SZ);
verlen = sizeof(ver);
if (RegQueryValueExA(ikey,"Version",NULL,&type,ver,&verlen)) {
FIXME("Could not get version value?\n");
ERR("Could not get version value?\n");
RegCloseKey(ikey);
return E_FAIL;
}
@ -246,7 +284,7 @@ _get_typeinfo_for_iid(REFIID riid, ITypeInfo**ti) {
sprintf(typelibkey,"Typelib\\%s\\%s\\0\\win32",tlguid,ver);
tlfnlen = sizeof(tlfn);
if (RegQueryValueA(HKEY_CLASSES_ROOT,typelibkey,tlfn,&tlfnlen)) {
FIXME("Could not get typelib fn?\n");
ERR("Could not get typelib fn?\n");
return E_FAIL;
}
MultiByteToWideChar(CP_ACP, 0, tlfn, -1, tlfnW, -1);
@ -336,29 +374,29 @@ static ULONG WINAPI
TMProxyImpl_AddRef(LPRPCPROXYBUFFER iface)
{
ICOM_THIS_MULTI(TMProxyImpl,lpvtbl2,iface);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("()\n");
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
return InterlockedIncrement(&This->ref);
return refCount;
}
static ULONG WINAPI
TMProxyImpl_Release(LPRPCPROXYBUFFER iface)
{
ULONG refs;
ICOM_THIS_MULTI(TMProxyImpl,lpvtbl2,iface);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("()\n");
TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
refs = InterlockedDecrement(&This->ref);
if (!refs)
if (!refCount)
{
DeleteCriticalSection(&This->crit);
if (This->chanbuf) IRpcChannelBuffer_Release(This->chanbuf);
VirtualFree(This->asmstubs, 0, MEM_RELEASE);
CoTaskMemFree(This);
}
return refs;
return refCount;
}
static HRESULT WINAPI
@ -551,7 +589,7 @@ serialize_param(
hres = ITypeInfo_GetRefTypeInfo(tinfo,tdesc->u.hreftype,&tinfo2);
if (hres) {
FIXME("Could not get typeinfo of hreftype %lx for VT_USERDEFINED.\n",tdesc->u.hreftype);
ERR("Could not get typeinfo of hreftype %lx for VT_USERDEFINED.\n",tdesc->u.hreftype);
return hres;
}
ITypeInfo_GetTypeAttr(tinfo2,&tattr);
@ -571,7 +609,7 @@ serialize_param(
hres = ITypeInfo2_GetVarDesc(tinfo2, i, &vdesc);
if (hres) {
FIXME("Could not get vardesc of %d\n",i);
ERR("Could not get vardesc of %d\n",i);
return hres;
}
/* Need them for hack below */
@ -816,7 +854,7 @@ deserialize_param(
case VT_UI1:
if (readit) {
hres = xbuf_get(buf,(LPBYTE)arg,sizeof(DWORD));
if (hres) FIXME("Failed to read integer 4 byte\n");
if (hres) ERR("Failed to read integer 4 byte\n");
}
if (debugout) TRACE_(olerelay)("%lx",*arg);
return hres;
@ -827,7 +865,7 @@ deserialize_param(
if (readit) {
hres = xbuf_get(buf,(LPBYTE)&len,sizeof(DWORD));
if (hres) {
FIXME("failed to read bstr klen\n");
ERR("failed to read bstr klen\n");
return hres;
}
if (len == -1) {
@ -837,7 +875,7 @@ deserialize_param(
str = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,len+sizeof(WCHAR));
hres = xbuf_get(buf,(LPBYTE)str,len);
if (hres) {
FIXME("Failed to read BSTR.\n");
ERR("Failed to read BSTR.\n");
return hres;
}
*arg = (DWORD)SysAllocStringLen(str,len);
@ -858,7 +896,7 @@ deserialize_param(
if (readit) {
hres = xbuf_get(buf,(LPBYTE)&cookie,sizeof(cookie));
if (hres) {
FIXME("Failed to load pointer cookie.\n");
ERR("Failed to load pointer cookie.\n");
return hres;
}
if (cookie != 0x42424242) {
@ -903,12 +941,12 @@ deserialize_param(
hres = ITypeInfo_GetRefTypeInfo(tinfo,tdesc->u.hreftype,&tinfo2);
if (hres) {
FIXME("Could not get typeinfo of hreftype %lx for VT_USERDEFINED.\n",tdesc->u.hreftype);
ERR("Could not get typeinfo of hreftype %lx for VT_USERDEFINED.\n",tdesc->u.hreftype);
return hres;
}
hres = ITypeInfo_GetTypeAttr(tinfo2,&tattr);
if (hres) {
FIXME("Could not get typeattr in VT_USERDEFINED.\n");
ERR("Could not get typeattr in VT_USERDEFINED.\n");
} else {
if (alloc)
*arg = (DWORD)HeapAlloc(GetProcessHeap(),0,tattr->cbSizeInstance);
@ -927,7 +965,7 @@ deserialize_param(
hres = ITypeInfo2_GetVarDesc(tinfo2, i, &vdesc);
if (hres) {
FIXME("Could not get vardesc of %d\n",i);
ERR("Could not get vardesc of %d\n",i);
return hres;
}
hres = deserialize_param(
@ -953,7 +991,7 @@ deserialize_param(
}
}
if (hres)
FIXME("failed to stuballoc in TKIND_RECORD.\n");
ERR("failed to stuballoc in TKIND_RECORD.\n");
ITypeInfo_Release(tinfo2);
return hres;
}
@ -1126,26 +1164,26 @@ _get_funcdesc(
hres = ITypeInfo_GetTypeAttr(tinfo, &attr);
if (hres) {
FIXME("GetTypeAttr failed with %lx\n",hres);
ERR("GetTypeAttr failed with %lx\n",hres);
return hres;
}
/* Not found, so look in inherited ifaces. */
for (j=0;j<attr->cImplTypes;j++) {
hres = ITypeInfo_GetRefTypeOfImplType(tinfo, j, &href);
if (hres) {
FIXME("Did not find a reftype for interface offset %d?\n",j);
ERR("Did not find a reftype for interface offset %d?\n",j);
break;
}
hres = ITypeInfo_GetRefTypeInfo(tinfo, href, &tinfo2);
if (hres) {
FIXME("Did not find a typeinfo for reftype %ld?\n",href);
ERR("Did not find a typeinfo for reftype %ld?\n",href);
continue;
}
hres = _get_funcdesc(tinfo2,iMethod,fdesc,iname,fname);
ITypeInfo_Release(tinfo2);
if (!hres) return S_OK;
}
return E_FAIL;
return hres;
}
if (((*fdesc)->oVft/4) == iMethod) {
if (fname)
@ -1273,7 +1311,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
);
if (hres) {
FIXME("Failed to serialize param, hres %lx\n",hres);
ERR("Failed to serialize param, hres %lx\n",hres);
break;
}
xargs+=_argsize(elem->tdesc.vt);
@ -1285,7 +1323,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
msg.iMethod = method;
hres = IRpcChannelBuffer_GetBuffer(tpinfo->chanbuf,&msg,&(tpinfo->iid));
if (hres) {
FIXME("RpcChannelBuffer GetBuffer failed, %lx\n",hres);
ERR("RpcChannelBuffer GetBuffer failed, %lx\n",hres);
LeaveCriticalSection(&tpinfo->crit);
return hres;
}
@ -1293,7 +1331,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
if (relaydeb) TRACE_(olerelay)("\n");
hres = IRpcChannelBuffer_SendReceive(tpinfo->chanbuf,&msg,&status);
if (hres) {
FIXME("RpcChannelBuffer SendReceive failed, %lx\n",hres);
ERR("RpcChannelBuffer SendReceive failed, %lx\n",hres);
LeaveCriticalSection(&tpinfo->crit);
return hres;
}
@ -1343,7 +1381,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
&buf
);
if (hres) {
FIXME("Failed to deserialize DISPPARAM*, hres %lx\n",hres);
ERR("Failed to deserialize DISPPARAM*, hres %lx\n",hres);
break;
}
isdeserialized = TRUE;
@ -1373,7 +1411,8 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
&buf
);
if (hres) {
FIXME("Failed to unmarshall param, hres %lx\n",hres);
ERR("Failed to unmarshall param, hres %lx\n",hres);
status = hres;
break;
}
xargs += _argsize(elem->tdesc.vt);
@ -1401,7 +1440,7 @@ PSFacBuf_CreateProxy(
TRACE("(...%s...)\n",debugstr_guid(riid));
hres = _get_typeinfo_for_iid(riid,&tinfo);
if (hres) {
FIXME("No typeinfo for %s?\n",debugstr_guid(riid));
ERR("No typeinfo for %s?\n",debugstr_guid(riid));
return hres;
}
nroffuncs = _nroffuncs(tinfo);
@ -1434,7 +1473,7 @@ PSFacBuf_CreateProxy(
int j;
hres = _get_funcdesc(tinfo,i,&fdesc,NULL,NULL);
if (hres) {
FIXME("GetFuncDesc %lx should not fail here.\n",hres);
ERR("GetFuncDesc %lx should not fail here.\n",hres);
return hres;
}
/* some args take more than 4 byte on the stack */
@ -1505,27 +1544,27 @@ static ULONG WINAPI
TMStubImpl_AddRef(LPRPCSTUBBUFFER iface)
{
TMStubImpl *This = (TMStubImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p) before %lu\n", This, This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return InterlockedIncrement(&This->ref);
return refCount;
}
static ULONG WINAPI
TMStubImpl_Release(LPRPCSTUBBUFFER iface)
{
ULONG refs;
TMStubImpl *This = (TMStubImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p) after %lu\n", This, This->ref-1);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
refs = InterlockedDecrement(&This->ref);
if (!refs)
if (!refCount)
{
IRpcStubBuffer_Disconnect(iface);
CoTaskMemFree(This);
}
return refs;
return refCount;
}
static HRESULT WINAPI
@ -1585,7 +1624,7 @@ TMStubImpl_Invoke(
}
hres = _get_funcdesc(This->tinfo,xmsg->iMethod,&fdesc,NULL,NULL);
if (hres) {
FIXME("GetFuncDesc on method %ld failed with %lx\n",xmsg->iMethod,hres);
ERR("GetFuncDesc on method %ld failed with %lx\n",xmsg->iMethod,hres);
return hres;
}
/* Need them for hack below */
@ -1626,7 +1665,7 @@ TMStubImpl_Invoke(
&buf
);
if (hres) {
FIXME("Failed to deserialize DISPPARAM*, hres %lx\n",hres);
ERR("Failed to deserialize DISPPARAM*, hres %lx\n",hres);
break;
}
isdeserialized = TRUE;
@ -1657,7 +1696,7 @@ TMStubImpl_Invoke(
);
xargs += _argsize(elem->tdesc.vt);
if (hres) {
FIXME("Failed to deserialize param %s, hres %lx\n",relaystr(names[i+1]),hres);
ERR("Failed to deserialize param %s, hres %lx\n",relaystr(names[i+1]),hres);
break;
}
}
@ -1724,7 +1763,7 @@ TMStubImpl_Invoke(
);
xargs += _argsize(elem->tdesc.vt);
if (hres) {
FIXME("Failed to stuballoc param, hres %lx\n",hres);
ERR("Failed to stuballoc param, hres %lx\n",hres);
break;
}
}
@ -1783,7 +1822,7 @@ PSFacBuf_CreateStub(
TRACE("(%s,%p,%p)\n",debugstr_guid(riid),pUnkServer,ppStub);
hres = _get_typeinfo_for_iid(riid,&tinfo);
if (hres) {
FIXME("No typeinfo for %s?\n",debugstr_guid(riid));
ERR("No typeinfo for %s?\n",debugstr_guid(riid));
return hres;
}
stub = CoTaskMemAlloc(sizeof(TMStubImpl));
@ -1797,7 +1836,7 @@ PSFacBuf_CreateStub(
*ppStub = (LPRPCSTUBBUFFER)stub;
TRACE("IRpcStubBuffer: %p\n", stub);
if (hres)
FIXME("Connect to pUnkServer failed?\n");
ERR("Connect to pUnkServer failed?\n");
return hres;
}

View file

@ -291,7 +291,7 @@ HRESULT WINAPI LoadTypeLib(
const OLECHAR *szFile,/* [in] Name of file to load from */
ITypeLib * *pptLib) /* [out] Pointer to pointer to loaded type library */
{
TRACE("\n");
TRACE("(%s,%p)\n",debugstr_w(szFile), pptLib);
return LoadTypeLibEx(szFile, REGKIND_DEFAULT, pptLib);
}
@ -332,26 +332,7 @@ HRESULT WINAPI LoadTypeLibEx(
if (GetFileAttributesW(szFileCopy) & FILE_ATTRIBUTE_DIRECTORY)
return TYPE_E_CANTLOADLIBRARY;
} else {
WCHAR tstpath[260];
static const WCHAR stdole32tlb[] = { 's','t','d','o','l','e','3','2','.','t','l','b',0 };
int i;
lstrcpyW(tstpath,szFile);
CharLowerW(tstpath);
for (i=0;i<strlenW(tstpath);i++) {
if (tstpath[i] == 's') {
if (!strcmpW(tstpath+i,stdole32tlb)) {
MESSAGE("\n");
MESSAGE("**************************************************************************\n");
MESSAGE("You must copy a 'stdole32.tlb' file to your Windows\\System directory!\n");
MESSAGE("You can get one from a Windows installation, or look for the DCOM95 package\n");
MESSAGE("on the Microsoft Download Pages.\n");
MESSAGE("**************************************************************************\n");
break;
}
}
}
FIXME("Wanted to load %s as typelib, but file was not found.\n",debugstr_w(szFile));
TRACE("Wanted to load %s as typelib, but file was not found.\n",debugstr_w(szFile));
return TYPE_E_CANTLOADLIBRARY;
}
}

View file

@ -1907,6 +1907,11 @@ HRESULT WINAPI VarParseNumFromStr(OLECHAR *lpszStr, LCID lcid, ULONG dwFlags,
/* VTBIT flags indicating a real number value */
#define REAL_VTBITS (VTBIT_R4|VTBIT_R8|VTBIT_CY)
/* Helper macros to check whether bit pattern fits in VARIANT (x is a ULONG64 ) */
#define FITS_AS_I1(x) ((x) >> 8 == 0)
#define FITS_AS_I2(x) ((x) >> 16 == 0)
#define FITS_AS_I4(x) ((x) >> 32 == 0)
/**********************************************************************
* VarNumFromParseNum [OLEAUT32.47]
*
@ -1977,52 +1982,43 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE *rgbDig,
l64=-ul64;
/* Try signed and unsigned types in size order */
if (dwVtBits & VTBIT_I1 && ((ul64 <= I1_MAX)||(l64 >= I1_MIN)))
if (dwVtBits & VTBIT_I1 && FITS_AS_I1(ul64))
{
V_VT(pVarDst) = VT_I1;
if (ul64 <= I1_MAX)
V_I1(pVarDst) = ul64;
else
V_I1(pVarDst) = l64;
V_I1(pVarDst) = ul64;
return S_OK;
}
else if (dwVtBits & VTBIT_UI1 && ul64 <= UI1_MAX)
else if (dwVtBits & VTBIT_UI1 && FITS_AS_I1(ul64))
{
V_VT(pVarDst) = VT_UI1;
V_UI1(pVarDst) = ul64;
return S_OK;
}
else if (dwVtBits & VTBIT_I2 && ((ul64 <= I2_MAX)||(l64 >= I2_MIN)))
else if (dwVtBits & VTBIT_I2 && FITS_AS_I2(ul64))
{
V_VT(pVarDst) = VT_I2;
if (ul64 <= I2_MAX)
V_I2(pVarDst) = ul64;
else
V_I2(pVarDst) = l64;
V_I2(pVarDst) = ul64;
return S_OK;
}
else if (dwVtBits & VTBIT_UI2 && ul64 <= UI2_MAX)
else if (dwVtBits & VTBIT_UI2 && FITS_AS_I2(ul64))
{
V_VT(pVarDst) = VT_UI2;
V_UI2(pVarDst) = ul64;
return S_OK;
}
else if (dwVtBits & VTBIT_I4 && ((ul64 <= I4_MAX)||(l64 >= I4_MIN)))
else if (dwVtBits & VTBIT_I4 && FITS_AS_I4(ul64))
{
V_VT(pVarDst) = VT_I4;
if (ul64 <= I4_MAX)
V_I4(pVarDst) = ul64;
else
V_I4(pVarDst) = l64;
V_I4(pVarDst) = ul64;
return S_OK;
}
else if (dwVtBits & VTBIT_UI4 && ul64 <= UI4_MAX)
else if (dwVtBits & VTBIT_UI4 && FITS_AS_I4(ul64))
{
V_VT(pVarDst) = VT_UI4;
V_UI4(pVarDst) = ul64;
return S_OK;
}
else if (dwVtBits & VTBIT_I8 && ((ul64 <= I4_MAX)||(l64>=I4_MIN)))
else if (dwVtBits & VTBIT_I8 && ((ul64 <= I8_MAX)||(l64>=I8_MIN)))
{
V_VT(pVarDst) = VT_I8;
V_I8(pVarDst) = ul64;
@ -2471,6 +2467,7 @@ HRESULT WINAPI VarCat(LPVARIANT left, LPVARIANT right, LPVARIANT out)
HRESULT hres;
V_VT(out) = VT_BSTR;
VariantInit(&bstrvar);
hres = VariantChangeTypeEx(&bstrvar,right,0,0,VT_BSTR);
if (hres) {
FIXME("Failed to convert right side from vt %d to VT_BSTR?\n",V_VT(right));
@ -2484,6 +2481,7 @@ HRESULT WINAPI VarCat(LPVARIANT left, LPVARIANT right, LPVARIANT out)
HRESULT hres;
V_VT(out) = VT_BSTR;
VariantInit(&bstrvar);
hres = VariantChangeTypeEx(&bstrvar,left,0,0,VT_BSTR);
if (hres) {
FIXME("Failed to convert right side from vt %d to VT_BSTR?\n",V_VT(right));