Sync to Wine-20050830:

Francois Gouget <fgouget@free.fr>
- Change some Dll* functions so they are exported by name like on
  Windows.
  Update the documentation accordingly.
Robert Shearman <rob@codeweavers.com>
- Remove redundant QueryInterface in marshal_interface - the object is
  always queried later on for the correct interface of the object.
- Make sure to Release the marshaled pointer in the typelib marshaler
  once it is no longer required.
- Shunt some trace statements over to the typelib channel that aren't
  really much use except in debugging typelib parsing.
- Make sure to release a reference to being returned as VariantCopyInd
  takes one for us.
- Revert to previous behaviour of detecting names with non-alphanumeric
  characters as ones with offsets, but add in a special case for an
  empty name.
- A name in an SLTG typelib only beginning with 0xff is the indicator
  of an offset, instead of any non alpha-numeric character.
- Any dispatch interface should have the fixed vtable size, not just
  dual ones.
- Warn when ITypeInfo_GetDocumentation fails.
- Make typelib marshaler use IRpcChannelBuffer::GetBuffer if possible.
Alexandre Julliard <julliard@winehq.org>
- Replace the ICOM_THIS_From macros by inline functions.
- Moved a number of definitions that are not needed in other files into
  vartype.c
- Removed some unnecessary macros, and make some functions static.
- Get rid of the almost empty tmarshal.h file.
Vincent Beron <vberon@mecano.gme.usherb.ca>
- Uniformize DllMain TRACEing across dlls.
Mike McCormack <mike@codeweavers.com>
- Fix gcc 4.0 warnings.
- gcc 4.0 warning fixes.
Michael Stefaniuc <mstefani@redhat.de>
- Implement IPicture::get_hPal for PICTYPE_BITMAP.
- VarAdd, VarMul: I4 overflows to R8 and not I8 even if the result
  would fit in I8. Fix tests.
- Document a brokeness in the handling of I8 numbers in
  VarNumFromParseNum. Fix tests.
Walt Ogburn <reuben@ugcs.caltech.edu>
- When applying logical / himetric ratio to olefont sizes, must divide
  by the standard ratio 72 / 2540.

svn path=/trunk/; revision=17679
This commit is contained in:
Gé van Geldorp 2005-09-05 22:00:07 +00:00
parent 05aeafcb9c
commit 52a92a993f
16 changed files with 1187 additions and 1237 deletions

View file

