Sync to Wine-20050628: Dmitry Timoshkov dmitry@codeweavers.com - Make remaining OLE interface vtables const. Robert Shearman rob@codeweavers.com - DispInvoke is correct so there is no need to print a fixme. - The typelib marshaler should only free the memory it actually allocated. - Add special cases for two lesser used types that aren't sizeof(DWORD) sized. - If we are accessing a method from a superclass then we need to use the superclass's ITypeInfo otherwise we could get errors when accessing hreftypes that aren't present in the subclass. - Don't print out cryptic message if IDispatch or IUnknown object is just NULL. - puArgErr is a ref pointer so we have to provide a dummy pointer if it is NULL. - Fail gracefully and notify caller if we ran out of memoy or if variant copying failed. - Clear out parameters to stop bad pointers lying around in memory if the function doesn't set them to anything. - Fix the return values from QueryPathOfRegTypeLib. - Open registry key with least access rights necessary. - Documentation updates. Michael Stefaniuc mstefani@redhat.de - VarCmp: handle comparision of VT_EMPTY with an integer - small comment fix - Reimplement VarAdd, had missing functionality and wrong behaviour. - Fix a typo in VarMul. - more VarFormat fixes for number formats (exponent, mixed '#' and '0' in formats, rounding, etc). Simplify the code. - previous VarFormat todo_wine tests pass now + add more tests - Fix VarFormat for formats that mix '0' and '#' in the whole number part. - Fix VarFormat for negative exponent formats. - Add tests for the above + a couple of "todo_wine"'s. - implement handling of exponents (e+,e-,E+,E-) when parsing number formats - fix a small cut'n'paste error in the comments Francois Gouget fgouget@free.fr - Assorted spelling fixes. Marcus Meissner marcus@jet.franken.de - Added VarMonthName() implementation. - Corrected string length method in ITypeLib::IsName() and FindName() for LPOLESTR type. - Fixed IType::Invoke in regards to handling propertyget variables longer than 4 bytes (like VT_DATE). - Added testcases for OLE Picture handling. - Implemented PICTYPE_NONE loading. - Cleaned up stream loading, handle "lt" magic. - Fixed some small problems exposed by tests against native. Stefan Huehner stefan@huehner.org - Fix some more -Wstrict-prototypes warnings. Huw Davies huw@codeweavers.com - Add comments describing the first DWORD in an import table entry. Modified: trunk/reactos/lib/oleaut32/connpt.c Modified: trunk/reactos/lib/oleaut32/dispatch.c Modified: trunk/reactos/lib/oleaut32/oaidl_p.c Modified: trunk/reactos/lib/oleaut32/oleaut32.spec Modified: trunk/reactos/lib/oleaut32/olefont.c Modified: trunk/reactos/lib/oleaut32/olepicture.c Modified: trunk/reactos/lib/oleaut32/recinfo.c Modified: trunk/reactos/lib/oleaut32/tmarshal.c Modified: trunk/reactos/lib/oleaut32/typelib.c Modified: trunk/reactos/lib/oleaut32/typelib.h Modified: trunk/reactos/lib/oleaut32/typelib2.c Modified: trunk/reactos/lib/oleaut32/usrmarshal.c Modified: trunk/reactos/lib/oleaut32/varformat.c Modified: trunk/reactos/lib/oleaut32/variant.c _____
Modified: trunk/reactos/lib/oleaut32/connpt.c --- trunk/reactos/lib/oleaut32/connpt.c 2005-08-03 22:31:39 UTC (rev 17036) +++ trunk/reactos/lib/oleaut32/connpt.c 2005-08-03 22:46:31 UTC (rev 17037) @@ -48,7 +48,7 @@
*/ typedef struct ConnectionPointImpl {
- IConnectionPointVtbl *lpvtbl; + const IConnectionPointVtbl *lpvtbl;
/* IUnknown of our main object*/ IUnknown *Obj; @@ -66,7 +66,7 @@ DWORD nSinks; } ConnectionPointImpl;
-static IConnectionPointVtbl ConnectionPointImpl_VTable; +static const IConnectionPointVtbl ConnectionPointImpl_VTable;
/*********************************************************************** * @@ -74,7 +74,7 @@ */ typedef struct EnumConnectionsImpl {
- IEnumConnectionsVtbl *lpvtbl; + const IEnumConnectionsVtbl *lpvtbl;
DWORD ref;
@@ -351,7 +351,7 @@ return hr; }
-static IConnectionPointVtbl ConnectionPointImpl_VTable = +static const IConnectionPointVtbl ConnectionPointImpl_VTable = { ConnectionPointImpl_QueryInterface, ConnectionPointImpl_AddRef, @@ -364,7 +364,7 @@ };
-static IEnumConnectionsVtbl EnumConnectionsImpl_VTable; +static const IEnumConnectionsVtbl EnumConnectionsImpl_VTable; static ULONG WINAPI EnumConnectionsImpl_AddRef(IEnumConnections* iface);
/*********************************************************************** * @@ -587,7 +587,7 @@ return S_OK; }
-static IEnumConnectionsVtbl EnumConnectionsImpl_VTable = +static const IEnumConnectionsVtbl EnumConnectionsImpl_VTable = { EnumConnectionsImpl_QueryInterface, EnumConnectionsImpl_AddRef, _____
Modified: trunk/reactos/lib/oleaut32/dispatch.c --- trunk/reactos/lib/oleaut32/dispatch.c 2005-08-03 22:31:39 UTC (rev 17036) +++ trunk/reactos/lib/oleaut32/dispatch.c 2005-08-03 22:46:31 UTC (rev 17037) @@ -17,7 +17,6 @@
* License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * TODO: Type coercion is implemented in variant.c but not called yet. */
#include "config.h" @@ -78,11 +77,7 @@ EXCEPINFO *pexcepinfo, /* [out] Destination for exception information */ UINT *puArgErr) /* [out] Destination for bad argument */ { - /** - * TODO: - * For each param, call DispGetParam to perform type coercion - */ - FIXME("Coercion of arguments not implemented\n"); + TRACE("\n");
return ITypeInfo_Invoke(ptinfo, _this, dispidMember, wFlags, pparams, pvarResult, pexcepinfo, puArgErr); @@ -219,7 +214,7 @@
typedef struct { - IDispatchVtbl *lpVtbl; + const IDispatchVtbl *lpVtbl; void * pvThis; ITypeInfo * pTypeInfo; ULONG ref; @@ -422,7 +417,7 @@ return DispInvoke(This->pvThis, This->pTypeInfo, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); }
-static IDispatchVtbl StdDispatch_VTable = +static const IDispatchVtbl StdDispatch_VTable = { StdDispatch_QueryInterface, StdDispatch_AddRef, _____
Modified: trunk/reactos/lib/oleaut32/oaidl_p.c --- trunk/reactos/lib/oleaut32/oaidl_p.c 2005-08-03 22:31:39 UTC (rev 17036) +++ trunk/reactos/lib/oleaut32/oaidl_p.c 2005-08-03 22:46:31 UTC (rev 17037) @@ -906,7 +906,7 @@
}
-const CINTERFACE_PROXY_VTABLE(7) _IDispatchProxyVtbl = +static const CINTERFACE_PROXY_VTABLE(7) _IDispatchProxyVtbl = { { &IID_IDispatch }, { @@ -929,7 +929,7 @@ IDispatch_RemoteInvoke_Stub };
-const CInterfaceStubVtbl _IDispatchStubVtbl = +static const CInterfaceStubVtbl _IDispatchStubVtbl = { { &IID_IDispatch, @@ -1447,7 +1447,7 @@
}
-const CINTERFACE_PROXY_VTABLE(7) _IEnumVARIANTProxyVtbl = +static const CINTERFACE_PROXY_VTABLE(7) _IEnumVARIANTProxyVtbl = { { &IID_IEnumVARIANT }, { @@ -1470,7 +1470,7 @@ IEnumVARIANT_Clone_Stub };
-const CInterfaceStubVtbl _IEnumVARIANTStubVtbl = +static const CInterfaceStubVtbl _IEnumVARIANTStubVtbl = { { &IID_IEnumVARIANT, @@ -2009,7 +2009,7 @@
}
-const CINTERFACE_PROXY_VTABLE(5) _ITypeCompProxyVtbl = +static const CINTERFACE_PROXY_VTABLE(5) _ITypeCompProxyVtbl = { { &IID_ITypeComp }, { @@ -2028,7 +2028,7 @@ ITypeComp_RemoteBindType_Stub };
-const CInterfaceStubVtbl _ITypeCompStubVtbl = +static const CInterfaceStubVtbl _ITypeCompStubVtbl = { { &IID_ITypeComp, @@ -4804,7 +4804,7 @@
}
-const CINTERFACE_PROXY_VTABLE(22) _ITypeInfoProxyVtbl = +static const CINTERFACE_PROXY_VTABLE(22) _ITypeInfoProxyVtbl = { { &IID_ITypeInfo }, { @@ -4857,7 +4857,7 @@ ITypeInfo_LocalReleaseVarDesc_Stub };
-const CInterfaceStubVtbl _ITypeInfoStubVtbl = +static const CInterfaceStubVtbl _ITypeInfoStubVtbl = { { &IID_ITypeInfo, @@ -7141,7 +7141,7 @@
}
-const CINTERFACE_PROXY_VTABLE(37) _ITypeInfo2ProxyVtbl = +static const CINTERFACE_PROXY_VTABLE(37) _ITypeInfo2ProxyVtbl = { { &IID_ITypeInfo2 }, { @@ -7224,7 +7224,7 @@ ITypeInfo2_GetAllImplTypeCustData_Stub };
-const CInterfaceStubVtbl _ITypeInfo2StubVtbl = +static const CInterfaceStubVtbl _ITypeInfo2StubVtbl = { { &IID_ITypeInfo2, @@ -8924,7 +8924,7 @@
}
-const CINTERFACE_PROXY_VTABLE(13) _ITypeLibProxyVtbl = +static const CINTERFACE_PROXY_VTABLE(13) _ITypeLibProxyVtbl = { { &IID_ITypeLib }, { @@ -8959,7 +8959,7 @@ ITypeLib_LocalReleaseTLibAttr_Stub };
-const CInterfaceStubVtbl _ITypeLibStubVtbl = +static const CInterfaceStubVtbl _ITypeLibStubVtbl = { { &IID_ITypeLib, @@ -9631,7 +9631,7 @@
}
-const CINTERFACE_PROXY_VTABLE(17) _ITypeLib2ProxyVtbl = +static const CINTERFACE_PROXY_VTABLE(17) _ITypeLib2ProxyVtbl = { { &IID_ITypeLib2 }, { @@ -10330,7 +10330,7 @@
}
-const CINTERFACE_PROXY_VTABLE(8) _IErrorInfoProxyVtbl = +static const CINTERFACE_PROXY_VTABLE(8) _IErrorInfoProxyVtbl = { { &IID_IErrorInfo }, { @@ -10355,7 +10355,7 @@ IErrorInfo_GetHelpContext_Stub };
-const CInterfaceStubVtbl _IErrorInfoStubVtbl = +static const CInterfaceStubVtbl _IErrorInfoStubVtbl = { { &IID_IErrorInfo, @@ -10926,7 +10926,7 @@
}
-const CINTERFACE_PROXY_VTABLE(8) _ICreateErrorInfoProxyVtbl = +static const CINTERFACE_PROXY_VTABLE(8) _ICreateErrorInfoProxyVtbl = { { &IID_ICreateErrorInfo }, { @@ -10951,7 +10951,7 @@ ICreateErrorInfo_SetHelpContext_Stub };
-const CInterfaceStubVtbl _ICreateErrorInfoStubVtbl = +static const CInterfaceStubVtbl _ICreateErrorInfoStubVtbl = { { &IID_ICreateErrorInfo, @@ -11080,7 +11080,7 @@
}
-const CINTERFACE_PROXY_VTABLE(4) _ISupportErrorInfoProxyVtbl = +static const CINTERFACE_PROXY_VTABLE(4) _ISupportErrorInfoProxyVtbl = { { &IID_ISupportErrorInfo }, { @@ -11097,7 +11097,7 @@ ISupportErrorInfo_InterfaceSupportsErrorInfo_Stub };
-const CInterfaceStubVtbl _ISupportErrorInfoStubVtbl = +static const CInterfaceStubVtbl _ISupportErrorInfoStubVtbl = { { &IID_ISupportErrorInfo, @@ -11347,7 +11347,7 @@ 0 /* Reserved5 */ };
-const CINTERFACE_PROXY_VTABLE(4) _ITypeFactoryProxyVtbl = +static const CINTERFACE_PROXY_VTABLE(4) _ITypeFactoryProxyVtbl = { { &IID_ITypeFactory }, { @@ -11364,7 +11364,7 @@ ITypeFactory_CreateFromTypeInfo_Stub };
-const CInterfaceStubVtbl _ITypeFactoryStubVtbl = +static const CInterfaceStubVtbl _ITypeFactoryStubVtbl = { { &IID_ITypeFactory, @@ -13702,39 +13702,39 @@ } };
-const CInterfaceProxyVtbl * _oaidl_ProxyVtblList[] = +static const CInterfaceProxyVtbl * _oaidl_ProxyVtblList[] = { - ( CInterfaceProxyVtbl *) &_IDispatchProxyVtbl, - ( CInterfaceProxyVtbl *) &_ITypeInfoProxyVtbl, - ( CInterfaceProxyVtbl *) &_ITypeLibProxyVtbl, - ( CInterfaceProxyVtbl *) &_ITypeCompProxyVtbl, - ( CInterfaceProxyVtbl *) &_IEnumVARIANTProxyVtbl, - ( CInterfaceProxyVtbl *) &_ITypeLib2ProxyVtbl, - ( CInterfaceProxyVtbl *) &_ITypeInfo2ProxyVtbl, - ( CInterfaceProxyVtbl *) &_IErrorInfoProxyVtbl, - ( CInterfaceProxyVtbl *) &_ITypeFactoryProxyVtbl, - ( CInterfaceProxyVtbl *) &_ICreateErrorInfoProxyVtbl, - ( CInterfaceProxyVtbl *) &_ISupportErrorInfoProxyVtbl, + ( const CInterfaceProxyVtbl *) &_IDispatchProxyVtbl, + ( const CInterfaceProxyVtbl *) &_ITypeInfoProxyVtbl, + ( const CInterfaceProxyVtbl *) &_ITypeLibProxyVtbl, + ( const CInterfaceProxyVtbl *) &_ITypeCompProxyVtbl, + ( const CInterfaceProxyVtbl *) &_IEnumVARIANTProxyVtbl, + ( const CInterfaceProxyVtbl *) &_ITypeLib2ProxyVtbl, + ( const CInterfaceProxyVtbl *) &_ITypeInfo2ProxyVtbl, + ( const CInterfaceProxyVtbl *) &_IErrorInfoProxyVtbl, + ( const CInterfaceProxyVtbl *) &_ITypeFactoryProxyVtbl, + ( const CInterfaceProxyVtbl *) &_ICreateErrorInfoProxyVtbl, + ( const CInterfaceProxyVtbl *) &_ISupportErrorInfoProxyVtbl, 0 };
-const CInterfaceStubVtbl * _oaidl_StubVtblList[] = +static const CInterfaceStubVtbl * _oaidl_StubVtblList[] = { - ( CInterfaceStubVtbl *) &_IDispatchStubVtbl, - ( CInterfaceStubVtbl *) &_ITypeInfoStubVtbl, - ( CInterfaceStubVtbl *) &_ITypeLibStubVtbl, - ( CInterfaceStubVtbl *) &_ITypeCompStubVtbl, - ( CInterfaceStubVtbl *) &_IEnumVARIANTStubVtbl, - ( CInterfaceStubVtbl *) &_ITypeLib2StubVtbl, - ( CInterfaceStubVtbl *) &_ITypeInfo2StubVtbl, - ( CInterfaceStubVtbl *) &_IErrorInfoStubVtbl, - ( CInterfaceStubVtbl *) &_ITypeFactoryStubVtbl, - ( CInterfaceStubVtbl *) &_ICreateErrorInfoStubVtbl, - ( CInterfaceStubVtbl *) &_ISupportErrorInfoStubVtbl, + ( const CInterfaceStubVtbl *) &_IDispatchStubVtbl, + ( const CInterfaceStubVtbl *) &_ITypeInfoStubVtbl, + ( const CInterfaceStubVtbl *) &_ITypeLibStubVtbl, + ( const CInterfaceStubVtbl *) &_ITypeCompStubVtbl, + ( const CInterfaceStubVtbl *) &_IEnumVARIANTStubVtbl, + ( const CInterfaceStubVtbl *) &_ITypeLib2StubVtbl, + ( const CInterfaceStubVtbl *) &_ITypeInfo2StubVtbl, + ( const CInterfaceStubVtbl *) &_IErrorInfoStubVtbl, + ( const CInterfaceStubVtbl *) &_ITypeFactoryStubVtbl, + ( const CInterfaceStubVtbl *) &_ICreateErrorInfoStubVtbl, + ( const CInterfaceStubVtbl *) &_ISupportErrorInfoStubVtbl, 0 };
-PCInterfaceName const _oaidl_InterfaceNamesList[] = +static const PCInterfaceName _oaidl_InterfaceNamesList[] = { "IDispatch", "ITypeInfo", @@ -13767,8 +13767,8 @@
const ExtendedProxyFileInfo oaidl_ProxyFileInfo = { - (PCInterfaceProxyVtblList *) & _oaidl_ProxyVtblList, - (PCInterfaceStubVtblList *) & _oaidl_StubVtblList, + (const PCInterfaceProxyVtblList *) & _oaidl_ProxyVtblList, + (const PCInterfaceStubVtblList *) & _oaidl_StubVtblList, (const PCInterfaceName * ) & _oaidl_InterfaceNamesList, 0, /* no delegation */ & _oaidl_IID_Lookup, _____
Modified: trunk/reactos/lib/oleaut32/oleaut32.spec --- trunk/reactos/lib/oleaut32/oleaut32.spec 2005-08-03 22:31:39 UTC (rev 17036) +++ trunk/reactos/lib/oleaut32/oleaut32.spec 2005-08-03 22:46:31 UTC (rev 17037) @@ -126,7 +126,7 @@
126 stdcall VarBoolFromDisp(ptr long ptr) 127 stdcall VarFormatCurrency(ptr long long long long long ptr) 128 stub VarWeekdayName # stdcall (long long long long ptr) -129 stub VarMonthName # stdcall (long long long ptr) +129 stdcall VarMonthName(long long long ptr) 130 stdcall VarUI1FromI2(long ptr) 131 stdcall VarUI1FromI4(long ptr) 132 stdcall VarUI1FromR4(long ptr) _____
Modified: trunk/reactos/lib/oleaut32/olefont.c --- trunk/reactos/lib/oleaut32/olefont.c 2005-08-03 22:31:39 UTC (rev 17036) +++ trunk/reactos/lib/oleaut32/olefont.c 2005-08-03 22:46:31 UTC (rev 17037) @@ -63,12 +63,12 @@
* The first two are supported by the first vtable, the next two are * supported by the second table and the last two have their own. */ - IFontVtbl* lpvtbl1; - IDispatchVtbl* lpvtbl2; - IPersistStreamVtbl* lpvtbl3; - IConnectionPointContainerVtbl* lpvtbl4; - IPersistPropertyBagVtbl* lpvtbl5; - IPersistStreamInitVtbl* lpvtbl6; + const IFontVtbl* lpvtbl1; + const IDispatchVtbl* lpvtbl2; + const IPersistStreamVtbl* lpvtbl3; + const IConnectionPointContainerVtbl* lpvtbl4; + const IPersistPropertyBagVtbl* lpvtbl5; + const IPersistStreamInitVtbl* lpvtbl6; /* * Reference count for that instance of the class. */ @@ -219,7 +219,7 @@ /* * Virtual function tables for the OLEFontImpl class. */ -static IFontVtbl OLEFontImpl_VTable = +static const IFontVtbl OLEFontImpl_VTable = { OLEFontImpl_QueryInterface, OLEFontImpl_AddRef, @@ -250,7 +250,7 @@ OLEFontImpl_SetHdc };
-static IDispatchVtbl OLEFontImpl_IDispatch_VTable = +static const IDispatchVtbl OLEFontImpl_IDispatch_VTable = { OLEFontImpl_IDispatch_QueryInterface, OLEFontImpl_IDispatch_AddRef, @@ -261,7 +261,7 @@ OLEFontImpl_Invoke };
-static IPersistStreamVtbl OLEFontImpl_IPersistStream_VTable = +static const IPersistStreamVtbl OLEFontImpl_IPersistStream_VTable = { OLEFontImpl_IPersistStream_QueryInterface, OLEFontImpl_IPersistStream_AddRef, @@ -273,7 +273,7 @@ OLEFontImpl_GetSizeMax };
-static IConnectionPointContainerVtbl +static const IConnectionPointContainerVtbl OLEFontImpl_IConnectionPointContainer_VTable = { OLEFontImpl_IConnectionPointContainer_QueryInterface, @@ -283,8 +283,9 @@ OLEFontImpl_FindConnectionPoint };
-static IPersistPropertyBagVtbl OLEFontImpl_IPersistPropertyBag_VTable; -static IPersistStreamInitVtbl OLEFontImpl_IPersistStreamInit_VTable; +static const IPersistPropertyBagVtbl OLEFontImpl_IPersistPropertyBag_VTable; +static const IPersistStreamInitVtbl OLEFontImpl_IPersistStreamInit_VTable; +
/*********************************************************************** ******* * OleCreateFontIndirect [OLEAUT32.420] */ @@ -2002,7 +2003,7 @@ return E_FAIL; }
-static IPersistPropertyBagVtbl OLEFontImpl_IPersistPropertyBag_VTable = +static const IPersistPropertyBagVtbl OLEFontImpl_IPersistPropertyBag_VTable = { OLEFontImpl_IPersistPropertyBag_QueryInterface, OLEFontImpl_IPersistPropertyBag_AddRef, @@ -2080,7 +2081,7 @@ return S_OK; }
-static IPersistStreamInitVtbl OLEFontImpl_IPersistStreamInit_VTable = +static const IPersistStreamInitVtbl OLEFontImpl_IPersistStreamInit_VTable = { OLEFontImpl_IPersistStreamInit_QueryInterface, OLEFontImpl_IPersistStreamInit_AddRef, @@ -2100,7 +2101,7 @@ typedef struct { /* IUnknown fields */ - IClassFactoryVtbl *lpVtbl; + const IClassFactoryVtbl *lpVtbl; DWORD ref; } IClassFactoryImpl;
@@ -2137,7 +2138,7 @@ return S_OK; }
-static IClassFactoryVtbl SFCF_Vtbl = { +static const IClassFactoryVtbl SFCF_Vtbl = { SFCF_QueryInterface, SFCF_AddRef, SFCF_Release, _____
Modified: trunk/reactos/lib/oleaut32/olepicture.c --- trunk/reactos/lib/oleaut32/olepicture.c 2005-08-03 22:31:39 UTC (rev 17036) +++ trunk/reactos/lib/oleaut32/olepicture.c 2005-08-03 22:46:31 UTC (rev 17037) @@ -103,10 +103,10 @@
* IPicture handles IUnknown */
- IPictureVtbl *lpvtbl1; - IDispatchVtbl *lpvtbl2; - IPersistStreamVtbl *lpvtbl3; - IConnectionPointContainerVtbl *lpvtbl4; + const IPictureVtbl *lpvtbl1; + const IDispatchVtbl *lpvtbl2; + const IPersistStreamVtbl *lpvtbl3; + const IConnectionPointContainerVtbl *lpvtbl4;
/* Object reference count */ DWORD ref; @@ -156,10 +156,10 @@ /* * Predeclare VTables. They get initialized at the end. */ -static IPictureVtbl OLEPictureImpl_VTable; -static IDispatchVtbl OLEPictureImpl_IDispatch_VTable; -static IPersistStreamVtbl OLEPictureImpl_IPersistStream_VTable; -static IConnectionPointContainerVtbl OLEPictureImpl_IConnectionPointContainer_VTable; +static const IPictureVtbl OLEPictureImpl_VTable; +static const IDispatchVtbl OLEPictureImpl_IDispatch_VTable; +static const IPersistStreamVtbl OLEPictureImpl_IPersistStream_VTable; +static const IConnectionPointContainerVtbl OLEPictureImpl_IConnectionPointContainer_VTable;
/*********************************************************************** * Implementation of the OLEPictureImpl class. @@ -334,6 +334,9 @@ case PICTYPE_ENHMETAFILE: DeleteEnhMetaFile(Obj->desc.u.emf.hemf); break; + case PICTYPE_NONE: + /* Nothing to do */ + break; default: FIXME("Unsupported type %d - unable to delete\n", Obj->desc.picType); break; @@ -485,6 +488,9 @@ OLEPictureImpl *This = (OLEPictureImpl *)iface; TRACE("(%p)->(%p)\n", This, phandle); switch(This->desc.picType) { + case PICTYPE_NONE: + *phandle = 0; + break; case PICTYPE_BITMAP: *phandle = (OLE_HANDLE)This->desc.u.bmp.hbitmap; break; @@ -512,8 +518,10 @@ OLE_HANDLE *phandle) { OLEPictureImpl *This = (OLEPictureImpl *)iface; - FIXME("(%p)->(%p): stub\n", This, phandle); - return E_NOTIMPL; + FIXME("(%p)->(%p): stub, return 0 palette.\n", This, phandle); + + *phandle = 0; + return S_OK; }
/*********************************************************************** * @@ -992,7 +1000,8 @@ */ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) { HRESULT hr = E_FAIL; - ULONG xread; + BOOL headerisdata = FALSE; + ULONG xread, toread; BYTE *xbuf; DWORD header[2]; WORD magic; @@ -1013,43 +1022,54 @@ */ hr=IStream_Stat(pStm,&statstg,STATFLAG_NONAME); if (hr) - FIXME("Stat failed with hres %lx\n",hr); + FIXME("Stat failed with hres %lx\n",hr); hr=IStream_Read(pStm,header,8,&xread); if (hr || xread!=8) { FIXME("Failure while reading picture header (hr is %lx, nread is %ld).\n",hr,xread); return hr; } - if (!memcmp(&(header[0]), "GIF8", 4) || /* GIF header */ - !memcmp(&(header[0]), "BM", 2) || /* BMP header */ - !memcmp(&(header[0]), "\xff\xd8", 2) || /* JPEG header */ - header[1] > statstg.cbSize.QuadPart || (header[1]==0)) {/* Incorrect header, assume none. */ - xread = 8; - xbuf = This->data = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,statstg.cbSize.QuadPart); - memcpy(xbuf,&header,8); - This->datalen = statstg.cbSize.QuadPart; - while (xread < This->datalen) { + + headerisdata = FALSE; + xread = 0; + if (!memcmp(&(header[0]),"lt\0\0", 4) && (header[1] <= statstg.cbSize.QuadPart-8)) { + toread = header[1]; + } else { + if (!memcmp(&(header[0]), "GIF8", 4) || /* GIF header */ + !memcmp(&(header[0]), "BM", 2) || /* BMP header */ + !memcmp(&(header[0]), "\xff\xd8", 2) || /* JPEG header */ + (header[1] > statstg.cbSize.QuadPart) || /* invalid size */ + (header[1]==0) + ) {/* Incorrect header, assume none. */ + headerisdata = TRUE; + toread = statstg.cbSize.QuadPart-8; + xread = 8; + } else { + FIXME("Unknown stream header magic: %08lx\n", header[0]); + toread = header[1]; + } + } + + This->datalen = toread+(headerisdata?8:0); + xbuf = This->data = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, This->datalen); + + if (headerisdata) + memcpy (xbuf, &header, 8); + + while (xread < This->datalen) { ULONG nread; hr = IStream_Read(pStm,xbuf+xread,This->datalen-xread,&nread); xread+=nread; if (hr || !nread) break; - } - if (xread != This->datalen) - FIXME("Could only read %ld of %d bytes in no-header case?\n",xread,This->datalen); - } else { - xread = 0; - xbuf = This->data = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,header[1]); - This->datalen = header[1]; - while (xread < header[1]) { - ULONG nread; - hr = IStream_Read(pStm,xbuf+xread,header[1]-xread,&nread); - xread+=nread; - if (hr || !nread) - break; - } - if (xread != header[1]) - FIXME("Could only read %ld of %ld bytes?\n",xread,header[1]); } + if (xread != This->datalen) + FIXME("Could only read %ld of %d bytes out of stream?\n",xread,This->datalen); + + if (This->datalen == 0) { /* Marks the "NONE" picture */ + This->desc.picType = PICTYPE_NONE; + return S_OK; + } + magic = xbuf[0] + (xbuf[1]<<8); switch (magic) { case 0x4947: { /* GIF */ @@ -1917,7 +1937,7 @@ }
-static IPictureVtbl OLEPictureImpl_VTable = +static const IPictureVtbl OLEPictureImpl_VTable = { OLEPictureImpl_QueryInterface, OLEPictureImpl_AddRef, @@ -1938,7 +1958,7 @@ OLEPictureImpl_get_Attributes };
-static IDispatchVtbl OLEPictureImpl_IDispatch_VTable = +static const IDispatchVtbl OLEPictureImpl_IDispatch_VTable = { OLEPictureImpl_IDispatch_QueryInterface, OLEPictureImpl_IDispatch_AddRef, @@ -1949,7 +1969,7 @@ OLEPictureImpl_Invoke };
-static IPersistStreamVtbl OLEPictureImpl_IPersistStream_VTable = +static const IPersistStreamVtbl OLEPictureImpl_IPersistStream_VTable = { OLEPictureImpl_IPersistStream_QueryInterface, OLEPictureImpl_IPersistStream_AddRef, @@ -1961,7 +1981,7 @@ OLEPictureImpl_GetSizeMax };
-static IConnectionPointContainerVtbl OLEPictureImpl_IConnectionPointContainer_VTable = +static const IConnectionPointContainerVtbl OLEPictureImpl_IConnectionPointContainer_VTable = { OLEPictureImpl_IConnectionPointContainer_QueryInterface, OLEPictureImpl_IConnectionPointContainer_AddRef, @@ -2189,7 +2209,7 @@ typedef struct { /* IUnknown fields */ - IClassFactoryVtbl *lpVtbl; + const IClassFactoryVtbl *lpVtbl; DWORD ref; } IClassFactoryImpl;
@@ -2227,7 +2247,7 @@ return S_OK; }
-static IClassFactoryVtbl SPCF_Vtbl = { +static const IClassFactoryVtbl SPCF_Vtbl = { SPCF_QueryInterface, SPCF_AddRef, SPCF_Release, _____
Modified: trunk/reactos/lib/oleaut32/recinfo.c --- trunk/reactos/lib/oleaut32/recinfo.c 2005-08-03 22:31:39 UTC (rev 17036) +++ trunk/reactos/lib/oleaut32/recinfo.c 2005-08-03 22:46:31 UTC (rev 17037) @@ -41,7 +41,7 @@
} fieldstr;
typedef struct { - IRecordInfoVtbl *lpVtbl; + const IRecordInfoVtbl *lpVtbl; ULONG ref;
GUID guid; @@ -476,7 +476,7 @@ return S_OK; }
-static IRecordInfoVtbl IRecordInfoImplVtbl = { +static const IRecordInfoVtbl IRecordInfoImplVtbl = { IRecordInfoImpl_QueryInterface, IRecordInfoImpl_AddRef, IRecordInfoImpl_Release, _____
Modified: trunk/reactos/lib/oleaut32/tmarshal.c --- trunk/reactos/lib/oleaut32/tmarshal.c 2005-08-03 22:31:39 UTC (rev 17036) +++ trunk/reactos/lib/oleaut32/tmarshal.c 2005-08-03 22:46:31 UTC (rev 17037) @@ -355,8 +355,8 @@
#endif
typedef struct _TMProxyImpl { - LPVOID *lpvtbl; - IRpcProxyBufferVtbl *lpvtbl2; + LPVOID *lpvtbl; + const IRpcProxyBufferVtbl *lpvtbl2; ULONG ref;
TMAsmProxy *asmstubs; @@ -443,7 +443,7 @@ }
-static IRpcProxyBufferVtbl tmproxyvtable = { +static const IRpcProxyBufferVtbl tmproxyvtable = { TMProxyImpl_QueryInterface, TMProxyImpl_AddRef, TMProxyImpl_Release, @@ -455,6 +455,10 @@ int _argsize(DWORD vt) { switch (vt) { + case VT_R8: + return sizeof(double)/sizeof(DWORD); + case VT_CY: + return sizeof(CY)/sizeof(DWORD); case VT_DATE: return sizeof(DATE)/sizeof(DWORD); case VT_VARIANT: @@ -607,7 +611,10 @@ } case VT_PTR: { DWORD cookie; + BOOL derefhere;
+ derefhere = (tdesc->u.lptdesc->vt != VT_USERDEFINED); + if (debugout) TRACE_(olerelay)("*"); /* Write always, so the other side knows when it gets a NULL pointer. */ @@ -620,7 +627,7 @@ return S_OK; } hres = serialize_param(tinfo,writeit,debugout,dealloc,tdesc->u.lptdesc,(DWORD*) *arg,buf); - if (dealloc) HeapFree(GetProcessHeap(),0,(LPVOID)arg); + if (derefhere && dealloc) HeapFree(GetProcessHeap(),0,(LPVOID)*arg); return hres; } case VT_UNKNOWN: @@ -686,6 +693,7 @@ (DWORD*)(((LPBYTE)arg)+vdesc->u.oInst), buf ); + ITypeInfo_ReleaseVarDesc(tinfo2, vdesc); if (hres!=S_OK) return hres; if (debugout && (i<(tattr->cVars-1))) @@ -1432,7 +1440,7 @@ /* Searches function, also in inherited interfaces */ static HRESULT _get_funcdesc( - ITypeInfo *tinfo, int iMethod, FUNCDESC **fdesc, BSTR *iname, BSTR *fname) + ITypeInfo *tinfo, int iMethod, ITypeInfo **tactual, FUNCDESC **fdesc, BSTR *iname, BSTR *fname) { int i = 0, j = 0; HRESULT hres; @@ -1440,6 +1448,9 @@ if (fname) *fname = NULL; if (iname) *iname = NULL;
+ *tactual = tinfo; + ITypeInfo_AddRef(*tactual); + while (1) { hres = ITypeInfo_GetFuncDesc(tinfo, i, fdesc); if (hres) { @@ -1464,7 +1475,7 @@ ERR("Did not find a typeinfo for reftype %ld?\n",href); continue; } - hres = _get_funcdesc(tinfo2,iMethod,fdesc,iname,fname); + hres = _get_funcdesc(tinfo2,iMethod,tactual,fdesc,iname,fname); ITypeInfo_Release(tinfo2); if (!hres) return S_OK; } @@ -1496,12 +1507,14 @@ int nrofnames; int is_idispatch_getidsofnames = 0; DWORD remoteresult = 0; + ITypeInfo *tinfo;
EnterCriticalSection(&tpinfo->crit);
- hres = _get_funcdesc(tpinfo->tinfo,method,&fdesc,&iname,&fname); + hres = _get_funcdesc(tpinfo->tinfo,method,&tinfo,&fdesc,&iname,&fname); if (hres) { ERR("Did not find typeinfo/funcdesc entry for method %d!\n",method); + ITypeInfo_Release(tinfo); LeaveCriticalSection(&tpinfo->crit); return E_FAIL; } @@ -1509,6 +1522,7 @@ if (!tpinfo->chanbuf) { WARN("Tried to use disconnected proxy\n"); + ITypeInfo_Release(tinfo); LeaveCriticalSection(&tpinfo->crit); return RPC_E_DISCONNECTED; } @@ -1537,6 +1551,8 @@ hres = serialize_IDispatch_GetIDsOfNames(TRUE,relaydeb,args,&buf); if (hres != S_OK) { FIXME("serialize of IDispatch::GetIDsOfNames failed!\n"); + ITypeInfo_Release(tinfo); + LeaveCriticalSection(&tpinfo->crit); return hres; } goto afterserialize; @@ -1553,7 +1569,7 @@
/* Need them for hack below */ memset(names,0,sizeof(names)); - if (ITypeInfo_GetNames(tpinfo->tinfo,fdesc->memid,names,sizeof(names)/sizeo f(names[0]),&nrofnames)) + if (ITypeInfo_GetNames(tinfo,fdesc->memid,names,sizeof(names)/sizeof(names[ 0]),&nrofnames)) nrofnames = 0; if (nrofnames > sizeof(names)/sizeof(names[0])) ERR("Need more names!\n"); @@ -1582,7 +1598,7 @@ /* DISPPARAMS* needs special serializer */ if (!lstrcmpW(names[i+1],pdispparamsW)) { hres = serialize_DISPPARAM_ptr( - tpinfo->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, relaydeb, FALSE, @@ -1594,7 +1610,7 @@ } if (!lstrcmpW(names[i+1],ppvObjectW)) { hres = serialize_LPVOID_ptr( - tpinfo->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, relaydeb, FALSE, @@ -1608,7 +1624,7 @@ } if (!isserialized) hres = serialize_param( - tpinfo->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, relaydeb, FALSE, @@ -1695,7 +1711,7 @@ /* deserialize DISPPARAM */ if (!lstrcmpW(names[i+1],pdispparamsW)) { hres = deserialize_DISPPARAM_ptr( - tpinfo->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, relaydeb, FALSE, @@ -1711,7 +1727,7 @@ } if (!lstrcmpW(names[i+1],ppvObjectW)) { hres = deserialize_LPVOID_ptr( - tpinfo->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, relaydeb, FALSE, @@ -1725,7 +1741,7 @@ } if (!isdeserialized) hres = deserialize_param( - tpinfo->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, relaydeb, FALSE, @@ -1750,6 +1766,7 @@ return status;
HeapFree(GetProcessHeap(),0,buf.base); + ITypeInfo_Release(tinfo); LeaveCriticalSection(&tpinfo->crit); return remoteresult; } @@ -1842,7 +1859,9 @@ int j; /* nrofargs without This */ int nrofargs; - hres = _get_funcdesc(tinfo,i,&fdesc,NULL,NULL); + ITypeInfo *tinfo2; + hres = _get_funcdesc(tinfo,i,&tinfo2,&fdesc,NULL,NULL); + ITypeInfo_Release(tinfo2); if (hres) { ERR("GetFuncDesc %lx should not fail here.\n",hres); return hres; @@ -1891,7 +1910,7 @@ }
typedef struct _TMStubImpl { - IRpcStubBufferVtbl *lpvtbl; + const IRpcStubBufferVtbl *lpvtbl; ULONG ref;
LPUNKNOWN pUnk; @@ -1976,6 +1995,7 @@ BSTR names[10]; BSTR fname = NULL,iname = NULL; BOOL is_idispatch_getidsofnames = 0; + ITypeInfo *tinfo;
memset(&buf,0,sizeof(buf)); buf.size = xmsg->cbBuffer; @@ -1996,7 +2016,7 @@ xmsg->cbBuffer = buf.size; return hres; } - hres = _get_funcdesc(This->tinfo,xmsg->iMethod,&fdesc,&iname,&fname); + hres = _get_funcdesc(This->tinfo,xmsg->iMethod,&tinfo,&fdesc,&iname,&fname); if (hres) { ERR("GetFuncDesc on method %ld failed with %lx\n",xmsg->iMethod,hres); return hres; @@ -2010,7 +2030,7 @@
/* Need them for hack below */ memset(names,0,sizeof(names)); - ITypeInfo_GetNames(This->tinfo,fdesc->memid,names,sizeof(names)/sizeof(n ames[0]),&nrofnames); + ITypeInfo_GetNames(tinfo,fdesc->memid,names,sizeof(names)/sizeof(names[0 ]),&nrofnames); if (nrofnames > sizeof(names)/sizeof(names[0])) { ERR("Need more names!\n"); } @@ -2047,7 +2067,7 @@ /* deserialize DISPPARAM */ if (!lstrcmpW(names[i+1],pdispparamsW)) { hres = deserialize_DISPPARAM_ptr( - This->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, FALSE, TRUE, @@ -2063,7 +2083,7 @@ } if (!lstrcmpW(names[i+1],ppvObjectW)) { hres = deserialize_LPVOID_ptr( - This->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, FALSE, TRUE, @@ -2077,7 +2097,7 @@ } if (!isdeserialized) hres = deserialize_param( - This->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FIN, FALSE, TRUE, @@ -2129,7 +2149,7 @@ /* DISPPARAMS* needs special serializer */ if (!lstrcmpW(names[i+1],pdispparamsW)) { hres = serialize_DISPPARAM_ptr( - This->tinfo, + tinfo, elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT, FALSE, [truncated at 1000 lines; 1479 more skipped]