@ -32,8 +32,7 @@
#include "ole2.h" #include "ole2.h"
#include "olectl.h" #include "olectl.h"
#include "oleauto.h" #include "oleauto.h"
#include "typelib.h"
#include "tmarshal.h"
#include "wine/debug.h" #include "wine/debug.h"
@ -701,7 +700,7 @@ extern void _get_STDFONT_CF(LPVOID);
extern void _get_STDPIC_CF(LPVOID); extern void _get_STDPIC_CF(LPVOID);
/*********************************************************************** /***********************************************************************
* DllGetClassObject (OLEAUT32.1) * DllGetClassObject (OLEAUT32.@)
*/ */
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
{ {
@ -727,7 +726,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
return OLEAUTPS_DllGetClassObject(&CLSID_PSDispatch, iid, ppv); return OLEAUTPS_DllGetClassObject(&CLSID_PSDispatch, iid, ppv);
} }
if (IsEqualGUID(rclsid,&CLSID_PSOAInterface)) { if (IsEqualGUID(rclsid,&CLSID_PSOAInterface)) {
if (S_OK==TypeLibFac_DllGetClassObject(rclsid,iid,ppv)) if (S_OK==TMARSHAL_DllGetClassObject(rclsid,iid,ppv))
return S_OK; return S_OK;
/*FALLTHROUGH*/ /*FALLTHROUGH*/
} }
@ -736,7 +735,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
} }
/*********************************************************************** /***********************************************************************
* DllCanUnloadNow (OLEAUT32.410) * DllCanUnloadNow (OLEAUT32.@)
* *
* Determine if this dll can be unloaded from the callers address space. * Determine if this dll can be unloaded from the callers address space.
* *
@ -756,7 +755,7 @@ HRESULT WINAPI DllCanUnloadNow(void)
*/ */
BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved)
{ {
TRACE("(%p,%lu,%p)\n", hInstDll, fdwReason, lpvReserved); TRACE("(%p,%ld,%p)\n", hInstDll, fdwReason, lpvReserved);
switch (fdwReason) { switch (fdwReason) {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:

View file

@ -1,4 +1,3 @@
1 stdcall -private DllGetClassObject(ptr ptr ptr)
2 stdcall SysAllocString(wstr) 2 stdcall SysAllocString(wstr)
3 stdcall SysReAllocString(ptr wstr) 3 stdcall SysReAllocString(ptr wstr)
4 stdcall SysAllocStringLen(wstr long) 4 stdcall SysAllocStringLen(wstr long)
@ -312,8 +311,6 @@
317 stdcall VarR8Round(double long ptr) 317 stdcall VarR8Round(double long ptr)
318 stdcall VarCat(ptr ptr ptr) 318 stdcall VarCat(ptr ptr ptr)
319 stdcall VarDateFromUdateEx(ptr long long ptr) 319 stdcall VarDateFromUdateEx(ptr long long ptr)
320 stdcall -private DllRegisterServer()
321 stdcall -private DllUnregisterServer()
322 stdcall GetRecordInfoFromGuids(ptr long long long ptr ptr) 322 stdcall GetRecordInfoFromGuids(ptr long long long ptr ptr)
323 stdcall GetRecordInfoFromTypeInfo(ptr ptr) 323 stdcall GetRecordInfoFromTypeInfo(ptr ptr)
325 stub SetVarConversionLocaleSetting 325 stub SetVarConversionLocaleSetting
@ -382,7 +379,6 @@
399 stub UserMSG_free_local 399 stub UserMSG_free_local
401 stdcall OleLoadPictureEx(ptr long long long long long long ptr) 401 stdcall OleLoadPictureEx(ptr long long long long long long ptr)
402 stub OleLoadPictureFileEx 402 stub OleLoadPictureFileEx
410 stdcall -private DllCanUnloadNow()
411 stdcall SafeArrayCreateVector(long long long) 411 stdcall SafeArrayCreateVector(long long long)
412 stdcall SafeArrayCopyData(ptr ptr) 412 stdcall SafeArrayCopyData(ptr ptr)
413 stdcall VectorFromBstr(ptr ptr) 413 stdcall VectorFromBstr(ptr ptr)
@ -414,3 +410,8 @@
439 stdcall VarUI8FromUI2(long ptr) 439 stdcall VarUI8FromUI2(long ptr)
440 stdcall VarUI8FromUI4(long ptr) 440 stdcall VarUI8FromUI4(long ptr)
441 stdcall VarUI8FromDec(long ptr) 441 stdcall VarUI8FromDec(long ptr)
@ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer()

View file

@ -63,12 +63,12 @@ struct OLEFontImpl
* The first two are supported by the first vtable, the next two are * 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. * supported by the second table and the last two have their own.
*/ */
const IFontVtbl* lpvtbl1; const IFontVtbl* lpVtbl;
const IDispatchVtbl* lpvtbl2; const IDispatchVtbl* lpvtblIDispatch;
const IPersistStreamVtbl* lpvtbl3; const IPersistStreamVtbl* lpvtblIPersistStream;
const IConnectionPointContainerVtbl* lpvtbl4; const IConnectionPointContainerVtbl* lpvtblIConnectionPointContainer;
const IPersistPropertyBagVtbl* lpvtbl5; const IPersistPropertyBagVtbl* lpvtblIPersistPropertyBag;
const IPersistStreamInitVtbl* lpvtbl6; const IPersistStreamInitVtbl* lpvtblIPersistStreamInit;
/* /*
* Reference count for that instance of the class. * Reference count for that instance of the class.
*/ */
@ -104,11 +104,31 @@ struct OLEFontImpl
* There is a version to accommodate all of the VTables implemented * There is a version to accommodate all of the VTables implemented
* by this object. * by this object.
*/ */
#define _ICOM_THIS_From_IDispatch(class, name) class* this = (class*)(((char*)name)-sizeof(void*))
#define _ICOM_THIS_From_IPersistStream(class, name) class* this = (class*)(((char*)name)-2*sizeof(void*)) static inline OLEFontImpl *impl_from_IDispatch( IDispatch *iface )
#define _ICOM_THIS_From_IConnectionPointContainer(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*)) {
#define _ICOM_THIS_From_IPersistPropertyBag(class, name) class* this = (class*)(((char*)name)-4*sizeof(void*)) return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIDispatch));
#define _ICOM_THIS_From_IPersistStreamInit(class, name) class* this = (class*)(((char*)name)-5*sizeof(void*)) }
static inline OLEFontImpl *impl_from_IPersistStream( IPersistStream *iface )
{
return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIPersistStream));
}
static inline OLEFontImpl *impl_from_IConnectionPointContainer( IConnectionPointContainer *iface )
{
return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIConnectionPointContainer));
}
static inline OLEFontImpl *impl_from_IPersistPropertyBag( IPersistPropertyBag *iface )
{
return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIPersistPropertyBag));
}
static inline OLEFontImpl *impl_from_IPersistStreamInit( IPersistStreamInit *iface )
{
return (OLEFontImpl *)((char*)iface - FIELD_OFFSET(OLEFontImpl, lpvtblIPersistStreamInit));
}
/*********************************************************************** /***********************************************************************
@ -402,12 +422,12 @@ static OLEFontImpl* OLEFontImpl_Construct(LPFONTDESC fontDesc)
/* /*
* Initialize the virtual function table. * Initialize the virtual function table.
*/ */
newObject->lpvtbl1 = &OLEFontImpl_VTable; newObject->lpVtbl = &OLEFontImpl_VTable;
newObject->lpvtbl2 = &OLEFontImpl_IDispatch_VTable; newObject->lpvtblIDispatch = &OLEFontImpl_IDispatch_VTable;
newObject->lpvtbl3 = &OLEFontImpl_IPersistStream_VTable; newObject->lpvtblIPersistStream = &OLEFontImpl_IPersistStream_VTable;
newObject->lpvtbl4 = &OLEFontImpl_IConnectionPointContainer_VTable; newObject->lpvtblIConnectionPointContainer = &OLEFontImpl_IConnectionPointContainer_VTable;
newObject->lpvtbl5 = &OLEFontImpl_IPersistPropertyBag_VTable; newObject->lpvtblIPersistPropertyBag = &OLEFontImpl_IPersistPropertyBag_VTable;
newObject->lpvtbl6 = &OLEFontImpl_IPersistStreamInit_VTable; newObject->lpvtblIPersistStreamInit = &OLEFontImpl_IPersistStreamInit_VTable;
/* /*
* Start with one reference count. The caller of this function * Start with one reference count. The caller of this function
@ -495,17 +515,17 @@ HRESULT WINAPI OLEFontImpl_QueryInterface(
if (IsEqualGUID(&IID_IFont, riid)) if (IsEqualGUID(&IID_IFont, riid))
*ppvObject = (IFont*)this; *ppvObject = (IFont*)this;
if (IsEqualGUID(&IID_IDispatch, riid)) if (IsEqualGUID(&IID_IDispatch, riid))
*ppvObject = (IDispatch*)&(this->lpvtbl2); *ppvObject = (IDispatch*)&(this->lpvtblIDispatch);
if (IsEqualGUID(&IID_IFontDisp, riid)) if (IsEqualGUID(&IID_IFontDisp, riid))
*ppvObject = (IDispatch*)&(this->lpvtbl2); *ppvObject = (IDispatch*)&(this->lpvtblIDispatch);
if (IsEqualGUID(&IID_IPersistStream, riid)) if (IsEqualGUID(&IID_IPersistStream, riid))
*ppvObject = (IPersistStream*)&(this->lpvtbl3); *ppvObject = (IPersistStream*)&(this->lpvtblIPersistStream);
if (IsEqualGUID(&IID_IConnectionPointContainer, riid)) if (IsEqualGUID(&IID_IConnectionPointContainer, riid))
*ppvObject = (IConnectionPointContainer*)&(this->lpvtbl4); *ppvObject = (IConnectionPointContainer*)&(this->lpvtblIConnectionPointContainer);
if (IsEqualGUID(&IID_IPersistPropertyBag, riid)) if (IsEqualGUID(&IID_IPersistPropertyBag, riid))
*ppvObject = (IPersistPropertyBag*)&(this->lpvtbl5); *ppvObject = (IPersistPropertyBag*)&(this->lpvtblIPersistPropertyBag);
if (IsEqualGUID(&IID_IPersistStreamInit, riid)) if (IsEqualGUID(&IID_IPersistStreamInit, riid))
*ppvObject = (IPersistStreamInit*)&(this->lpvtbl6); *ppvObject = (IPersistStreamInit*)&(this->lpvtblIPersistStreamInit);
/* /*
* Check that we obtained an interface. * Check that we obtained an interface.
@ -933,7 +953,9 @@ static HRESULT WINAPI OLEFontImpl_get_hFont(
*/ */
IFont_get_Size(iface, &cySize); IFont_get_Size(iface, &cySize);
fontHeight = MulDiv( cySize.s.Lo, this->cyLogical, this->cyHimetric ); /* Standard ratio is 72 / 2540, or 18 / 635 in lowest terms. */
/* Ratio is applied here relative to the standard. */
fontHeight = MulDiv( cySize.s.Lo, this->cyLogical*635, this->cyHimetric*18 );
memset(&logFont, 0, sizeof(LOGFONTW)); memset(&logFont, 0, sizeof(LOGFONTW));
@ -1000,7 +1022,7 @@ static HRESULT WINAPI OLEFontImpl_Clone(
/* We need to clone the HFONT too. This is just cut & paste from above */ /* We need to clone the HFONT too. This is just cut & paste from above */
IFont_get_Size(iface, &cySize); IFont_get_Size(iface, &cySize);
fontHeight = MulDiv(cySize.s.Lo, this->cyLogical,this->cyHimetric); fontHeight = MulDiv(cySize.s.Lo, this->cyLogical*635,this->cyHimetric*18);
memset(&logFont, 0, sizeof(LOGFONTW)); memset(&logFont, 0, sizeof(LOGFONTW));
@ -1156,9 +1178,9 @@ static HRESULT WINAPI OLEFontImpl_IDispatch_QueryInterface(
REFIID riid, REFIID riid,
VOID** ppvoid) VOID** ppvoid)
{ {
_ICOM_THIS_From_IDispatch(IFont, iface); OLEFontImpl *this = impl_from_IDispatch(iface);
return IFont_QueryInterface(this, riid, ppvoid); return IFont_QueryInterface((IFont *)this, riid, ppvoid);
} }
/************************************************************************ /************************************************************************
@ -1169,9 +1191,9 @@ static HRESULT WINAPI OLEFontImpl_IDispatch_QueryInterface(
static ULONG WINAPI OLEFontImpl_IDispatch_Release( static ULONG WINAPI OLEFontImpl_IDispatch_Release(
IDispatch* iface) IDispatch* iface)
{ {
_ICOM_THIS_From_IDispatch(IFont, iface); OLEFontImpl *this = impl_from_IDispatch(iface);
return IFont_Release(this); return IFont_Release((IFont *)this);
} }
/************************************************************************ /************************************************************************
@ -1182,9 +1204,9 @@ static ULONG WINAPI OLEFontImpl_IDispatch_Release(
static ULONG WINAPI OLEFontImpl_IDispatch_AddRef( static ULONG WINAPI OLEFontImpl_IDispatch_AddRef(
IDispatch* iface) IDispatch* iface)
{ {
_ICOM_THIS_From_IDispatch(IFont, iface); OLEFontImpl *this = impl_from_IDispatch(iface);
return IFont_AddRef(this); return IFont_AddRef((IFont *)this);
} }
/************************************************************************ /************************************************************************
@ -1196,7 +1218,7 @@ static HRESULT WINAPI OLEFontImpl_GetTypeInfoCount(
IDispatch* iface, IDispatch* iface,
unsigned int* pctinfo) unsigned int* pctinfo)
{ {
_ICOM_THIS_From_IDispatch(IFont, iface); OLEFontImpl *this = impl_from_IDispatch(iface);
FIXME("(%p)->(%p): Stub\n", this, pctinfo); FIXME("(%p)->(%p): Stub\n", this, pctinfo);
return E_NOTIMPL; return E_NOTIMPL;
@ -1217,7 +1239,7 @@ static HRESULT WINAPI OLEFontImpl_GetTypeInfo(
ITypeLib *tl; ITypeLib *tl;
HRESULT hres; HRESULT hres;
_ICOM_THIS_From_IDispatch(OLEFontImpl, iface); OLEFontImpl *this = impl_from_IDispatch(iface);
TRACE("(%p, iTInfo=%d, lcid=%04x, %p)\n", this, iTInfo, (int)lcid, ppTInfo); TRACE("(%p, iTInfo=%d, lcid=%04x, %p)\n", this, iTInfo, (int)lcid, ppTInfo);
if (iTInfo != 0) if (iTInfo != 0)
return E_FAIL; return E_FAIL;
@ -1246,7 +1268,7 @@ static HRESULT WINAPI OLEFontImpl_GetIDsOfNames(
LCID lcid, LCID lcid,
DISPID* rgDispId) DISPID* rgDispId)
{ {
_ICOM_THIS_From_IDispatch(IFont, iface); OLEFontImpl *this = impl_from_IDispatch(iface);
FIXME("(%p,%s,%p,%d,%04x,%p), stub!\n", this, debugstr_guid(riid), rgszNames, FIXME("(%p,%s,%p,%d,%04x,%p), stub!\n", this, debugstr_guid(riid), rgszNames,
cNames, (int)lcid, rgDispId cNames, (int)lcid, rgDispId
); );
@ -1273,7 +1295,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
EXCEPINFO* pExepInfo, EXCEPINFO* pExepInfo,
UINT* puArgErr) UINT* puArgErr)
{ {
_ICOM_THIS_From_IDispatch(IFont, iface); OLEFontImpl *this = impl_from_IDispatch(iface);
OLEFontImpl *xthis = (OLEFontImpl*)this; OLEFontImpl *xthis = (OLEFontImpl*)this;
switch (dispIdMember) { switch (dispIdMember) {
@ -1282,7 +1304,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPATCH_PROPERTYGET: case DISPATCH_PROPERTYGET:
case DISPATCH_PROPERTYGET|DISPATCH_METHOD: case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
V_VT(pVarResult) = VT_BSTR; V_VT(pVarResult) = VT_BSTR;
return OLEFontImpl_get_Name(this, &V_BSTR(pVarResult)); return OLEFontImpl_get_Name((IFont *)this, &V_BSTR(pVarResult));
case DISPATCH_PROPERTYPUT: { case DISPATCH_PROPERTYPUT: {
BSTR name; BSTR name;
BOOL freename; BOOL freename;
@ -1334,7 +1356,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPATCH_PROPERTYGET: case DISPATCH_PROPERTYGET:
case DISPATCH_PROPERTYGET|DISPATCH_METHOD: case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
V_VT(pVarResult) = VT_BOOL; V_VT(pVarResult) = VT_BOOL;
return OLEFontImpl_get_Bold(this, (BOOL*)&V_BOOL(pVarResult)); return OLEFontImpl_get_Bold((IFont *)this, (BOOL*)&V_BOOL(pVarResult));
case DISPATCH_PROPERTYPUT: case DISPATCH_PROPERTYPUT:
if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL) { if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL) {
FIXME("DISPID_FONT_BOLD/put, vt is %d, not VT_BOOL.\n",V_VT(&pDispParams->rgvarg[0])); FIXME("DISPID_FONT_BOLD/put, vt is %d, not VT_BOOL.\n",V_VT(&pDispParams->rgvarg[0]));
@ -1350,7 +1372,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPATCH_PROPERTYGET: case DISPATCH_PROPERTYGET:
case DISPATCH_PROPERTYGET|DISPATCH_METHOD: case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
V_VT(pVarResult) = VT_BOOL; V_VT(pVarResult) = VT_BOOL;
return OLEFontImpl_get_Italic(this, (BOOL*)&V_BOOL(pVarResult)); return OLEFontImpl_get_Italic((IFont *)this, (BOOL*)&V_BOOL(pVarResult));
case DISPATCH_PROPERTYPUT: case DISPATCH_PROPERTYPUT:
if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL) { if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL) {
FIXME("DISPID_FONT_ITALIC/put, vt is %d, not VT_BOOL.\n",V_VT(&pDispParams->rgvarg[0])); FIXME("DISPID_FONT_ITALIC/put, vt is %d, not VT_BOOL.\n",V_VT(&pDispParams->rgvarg[0]));
@ -1366,7 +1388,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPATCH_PROPERTYGET: case DISPATCH_PROPERTYGET:
case DISPATCH_PROPERTYGET|DISPATCH_METHOD: case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
V_VT(pVarResult) = VT_BOOL; V_VT(pVarResult) = VT_BOOL;
return OLEFontImpl_get_Underline(this, (BOOL*)&V_BOOL(pVarResult)); return OLEFontImpl_get_Underline((IFont *)this, (BOOL*)&V_BOOL(pVarResult));
case DISPATCH_PROPERTYPUT: case DISPATCH_PROPERTYPUT:
if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL) { if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL) {
FIXME("DISPID_FONT_UNDER/put, vt is %d, not VT_BOOL.\n",V_VT(&pDispParams->rgvarg[0])); FIXME("DISPID_FONT_UNDER/put, vt is %d, not VT_BOOL.\n",V_VT(&pDispParams->rgvarg[0]));
@ -1382,7 +1404,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPATCH_PROPERTYGET: case DISPATCH_PROPERTYGET:
case DISPATCH_PROPERTYGET|DISPATCH_METHOD: case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
V_VT(pVarResult) = VT_BOOL; V_VT(pVarResult) = VT_BOOL;
return OLEFontImpl_get_Strikethrough(this, (BOOL*)&V_BOOL(pVarResult)); return OLEFontImpl_get_Strikethrough((IFont *)this, (BOOL*)&V_BOOL(pVarResult));
case DISPATCH_PROPERTYPUT: case DISPATCH_PROPERTYPUT:
if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL) { if (V_VT(&pDispParams->rgvarg[0]) != VT_BOOL) {
FIXME("DISPID_FONT_STRIKE/put, vt is %d, not VT_BOOL.\n",V_VT(&pDispParams->rgvarg[0])); FIXME("DISPID_FONT_STRIKE/put, vt is %d, not VT_BOOL.\n",V_VT(&pDispParams->rgvarg[0]));
@ -1412,7 +1434,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPATCH_PROPERTYGET: case DISPATCH_PROPERTYGET:
case DISPATCH_PROPERTYGET|DISPATCH_METHOD: case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
V_VT(pVarResult) = VT_CY; V_VT(pVarResult) = VT_CY;
return OLEFontImpl_get_Size(this, &V_CY(pVarResult)); return OLEFontImpl_get_Size((IFont *)this, &V_CY(pVarResult));
} }
break; break;
case DISPID_FONT_CHARSET: case DISPID_FONT_CHARSET:
@ -1426,7 +1448,7 @@ static HRESULT WINAPI OLEFontImpl_Invoke(
case DISPATCH_PROPERTYGET: case DISPATCH_PROPERTYGET:
case DISPATCH_PROPERTYGET|DISPATCH_METHOD: case DISPATCH_PROPERTYGET|DISPATCH_METHOD:
V_VT(pVarResult) = VT_I2; V_VT(pVarResult) = VT_I2;
return OLEFontImpl_get_Charset(this, &V_I2(pVarResult)); return OLEFontImpl_get_Charset((IFont *)this, &V_I2(pVarResult));
} }
break; break;
} }
@ -1447,9 +1469,9 @@ static HRESULT WINAPI OLEFontImpl_IPersistStream_QueryInterface(
REFIID riid, REFIID riid,
VOID** ppvoid) VOID** ppvoid)
{ {
_ICOM_THIS_From_IPersistStream(IFont, iface); OLEFontImpl *this = impl_from_IPersistStream(iface);
return IFont_QueryInterface(this, riid, ppvoid); return IFont_QueryInterface((IFont *)this, riid, ppvoid);
} }
/************************************************************************ /************************************************************************
@ -1460,9 +1482,9 @@ static HRESULT WINAPI OLEFontImpl_IPersistStream_QueryInterface(
static ULONG WINAPI OLEFontImpl_IPersistStream_Release( static ULONG WINAPI OLEFontImpl_IPersistStream_Release(
IPersistStream* iface) IPersistStream* iface)
{ {
_ICOM_THIS_From_IPersistStream(IFont, iface); OLEFontImpl *this = impl_from_IPersistStream(iface);
return IFont_Release(this); return IFont_Release((IFont *)this);
} }
/************************************************************************ /************************************************************************
@ -1473,9 +1495,9 @@ static ULONG WINAPI OLEFontImpl_IPersistStream_Release(
static ULONG WINAPI OLEFontImpl_IPersistStream_AddRef( static ULONG WINAPI OLEFontImpl_IPersistStream_AddRef(
IPersistStream* iface) IPersistStream* iface)
{ {
_ICOM_THIS_From_IPersistStream(IFont, iface); OLEFontImpl *this = impl_from_IPersistStream(iface);
return IFont_AddRef(this); return IFont_AddRef((IFont *)this);
} }
/************************************************************************ /************************************************************************
@ -1540,7 +1562,7 @@ static HRESULT WINAPI OLEFontImpl_Load(
BYTE bStringSize; BYTE bStringSize;
INT len; INT len;
_ICOM_THIS_From_IPersistStream(OLEFontImpl, iface); OLEFontImpl *this = impl_from_IPersistStream(iface);
/* /*
* Read the version byte * Read the version byte
@ -1632,7 +1654,7 @@ static HRESULT WINAPI OLEFontImpl_Save(
BYTE bAttributes; BYTE bAttributes;
BYTE bStringSize; BYTE bStringSize;
_ICOM_THIS_From_IPersistStream(OLEFontImpl, iface); OLEFontImpl *this = impl_from_IPersistStream(iface);
/* /*
* Read the version byte * Read the version byte
@ -1725,7 +1747,7 @@ static HRESULT WINAPI OLEFontImpl_GetSizeMax(
IPersistStream* iface, IPersistStream* iface,
ULARGE_INTEGER* pcbSize) ULARGE_INTEGER* pcbSize)
{ {
_ICOM_THIS_From_IPersistStream(OLEFontImpl, iface); OLEFontImpl *this = impl_from_IPersistStream(iface);
if (pcbSize==NULL) if (pcbSize==NULL)
return E_POINTER; return E_POINTER;
@ -1756,7 +1778,7 @@ static HRESULT WINAPI OLEFontImpl_IConnectionPointContainer_QueryInterface(
REFIID riid, REFIID riid,
VOID** ppvoid) VOID** ppvoid)
{ {
_ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface); OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
return IFont_QueryInterface((IFont*)this, riid, ppvoid); return IFont_QueryInterface((IFont*)this, riid, ppvoid);
} }
@ -1769,7 +1791,7 @@ static HRESULT WINAPI OLEFontImpl_IConnectionPointContainer_QueryInterface(
static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_Release( static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_Release(
IConnectionPointContainer* iface) IConnectionPointContainer* iface)
{ {
_ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface); OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
return IFont_Release((IFont*)this); return IFont_Release((IFont*)this);
} }
@ -1782,7 +1804,7 @@ static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_Release(
static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_AddRef( static ULONG WINAPI OLEFontImpl_IConnectionPointContainer_AddRef(
IConnectionPointContainer* iface) IConnectionPointContainer* iface)
{ {
_ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface); OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
return IFont_AddRef((IFont*)this); return IFont_AddRef((IFont*)this);
} }
@ -1797,7 +1819,7 @@ static HRESULT WINAPI OLEFontImpl_EnumConnectionPoints(
IConnectionPointContainer* iface, IConnectionPointContainer* iface,
IEnumConnectionPoints **ppEnum) IEnumConnectionPoints **ppEnum)
{ {
_ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface); OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
FIXME("(%p)->(%p): stub\n", this, ppEnum); FIXME("(%p)->(%p): stub\n", this, ppEnum);
return E_NOTIMPL; return E_NOTIMPL;
@ -1814,7 +1836,7 @@ static HRESULT WINAPI OLEFontImpl_FindConnectionPoint(
REFIID riid, REFIID riid,
IConnectionPoint **ppCp) IConnectionPoint **ppCp)
{ {
_ICOM_THIS_From_IConnectionPointContainer(OLEFontImpl, iface); OLEFontImpl *this = impl_from_IConnectionPointContainer(iface);
TRACE("(%p)->(%s, %p): stub\n", this, debugstr_guid(riid), ppCp); TRACE("(%p)->(%s, %p): stub\n", this, debugstr_guid(riid), ppCp);
if(memcmp(riid, &IID_IPropertyNotifySink, sizeof(IID_IPropertyNotifySink)) == 0) { if(memcmp(riid, &IID_IPropertyNotifySink, sizeof(IID_IPropertyNotifySink)) == 0) {
@ -1832,22 +1854,22 @@ static HRESULT WINAPI OLEFontImpl_FindConnectionPoint(
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_QueryInterface( static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_QueryInterface(
IPersistPropertyBag *iface, REFIID riid, LPVOID *ppvObj IPersistPropertyBag *iface, REFIID riid, LPVOID *ppvObj
) { ) {
_ICOM_THIS_From_IPersistPropertyBag(IFont, iface); OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
return IFont_QueryInterface(this,riid,ppvObj); return IFont_QueryInterface((IFont *)this,riid,ppvObj);
} }
static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_AddRef( static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_AddRef(
IPersistPropertyBag *iface IPersistPropertyBag *iface
) { ) {
_ICOM_THIS_From_IPersistPropertyBag(IFont, iface); OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
return IFont_AddRef(this); return IFont_AddRef((IFont *)this);
} }
static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_Release( static ULONG WINAPI OLEFontImpl_IPersistPropertyBag_Release(
IPersistPropertyBag *iface IPersistPropertyBag *iface
) { ) {
_ICOM_THIS_From_IPersistPropertyBag(IFont, iface); OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
return IFont_Release(this); return IFont_Release((IFont *)this);
} }
static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_GetClassID( static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_GetClassID(
@ -1886,7 +1908,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
VARIANT rawAttr; VARIANT rawAttr;
VARIANT valueAttr; VARIANT valueAttr;
HRESULT iRes = S_OK; HRESULT iRes = S_OK;
_ICOM_THIS_From_IPersistPropertyBag(IFont, iface); OLEFontImpl *this = impl_from_IPersistPropertyBag(iface);
VariantInit(&rawAttr); VariantInit(&rawAttr);
VariantInit(&valueAttr); VariantInit(&valueAttr);
@ -1897,7 +1919,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_BSTR); iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_BSTR);
if (iRes == S_OK) if (iRes == S_OK)
iRes = IFont_put_Name(this, V_BSTR(&valueAttr)); iRes = IFont_put_Name((IFont *)this, V_BSTR(&valueAttr));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -1911,7 +1933,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_CY); iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_CY);
if (iRes == S_OK) if (iRes == S_OK)
iRes = IFont_put_Size(this, V_CY(&valueAttr)); iRes = IFont_put_Size((IFont *)this, V_CY(&valueAttr));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -1925,7 +1947,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_I2); iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_I2);
if (iRes == S_OK) if (iRes == S_OK)
iRes = IFont_put_Charset(this, V_I2(&valueAttr)); iRes = IFont_put_Charset((IFont *)this, V_I2(&valueAttr));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -1939,7 +1961,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_I2); iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_I2);
if (iRes == S_OK) if (iRes == S_OK)
iRes = IFont_put_Weight(this, V_I2(&valueAttr)); iRes = IFont_put_Weight((IFont *)this, V_I2(&valueAttr));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -1954,7 +1976,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_BOOL); iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_BOOL);
if (iRes == S_OK) if (iRes == S_OK)
iRes = IFont_put_Underline(this, V_BOOL(&valueAttr)); iRes = IFont_put_Underline((IFont *)this, V_BOOL(&valueAttr));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -1968,7 +1990,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_BOOL); iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_BOOL);
if (iRes == S_OK) if (iRes == S_OK)
iRes = IFont_put_Italic(this, V_BOOL(&valueAttr)); iRes = IFont_put_Italic((IFont *)this, V_BOOL(&valueAttr));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -1982,7 +2004,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Load(
{ {
iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_BOOL); iRes = VariantChangeType(&rawAttr, &valueAttr, 0, VT_BOOL);
if (iRes == S_OK) if (iRes == S_OK)
IFont_put_Strikethrough(this, V_BOOL(&valueAttr)); IFont_put_Strikethrough((IFont *)this, V_BOOL(&valueAttr));
} }
else if (iRes == E_INVALIDARG) else if (iRes == E_INVALIDARG)
iRes = S_OK; iRes = S_OK;
@ -2021,22 +2043,22 @@ static const IPersistPropertyBagVtbl OLEFontImpl_IPersistPropertyBag_VTable =
static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_QueryInterface( static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_QueryInterface(
IPersistStreamInit *iface, REFIID riid, LPVOID *ppvObj IPersistStreamInit *iface, REFIID riid, LPVOID *ppvObj
) { ) {
_ICOM_THIS_From_IPersistStreamInit(IFont, iface); OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
return IFont_QueryInterface(this,riid,ppvObj); return IFont_QueryInterface((IFont *)this,riid,ppvObj);
} }
static ULONG WINAPI OLEFontImpl_IPersistStreamInit_AddRef( static ULONG WINAPI OLEFontImpl_IPersistStreamInit_AddRef(
IPersistStreamInit *iface IPersistStreamInit *iface
) { ) {
_ICOM_THIS_From_IPersistStreamInit(IFont, iface); OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
return IFont_AddRef(this); return IFont_AddRef((IFont *)this);
} }
static ULONG WINAPI OLEFontImpl_IPersistStreamInit_Release( static ULONG WINAPI OLEFontImpl_IPersistStreamInit_Release(
IPersistStreamInit *iface IPersistStreamInit *iface
) { ) {
_ICOM_THIS_From_IPersistStreamInit(IFont, iface); OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
return IFont_Release(this); return IFont_Release((IFont *)this);
} }
static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_GetClassID( static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_GetClassID(

View file

@ -125,10 +125,10 @@ typedef struct OLEPictureImpl {
* IPicture handles IUnknown * IPicture handles IUnknown
*/ */
const IPictureVtbl *lpvtbl1; const IPictureVtbl *lpVtbl;
const IDispatchVtbl *lpvtbl2; const IDispatchVtbl *lpvtblIDispatch;
const IPersistStreamVtbl *lpvtbl3; const IPersistStreamVtbl *lpvtblIPersistStream;
const IConnectionPointContainerVtbl *lpvtbl4; const IConnectionPointContainerVtbl *lpvtblIConnectionPointContainer;
/* Object reference count */ /* Object reference count */
LONG ref; LONG ref;
@ -168,12 +168,21 @@ typedef struct OLEPictureImpl {
/* /*
* Macros to retrieve pointer to IUnknown (IPicture) from the other VTables. * Macros to retrieve pointer to IUnknown (IPicture) from the other VTables.
*/ */
#define ICOM_THIS_From_IDispatch(impl, name) \
impl *This = (impl*)(((char*)name)-sizeof(void*)); static inline OLEPictureImpl *impl_from_IDispatch( IDispatch *iface )
#define ICOM_THIS_From_IPersistStream(impl, name) \ {
impl *This = (impl*)(((char*)name)-2*sizeof(void*)); return (OLEPictureImpl *)((char*)iface - FIELD_OFFSET(OLEPictureImpl, lpvtblIDispatch));
#define ICOM_THIS_From_IConnectionPointContainer(impl, name) \ }
impl *This = (impl*)(((char*)name)-3*sizeof(void*));
static inline OLEPictureImpl *impl_from_IPersistStream( IPersistStream *iface )
{
return (OLEPictureImpl *)((char*)iface - FIELD_OFFSET(OLEPictureImpl, lpvtblIPersistStream));
}
static inline OLEPictureImpl *impl_from_IConnectionPointContainer( IConnectionPointContainer *iface )
{
return (OLEPictureImpl *)((char*)iface - FIELD_OFFSET(OLEPictureImpl, lpvtblIConnectionPointContainer));
}
/* /*
* Predeclare VTables. They get initialized at the end. * Predeclare VTables. They get initialized at the end.
@ -265,10 +274,10 @@ static OLEPictureImpl* OLEPictureImpl_Construct(LPPICTDESC pictDesc, BOOL fOwn)
/* /*
* Initialize the virtual function table. * Initialize the virtual function table.
*/ */
newObject->lpvtbl1 = &OLEPictureImpl_VTable; newObject->lpVtbl = &OLEPictureImpl_VTable;
newObject->lpvtbl2 = &OLEPictureImpl_IDispatch_VTable; newObject->lpvtblIDispatch = &OLEPictureImpl_IDispatch_VTable;
newObject->lpvtbl3 = &OLEPictureImpl_IPersistStream_VTable; newObject->lpvtblIPersistStream = &OLEPictureImpl_IPersistStream_VTable;
newObject->lpvtbl4 = &OLEPictureImpl_IConnectionPointContainer_VTable; newObject->lpvtblIConnectionPointContainer = &OLEPictureImpl_IConnectionPointContainer_VTable;
CreateConnectionPoint((IUnknown*)newObject,&IID_IPropertyNotifySink,&newObject->pCP); CreateConnectionPoint((IUnknown*)newObject,&IID_IPropertyNotifySink,&newObject->pCP);
@ -407,19 +416,19 @@ static HRESULT WINAPI OLEPictureImpl_QueryInterface(
} }
else if (memcmp(&IID_IDispatch, riid, sizeof(IID_IDispatch)) == 0) else if (memcmp(&IID_IDispatch, riid, sizeof(IID_IDispatch)) == 0)
{ {
*ppvObject = (IDispatch*)&(This->lpvtbl2); *ppvObject = (IDispatch*)&(This->lpvtblIDispatch);
} }
else if (memcmp(&IID_IPictureDisp, riid, sizeof(IID_IPictureDisp)) == 0) else if (memcmp(&IID_IPictureDisp, riid, sizeof(IID_IPictureDisp)) == 0)
{ {
*ppvObject = (IDispatch*)&(This->lpvtbl2); *ppvObject = (IDispatch*)&(This->lpvtblIDispatch);
} }
else if (memcmp(&IID_IPersistStream, riid, sizeof(IID_IPersistStream)) == 0) else if (memcmp(&IID_IPersistStream, riid, sizeof(IID_IPersistStream)) == 0)
{ {
*ppvObject = (IPersistStream*)&(This->lpvtbl3); *ppvObject = (IPersistStream*)&(This->lpvtblIPersistStream);
} }
else if (memcmp(&IID_IConnectionPointContainer, riid, sizeof(IID_IConnectionPointContainer)) == 0) else if (memcmp(&IID_IConnectionPointContainer, riid, sizeof(IID_IConnectionPointContainer)) == 0)
{ {
*ppvObject = (IConnectionPointContainer*)&(This->lpvtbl4); *ppvObject = (IConnectionPointContainer*)&(This->lpvtblIConnectionPointContainer);
} }
/* /*
* Check that we obtained an interface. * Check that we obtained an interface.
@ -540,10 +549,34 @@ static HRESULT WINAPI OLEPictureImpl_get_hPal(IPicture *iface,
OLE_HANDLE *phandle) OLE_HANDLE *phandle)
{ {
OLEPictureImpl *This = (OLEPictureImpl *)iface; OLEPictureImpl *This = (OLEPictureImpl *)iface;
FIXME("(%p)->(%p): stub, return 0 palette.\n", This, phandle); HRESULT hres;
TRACE("(%p)->(%p)\n", This, phandle);
if (!phandle)
return E_POINTER;
switch (This->desc.picType) {
case PICTYPE_UNINITIALIZED:
case PICTYPE_NONE:
*phandle = 0; *phandle = 0;
return S_OK; hres = S_FALSE;
break;
case PICTYPE_BITMAP:
*phandle = (OLE_HANDLE)This->desc.u.bmp.hpal;
hres = S_OK;
break;
case PICTYPE_ICON:
case PICTYPE_METAFILE:
case PICTYPE_ENHMETAFILE:
default:
FIXME("unimplemented for type %d. Returning 0 palette.\n",
This->desc.picType);
*phandle = 0;
hres = S_OK;
}
TRACE("returning 0x%08lx, palette handle %08x\n", hres, *phandle);
return hres;
} }
/************************************************************************ /************************************************************************
@ -791,34 +824,34 @@ static HRESULT WINAPI OLEPictureImpl_get_Attributes(IPicture *iface,
static HRESULT WINAPI OLEPictureImpl_IConnectionPointContainer_QueryInterface( static HRESULT WINAPI OLEPictureImpl_IConnectionPointContainer_QueryInterface(
IConnectionPointContainer* iface, IConnectionPointContainer* iface,
REFIID riid, REFIID riid,
VOID** ppvoid VOID** ppvoid)
) { {
ICOM_THIS_From_IConnectionPointContainer(IPicture,iface); OLEPictureImpl *This = impl_from_IConnectionPointContainer(iface);
return IPicture_QueryInterface(This,riid,ppvoid); return IPicture_QueryInterface((IPicture *)This,riid,ppvoid);
} }
static ULONG WINAPI OLEPictureImpl_IConnectionPointContainer_AddRef( static ULONG WINAPI OLEPictureImpl_IConnectionPointContainer_AddRef(
IConnectionPointContainer* iface) IConnectionPointContainer* iface)
{ {
ICOM_THIS_From_IConnectionPointContainer(IPicture, iface); OLEPictureImpl *This = impl_from_IConnectionPointContainer(iface);
return IPicture_AddRef(This); return IPicture_AddRef((IPicture *)This);
} }
static ULONG WINAPI OLEPictureImpl_IConnectionPointContainer_Release( static ULONG WINAPI OLEPictureImpl_IConnectionPointContainer_Release(
IConnectionPointContainer* iface) IConnectionPointContainer* iface)
{ {
ICOM_THIS_From_IConnectionPointContainer(IPicture, iface); OLEPictureImpl *This = impl_from_IConnectionPointContainer(iface);
return IPicture_Release(This); return IPicture_Release((IPicture *)This);
} }
static HRESULT WINAPI OLEPictureImpl_EnumConnectionPoints( static HRESULT WINAPI OLEPictureImpl_EnumConnectionPoints(
IConnectionPointContainer* iface, IConnectionPointContainer* iface,
IEnumConnectionPoints** ppEnum IEnumConnectionPoints** ppEnum)
) { {
ICOM_THIS_From_IConnectionPointContainer(IPicture, iface); OLEPictureImpl *This = impl_from_IConnectionPointContainer(iface);
FIXME("(%p,%p), stub!\n",This,ppEnum); FIXME("(%p,%p), stub!\n",This,ppEnum);
return E_NOTIMPL; return E_NOTIMPL;
@ -827,9 +860,9 @@ static HRESULT WINAPI OLEPictureImpl_EnumConnectionPoints(
static HRESULT WINAPI OLEPictureImpl_FindConnectionPoint( static HRESULT WINAPI OLEPictureImpl_FindConnectionPoint(
IConnectionPointContainer* iface, IConnectionPointContainer* iface,
REFIID riid, REFIID riid,
IConnectionPoint **ppCP IConnectionPoint **ppCP)
) { {
ICOM_THIS_From_IConnectionPointContainer(OLEPictureImpl, iface); OLEPictureImpl *This = impl_from_IConnectionPointContainer(iface);
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppCP); TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppCP);
if (!ppCP) if (!ppCP)
return E_POINTER; return E_POINTER;
@ -852,9 +885,9 @@ static HRESULT WINAPI OLEPictureImpl_IPersistStream_QueryInterface(
REFIID riid, REFIID riid,
VOID** ppvoid) VOID** ppvoid)
{ {
ICOM_THIS_From_IPersistStream(IPicture, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
return IPicture_QueryInterface(This, riid, ppvoid); return IPicture_QueryInterface((IPicture *)This, riid, ppvoid);
} }
/************************************************************************ /************************************************************************
@ -865,9 +898,9 @@ static HRESULT WINAPI OLEPictureImpl_IPersistStream_QueryInterface(
static ULONG WINAPI OLEPictureImpl_IPersistStream_AddRef( static ULONG WINAPI OLEPictureImpl_IPersistStream_AddRef(
IPersistStream* iface) IPersistStream* iface)
{ {
ICOM_THIS_From_IPersistStream(IPicture, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
return IPicture_AddRef(This); return IPicture_AddRef((IPicture *)This);
} }
/************************************************************************ /************************************************************************
@ -878,9 +911,9 @@ static ULONG WINAPI OLEPictureImpl_IPersistStream_AddRef(
static ULONG WINAPI OLEPictureImpl_IPersistStream_Release( static ULONG WINAPI OLEPictureImpl_IPersistStream_Release(
IPersistStream* iface) IPersistStream* iface)
{ {
ICOM_THIS_From_IPersistStream(IPicture, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
return IPicture_Release(This); return IPicture_Release((IPicture *)This);
} }
/************************************************************************ /************************************************************************
@ -889,7 +922,7 @@ static ULONG WINAPI OLEPictureImpl_IPersistStream_Release(
static HRESULT WINAPI OLEPictureImpl_GetClassID( static HRESULT WINAPI OLEPictureImpl_GetClassID(
IPersistStream* iface,CLSID* pClassID) IPersistStream* iface,CLSID* pClassID)
{ {
ICOM_THIS_From_IPersistStream(IPicture, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p),stub!\n",This); FIXME("(%p),stub!\n",This);
return E_FAIL; return E_FAIL;
} }
@ -900,7 +933,7 @@ static HRESULT WINAPI OLEPictureImpl_GetClassID(
static HRESULT WINAPI OLEPictureImpl_IsDirty( static HRESULT WINAPI OLEPictureImpl_IsDirty(
IPersistStream* iface) IPersistStream* iface)
{ {
ICOM_THIS_From_IPersistStream(IPicture, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p),stub!\n",This); FIXME("(%p),stub!\n",This);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -1028,7 +1061,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
DWORD header[2]; DWORD header[2];
WORD magic; WORD magic;
STATSTG statstg; STATSTG statstg;
ICOM_THIS_From_IPersistStream(OLEPictureImpl, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
TRACE("(%p,%p)\n",This,pStm); TRACE("(%p,%p)\n",This,pStm);
@ -1519,7 +1552,7 @@ static HRESULT WINAPI OLEPictureImpl_Save(
ULONG dummy; ULONG dummy;
int iSerializeResult = 0; int iSerializeResult = 0;
ICOM_THIS_From_IPersistStream(OLEPictureImpl, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
switch (This->desc.picType) { switch (This->desc.picType) {
case PICTYPE_ICON: case PICTYPE_ICON:
@ -1837,7 +1870,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength)
static HRESULT WINAPI OLEPictureImpl_GetSizeMax( static HRESULT WINAPI OLEPictureImpl_GetSizeMax(
IPersistStream* iface,ULARGE_INTEGER*pcbSize) IPersistStream* iface,ULARGE_INTEGER*pcbSize)
{ {
ICOM_THIS_From_IPersistStream(IPicture, iface); OLEPictureImpl *This = impl_from_IPersistStream(iface);
FIXME("(%p,%p),stub!\n",This,pcbSize); FIXME("(%p,%p),stub!\n",This,pcbSize);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -1855,9 +1888,9 @@ static HRESULT WINAPI OLEPictureImpl_IDispatch_QueryInterface(
REFIID riid, REFIID riid,
VOID** ppvoid) VOID** ppvoid)
{ {
ICOM_THIS_From_IDispatch(IPicture, iface); OLEPictureImpl *This = impl_from_IDispatch(iface);
return IPicture_QueryInterface(This, riid, ppvoid); return IPicture_QueryInterface((IPicture *)This, riid, ppvoid);
} }
/************************************************************************ /************************************************************************
@ -1868,9 +1901,9 @@ static HRESULT WINAPI OLEPictureImpl_IDispatch_QueryInterface(
static ULONG WINAPI OLEPictureImpl_IDispatch_AddRef( static ULONG WINAPI OLEPictureImpl_IDispatch_AddRef(
IDispatch* iface) IDispatch* iface)
{ {
ICOM_THIS_From_IDispatch(IPicture, iface); OLEPictureImpl *This = impl_from_IDispatch(iface);
return IPicture_AddRef(This); return IPicture_AddRef((IPicture *)This);
} }
/************************************************************************ /************************************************************************
@ -1881,9 +1914,9 @@ static ULONG WINAPI OLEPictureImpl_IDispatch_AddRef(
static ULONG WINAPI OLEPictureImpl_IDispatch_Release( static ULONG WINAPI OLEPictureImpl_IDispatch_Release(
IDispatch* iface) IDispatch* iface)
{ {
ICOM_THIS_From_IDispatch(IPicture, iface); OLEPictureImpl *This = impl_from_IDispatch(iface);
return IPicture_Release(This); return IPicture_Release((IPicture *)This);
} }
/************************************************************************ /************************************************************************

View file

@ -901,7 +901,7 @@ static struct regsvr_interface const interface_list[] = {
}; };
/*********************************************************************** /***********************************************************************
* DllRegisterServer (OLEAUT32.320) * DllRegisterServer (OLEAUT32.@)
*/ */
HRESULT WINAPI DllRegisterServer(void) HRESULT WINAPI DllRegisterServer(void)
{ {
@ -916,7 +916,7 @@ HRESULT WINAPI DllRegisterServer(void)
} }
/*********************************************************************** /***********************************************************************
* DllUnregisterServer (OLEAUT32.321) * DllUnregisterServer (OLEAUT32.@)
*/ */
HRESULT WINAPI DllUnregisterServer(void) HRESULT WINAPI DllUnregisterServer(void)
{ {

View file

@ -789,12 +789,12 @@ HRESULT WINAPI SafeArrayLock(SAFEARRAY *psa)
if (!psa) if (!psa)
return E_INVALIDARG; return E_INVALIDARG;
ulLocks = InterlockedIncrement(&psa->cLocks); ulLocks = InterlockedIncrement( (LONG*) &psa->cLocks);
if (ulLocks > 0xffff) /* Maximum of 16384 locks at a time */ if (ulLocks > 0xffff) /* Maximum of 16384 locks at a time */
{ {
WARN("Out of locks!\n"); WARN("Out of locks!\n");
InterlockedDecrement(&psa->cLocks); InterlockedDecrement( (LONG*) &psa->cLocks);
return E_UNEXPECTED; return E_UNEXPECTED;
} }
return S_OK; return S_OK;
@ -823,10 +823,10 @@ HRESULT WINAPI SafeArrayUnlock(SAFEARRAY *psa)
if (!psa) if (!psa)
return E_INVALIDARG; return E_INVALIDARG;
if ((LONG)InterlockedDecrement(&psa->cLocks) < 0) if ((LONG)InterlockedDecrement( (LONG*) &psa->cLocks) < 0)
{ {
WARN("Unlocked but no lock held!\n"); WARN("Unlocked but no lock held!\n");
InterlockedIncrement(&psa->cLocks); InterlockedIncrement( (LONG*) &psa->cLocks);
return E_UNEXPECTED; return E_UNEXPECTED;
} }
return S_OK; return S_OK;

View file

@ -159,7 +159,6 @@ _unmarshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN *pUnk) {
static HRESULT static HRESULT
_marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) { _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
LPUNKNOWN newiface = NULL;
LPBYTE tempbuf = NULL; LPBYTE tempbuf = NULL;
IStream *pStm = NULL; IStream *pStm = NULL;
STATSTG ststg; STATSTG ststg;
@ -183,11 +182,6 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
hres = E_FAIL; hres = E_FAIL;
TRACE("...%s...\n",debugstr_guid(riid)); TRACE("...%s...\n",debugstr_guid(riid));
hres = IUnknown_QueryInterface(pUnk,riid,(LPVOID*)&newiface);
if (hres) {
WARN("%p does not support iface %s\n",pUnk,debugstr_guid(riid));
goto fail;
}
hres = CreateStreamOnHGlobal(0,TRUE,&pStm); hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
if (hres) { if (hres) {
@ -195,7 +189,7 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
goto fail; goto fail;
} }
hres = CoMarshalInterface(pStm,riid,newiface,0,NULL,0); hres = CoMarshalInterface(pStm,riid,pUnk,0,NULL,0);
if (hres) { if (hres) {
ERR("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; goto fail;
@ -226,7 +220,6 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
hres = xbuf_add(buf,tempbuf,ststg.cbSize.u.LowPart); hres = xbuf_add(buf,tempbuf,ststg.cbSize.u.LowPart);
HeapFree(GetProcessHeap(),0,tempbuf); HeapFree(GetProcessHeap(),0,tempbuf);
IUnknown_Release(newiface);
IStream_Release(pStm); IStream_Release(pStm);
return hres; return hres;
@ -235,7 +228,6 @@ fail:
xsize = 0; xsize = 0;
xbuf_add(buf,(LPBYTE)&xsize,sizeof(xsize)); xbuf_add(buf,(LPBYTE)&xsize,sizeof(xsize));
if (pStm) IUnknown_Release(pStm); if (pStm) IUnknown_Release(pStm);
if (newiface) IUnknown_Release(newiface);
HeapFree(GetProcessHeap(), 0, tempbuf); HeapFree(GetProcessHeap(), 0, tempbuf);
return hres; return hres;
} }
@ -556,7 +548,7 @@ serialize_param(
if (hres) return hres; if (hres) return hres;
} }
/* need to recurse since we need to free the stuff */ /* need to recurse since we need to free the stuff */
hres = serialize_param(tinfo,writeit,debugout,dealloc,&tdesc2,&(V_I4(vt)),buf); hres = serialize_param(tinfo,writeit,debugout,dealloc,&tdesc2,(DWORD*)&(V_I4(vt)),buf);
if (debugout) TRACE_(olerelay)(")"); if (debugout) TRACE_(olerelay)(")");
return hres; return hres;
} }
@ -663,6 +655,8 @@ serialize_param(
case TKIND_INTERFACE: case TKIND_INTERFACE:
if (writeit) if (writeit)
hres=_marshal_interface(buf,&(tattr->guid),(LPUNKNOWN)arg); hres=_marshal_interface(buf,&(tattr->guid),(LPUNKNOWN)arg);
if (dealloc)
IUnknown_Release((LPUNKNOWN)arg);
break; break;
case TKIND_RECORD: { case TKIND_RECORD: {
int i; int i;
@ -1077,7 +1071,7 @@ deserialize_param(
tdesc2.vt = vttype; tdesc2.vt = vttype;
V_VT(vt) = vttype; V_VT(vt) = vttype;
if (debugout) TRACE_(olerelay)("Vt(%ld)(",vttype); if (debugout) TRACE_(olerelay)("Vt(%ld)(",vttype);
hres = deserialize_param(tinfo, readit, debugout, alloc, &tdesc2, &(V_I4(vt)), buf); hres = deserialize_param(tinfo, readit, debugout, alloc, &tdesc2, (DWORD*)&(V_I4(vt)), buf);
TRACE_(olerelay)(")"); TRACE_(olerelay)(")");
return hres; return hres;
} else { } else {
@ -1526,7 +1520,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
ULONG status; ULONG status;
BSTR fname,iname; BSTR fname,iname;
BSTR names[10]; BSTR names[10];
int nrofnames; UINT nrofnames;
int is_idispatch_getidsofnames = 0; int is_idispatch_getidsofnames = 0;
DWORD remoteresult = 0; DWORD remoteresult = 0;
ITypeInfo *tinfo; ITypeInfo *tinfo;
@ -2016,7 +2010,7 @@ TMStubImpl_Invoke(
HRESULT hres; HRESULT hres;
DWORD *args, res, *xargs, nrofargs; DWORD *args, res, *xargs, nrofargs;
marshal_state buf; marshal_state buf;
int nrofnames; UINT nrofnames;
BSTR names[10]; BSTR names[10];
BSTR fname = NULL,iname = NULL; BSTR fname = NULL,iname = NULL;
BOOL is_idispatch_getidsofnames = 0; BOOL is_idispatch_getidsofnames = 0;
@ -2220,11 +2214,34 @@ afterserialize:
return hres; return hres;
ITypeInfo_Release(tinfo); ITypeInfo_Release(tinfo);
HeapFree(GetProcessHeap(), 0, args);
xmsg->cbBuffer = buf.curoff; xmsg->cbBuffer = buf.curoff;
I_RpcGetBuffer((RPC_MESSAGE *)xmsg); if (rpcchanbuf)
{
hres = IRpcChannelBuffer_GetBuffer(rpcchanbuf, xmsg, &This->iid);
if (hres != S_OK)
ERR("IRpcChannelBuffer_GetBuffer failed with error 0x%08lx\n", hres);
}
else
{
/* FIXME: remove this case when we start sending an IRpcChannelBuffer
* object with builtin OLE */
RPC_STATUS status = I_RpcGetBuffer((RPC_MESSAGE *)xmsg);
if (status != RPC_S_OK)
{
ERR("I_RpcGetBuffer failed with error %ld\n", status);
hres = E_FAIL;
}
}
if (hres == S_OK)
memcpy(xmsg->Buffer, buf.base, buf.curoff); memcpy(xmsg->Buffer, buf.base, buf.curoff);
HeapFree(GetProcessHeap(),0,args);
return S_OK; HeapFree(GetProcessHeap(), 0, buf.base);
TRACE("returning\n");
return hres;
} }
static LPRPCSTUBBUFFER WINAPI static LPRPCSTUBBUFFER WINAPI
@ -2237,6 +2254,7 @@ static ULONG WINAPI
TMStubImpl_CountRefs(LPRPCSTUBBUFFER iface) { TMStubImpl_CountRefs(LPRPCSTUBBUFFER iface) {
TMStubImpl *This = (TMStubImpl *)iface; TMStubImpl *This = (TMStubImpl *)iface;
FIXME("()\n");
return This->ref; /*FIXME? */ return This->ref; /*FIXME? */
} }
@ -2305,10 +2323,9 @@ static const IPSFactoryBufferVtbl psfacbufvtbl = {
static const IPSFactoryBufferVtbl *lppsfac = &psfacbufvtbl; static const IPSFactoryBufferVtbl *lppsfac = &psfacbufvtbl;
/*********************************************************************** /***********************************************************************
* DllGetClassObject [OLE32.63] * TMARSHAL_DllGetClassObject
*/ */
HRESULT WINAPI HRESULT TMARSHAL_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
TypeLibFac_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
{ {
if (IsEqualIID(iid,&IID_IPSFactoryBuffer)) { if (IsEqualIID(iid,&IID_IPSFactoryBuffer)) {
*ppv = &lppsfac; *ppv = &lppsfac;

View file

@ -247,7 +247,7 @@ HRESULT WINAPI QueryPathOfRegTypeLib(
while (hr != S_OK) while (hr != S_OK)
{ {
DWORD dwPathLen = sizeof(Path); LONG dwPathLen = sizeof(Path);
get_lcid_subkey( myLCID, SYS_WIN32, buffer ); get_lcid_subkey( myLCID, SYS_WIN32, buffer );
@ -885,8 +885,10 @@ typedef struct tagITypeLibImpl
static const ITypeLib2Vtbl tlbvt; static const ITypeLib2Vtbl tlbvt;
static const ITypeCompVtbl tlbtcvt; static const ITypeCompVtbl tlbtcvt;
#define _ITypeComp_Offset(impl) ((int)(&(((impl*)0)->lpVtblTypeComp))) static inline ITypeLibImpl *impl_from_ITypeComp( ITypeComp *iface )
#define ICOM_THIS_From_ITypeComp(impl, iface) impl* This = (impl*)(((char*)iface)-_ITypeComp_Offset(impl)) {
return (ITypeLibImpl *)((char*)iface - FIELD_OFFSET(ITypeLibImpl, lpVtblTypeComp));
}
/* ITypeLib methods */ /* ITypeLib methods */
static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength); static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength);
@ -995,6 +997,11 @@ typedef struct tagITypeInfoImpl
struct tagITypeInfoImpl * next; struct tagITypeInfoImpl * next;
} ITypeInfoImpl; } ITypeInfoImpl;
static inline ITypeInfoImpl *info_impl_from_ITypeComp( ITypeComp *iface )
{
return (ITypeInfoImpl *)((char*)iface - FIELD_OFFSET(ITypeInfoImpl, lpVtblTypeComp));
}
static const ITypeInfo2Vtbl tinfvt; static const ITypeInfo2Vtbl tinfvt;
static const ITypeCompVtbl tcompvt; static const ITypeCompVtbl tcompvt;
@ -2909,7 +2916,7 @@ static SLTG_TypeInfoTail *SLTG_ProcessInterface(char *pBlk, ITypeInfoImpl *pTI,
paramName = NULL; paramName = NULL;
HaveOffs = TRUE; HaveOffs = TRUE;
} }
else if(!isalnum(*(paramName-1))) else if(paramName[-1] && !isalnum(paramName[-1]))
HaveOffs = TRUE; HaveOffs = TRUE;
pArg++; pArg++;
@ -3125,7 +3132,7 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
DWORD len, order; DWORD len, order;
ITypeInfoImpl **ppTypeInfoImpl; ITypeInfoImpl **ppTypeInfoImpl;
TRACE("%p, TLB length = %ld\n", pLib, dwTLBLength); TRACE_(typelib)("%p, TLB length = %ld\n", pLib, dwTLBLength);
pTypeLibImpl = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ITypeLibImpl)); pTypeLibImpl = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ITypeLibImpl));
if (!pTypeLibImpl) return NULL; if (!pTypeLibImpl) return NULL;
@ -3135,8 +3142,8 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
pHeader = pLib; pHeader = pLib;
TRACE("header:\n"); TRACE_(typelib)("header:\n");
TRACE("\tmagic=0x%08lx, file blocks = %d\n", pHeader->SLTG_magic, TRACE_(typelib)("\tmagic=0x%08lx, file blocks = %d\n", pHeader->SLTG_magic,
pHeader->nrOfFileBlks ); pHeader->nrOfFileBlks );
if (pHeader->SLTG_magic != SLTG_SIGNATURE) { if (pHeader->SLTG_magic != SLTG_SIGNATURE) {
FIXME("Header type magic 0x%08lx not supported.\n", FIXME("Header type magic 0x%08lx not supported.\n",
@ -3212,7 +3219,7 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
} }
w = *(WORD*)(ptr + 4 + len); w = *(WORD*)(ptr + 4 + len);
if(w != 0xffff) { if(w != 0xffff) {
TRACE("\twith %s\n", debugstr_an(ptr + 6 + len, w)); TRACE_(typelib)("\twith %s\n", debugstr_an(ptr + 6 + len, w));
len += w; len += w;
pOtherTypeInfoBlks[i].other_name = HeapAlloc(GetProcessHeap(),0, pOtherTypeInfoBlks[i].other_name = HeapAlloc(GetProcessHeap(),0,
w+1); w+1);
@ -3359,7 +3366,7 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
(*ppTypeInfoImpl)->TypeAttr.cbSizeInstance = pTITail->cbSizeInstance; (*ppTypeInfoImpl)->TypeAttr.cbSizeInstance = pTITail->cbSizeInstance;
(*ppTypeInfoImpl)->TypeAttr.cbSizeVft = pTITail->cbSizeVft; (*ppTypeInfoImpl)->TypeAttr.cbSizeVft = pTITail->cbSizeVft;
#define X(x) TRACE("tt "#x": %x\n",pTITail->res##x); #define X(x) TRACE_(typelib)("tt "#x": %x\n",pTITail->res##x);
X(06); X(06);
X(08); X(08);
X(0a); X(0a);
@ -4003,23 +4010,23 @@ static const ITypeLib2Vtbl tlbvt = {
static HRESULT WINAPI ITypeLibComp_fnQueryInterface(ITypeComp * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI ITypeLibComp_fnQueryInterface(ITypeComp * iface, REFIID riid, LPVOID * ppv)
{ {
ICOM_THIS_From_ITypeComp(ITypeLibImpl, iface); ITypeLibImpl *This = impl_from_ITypeComp(iface);
return ITypeInfo_QueryInterface((ITypeInfo *)This, riid, ppv); return ITypeLib2_QueryInterface((ITypeLib *)This, riid, ppv);
} }
static ULONG WINAPI ITypeLibComp_fnAddRef(ITypeComp * iface) static ULONG WINAPI ITypeLibComp_fnAddRef(ITypeComp * iface)
{ {
ICOM_THIS_From_ITypeComp(ITypeLibImpl, iface); ITypeLibImpl *This = impl_from_ITypeComp(iface);
return ITypeInfo_AddRef((ITypeInfo *)This); return ITypeLib2_AddRef((ITypeLib2 *)This);
} }
static ULONG WINAPI ITypeLibComp_fnRelease(ITypeComp * iface) static ULONG WINAPI ITypeLibComp_fnRelease(ITypeComp * iface)
{ {
ICOM_THIS_From_ITypeComp(ITypeLibImpl, iface); ITypeLibImpl *This = impl_from_ITypeComp(iface);
return ITypeInfo_Release((ITypeInfo *)This); return ITypeLib2_Release((ITypeLib2 *)This);
} }
static HRESULT WINAPI ITypeLibComp_fnBind( static HRESULT WINAPI ITypeLibComp_fnBind(
@ -4169,7 +4176,7 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface,
if(This->TypeAttr.typekind == TKIND_ALIAS) /* need to deep copy typedesc */ if(This->TypeAttr.typekind == TKIND_ALIAS) /* need to deep copy typedesc */
copy_typedesc(&(*ppTypeAttr)->tdescAlias, &This->TypeAttr.tdescAlias); copy_typedesc(&(*ppTypeAttr)->tdescAlias, &This->TypeAttr.tdescAlias);
if((*ppTypeAttr)->typekind == TKIND_DISPATCH && (*ppTypeAttr)->wTypeFlags & TYPEFLAG_FDUAL) { if((*ppTypeAttr)->typekind == TKIND_DISPATCH) {
(*ppTypeAttr)->cFuncs = (*ppTypeAttr)->cbSizeVft / 4; /* This should include all the inherited (*ppTypeAttr)->cFuncs = (*ppTypeAttr)->cbSizeVft / 4; /* This should include all the inherited
funcs */ funcs */
(*ppTypeAttr)->cbSizeVft = 28; /* This is always the size of IDispatch's vtbl */ (*ppTypeAttr)->cbSizeVft = 28; /* This is always the size of IDispatch's vtbl */
@ -4990,6 +4997,14 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
dump_Variant(&varresult); dump_Variant(&varresult);
} }
hres = VariantCopyInd(pVarResult, &varresult); hres = VariantCopyInd(pVarResult, &varresult);
/* free data stored in varresult. Note that
* VariantClear doesn't do what we want because we are
* working with byref types. */
/* FIXME: clear safearrays, bstrs, records and
* variants here too */
if ((V_VT(&varresult) == (VT_UNKNOWN | VT_BYREF)) ||
(V_VT(&varresult) == (VT_DISPATCH | VT_BYREF)))
IUnknown_Release(*V_UNKNOWNREF(&varresult));
break; break;
} }
} }
@ -5113,6 +5128,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDocumentation( ITypeInfo2 *iface,
return S_OK; return S_OK;
} }
} }
WARN("member %ld not found\n", memid);
return TYPE_E_ELEMENTNOTFOUND; return TYPE_E_ELEMENTNOTFOUND;
} }
@ -5207,7 +5223,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo(
ITypeLib *pTLib = NULL; ITypeLib *pTLib = NULL;
if(pRefType->pImpTLInfo == TLB_REF_INTERNAL) { if(pRefType->pImpTLInfo == TLB_REF_INTERNAL) {
int Index; UINT Index;
result = ITypeInfo_GetContainingTypeLib(iface, &pTLib, &Index); result = ITypeInfo_GetContainingTypeLib(iface, &pTLib, &Index);
} else { } else {
if(pRefType->pImpTLInfo->pImpTypeLib) { if(pRefType->pImpTLInfo->pImpTypeLib) {
@ -5955,21 +5971,21 @@ HRESULT WINAPI CreateDispTypeInfo(
static HRESULT WINAPI ITypeComp_fnQueryInterface(ITypeComp * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI ITypeComp_fnQueryInterface(ITypeComp * iface, REFIID riid, LPVOID * ppv)
{ {
ICOM_THIS_From_ITypeComp(ITypeInfoImpl, iface); ITypeInfoImpl *This = info_impl_from_ITypeComp(iface);
return ITypeInfo_QueryInterface((ITypeInfo *)This, riid, ppv); return ITypeInfo_QueryInterface((ITypeInfo *)This, riid, ppv);
} }
static ULONG WINAPI ITypeComp_fnAddRef(ITypeComp * iface) static ULONG WINAPI ITypeComp_fnAddRef(ITypeComp * iface)
{ {
ICOM_THIS_From_ITypeComp(ITypeInfoImpl, iface); ITypeInfoImpl *This = info_impl_from_ITypeComp(iface);
return ITypeInfo_AddRef((ITypeInfo *)This); return ITypeInfo_AddRef((ITypeInfo *)This);
} }
static ULONG WINAPI ITypeComp_fnRelease(ITypeComp * iface) static ULONG WINAPI ITypeComp_fnRelease(ITypeComp * iface)
{ {
ICOM_THIS_From_ITypeComp(ITypeInfoImpl, iface); ITypeInfoImpl *This = info_impl_from_ITypeComp(iface);
return ITypeInfo_Release((ITypeInfo *)This); return ITypeInfo_Release((ITypeInfo *)This);
} }
@ -5983,7 +5999,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
DESCKIND * pDescKind, DESCKIND * pDescKind,
BINDPTR * pBindPtr) BINDPTR * pBindPtr)
{ {
ICOM_THIS_From_ITypeComp(ITypeInfoImpl, iface); ITypeInfoImpl *This = info_impl_from_ITypeComp(iface);
TLBFuncDesc * pFDesc; TLBFuncDesc * pFDesc;
TLBVarDesc * pVDesc; TLBVarDesc * pVDesc;

View file

@ -597,9 +597,12 @@ WORD offset from start of block to SAFEARRAY
WORD typeofarray WORD typeofarray
*/ */
#include "poppack.h"
extern DWORD _invoke(FARPROC func,CALLCONV callconv, int nrargs, DWORD *args); extern DWORD _invoke(FARPROC func,CALLCONV callconv, int nrargs, DWORD *args);
extern void dump_Variant(VARIANT * pvar); extern void dump_Variant(VARIANT * pvar);
#include "poppack.h"
HRESULT TMARSHAL_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv);
/*---------------------------END--------------------------------------------*/ /*---------------------------END--------------------------------------------*/
#endif #endif

View file

@ -166,8 +166,10 @@ typedef struct tagICreateTypeLib2Impl
struct tagICreateTypeInfo2Impl *last_typeinfo; struct tagICreateTypeInfo2Impl *last_typeinfo;
} ICreateTypeLib2Impl; } ICreateTypeLib2Impl;
#define _ITypeLib2_Offset(impl) ((int)(&(((impl*)0)->lpVtblTypeLib2))) static inline ICreateTypeLib2Impl *impl_from_ITypeLib2( ITypeLib2 *iface )
#define ICOM_THIS_From_ITypeLib2(impl, iface) impl* This = (impl*)(((char*)iface)-_ITypeLib2_Offset(impl)) {
return (ICreateTypeLib2Impl *)((char*)iface - FIELD_OFFSET(ICreateTypeLib2Impl, lpVtblTypeLib2));
}
typedef struct tagICreateTypeInfo2Impl typedef struct tagICreateTypeInfo2Impl
{ {
@ -192,8 +194,10 @@ typedef struct tagICreateTypeInfo2Impl
struct tagICreateTypeInfo2Impl *next_typeinfo; struct tagICreateTypeInfo2Impl *next_typeinfo;
} ICreateTypeInfo2Impl; } ICreateTypeInfo2Impl;
#define _ITypeInfo2_Offset(impl) ((int)(&(((impl*)0)->lpVtblTypeInfo2))) static inline ICreateTypeInfo2Impl *impl_from_ITypeInfo2( ITypeInfo2 *iface )
#define ICOM_THIS_From_ITypeInfo2(impl, iface) impl* This = (impl*)(((char*)iface)-_ITypeInfo2_Offset(impl)) {
return (ICreateTypeInfo2Impl *)((char*)iface - FIELD_OFFSET(ICreateTypeInfo2Impl, lpVtblTypeInfo2));
}
static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface); static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface);
@ -1328,7 +1332,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddRefTypeInfo(
ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface; ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
ITypeLib *container; ITypeLib *container;
int index; UINT index;
HRESULT res; HRESULT res;
TRACE("(%p,%p,%p)\n", iface, pTInfo, phRefType); TRACE("(%p,%p,%p)\n", iface, pTInfo, phRefType);
@ -2198,7 +2202,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetName(
*/ */
static HRESULT WINAPI ITypeInfo2_fnQueryInterface(ITypeInfo2 * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI ITypeInfo2_fnQueryInterface(ITypeInfo2 * iface, REFIID riid, LPVOID * ppv)
{ {
ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface); ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
return ICreateTypeInfo2_QueryInterface((ICreateTypeInfo2 *)This, riid, ppv); return ICreateTypeInfo2_QueryInterface((ICreateTypeInfo2 *)This, riid, ppv);
} }
@ -2210,7 +2214,7 @@ static HRESULT WINAPI ITypeInfo2_fnQueryInterface(ITypeInfo2 * iface, REFIID rii
*/ */
static ULONG WINAPI ITypeInfo2_fnAddRef(ITypeInfo2 * iface) static ULONG WINAPI ITypeInfo2_fnAddRef(ITypeInfo2 * iface)
{ {
ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface); ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
return ICreateTypeInfo2_AddRef((ICreateTypeInfo2 *)This); return ICreateTypeInfo2_AddRef((ICreateTypeInfo2 *)This);
} }
@ -2222,7 +2226,7 @@ static ULONG WINAPI ITypeInfo2_fnAddRef(ITypeInfo2 * iface)
*/ */
static ULONG WINAPI ITypeInfo2_fnRelease(ITypeInfo2 * iface) static ULONG WINAPI ITypeInfo2_fnRelease(ITypeInfo2 * iface)
{ {
ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface); ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
return ICreateTypeInfo2_Release((ICreateTypeInfo2 *)This); return ICreateTypeInfo2_Release((ICreateTypeInfo2 *)This);
} }
@ -2461,7 +2465,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetContainingTypeLib(
ITypeLib** ppTLib, ITypeLib** ppTLib,
UINT* pIndex) UINT* pIndex)
{ {
ICOM_THIS_From_ITypeInfo2(ICreateTypeInfo2Impl, iface); ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
TRACE("(%p,%p,%p)\n", iface, ppTLib, pIndex); TRACE("(%p,%p,%p)\n", iface, ppTLib, pIndex);
@ -3431,7 +3435,7 @@ static HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringDll(
*/ */
static HRESULT WINAPI ITypeLib2_fnQueryInterface(ITypeLib2 * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI ITypeLib2_fnQueryInterface(ITypeLib2 * iface, REFIID riid, LPVOID * ppv)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
return ICreateTypeLib2_QueryInterface((ICreateTypeLib2 *)This, riid, ppv); return ICreateTypeLib2_QueryInterface((ICreateTypeLib2 *)This, riid, ppv);
} }
@ -3443,7 +3447,7 @@ static HRESULT WINAPI ITypeLib2_fnQueryInterface(ITypeLib2 * iface, REFIID riid,
*/ */
static ULONG WINAPI ITypeLib2_fnAddRef(ITypeLib2 * iface) static ULONG WINAPI ITypeLib2_fnAddRef(ITypeLib2 * iface)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
return ICreateTypeLib2_AddRef((ICreateTypeLib2 *)This); return ICreateTypeLib2_AddRef((ICreateTypeLib2 *)This);
} }
@ -3455,7 +3459,7 @@ static ULONG WINAPI ITypeLib2_fnAddRef(ITypeLib2 * iface)
*/ */
static ULONG WINAPI ITypeLib2_fnRelease(ITypeLib2 * iface) static ULONG WINAPI ITypeLib2_fnRelease(ITypeLib2 * iface)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
return ICreateTypeLib2_Release((ICreateTypeLib2 *)This); return ICreateTypeLib2_Release((ICreateTypeLib2 *)This);
} }
@ -3468,7 +3472,7 @@ static ULONG WINAPI ITypeLib2_fnRelease(ITypeLib2 * iface)
static UINT WINAPI ITypeLib2_fnGetTypeInfoCount( static UINT WINAPI ITypeLib2_fnGetTypeInfoCount(
ITypeLib2 * iface) ITypeLib2 * iface)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
TRACE("(%p)\n", iface); TRACE("(%p)\n", iface);
@ -3485,7 +3489,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfo(
UINT index, UINT index,
ITypeInfo** ppTInfo) ITypeInfo** ppTInfo)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
TRACE("(%p,%d,%p)\n", iface, index, ppTInfo); TRACE("(%p,%d,%p)\n", iface, index, ppTInfo);
@ -3506,7 +3510,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoType(
UINT index, UINT index,
TYPEKIND* pTKind) TYPEKIND* pTKind)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
TRACE("(%p,%d,%p)\n", iface, index, pTKind); TRACE("(%p,%d,%p)\n", iface, index, pTKind);
@ -3529,7 +3533,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoOfGuid(
REFGUID guid, REFGUID guid,
ITypeInfo** ppTinfo) ITypeInfo** ppTinfo)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
int guidoffset; int guidoffset;
int typeinfo; int typeinfo;
@ -3554,9 +3558,9 @@ static HRESULT WINAPI ITypeLib2_fnGetLibAttr(
ITypeLib2 * iface, ITypeLib2 * iface,
TLIBATTR** ppTLibAttr) TLIBATTR** ppTLibAttr)
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%p), stub!\n", iface, ppTLibAttr); FIXME("(%p,%p), stub!\n", This, ppTLibAttr);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
@ -3570,9 +3574,9 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeComp(
ITypeLib2 * iface, ITypeLib2 * iface,
ITypeComp** ppTComp) ITypeComp** ppTComp)
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%p), stub!\n", iface, ppTComp); FIXME("(%p,%p), stub!\n", This, ppTComp);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
@ -3590,9 +3594,9 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation(
DWORD* pdwHelpContext, DWORD* pdwHelpContext,
BSTR* pBstrHelpFile) BSTR* pBstrHelpFile)
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%d,%p,%p,%p,%p), stub!\n", iface, index, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile); FIXME("(%p,%d,%p,%p,%p,%p), stub!\n", This, index, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
@ -3608,7 +3612,7 @@ static HRESULT WINAPI ITypeLib2_fnIsName(
ULONG lHashVal, ULONG lHashVal,
BOOL* pfName) BOOL* pfName)
{ {
ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
char *encoded_name; char *encoded_name;
int nameoffset; int nameoffset;
@ -3646,9 +3650,9 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
MEMBERID* rgMemId, MEMBERID* rgMemId,
USHORT* pcFound) USHORT* pcFound)
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%s,%lx,%p,%p,%p), stub!\n", iface, debugstr_w(szNameBuf), lHashVal, ppTInfo, rgMemId, pcFound); FIXME("(%p,%s,%lx,%p,%p,%p), stub!\n", This, debugstr_w(szNameBuf), lHashVal, ppTInfo, rgMemId, pcFound);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
@ -3662,9 +3666,9 @@ static void WINAPI ITypeLib2_fnReleaseTLibAttr(
ITypeLib2 * iface, ITypeLib2 * iface,
TLIBATTR* pTLibAttr) TLIBATTR* pTLibAttr)
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%p), stub!\n", iface, pTLibAttr); FIXME("(%p,%p), stub!\n", This, pTLibAttr);
} }
/****************************************************************************** /******************************************************************************
@ -3682,9 +3686,9 @@ static HRESULT WINAPI ITypeLib2_fnGetCustData(
REFGUID guid, /* [I] The GUID under which the custom data is stored. */ REFGUID guid, /* [I] The GUID under which the custom data is stored. */
VARIANT* pVarVal) /* [O] The custom data. */ VARIANT* pVarVal) /* [O] The custom data. */
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%s,%p), stub!\n", iface, debugstr_guid(guid), pVarVal); FIXME("(%p,%s,%p), stub!\n", This, debugstr_guid(guid), pVarVal);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
@ -3705,9 +3709,9 @@ static HRESULT WINAPI ITypeLib2_fnGetLibStatistics(
ULONG* pcUniqueNames, /* [O] The number of unique names in the type library. */ ULONG* pcUniqueNames, /* [O] The number of unique names in the type library. */
ULONG* pcchUniqueNames) /* [O] The number of changed (?) characters in names in the type library. */ ULONG* pcchUniqueNames) /* [O] The number of changed (?) characters in names in the type library. */
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%p,%p), stub!\n", iface, pcUniqueNames, pcchUniqueNames); FIXME("(%p,%p,%p), stub!\n", This, pcUniqueNames, pcchUniqueNames);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
@ -3730,9 +3734,9 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation2(
DWORD* pdwHelpStringContext, DWORD* pdwHelpStringContext,
BSTR* pbstrHelpStringDll) BSTR* pbstrHelpStringDll)
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%d,%ld,%p,%p,%p), stub!\n", iface, index, lcid, pbstrHelpString, pdwHelpStringContext, pbstrHelpStringDll); FIXME("(%p,%d,%ld,%p,%p,%p), stub!\n", This, index, lcid, pbstrHelpString, pdwHelpStringContext, pbstrHelpStringDll);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
@ -3751,9 +3755,9 @@ static HRESULT WINAPI ITypeLib2_fnGetAllCustData(
ITypeLib2 * iface, /* [I] The type library in which to find the custom data. */ ITypeLib2 * iface, /* [I] The type library in which to find the custom data. */
CUSTDATA* pCustData) /* [O] The structure in which to place the custom data. */ CUSTDATA* pCustData) /* [O] The structure in which to place the custom data. */
{ {
/* ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */ ICreateTypeLib2Impl *This = impl_from_ITypeLib2(iface);
FIXME("(%p,%p), stub!\n", iface, pCustData); FIXME("(%p,%p), stub!\n", This, pCustData);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }

View file

@ -1342,7 +1342,7 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
case FMT_GEN_INLINE: case FMT_GEN_INLINE:
pToken += 2; pToken += 2;
TRACE("copy %s\n", debugstr_a(pToken)); TRACE("copy %s\n", debugstr_a((LPCSTR)pToken));
while (*pToken) while (*pToken)
*pBuff++ = *pToken++; *pBuff++ = *pToken++;
break; break;

View file

@ -1926,6 +1926,11 @@ HRESULT WINAPI VarParseNumFromStr(OLECHAR *lpszStr, LCID lcid, ULONG dwFlags,
* - Rounding (dropping of decimal points) occurs without error. See VarI8FromR8() * - Rounding (dropping of decimal points) occurs without error. See VarI8FromR8()
* for details of the rounding method. * for details of the rounding method.
* - pVarDst is not cleared before the result is stored in it. * - pVarDst is not cleared before the result is stored in it.
* - WinXP and Win2003 support VTBIT_I8, VTBIT_UI8 but that's buggy (by
* design?): If some other VTBIT's for integers are specified together
* with VTBIT_I8 and the number will fit only in a VT_I8 Windows will "cast"
* the number to the smallest requested integer truncating this way the
* number. Wine dosn't implement this "feature" (yet?).
*/ */
HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE *rgbDig, HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE *rgbDig,
ULONG dwVtBits, VARIANT *pVarDst) ULONG dwVtBits, VARIANT *pVarDst)
@ -2893,7 +2898,11 @@ HRESULT WINAPI VarAdd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
} }
if (resvt != tvt) { if (resvt != tvt) {
if ((hres = VariantChangeType(result, &tv, 0, resvt)) != S_OK) { if ((hres = VariantChangeType(result, &tv, 0, resvt)) != S_OK) {
/* Overflow! Change to the vartype with the next higher priority */ /* Overflow! Change to the vartype with the next higher priority.
With one exception: I4 ==> R8 even if it would fit in I8 */
if (resvt == VT_I4)
resvt = VT_R8;
else
resvt = prio2vt[coerce[resvt] + 1]; resvt = prio2vt[coerce[resvt] + 1];
hres = VariantChangeType(result, &tv, 0, resvt); hres = VariantChangeType(result, &tv, 0, resvt);
} }
@ -3061,7 +3070,11 @@ HRESULT WINAPI VarMul(LPVARIANT left, LPVARIANT right, LPVARIANT result)
} }
if (resvt != tvt) { if (resvt != tvt) {
while ((hres = VariantChangeType(result, &tv, 0, resvt)) != S_OK) { while ((hres = VariantChangeType(result, &tv, 0, resvt)) != S_OK) {
/* Overflow! Change to the vartype with the next higher priority */ /* Overflow! Change to the vartype with the next higher priority.
With one exception: I4 ==> R8 even if it would fit in I8 */
if (resvt == VT_I4)
resvt = VT_R8;
else
resvt = prio2vt[coerce[resvt] + 1]; resvt = prio2vt[coerce[resvt] + 1];
} }
} else } else

View file

@ -92,333 +92,11 @@ extern const char* wine_vflags[];
#define DEC_MAX_SCALE 28 /* Maximum scale for a decimal */ #define DEC_MAX_SCALE 28 /* Maximum scale for a decimal */
/* Inline return type */
#define RETTYP inline static HRESULT
/* Simple compiler cast from one type to another */
#define SIMPLE(dest, src, func) RETTYP _##func(src in, dest* out) { \
*out = in; return S_OK; }
/* Compiler cast where input cannot be negative */
#define NEGTST(dest, src, func) RETTYP _##func(src in, dest* out) { \
if (in < (src)0) return DISP_E_OVERFLOW; *out = in; return S_OK; }
/* Compiler cast where input cannot be > some number */
#define POSTST(dest, src, func, tst) RETTYP _##func(src in, dest* out) { \
if (in > (dest)tst) return DISP_E_OVERFLOW; *out = in; return S_OK; }
/* Compiler cast where input cannot be < some number or >= some other number */
#define BOTHTST(dest, src, func, lo, hi) RETTYP _##func(src in, dest* out) { \
if (in < (dest)lo || in > hi) return DISP_E_OVERFLOW; *out = in; return S_OK; }
/* Conversions from IDispatch use the same code */
HRESULT VARIANT_FromDisp(IDispatch*,LCID,void*,VARTYPE);
/* As do conversions from BSTR to numeric types */
HRESULT VARIANT_NumberFromBstr(OLECHAR*,LCID,ULONG,void*,VARTYPE);
#define CY_MULTIPLIER 10000 /* 4 dp of precision */
#define CY_MULTIPLIER_F 10000.0
#define CY_HALF (CY_MULTIPLIER/2) /* 0.5 */
#define CY_HALF_F (CY_MULTIPLIER_F/2.0)
/* I1 */
POSTST(signed char, BYTE, VarI1FromUI1, I1_MAX);
BOTHTST(signed char, SHORT, VarI1FromI2, I1_MIN, I1_MAX);
BOTHTST(signed char, LONG, VarI1FromI4, I1_MIN, I1_MAX);
#define _VarI1FromR4(flt,out) VarI1FromR8((double)flt,out)
#define _VarI1FromR8 VarI1FromR8
#define _VarI1FromCy VarI1FromCy
#define _VarI1FromDate(dt,out) VarI1FromR8((double)dt,out)
#define _VarI1FromStr(str,lcid,flags,out) VARIANT_NumberFromBstr(str,lcid,flags,(BYTE*)out,VT_I1)
#define _VarI1FromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, (BYTE*)out, VT_I1)
SIMPLE(signed char, VARIANT_BOOL, VarI1FromBool);
POSTST(signed char, USHORT, VarI1FromUI2, I1_MAX);
POSTST(signed char, ULONG, VarI1FromUI4, I1_MAX);
#define _VarI1FromDec VarI1FromDec
BOTHTST(signed char, LONG64, VarI1FromI8, I1_MIN, I1_MAX);
POSTST(signed char, ULONG64, VarI1FromUI8, I1_MAX);
/* UI1 */
BOTHTST(BYTE, SHORT, VarUI1FromI2, UI1_MIN, UI1_MAX);
#define _VarUI1FromR4(flt,out) VarUI1FromR8((double)flt,out)
#define _VarUI1FromR8 VarUI1FromR8
#define _VarUI1FromCy VarUI1FromCy
#define _VarUI1FromDate(dt,out) VarUI1FromR8((double)dt,out)
#define _VarUI1FromStr(str,lcid,flags,out) VARIANT_NumberFromBstr(str,lcid,flags,(BYTE*)out,VT_UI1)
#define _VarUI1FromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_UI1)
SIMPLE(BYTE, VARIANT_BOOL, VarUI1FromBool);
NEGTST(BYTE, signed char, VarUI1FromI1);
POSTST(BYTE, USHORT, VarUI1FromUI2, UI1_MAX);
BOTHTST(BYTE, LONG, VarUI1FromI4, UI1_MIN, UI1_MAX);
POSTST(BYTE, ULONG, VarUI1FromUI4, UI1_MAX);
#define _VarUI1FromDec VarUI1FromDec
BOTHTST(BYTE, LONG64, VarUI1FromI8, UI1_MIN, UI1_MAX);
POSTST(BYTE, ULONG64, VarUI1FromUI8, UI1_MAX);
/* I2 */
SIMPLE(SHORT, BYTE, VarI2FromUI1);
BOTHTST(SHORT, LONG, VarI2FromI4, I2_MIN, I2_MAX);
#define _VarI2FromR4(flt,out) VarI2FromR8((double)flt,out)
#define _VarI2FromR8 VarI2FromR8
#define _VarI2FromCy VarI2FromCy
#define _VarI2FromDate(dt,out) VarI2FromR8((double)dt,out)
#define _VarI2FromStr(str,lcid,flags,out) VARIANT_NumberFromBstr(str,lcid,flags,(BYTE*)out,VT_I2)
#define _VarI2FromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, (BYTE*)out, VT_I2)
SIMPLE(SHORT, VARIANT_BOOL, VarI2FromBool);
SIMPLE(SHORT, signed char, VarI2FromI1);
POSTST(SHORT, USHORT, VarI2FromUI2, I2_MAX);
POSTST(SHORT, ULONG, VarI2FromUI4, I2_MAX);
#define _VarI2FromDec VarI2FromDec
BOTHTST(SHORT, LONG64, VarI2FromI8, I2_MIN, I2_MAX);
POSTST(SHORT, ULONG64, VarI2FromUI8, I2_MAX);
/* UI2 */
SIMPLE(USHORT, BYTE, VarUI2FromUI1);
NEGTST(USHORT, SHORT, VarUI2FromI2);
BOTHTST(USHORT, LONG, VarUI2FromI4, UI2_MIN, UI2_MAX);
#define _VarUI2FromR4(flt,out) VarUI2FromR8((double)flt,out)
#define _VarUI2FromR8 VarUI2FromR8
#define _VarUI2FromCy VarUI2FromCy
#define _VarUI2FromDate(dt,out) VarUI2FromR8((double)dt,out)
#define _VarUI2FromStr(str,lcid,flags,out) VARIANT_NumberFromBstr(str,lcid,flags,(BYTE*)out,VT_UI2)
#define _VarUI2FromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_UI2)
SIMPLE(USHORT, VARIANT_BOOL, VarUI2FromBool);
NEGTST(USHORT, signed char, VarUI2FromI1);
POSTST(USHORT, ULONG, VarUI2FromUI4, UI2_MAX);
#define _VarUI2FromDec VarUI2FromDec
BOTHTST(USHORT, LONG64, VarUI2FromI8, UI2_MIN, UI2_MAX);
POSTST(USHORT, ULONG64, VarUI2FromUI8, UI2_MAX);
/* I4 */
SIMPLE(LONG, BYTE, VarI4FromUI1);
SIMPLE(LONG, SHORT, VarI4FromI2);
#define _VarI4FromR4(flt,out) VarI4FromR8((double)flt,out)
#define _VarI4FromR8 VarI4FromR8
#define _VarI4FromCy VarI4FromCy
#define _VarI4FromDate(dt,out) VarI4FromR8((double)dt,out)
#define _VarI4FromStr(str,lcid,flags,out) VARIANT_NumberFromBstr(str,lcid,flags,(BYTE*)out,VT_I4)
#define _VarI4FromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, (BYTE*)out, VT_I4)
SIMPLE(LONG, VARIANT_BOOL, VarI4FromBool);
SIMPLE(LONG, signed char, VarI4FromI1);
SIMPLE(LONG, USHORT, VarI4FromUI2);
POSTST(LONG, ULONG, VarI4FromUI4, I4_MAX);
#define _VarI4FromDec VarI4FromDec
BOTHTST(LONG, LONG64, VarI4FromI8, I4_MIN, I4_MAX);
POSTST(LONG, ULONG64, VarI4FromUI8, I4_MAX);
/* UI4 */
SIMPLE(ULONG, BYTE, VarUI4FromUI1);
NEGTST(ULONG, SHORT, VarUI4FromI2);
NEGTST(ULONG, LONG, VarUI4FromI4);
#define _VarUI4FromR4(flt,out) VarUI4FromR8((double)flt,out)
#define _VarUI4FromR8 VarUI4FromR8
#define _VarUI4FromCy VarUI4FromCy
#define _VarUI4FromDate(dt,out) VarUI4FromR8((double)dt,out)
#define _VarUI4FromStr(str,lcid,flags,out) VARIANT_NumberFromBstr(str,lcid,flags,(BYTE*)out,VT_UI4)
#define _VarUI4FromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_UI4)
SIMPLE(ULONG, VARIANT_BOOL, VarUI4FromBool);
NEGTST(ULONG, signed char, VarUI4FromI1);
SIMPLE(ULONG, USHORT, VarUI4FromUI2);
#define _VarUI4FromDec VarUI4FromDec
BOTHTST(ULONG, LONG64, VarUI4FromI8, UI4_MIN, UI4_MAX);
POSTST(ULONG, ULONG64, VarUI4FromUI8, UI4_MAX);
/* I8 */
SIMPLE(LONG64, BYTE, VarI8FromUI1);
SIMPLE(LONG64, SHORT, VarI8FromI2);
#define _VarI8FromR4 VarI8FromR8
#define _VarI8FromR8 VarI8FromR8
#define _VarI8FromCy VarI8FromCy
#define _VarI8FromDate(dt,out) VarI8FromR8((double)dt,out)
#define _VarI8FromStr(str,lcid,flags,out) VARIANT_NumberFromBstr(str,lcid,flags,(BYTE*)out,VT_I8)
#define _VarI8FromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_I8)
#define _VarI8FromBool _VarI8FromI2
SIMPLE(LONG64, signed char, VarI8FromI1);
SIMPLE(LONG64, USHORT, VarI8FromUI2);
SIMPLE(LONG64, LONG, VarI8FromI4);
SIMPLE(LONG64, ULONG, VarI8FromUI4);
#define _VarI8FromDec VarI8FromDec
POSTST(LONG64, ULONG64, VarI8FromUI8, I8_MAX);
/* UI8 */
SIMPLE(ULONG64, BYTE, VarUI8FromUI1);
NEGTST(ULONG64, SHORT, VarUI8FromI2);
#define _VarUI8FromR4 VarUI8FromR8
#define _VarUI8FromR8 VarUI8FromR8
#define _VarUI8FromCy VarUI8FromCy
#define _VarUI8FromDate(dt,out) VarUI8FromR8((double)dt,out)
#define _VarUI8FromStr(str,lcid,flags,out) VARIANT_NumberFromBstr(str,lcid,flags,(BYTE*)out,VT_UI8)
#define _VarUI8FromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_UI8)
#define _VarUI8FromBool _VarI8FromI2
NEGTST(ULONG64, signed char, VarUI8FromI1);
SIMPLE(ULONG64, USHORT, VarUI8FromUI2);
NEGTST(ULONG64, LONG, VarUI8FromI4);
SIMPLE(ULONG64, ULONG, VarUI8FromUI4);
#define _VarUI8FromDec VarUI8FromDec
NEGTST(ULONG64, LONG64, VarUI8FromI8);
/* R4 (float) */
SIMPLE(float, BYTE, VarR4FromUI1);
SIMPLE(float, SHORT, VarR4FromI2);
RETTYP _VarR4FromR8(double i, float* o) {
double d = i < 0.0 ? -i : i;
if (d > R4_MAX) return DISP_E_OVERFLOW;
*o = i;
return S_OK;
}
RETTYP _VarR4FromCy(CY i, float* o) { *o = (double)i.int64 / CY_MULTIPLIER_F; return S_OK; }
#define _VarR4FromDate(dt,out) _VarR4FromR8((double)dt,out)
#define _VarR4FromStr(str,lcid,flags,out) VARIANT_NumberFromBstr(str,lcid,flags,(BYTE*)out,VT_R4)
#define _VarR4FromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_R4)
#define _VarR4FromBool _VarR4FromI2
SIMPLE(float, signed char, VarR4FromI1);
SIMPLE(float, USHORT, VarR4FromUI2);
SIMPLE(float, LONG, VarR4FromI4);
SIMPLE(float, ULONG, VarR4FromUI4);
#define _VarR4FromDec VarR4FromDec
SIMPLE(float, LONG64, VarR4FromI8);
SIMPLE(float, ULONG64, VarR4FromUI8);
/* R8 (double) */
SIMPLE(double, BYTE, VarR8FromUI1);
SIMPLE(double, SHORT, VarR8FromI2);
SIMPLE(double, float, VarR8FromR4);
RETTYP _VarR8FromCy(CY i, double* o) { *o = (double)i.int64 / CY_MULTIPLIER_F; return S_OK; }
SIMPLE(double, DATE, VarR8FromDate);
#define _VarR8FromStr(str,lcid,flags,out) VARIANT_NumberFromBstr(str,lcid,flags,(BYTE*)out,VT_R8)
#define _VarR8FromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_R8)
#define _VarR8FromBool _VarR8FromI2
SIMPLE(double, signed char, VarR8FromI1);
SIMPLE(double, USHORT, VarR8FromUI2);
SIMPLE(double, LONG, VarR8FromI4);
SIMPLE(double, ULONG, VarR8FromUI4);
#define _VarR8FromDec VarR8FromDec
SIMPLE(double, LONG64, VarR8FromI8);
SIMPLE(double, ULONG64, VarR8FromUI8);
/* BOOL */
#define BOOLFUNC(src, func) RETTYP _##func(src in, VARIANT_BOOL* out) { \
*out = in ? VARIANT_TRUE : VARIANT_FALSE; return S_OK; }
BOOLFUNC(signed char,VarBoolFromI1);
BOOLFUNC(BYTE,VarBoolFromUI1);
BOOLFUNC(SHORT,VarBoolFromI2);
BOOLFUNC(USHORT,VarBoolFromUI2);
BOOLFUNC(LONG,VarBoolFromI4);
BOOLFUNC(ULONG,VarBoolFromUI4);
BOOLFUNC(LONG64,VarBoolFromI8);
BOOLFUNC(ULONG64,VarBoolFromUI8);
#define _VarBoolFromR4(flt,out) _VarBoolFromR8((double)flt,out)
BOOLFUNC(double,VarBoolFromR8);
#define _VarBoolFromCy(i,o) _VarBoolFromI8(i.int64,o)
#define _VarBoolFromDate(dt,out) _VarBoolFromR8((double)dt,out)
#define _VarBoolFromStr VarBoolFromStr
#define _VarBoolFromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, (BYTE*)out, VT_BOOL)
#define _VarBoolFromDec VarBoolFromDec
/* Internal flags for low level conversion functions */ /* Internal flags for low level conversion functions */
#define VAR_BOOLONOFF 0x0400 /* Convert bool to "On"/"Off" */ #define VAR_BOOLONOFF 0x0400 /* Convert bool to "On"/"Off" */
#define VAR_BOOLYESNO 0x0800 /* Convert bool to "Yes"/"No" */ #define VAR_BOOLYESNO 0x0800 /* Convert bool to "Yes"/"No" */
#define VAR_NEGATIVE 0x1000 /* Number is negative */ #define VAR_NEGATIVE 0x1000 /* Number is negative */
/* DECIMAL */
#define _VarDecFromUI1 VarDecFromUI4
#define _VarDecFromI2 VarDecFromI4
#define _VarDecFromR4 VarDecFromR4
#define _VarDecFromR8 VarDecFromR8
#define _VarDecFromCy VarDecFromCy
#define _VarDecFromDate(dt,out) VarDecFromR8((double)dt,out)
#define _VarDecFromStr(str,lcid,flags,out) VARIANT_NumberFromBstr(str,lcid,flags,(BYTE*)out,VT_DECIMAL)
#define _VarDecFromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_DECIMAL)
#define _VarDecFromBool VarDecFromBool
#define _VarDecFromI1 VarDecFromI4
#define _VarDecFromUI2 VarDecFromUI4
#define _VarDecFromI4 VarDecFromI4
#define _VarDecFromUI4 VarDecFromUI4
#define _VarDecFromI8 VarDecFromI8
#define _VarDecFromUI8 VarDecFromUI8
/* CY (Currency) */
#define _VarCyFromUI1 VarCyFromR8
#define _VarCyFromI2 VarCyFromR8
#define _VarCyFromR4 VarCyFromR8
#define _VarCyFromR8 VarCyFromR8
#define _VarCyFromDate VarCyFromR8
#define _VarCyFromStr(str,lcid,flags,out) VARIANT_NumberFromBstr(str,lcid,flags,(BYTE*)out,VT_CY)
#define _VarCyFromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_CY)
#define _VarCyFromBool VarCyFromR8
#define _VarCyFromI1 VarCyFromR8
#define _VarCyFromUI2 VarCyFromR8
#define _VarCyFromI4 VarCyFromR8
#define _VarCyFromUI4 VarCyFromR8
#define _VarCyFromDec VarCyFromDec
RETTYP _VarCyFromI8(LONG64 i, CY* o) {
if (i <= (I8_MIN/CY_MULTIPLIER) || i >= (I8_MAX/CY_MULTIPLIER)) return DISP_E_OVERFLOW;
o->int64 = i * CY_MULTIPLIER;
return S_OK;
}
#define _VarCyFromUI8 VarCyFromR8
/* DATE */
#define _VarDateFromUI1 _VarR8FromUI1
#define _VarDateFromI2 _VarR8FromI2
#define _VarDateFromR4 _VarDateFromR8
RETTYP _VarDateFromR8(double i, DATE* o) {
if (i <= (DATE_MIN - 1.0) || i >= (DATE_MAX + 1.0)) return DISP_E_OVERFLOW;
*o = (DATE)i;
return S_OK;
}
#define _VarDateFromCy _VarR8FromCy
#define _VarDateFromStr VarDateFromStr
#define _VarDateFromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_DATE)
#define _VarDateFromBool _VarR8FromBool
#define _VarDateFromI1 _VarR8FromI1
#define _VarDateFromUI2 _VarR8FromUI2
#define _VarDateFromI4 _VarDateFromR8
#define _VarDateFromUI4 _VarDateFromR8
#define _VarDateFromDec _VarR8FromDec
RETTYP _VarDateFromI8(LONG64 i, DATE* o) {
if (i < DATE_MIN || i > DATE_MAX) return DISP_E_OVERFLOW;
*o = (DATE)i;
return S_OK;
}
RETTYP _VarDateFromUI8(ULONG64 i, DATE* o) {
if (i > DATE_MAX) return DISP_E_OVERFLOW;
*o = (DATE)i;
return S_OK;
}
/* BSTR */
#define _VarBstrFromUI1 VarBstrFromUI4
#define _VarBstrFromI2 VarBstrFromI4
#define _VarBstrFromR4 VarBstrFromR8
#define _VarBstrFromR8 VarBstrFromR8
#define _VarBstrFromCy VarBstrFromCy
#define _VarBstrFromDate VarBstrFromDate
#define _VarBstrFromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_BSTR)
#define _VarBstrFromBool VarBstrFromBool
#define _VarBstrFromI1 VarBstrFromI4
#define _VarBstrFromUI2 VarBstrFromUI4
#define _VarBstrFromI4 VarBstrFromI4
#define _VarBstrFromUI4 VarBstrFromUI4
#define _VarBstrFromDec VarBstrFromDec
#define _VarBstrFromI8 VarBstrFromI8
#define _VarBstrFromUI8 VarBstrFromUI8
/* Macro to inline conversion from a float or double to any integer type,
* rounding according to the 'dutch' convention.
*/
#define OLEAUT32_DutchRound(typ, value, res) do { \
double whole = (double)value < 0 ? ceil((double)value) : floor((double)value); \
double fract = (double)value - whole; \
if (fract > 0.5) res = (typ)whole + (typ)1; \
else if (fract == 0.5) { typ is_odd = (typ)whole & 1; res = whole + is_odd; } \
else if (fract >= 0.0) res = (typ)whole; \
else if (fract == -0.5) { typ is_odd = (typ)whole & 1; res = whole - is_odd; } \
else if (fract > -0.5) res = (typ)whole; \
else res = (typ)whole - (typ)1; \
} while(0);
/* The localised characters that make up a valid number */ /* The localised characters that make up a valid number */
typedef struct tagVARIANT_NUMBER_CHARS typedef struct tagVARIANT_NUMBER_CHARS
{ {

File diff suppressed because it is too large Load diff