Commit 374d74e8 authored by Alexandre Julliard's avatar Alexandre Julliard

oleaut32: Use nameless unions/structs.

parent 36963b6d
...@@ -26,9 +26,6 @@ ...@@ -26,9 +26,6 @@
#include <string.h> #include <string.h>
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "winerror.h" #include "winerror.h"
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -331,8 +328,8 @@ HRESULT WINAPI OleCreateFontIndirect( ...@@ -331,8 +328,8 @@ HRESULT WINAPI OleCreateFontIndirect(
fd.cbSizeofstruct = sizeof(fd); fd.cbSizeofstruct = sizeof(fd);
fd.lpstrName = fname; fd.lpstrName = fname;
fd.cySize.s.Lo = 80000; fd.cySize.Lo = 80000;
fd.cySize.s.Hi = 0; fd.cySize.Hi = 0;
fd.sWeight = 0; fd.sWeight = 0;
fd.sCharset = 0; fd.sCharset = 0;
fd.fItalic = FALSE; fd.fItalic = FALSE;
...@@ -586,7 +583,7 @@ static void realize_font(OLEFontImpl *This) ...@@ -586,7 +583,7 @@ static void realize_font(OLEFontImpl *This)
* Ratio is applied here relative to the standard. * Ratio is applied here relative to the standard.
*/ */
fontHeight = MulDiv( This->description.cySize.s.Lo, This->cyLogical*635, This->cyHimetric*18 ); fontHeight = MulDiv( This->description.cySize.Lo, This->cyLogical*635, This->cyHimetric*18 );
logFont.lfHeight = ((fontHeight%10000L)>5000L) ? (-fontHeight/10000L) - 1 : logFont.lfHeight = ((fontHeight%10000L)>5000L) ? (-fontHeight/10000L) - 1 :
(-fontHeight/10000L); (-fontHeight/10000L);
...@@ -685,10 +682,8 @@ static HRESULT WINAPI OLEFontImpl_get_Size( ...@@ -685,10 +682,8 @@ static HRESULT WINAPI OLEFontImpl_get_Size(
* Convert realized font height in pixels to points descaled by current * Convert realized font height in pixels to points descaled by current
* scaling ratio then scaled up by 10000. * scaling ratio then scaled up by 10000.
*/ */
psize->s.Lo = MulDiv(this->nRealHeight, psize->Lo = MulDiv(this->nRealHeight, this->cyHimetric * 72 * 10000, this->cyLogical * 2540);
this->cyHimetric * 72 * 10000, psize->Hi = 0;
this->cyLogical * 2540);
psize->s.Hi = 0;
return S_OK; return S_OK;
} }
...@@ -696,9 +691,9 @@ static HRESULT WINAPI OLEFontImpl_get_Size( ...@@ -696,9 +691,9 @@ static HRESULT WINAPI OLEFontImpl_get_Size(
static HRESULT WINAPI OLEFontImpl_put_Size(IFont *iface, CY size) static HRESULT WINAPI OLEFontImpl_put_Size(IFont *iface, CY size)
{ {
OLEFontImpl *this = impl_from_IFont(iface); OLEFontImpl *this = impl_from_IFont(iface);
TRACE("%p, %ld.\n", iface, size.s.Lo); TRACE("%p, %ld.\n", iface, size.Lo);
this->description.cySize.s.Hi = 0; this->description.cySize.Hi = 0;
this->description.cySize.s.Lo = size.s.Lo; this->description.cySize.Lo = size.Lo;
OLEFont_SendNotify(this, DISPID_FONT_SIZE); OLEFont_SendNotify(this, DISPID_FONT_SIZE);
return S_OK; return S_OK;
...@@ -997,9 +992,9 @@ static HRESULT WINAPI OLEFontImpl_IsEqual( ...@@ -997,9 +992,9 @@ static HRESULT WINAPI OLEFontImpl_IsEqual(
if(pFontOther == NULL) if(pFontOther == NULL)
return E_POINTER; return E_POINTER;
else if (left->description.cySize.s.Lo != right->description.cySize.s.Lo) else if (left->description.cySize.Lo != right->description.cySize.Lo)
return S_FALSE; return S_FALSE;
else if (left->description.cySize.s.Hi != right->description.cySize.s.Hi) else if (left->description.cySize.Hi != right->description.cySize.Hi)
return S_FALSE; return S_FALSE;
else if (left->description.sWeight != right->description.sWeight) else if (left->description.sWeight != right->description.sWeight)
return S_FALSE; return S_FALSE;
...@@ -1600,10 +1595,10 @@ static HRESULT WINAPI OLEFontImpl_Load( ...@@ -1600,10 +1595,10 @@ static HRESULT WINAPI OLEFontImpl_Load(
if (cbRead != sizeof(WORD)) return E_FAIL; if (cbRead != sizeof(WORD)) return E_FAIL;
/* Size */ /* Size */
IStream_Read(pLoadStream, &this->description.cySize.s.Lo, sizeof(DWORD), &cbRead); IStream_Read(pLoadStream, &this->description.cySize.Lo, sizeof(DWORD), &cbRead);
if (cbRead != sizeof(DWORD)) return E_FAIL; if (cbRead != sizeof(DWORD)) return E_FAIL;
this->description.cySize.s.Hi = 0; this->description.cySize.Hi = 0;
/* Name */ /* Name */
IStream_Read(pLoadStream, &string_size, sizeof(BYTE), &cbRead); IStream_Read(pLoadStream, &string_size, sizeof(BYTE), &cbRead);
...@@ -1671,7 +1666,7 @@ static HRESULT WINAPI OLEFontImpl_Save( ...@@ -1671,7 +1666,7 @@ static HRESULT WINAPI OLEFontImpl_Save(
if (written != sizeof(WORD)) return E_FAIL; if (written != sizeof(WORD)) return E_FAIL;
/* Size */ /* Size */
IStream_Write(pOutStream, &this->description.cySize.s.Lo, sizeof(DWORD), &written); IStream_Write(pOutStream, &this->description.cySize.Lo, sizeof(DWORD), &written);
if (written != sizeof(DWORD)) return E_FAIL; if (written != sizeof(DWORD)) return E_FAIL;
/* FontName */ /* FontName */
......
...@@ -41,8 +41,6 @@ ...@@ -41,8 +41,6 @@
#include <string.h> #include <string.h>
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION
#include "winerror.h" #include "winerror.h"
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -201,8 +199,8 @@ static void OLEPictureImpl_SetBitmap(OLEPictureImpl *This) ...@@ -201,8 +199,8 @@ static void OLEPictureImpl_SetBitmap(OLEPictureImpl *This)
BITMAP bm; BITMAP bm;
HDC hdcRef; HDC hdcRef;
TRACE("bitmap handle %p\n", This->desc.u.bmp.hbitmap); TRACE("bitmap handle %p\n", This->desc.bmp.hbitmap);
if(GetObjectW(This->desc.u.bmp.hbitmap, sizeof(bm), &bm) != sizeof(bm)) { if(GetObjectW(This->desc.bmp.hbitmap, sizeof(bm), &bm) != sizeof(bm)) {
ERR("GetObject fails\n"); ERR("GetObject fails\n");
return; return;
} }
...@@ -230,8 +228,8 @@ static void OLEPictureImpl_SetIcon(OLEPictureImpl * This) ...@@ -230,8 +228,8 @@ static void OLEPictureImpl_SetIcon(OLEPictureImpl * This)
{ {
ICONINFO infoIcon; ICONINFO infoIcon;
TRACE("icon handle %p\n", This->desc.u.icon.hicon); TRACE("icon handle %p\n", This->desc.icon.hicon);
if (GetIconInfo(This->desc.u.icon.hicon, &infoIcon)) { if (GetIconInfo(This->desc.icon.hicon, &infoIcon)) {
HDC hdcRef; HDC hdcRef;
BITMAP bm; BITMAP bm;
...@@ -254,7 +252,7 @@ static void OLEPictureImpl_SetIcon(OLEPictureImpl * This) ...@@ -254,7 +252,7 @@ static void OLEPictureImpl_SetIcon(OLEPictureImpl * This)
DeleteObject(infoIcon.hbmMask); DeleteObject(infoIcon.hbmMask);
if (infoIcon.hbmColor) DeleteObject(infoIcon.hbmColor); if (infoIcon.hbmColor) DeleteObject(infoIcon.hbmColor);
} else { } else {
ERR("GetIconInfo() fails on icon %p\n", This->desc.u.icon.hicon); ERR("GetIconInfo() fails on icon %p\n", This->desc.icon.hicon);
} }
} }
...@@ -326,9 +324,9 @@ static HRESULT OLEPictureImpl_Construct(LPPICTDESC pictDesc, BOOL fOwn, OLEPictu ...@@ -326,9 +324,9 @@ static HRESULT OLEPictureImpl_Construct(LPPICTDESC pictDesc, BOOL fOwn, OLEPictu
break; break;
case PICTYPE_METAFILE: case PICTYPE_METAFILE:
TRACE("metafile handle %p\n", pictDesc->u.wmf.hmeta); TRACE("metafile handle %p\n", pictDesc->wmf.hmeta);
newObject->himetricWidth = pictDesc->u.wmf.xExt; newObject->himetricWidth = pictDesc->wmf.xExt;
newObject->himetricHeight = pictDesc->u.wmf.yExt; newObject->himetricHeight = pictDesc->wmf.yExt;
break; break;
case PICTYPE_NONE: case PICTYPE_NONE:
...@@ -375,18 +373,18 @@ static void OLEPictureImpl_Destroy(OLEPictureImpl* Obj) ...@@ -375,18 +373,18 @@ static void OLEPictureImpl_Destroy(OLEPictureImpl* Obj)
if(Obj->fOwn) { /* We need to destroy the picture */ if(Obj->fOwn) { /* We need to destroy the picture */
switch(Obj->desc.picType) { switch(Obj->desc.picType) {
case PICTYPE_BITMAP: case PICTYPE_BITMAP:
DeleteObject(Obj->desc.u.bmp.hbitmap); DeleteObject(Obj->desc.bmp.hbitmap);
if (Obj->hbmMask != NULL) DeleteObject(Obj->hbmMask); if (Obj->hbmMask != NULL) DeleteObject(Obj->hbmMask);
if (Obj->hbmXor != NULL) DeleteObject(Obj->hbmXor); if (Obj->hbmXor != NULL) DeleteObject(Obj->hbmXor);
break; break;
case PICTYPE_METAFILE: case PICTYPE_METAFILE:
DeleteMetaFile(Obj->desc.u.wmf.hmeta); DeleteMetaFile(Obj->desc.wmf.hmeta);
break; break;
case PICTYPE_ICON: case PICTYPE_ICON:
DestroyIcon(Obj->desc.u.icon.hicon); DestroyIcon(Obj->desc.icon.hicon);
break; break;
case PICTYPE_ENHMETAFILE: case PICTYPE_ENHMETAFILE:
DeleteEnhMetaFile(Obj->desc.u.emf.hemf); DeleteEnhMetaFile(Obj->desc.emf.hemf);
break; break;
case PICTYPE_NONE: case PICTYPE_NONE:
case PICTYPE_UNINITIALIZED: case PICTYPE_UNINITIALIZED:
...@@ -503,16 +501,16 @@ static HRESULT WINAPI OLEPictureImpl_get_Handle(IPicture *iface, ...@@ -503,16 +501,16 @@ static HRESULT WINAPI OLEPictureImpl_get_Handle(IPicture *iface,
*phandle = 0; *phandle = 0;
break; break;
case PICTYPE_BITMAP: case PICTYPE_BITMAP:
*phandle = HandleToUlong(This->desc.u.bmp.hbitmap); *phandle = HandleToUlong(This->desc.bmp.hbitmap);
break; break;
case PICTYPE_METAFILE: case PICTYPE_METAFILE:
*phandle = HandleToUlong(This->desc.u.wmf.hmeta); *phandle = HandleToUlong(This->desc.wmf.hmeta);
break; break;
case PICTYPE_ICON: case PICTYPE_ICON:
*phandle = HandleToUlong(This->desc.u.icon.hicon); *phandle = HandleToUlong(This->desc.icon.hicon);
break; break;
case PICTYPE_ENHMETAFILE: case PICTYPE_ENHMETAFILE:
*phandle = HandleToUlong(This->desc.u.emf.hemf); *phandle = HandleToUlong(This->desc.emf.hemf);
break; break;
default: default:
FIXME("Unimplemented type %d\n", This->desc.picType); FIXME("Unimplemented type %d\n", This->desc.picType);
...@@ -536,7 +534,7 @@ static HRESULT WINAPI OLEPictureImpl_get_hPal(IPicture *iface, ...@@ -536,7 +534,7 @@ static HRESULT WINAPI OLEPictureImpl_get_hPal(IPicture *iface,
if (This->desc.picType == PICTYPE_BITMAP) if (This->desc.picType == PICTYPE_BITMAP)
{ {
*phandle = HandleToUlong(This->desc.u.bmp.hpal); *phandle = HandleToUlong(This->desc.bmp.hpal);
return S_OK; return S_OK;
} }
...@@ -661,7 +659,7 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc, ...@@ -661,7 +659,7 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
else else
{ {
hbmMask = 0; hbmMask = 0;
hbmXor = This->desc.u.bmp.hbitmap; hbmXor = This->desc.bmp.hbitmap;
} }
render_masked_bitmap(This, hdc, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, hbmMask, hbmXor); render_masked_bitmap(This, hdc, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, hbmMask, hbmXor);
...@@ -672,7 +670,7 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc, ...@@ -672,7 +670,7 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
{ {
ICONINFO info; ICONINFO info;
if (!GetIconInfo(This->desc.u.icon.hicon, &info)) if (!GetIconInfo(This->desc.icon.hicon, &info))
return E_FAIL; return E_FAIL;
render_masked_bitmap(This, hdc, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, info.hbmMask, info.hbmColor); render_masked_bitmap(This, hdc, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, info.hbmMask, info.hbmColor);
...@@ -698,7 +696,7 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc, ...@@ -698,7 +696,7 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
SetViewportOrgEx(hdc, x, y, &prevOrg); SetViewportOrgEx(hdc, x, y, &prevOrg);
SetViewportExtEx(hdc, cx, cy, &prevExt); SetViewportExtEx(hdc, cx, cy, &prevExt);
if (!PlayMetaFile(hdc, This->desc.u.wmf.hmeta)) if (!PlayMetaFile(hdc, This->desc.wmf.hmeta))
ERR("PlayMetaFile failed!\n"); ERR("PlayMetaFile failed!\n");
/* We're done, restore the DC to the previous settings for converting /* We're done, restore the DC to the previous settings for converting
...@@ -714,7 +712,7 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc, ...@@ -714,7 +712,7 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
case PICTYPE_ENHMETAFILE: case PICTYPE_ENHMETAFILE:
{ {
RECT rc = { x, y, x + cx, y + cy }; RECT rc = { x, y, x + cx, y + cy };
PlayEnhMetaFile(hdc, This->desc.u.emf.hemf, &rc); PlayEnhMetaFile(hdc, This->desc.emf.hemf, &rc);
break; break;
} }
...@@ -737,7 +735,7 @@ static HRESULT WINAPI OLEPictureImpl_set_hPal(IPicture *iface, ...@@ -737,7 +735,7 @@ static HRESULT WINAPI OLEPictureImpl_set_hPal(IPicture *iface,
if (This->desc.picType == PICTYPE_BITMAP) if (This->desc.picType == PICTYPE_BITMAP)
{ {
This->desc.u.bmp.hpal = ULongToHandle(hpal); This->desc.bmp.hpal = ULongToHandle(hpal);
OLEPicture_SendNotify(This,DISPID_PICT_HPAL); OLEPicture_SendNotify(This,DISPID_PICT_HPAL);
return S_OK; return S_OK;
} }
...@@ -771,10 +769,10 @@ static HRESULT WINAPI OLEPictureImpl_SelectPicture(IPicture *iface, ...@@ -771,10 +769,10 @@ static HRESULT WINAPI OLEPictureImpl_SelectPicture(IPicture *iface,
if (phdcOut) if (phdcOut)
*phdcOut = This->hDCCur; *phdcOut = This->hDCCur;
if (This->hDCCur) SelectObject(This->hDCCur,This->stock_bitmap); if (This->hDCCur) SelectObject(This->hDCCur,This->stock_bitmap);
if (hdcIn) SelectObject(hdcIn,This->desc.u.bmp.hbitmap); if (hdcIn) SelectObject(hdcIn,This->desc.bmp.hbitmap);
This->hDCCur = hdcIn; This->hDCCur = hdcIn;
if (phbmpOut) if (phbmpOut)
*phbmpOut = HandleToUlong(This->desc.u.bmp.hbitmap); *phbmpOut = HandleToUlong(This->desc.bmp.hbitmap);
return S_OK; return S_OK;
} else { } else {
FIXME("Don't know how to select picture type %d\n",This->desc.picType); FIXME("Don't know how to select picture type %d\n",This->desc.picType);
...@@ -993,7 +991,7 @@ static HRESULT OLEPictureImpl_LoadDIB(OLEPictureImpl *This, BYTE *xbuf, ULONG xr ...@@ -993,7 +991,7 @@ static HRESULT OLEPictureImpl_LoadDIB(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
* components which are in both * components which are in both
*/ */
hdcref = GetDC(0); hdcref = GetDC(0);
This->desc.u.bmp.hbitmap = CreateDIBitmap( This->desc.bmp.hbitmap = CreateDIBitmap(
hdcref, hdcref,
&(bi->bmiHeader), &(bi->bmiHeader),
CBM_INIT, CBM_INIT,
...@@ -1002,7 +1000,7 @@ static HRESULT OLEPictureImpl_LoadDIB(OLEPictureImpl *This, BYTE *xbuf, ULONG xr ...@@ -1002,7 +1000,7 @@ static HRESULT OLEPictureImpl_LoadDIB(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
DIB_RGB_COLORS DIB_RGB_COLORS
); );
ReleaseDC(0, hdcref); ReleaseDC(0, hdcref);
if (This->desc.u.bmp.hbitmap == 0) if (This->desc.bmp.hbitmap == 0)
return E_FAIL; return E_FAIL;
This->desc.picType = PICTYPE_BITMAP; This->desc.picType = PICTYPE_BITMAP;
OLEPictureImpl_SetBitmap(This); OLEPictureImpl_SetBitmap(This);
...@@ -1060,7 +1058,7 @@ static HRESULT OLEPictureImpl_LoadWICSource(OLEPictureImpl *This, IWICBitmapSour ...@@ -1060,7 +1058,7 @@ static HRESULT OLEPictureImpl_LoadWICSource(OLEPictureImpl *This, IWICBitmapSour
goto end; goto end;
hdcref = GetDC(0); hdcref = GetDC(0);
This->desc.u.bmp.hbitmap = CreateDIBitmap( This->desc.bmp.hbitmap = CreateDIBitmap(
hdcref, hdcref,
&bih, &bih,
CBM_INIT, CBM_INIT,
...@@ -1068,7 +1066,7 @@ static HRESULT OLEPictureImpl_LoadWICSource(OLEPictureImpl *This, IWICBitmapSour ...@@ -1068,7 +1066,7 @@ static HRESULT OLEPictureImpl_LoadWICSource(OLEPictureImpl *This, IWICBitmapSour
(BITMAPINFO*)&bih, (BITMAPINFO*)&bih,
DIB_RGB_COLORS); DIB_RGB_COLORS);
if (This->desc.u.bmp.hbitmap == 0) if (This->desc.bmp.hbitmap == 0)
{ {
hr = E_FAIL; hr = E_FAIL;
ReleaseDC(0, hdcref); ReleaseDC(0, hdcref);
...@@ -1111,7 +1109,7 @@ static HRESULT OLEPictureImpl_LoadWICSource(OLEPictureImpl *This, IWICBitmapSour ...@@ -1111,7 +1109,7 @@ static HRESULT OLEPictureImpl_LoadWICSource(OLEPictureImpl *This, IWICBitmapSour
hdcXor = CreateCompatibleDC(NULL); hdcXor = CreateCompatibleDC(NULL);
hdcMask = CreateCompatibleDC(NULL); hdcMask = CreateCompatibleDC(NULL);
hbmoldBmp = SelectObject(hdcBmp,This->desc.u.bmp.hbitmap); hbmoldBmp = SelectObject(hdcBmp,This->desc.bmp.hbitmap);
hbmoldXor = SelectObject(hdcXor,This->hbmXor); hbmoldXor = SelectObject(hdcXor,This->hbmXor);
hbmoldMask = SelectObject(hdcMask,This->hbmMask); hbmoldMask = SelectObject(hdcMask,This->hbmMask);
...@@ -1273,7 +1271,7 @@ static HRESULT OLEPictureImpl_LoadIcon(OLEPictureImpl *This, BYTE *xbuf, ULONG x ...@@ -1273,7 +1271,7 @@ static HRESULT OLEPictureImpl_LoadIcon(OLEPictureImpl *This, BYTE *xbuf, ULONG x
return E_FAIL; return E_FAIL;
} else { } else {
This->desc.picType = PICTYPE_ICON; This->desc.picType = PICTYPE_ICON;
This->desc.u.icon.hicon = hicon; This->desc.icon.hicon = hicon;
This->origWidth = cifd->idEntries[i].bWidth; This->origWidth = cifd->idEntries[i].bWidth;
This->origHeight = cifd->idEntries[i].bHeight; This->origHeight = cifd->idEntries[i].bHeight;
hdcRef = CreateCompatibleDC(0); hdcRef = CreateCompatibleDC(0);
...@@ -1296,7 +1294,7 @@ static HRESULT OLEPictureImpl_LoadEnhMetafile(OLEPictureImpl *This, ...@@ -1296,7 +1294,7 @@ static HRESULT OLEPictureImpl_LoadEnhMetafile(OLEPictureImpl *This,
GetEnhMetaFileHeader(hemf, sizeof(hdr), &hdr); GetEnhMetaFileHeader(hemf, sizeof(hdr), &hdr);
This->desc.picType = PICTYPE_ENHMETAFILE; This->desc.picType = PICTYPE_ENHMETAFILE;
This->desc.u.emf.hemf = hemf; This->desc.emf.hemf = hemf;
This->origWidth = 0; This->origWidth = 0;
This->origHeight = 0; This->origHeight = 0;
...@@ -1322,9 +1320,9 @@ static HRESULT OLEPictureImpl_LoadAPM(OLEPictureImpl *This, ...@@ -1322,9 +1320,9 @@ static HRESULT OLEPictureImpl_LoadAPM(OLEPictureImpl *This,
if (!hmf) return E_FAIL; if (!hmf) return E_FAIL;
This->desc.picType = PICTYPE_METAFILE; This->desc.picType = PICTYPE_METAFILE;
This->desc.u.wmf.hmeta = hmf; This->desc.wmf.hmeta = hmf;
This->desc.u.wmf.xExt = 0; This->desc.wmf.xExt = 0;
This->desc.u.wmf.yExt = 0; This->desc.wmf.yExt = 0;
This->origWidth = 0; This->origWidth = 0;
This->origHeight = 0; This->origHeight = 0;
...@@ -1771,7 +1769,7 @@ static HRESULT WINAPI OLEPictureImpl_Save( ...@@ -1771,7 +1769,7 @@ static HRESULT WINAPI OLEPictureImpl_Save(
case PICTYPE_ICON: case PICTYPE_ICON:
if (This->bIsDirty || !This->data) { if (This->bIsDirty || !This->data) {
if (!serializeIcon(This->desc.u.icon.hicon, &pIconData, &iDataSize)) { if (!serializeIcon(This->desc.icon.hicon, &pIconData, &iDataSize)) {
ERR("(%p,%p,%d), serializeIcon() failed\n", This, pStm, fClearDirty); ERR("(%p,%p,%d), serializeIcon() failed\n", This, pStm, fClearDirty);
hResult = E_FAIL; hResult = E_FAIL;
break; break;
...@@ -1791,7 +1789,7 @@ static HRESULT WINAPI OLEPictureImpl_Save( ...@@ -1791,7 +1789,7 @@ static HRESULT WINAPI OLEPictureImpl_Save(
if (This->bIsDirty || !This->data) { if (This->bIsDirty || !This->data) {
switch (This->keepOrigFormat ? This->loadtime_format : BITMAP_FORMAT_BMP) { switch (This->keepOrigFormat ? This->loadtime_format : BITMAP_FORMAT_BMP) {
case BITMAP_FORMAT_BMP: case BITMAP_FORMAT_BMP:
serializeResult = serializeBMP(This->desc.u.bmp.hbitmap, &pIconData, &iDataSize); serializeResult = serializeBMP(This->desc.bmp.hbitmap, &pIconData, &iDataSize);
break; break;
case BITMAP_FORMAT_JPEG: case BITMAP_FORMAT_JPEG:
FIXME("(%p,%p,%d), PICTYPE_BITMAP (format JPEG) not implemented!\n",This,pStm,fClearDirty); FIXME("(%p,%p,%d), PICTYPE_BITMAP (format JPEG) not implemented!\n",This,pStm,fClearDirty);
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include <stdarg.h> #include <stdarg.h>
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
...@@ -244,14 +242,14 @@ HRESULT WINAPI OleCreatePropertyFrameIndirect(LPOCPFIPARAMS lpParams) ...@@ -244,14 +242,14 @@ HRESULT WINAPI OleCreatePropertyFrameIndirect(LPOCPFIPARAMS lpParams)
property_sheet.pszCaption = lpParams->lpszCaption; property_sheet.pszCaption = lpParams->lpszCaption;
} }
property_sheet.u3.phpage = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, property_sheet.phpage = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
lpParams->cPages*sizeof(HPROPSHEETPAGE)); lpParams->cPages*sizeof(HPROPSHEETPAGE));
property_page = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, property_page = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
lpParams->cPages*sizeof(IPropertyPage*)); lpParams->cPages*sizeof(IPropertyPage*));
dialogs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dialogs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
lpParams->cPages*sizeof(*dialogs)); lpParams->cPages*sizeof(*dialogs));
if(!property_sheet.u3.phpage || !property_page || !dialogs) { if(!property_sheet.phpage || !property_page || !dialogs) {
HeapFree(GetProcessHeap(), 0, property_sheet.u3.phpage); HeapFree(GetProcessHeap(), 0, property_sheet.phpage);
HeapFree(GetProcessHeap(), 0, property_page); HeapFree(GetProcessHeap(), 0, property_page);
HeapFree(GetProcessHeap(), 0, dialogs); HeapFree(GetProcessHeap(), 0, dialogs);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -295,11 +293,11 @@ HRESULT WINAPI OleCreatePropertyFrameIndirect(LPOCPFIPARAMS lpParams) ...@@ -295,11 +293,11 @@ HRESULT WINAPI OleCreatePropertyFrameIndirect(LPOCPFIPARAMS lpParams)
dialogs[i].template.cx = MulDiv(page_info.size.cx, 4, font_width); dialogs[i].template.cx = MulDiv(page_info.size.cx, 4, font_width);
dialogs[i].template.cy = MulDiv(page_info.size.cy, 8, font_height); dialogs[i].template.cy = MulDiv(page_info.size.cy, 8, font_height);
property_sheet_page.u.pResource = &dialogs[i].template; property_sheet_page.pResource = &dialogs[i].template;
property_sheet_page.lParam = (LPARAM)property_page[i]; property_sheet_page.lParam = (LPARAM)property_page[i];
property_sheet_page.pszTitle = page_info.pszTitle; property_sheet_page.pszTitle = page_info.pszTitle;
property_sheet.u3.phpage[property_sheet.nPages++] = property_sheet.phpage[property_sheet.nPages++] =
CreatePropertySheetPageW(&property_sheet_page); CreatePropertySheetPageW(&property_sheet_page);
} }
...@@ -312,7 +310,7 @@ HRESULT WINAPI OleCreatePropertyFrameIndirect(LPOCPFIPARAMS lpParams) ...@@ -312,7 +310,7 @@ HRESULT WINAPI OleCreatePropertyFrameIndirect(LPOCPFIPARAMS lpParams)
HeapFree(GetProcessHeap(), 0, dialogs); HeapFree(GetProcessHeap(), 0, dialogs);
HeapFree(GetProcessHeap(), 0, property_page); HeapFree(GetProcessHeap(), 0, property_page);
HeapFree(GetProcessHeap(), 0, property_sheet.u3.phpage); HeapFree(GetProcessHeap(), 0, property_sheet.phpage);
return S_OK; return S_OK;
} }
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include <stdarg.h> #include <stdarg.h>
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "objbase.h" #include "objbase.h"
...@@ -639,7 +637,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo ...@@ -639,7 +637,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
} }
if(typeattr->typekind == TKIND_ALIAS) { if(typeattr->typekind == TKIND_ALIAS) {
hres = ITypeInfo_GetRefTypeInfo(pTI, typeattr->tdescAlias.u.hreftype, &pTypeInfo); hres = ITypeInfo_GetRefTypeInfo(pTI, typeattr->tdescAlias.hreftype, &pTypeInfo);
guid = typeattr->guid; guid = typeattr->guid;
ITypeInfo_ReleaseTypeAttr(pTI, typeattr); ITypeInfo_ReleaseTypeAttr(pTI, typeattr);
if(FAILED(hres)) { if(FAILED(hres)) {
...@@ -695,7 +693,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo ...@@ -695,7 +693,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
} }
ret->fields[i].vt = vardesc->elemdescVar.tdesc.vt; ret->fields[i].vt = vardesc->elemdescVar.tdesc.vt;
ret->fields[i].varkind = vardesc->varkind; ret->fields[i].varkind = vardesc->varkind;
ret->fields[i].offset = vardesc->u.oInst; ret->fields[i].offset = vardesc->oInst;
hres = ITypeInfo_GetDocumentation(pTypeInfo, vardesc->memid, &ret->fields[i].name, hres = ITypeInfo_GetDocumentation(pTypeInfo, vardesc->memid, &ret->fields[i].name,
NULL, NULL, NULL); NULL, NULL, NULL);
if(FAILED(hres)) if(FAILED(hres))
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
#include <ctype.h> #include <ctype.h>
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION
#include "winerror.h" #include "winerror.h"
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -1352,18 +1350,18 @@ static void dump_TypeDesc(const TYPEDESC *pTD,char *szVarType) { ...@@ -1352,18 +1350,18 @@ static void dump_TypeDesc(const TYPEDESC *pTD,char *szVarType) {
case VT_VARIANT: sprintf(szVarType, "VT_VARIANT"); break; case VT_VARIANT: sprintf(szVarType, "VT_VARIANT"); break;
case VT_VOID: sprintf(szVarType, "VT_VOID"); break; case VT_VOID: sprintf(szVarType, "VT_VOID"); break;
case VT_HRESULT: sprintf(szVarType, "VT_HRESULT"); break; case VT_HRESULT: sprintf(szVarType, "VT_HRESULT"); break;
case VT_USERDEFINED: sprintf(szVarType, "VT_USERDEFINED ref = %lx", pTD->u.hreftype); break; case VT_USERDEFINED: sprintf(szVarType, "VT_USERDEFINED ref = %lx", pTD->hreftype); break;
case VT_LPSTR: sprintf(szVarType, "VT_LPSTR"); break; case VT_LPSTR: sprintf(szVarType, "VT_LPSTR"); break;
case VT_LPWSTR: sprintf(szVarType, "VT_LPWSTR"); break; case VT_LPWSTR: sprintf(szVarType, "VT_LPWSTR"); break;
case VT_PTR: sprintf(szVarType, "ptr to "); case VT_PTR: sprintf(szVarType, "ptr to ");
dump_TypeDesc(pTD->u.lptdesc, szVarType + 7); dump_TypeDesc(pTD->lptdesc, szVarType + 7);
break; break;
case VT_SAFEARRAY: sprintf(szVarType, "safearray of "); case VT_SAFEARRAY: sprintf(szVarType, "safearray of ");
dump_TypeDesc(pTD->u.lptdesc, szVarType + 13); dump_TypeDesc(pTD->lptdesc, szVarType + 13);
break; break;
case VT_CARRAY: sprintf(szVarType, "%d dim array of ", case VT_CARRAY: sprintf(szVarType, "%d dim array of ",
pTD->u.lpadesc->cDims); /* FIXME print out sizes */ pTD->lpadesc->cDims); /* FIXME print out sizes */
dump_TypeDesc(&pTD->u.lpadesc->tdescElem, szVarType + strlen(szVarType)); dump_TypeDesc(&pTD->lpadesc->tdescElem, szVarType + strlen(szVarType));
break; break;
default: sprintf(szVarType, "unknown(%d)", pTD->vt & VT_TYPEMASK); break; default: sprintf(szVarType, "unknown(%d)", pTD->vt & VT_TYPEMASK); break;
...@@ -1372,7 +1370,7 @@ static void dump_TypeDesc(const TYPEDESC *pTD,char *szVarType) { ...@@ -1372,7 +1370,7 @@ static void dump_TypeDesc(const TYPEDESC *pTD,char *szVarType) {
static void dump_ELEMDESC(const ELEMDESC *edesc) { static void dump_ELEMDESC(const ELEMDESC *edesc) {
char buf[200]; char buf[200];
USHORT flags = edesc->u.paramdesc.wParamFlags; USHORT flags = edesc->paramdesc.wParamFlags;
dump_TypeDesc(&edesc->tdesc,buf); dump_TypeDesc(&edesc->tdesc,buf);
MESSAGE("\t\ttdesc.vartype %d (%s)\n",edesc->tdesc.vt,buf); MESSAGE("\t\ttdesc.vartype %d (%s)\n",edesc->tdesc.vt,buf);
MESSAGE("\t\tu.paramdesc.wParamFlags"); MESSAGE("\t\tu.paramdesc.wParamFlags");
...@@ -1384,7 +1382,7 @@ static void dump_ELEMDESC(const ELEMDESC *edesc) { ...@@ -1384,7 +1382,7 @@ static void dump_ELEMDESC(const ELEMDESC *edesc) {
if (flags & PARAMFLAG_FOPT) MESSAGE(" PARAMFLAG_FOPT"); if (flags & PARAMFLAG_FOPT) MESSAGE(" PARAMFLAG_FOPT");
if (flags & PARAMFLAG_FHASDEFAULT) MESSAGE(" PARAMFLAG_FHASDEFAULT"); if (flags & PARAMFLAG_FHASDEFAULT) MESSAGE(" PARAMFLAG_FHASDEFAULT");
if (flags & PARAMFLAG_FHASCUSTDATA) MESSAGE(" PARAMFLAG_FHASCUSTDATA"); if (flags & PARAMFLAG_FHASCUSTDATA) MESSAGE(" PARAMFLAG_FHASCUSTDATA");
MESSAGE("\n\t\tu.paramdesc.lpex %p\n",edesc->u.paramdesc.pparamdescex); MESSAGE("\n\t\tu.paramdesc.lpex %p\n",edesc->paramdesc.pparamdescex);
} }
static void dump_FUNCDESC(const FUNCDESC *funcdesc) { static void dump_FUNCDESC(const FUNCDESC *funcdesc) {
int i; int i;
...@@ -1557,7 +1555,7 @@ static void dump_VARDESC(const VARDESC *v) ...@@ -1557,7 +1555,7 @@ static void dump_VARDESC(const VARDESC *v)
{ {
MESSAGE("memid %ld\n",v->memid); MESSAGE("memid %ld\n",v->memid);
MESSAGE("lpstrSchema %s\n",debugstr_w(v->lpstrSchema)); MESSAGE("lpstrSchema %s\n",debugstr_w(v->lpstrSchema));
MESSAGE("oInst %ld\n", v->u.oInst); MESSAGE("oInst %ld\n", v->oInst);
dump_ELEMDESC(&(v->elemdescVar)); dump_ELEMDESC(&(v->elemdescVar));
MESSAGE("wVarFlags %x\n",v->wVarFlags); MESSAGE("wVarFlags %x\n",v->wVarFlags);
MESSAGE("varkind %d\n",v->varkind); MESSAGE("varkind %d\n",v->varkind);
...@@ -1594,11 +1592,11 @@ static SIZE_T TLB_SizeTypeDesc( const TYPEDESC *tdesc, BOOL alloc_initial_space ...@@ -1594,11 +1592,11 @@ static SIZE_T TLB_SizeTypeDesc( const TYPEDESC *tdesc, BOOL alloc_initial_space
{ {
case VT_PTR: case VT_PTR:
case VT_SAFEARRAY: case VT_SAFEARRAY:
size += TLB_SizeTypeDesc(tdesc->u.lptdesc, TRUE); size += TLB_SizeTypeDesc(tdesc->lptdesc, TRUE);
break; break;
case VT_CARRAY: case VT_CARRAY:
size += FIELD_OFFSET(ARRAYDESC, rgbounds[tdesc->u.lpadesc->cDims]); size += FIELD_OFFSET(ARRAYDESC, rgbounds[tdesc->lpadesc->cDims]);
size += TLB_SizeTypeDesc(&tdesc->u.lpadesc->tdescElem, FALSE); size += TLB_SizeTypeDesc(&tdesc->lpadesc->tdescElem, FALSE);
break; break;
} }
return size; return size;
...@@ -1619,14 +1617,14 @@ static void *TLB_CopyTypeDesc( TYPEDESC *dest, const TYPEDESC *src, void *buffer ...@@ -1619,14 +1617,14 @@ static void *TLB_CopyTypeDesc( TYPEDESC *dest, const TYPEDESC *src, void *buffer
{ {
case VT_PTR: case VT_PTR:
case VT_SAFEARRAY: case VT_SAFEARRAY:
dest->u.lptdesc = buffer; dest->lptdesc = buffer;
buffer = TLB_CopyTypeDesc(NULL, src->u.lptdesc, buffer); buffer = TLB_CopyTypeDesc(NULL, src->lptdesc, buffer);
break; break;
case VT_CARRAY: case VT_CARRAY:
dest->u.lpadesc = buffer; dest->lpadesc = buffer;
memcpy(dest->u.lpadesc, src->u.lpadesc, FIELD_OFFSET(ARRAYDESC, rgbounds[src->u.lpadesc->cDims])); memcpy(dest->lpadesc, src->lpadesc, FIELD_OFFSET(ARRAYDESC, rgbounds[src->lpadesc->cDims]));
buffer = (char *)buffer + FIELD_OFFSET(ARRAYDESC, rgbounds[src->u.lpadesc->cDims]); buffer = (char *)buffer + FIELD_OFFSET(ARRAYDESC, rgbounds[src->lpadesc->cDims]);
buffer = TLB_CopyTypeDesc(&dest->u.lpadesc->tdescElem, &src->u.lpadesc->tdescElem, buffer); buffer = TLB_CopyTypeDesc(&dest->lpadesc->tdescElem, &src->lpadesc->tdescElem, buffer);
break; break;
} }
return buffer; return buffer;
...@@ -1994,15 +1992,15 @@ static HRESULT TLB_size_instance(ITypeInfoImpl *info, SYSKIND sys, ...@@ -1994,15 +1992,15 @@ static HRESULT TLB_size_instance(ITypeInfoImpl *info, SYSKIND sys,
break; break;
case VT_CARRAY: case VT_CARRAY:
*size = 0; *size = 0;
for(i = 0; i < tdesc->u.lpadesc->cDims; ++i) for(i = 0; i < tdesc->lpadesc->cDims; ++i)
*size += tdesc->u.lpadesc->rgbounds[i].cElements; *size += tdesc->lpadesc->rgbounds[i].cElements;
hr = TLB_size_instance(info, sys, &tdesc->u.lpadesc->tdescElem, &sub, align); hr = TLB_size_instance(info, sys, &tdesc->lpadesc->tdescElem, &sub, align);
if(FAILED(hr)) if(FAILED(hr))
return hr; return hr;
*size *= sub; *size *= sub;
return S_OK; return S_OK;
case VT_USERDEFINED: case VT_USERDEFINED:
return TLB_get_size_from_hreftype(info, tdesc->u.hreftype, size, align); return TLB_get_size_from_hreftype(info, tdesc->hreftype, size, align);
default: default:
FIXME("Unsized VT: 0x%x\n", tdesc->vt); FIXME("Unsized VT: 0x%x\n", tdesc->vt);
return E_FAIL; return E_FAIL;
...@@ -2474,7 +2472,7 @@ MSFT_DoFuncs(TLBContext* pcx, ...@@ -2474,7 +2472,7 @@ MSFT_DoFuncs(TLBContext* pcx,
paraminfo.DataType, paraminfo.DataType,
&elemdesc->tdesc); &elemdesc->tdesc);
elemdesc->u.paramdesc.wParamFlags = paraminfo.Flags; elemdesc->paramdesc.wParamFlags = paraminfo.Flags;
/* name */ /* name */
if (paraminfo.oName != -1) if (paraminfo.oName != -1)
...@@ -2483,14 +2481,14 @@ MSFT_DoFuncs(TLBContext* pcx, ...@@ -2483,14 +2481,14 @@ MSFT_DoFuncs(TLBContext* pcx,
TRACE_(typelib)("param[%d] = %s\n", j, debugstr_w(TLB_get_bstr(ptfd->pParamDesc[j].Name))); TRACE_(typelib)("param[%d] = %s\n", j, debugstr_w(TLB_get_bstr(ptfd->pParamDesc[j].Name)));
/* default value */ /* default value */
if ( (elemdesc->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) && if ( (elemdesc->paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) &&
(pFuncRec->FKCCIC & 0x1000) ) (pFuncRec->FKCCIC & 0x1000) )
{ {
INT* pInt = (INT *)((char *)pFuncRec + INT* pInt = (INT *)((char *)pFuncRec +
reclength - reclength -
(pFuncRec->nrargs * 4) * sizeof(INT) ); (pFuncRec->nrargs * 4) * sizeof(INT) );
PARAMDESC* pParamDesc = &elemdesc->u.paramdesc; PARAMDESC* pParamDesc = &elemdesc->paramdesc;
pParamDesc->pparamdescex = (PARAMDESCEX*)(ptfd->funcdesc.lprgelemdescParam+pFuncRec->nrargs)+j; pParamDesc->pparamdescex = (PARAMDESCEX*)(ptfd->funcdesc.lprgelemdescParam+pFuncRec->nrargs)+j;
pParamDesc->pparamdescex->cBytes = sizeof(PARAMDESCEX); pParamDesc->pparamdescex->cBytes = sizeof(PARAMDESCEX);
...@@ -2499,7 +2497,7 @@ MSFT_DoFuncs(TLBContext* pcx, ...@@ -2499,7 +2497,7 @@ MSFT_DoFuncs(TLBContext* pcx,
pInt[j], pcx); pInt[j], pcx);
} }
else else
elemdesc->u.paramdesc.pparamdescex = NULL; elemdesc->paramdesc.pparamdescex = NULL;
/* custom info */ /* custom info */
if (optional > (FIELD_OFFSET(MSFT_FuncRecord, oArgCustData) + if (optional > (FIELD_OFFSET(MSFT_FuncRecord, oArgCustData) +
...@@ -2582,11 +2580,11 @@ static void MSFT_DoVars(TLBContext *pcx, ITypeInfoImpl *pTI, int cFuncs, ...@@ -2582,11 +2580,11 @@ static void MSFT_DoVars(TLBContext *pcx, ITypeInfoImpl *pTI, int cFuncs,
&ptvd->vardesc.elemdescVar.tdesc); &ptvd->vardesc.elemdescVar.tdesc);
/* ptvd->vardesc.lpstrSchema; is reserved (SDK) FIXME?? */ /* ptvd->vardesc.lpstrSchema; is reserved (SDK) FIXME?? */
if(pVarRec->VarKind == VAR_CONST ){ if(pVarRec->VarKind == VAR_CONST ){
ptvd->vardesc.u.lpvarValue = heap_alloc_zero(sizeof(VARIANT)); ptvd->vardesc.lpvarValue = heap_alloc_zero(sizeof(VARIANT));
MSFT_ReadValue(ptvd->vardesc.u.lpvarValue, MSFT_ReadValue(ptvd->vardesc.lpvarValue,
pVarRec->OffsValue, pcx); pVarRec->OffsValue, pcx);
} else } else
ptvd->vardesc.u.oInst=pVarRec->OffsValue; ptvd->vardesc.oInst=pVarRec->OffsValue;
recoffset += reclength; recoffset += reclength;
} }
} }
...@@ -3539,18 +3537,18 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength) ...@@ -3539,18 +3537,18 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
{ {
/* FIXME: check safearray */ /* FIXME: check safearray */
if(td[3] < 0) if(td[3] < 0)
pTypeLibImpl->pTypeDesc[i].u.lptdesc = &std_typedesc[td[2]]; pTypeLibImpl->pTypeDesc[i].lptdesc = &std_typedesc[td[2]];
else else
pTypeLibImpl->pTypeDesc[i].u.lptdesc = &pTypeLibImpl->pTypeDesc[td[2]/8]; pTypeLibImpl->pTypeDesc[i].lptdesc = &pTypeLibImpl->pTypeDesc[td[2]/8];
} }
else if(td[0] == VT_CARRAY) else if(td[0] == VT_CARRAY)
{ {
/* array descr table here */ /* array descr table here */
pTypeLibImpl->pTypeDesc[i].u.lpadesc = (void *)(INT_PTR)td[2]; /* temp store offset in*/ pTypeLibImpl->pTypeDesc[i].lpadesc = (void *)(INT_PTR)td[2]; /* temp store offset in*/
} }
else if(td[0] == VT_USERDEFINED) else if(td[0] == VT_USERDEFINED)
{ {
pTypeLibImpl->pTypeDesc[i].u.hreftype = MAKELONG(td[2],td[3]); pTypeLibImpl->pTypeDesc[i].hreftype = MAKELONG(td[2],td[3]);
} }
if(++i<cTD) MSFT_ReadLEWords(td, sizeof(td), &cx, DO_NOT_SEEK); if(++i<cTD) MSFT_ReadLEWords(td, sizeof(td), &cx, DO_NOT_SEEK);
} }
...@@ -3561,27 +3559,27 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength) ...@@ -3561,27 +3559,27 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
if(pTypeLibImpl->pTypeDesc[i].vt != VT_CARRAY) continue; if(pTypeLibImpl->pTypeDesc[i].vt != VT_CARRAY) continue;
if(tlbSegDir.pArrayDescriptions.offset>0) if(tlbSegDir.pArrayDescriptions.offset>0)
{ {
MSFT_ReadLEWords(td, sizeof(td), &cx, tlbSegDir.pArrayDescriptions.offset + (INT_PTR)pTypeLibImpl->pTypeDesc[i].u.lpadesc); MSFT_ReadLEWords(td, sizeof(td), &cx, tlbSegDir.pArrayDescriptions.offset + (INT_PTR)pTypeLibImpl->pTypeDesc[i].lpadesc);
pTypeLibImpl->pTypeDesc[i].u.lpadesc = heap_alloc_zero(sizeof(ARRAYDESC)+sizeof(SAFEARRAYBOUND)*(td[3]-1)); pTypeLibImpl->pTypeDesc[i].lpadesc = heap_alloc_zero(sizeof(ARRAYDESC)+sizeof(SAFEARRAYBOUND)*(td[3]-1));
if(td[1]<0) if(td[1]<0)
pTypeLibImpl->pTypeDesc[i].u.lpadesc->tdescElem.vt = td[0] & VT_TYPEMASK; pTypeLibImpl->pTypeDesc[i].lpadesc->tdescElem.vt = td[0] & VT_TYPEMASK;
else else
pTypeLibImpl->pTypeDesc[i].u.lpadesc->tdescElem = cx.pLibInfo->pTypeDesc[td[0]/(2*sizeof(INT))]; pTypeLibImpl->pTypeDesc[i].lpadesc->tdescElem = cx.pLibInfo->pTypeDesc[td[0]/(2*sizeof(INT))];
pTypeLibImpl->pTypeDesc[i].u.lpadesc->cDims = td[2]; pTypeLibImpl->pTypeDesc[i].lpadesc->cDims = td[2];
for(j = 0; j<td[2]; j++) for(j = 0; j<td[2]; j++)
{ {
MSFT_ReadLEDWords(& pTypeLibImpl->pTypeDesc[i].u.lpadesc->rgbounds[j].cElements, MSFT_ReadLEDWords(& pTypeLibImpl->pTypeDesc[i].lpadesc->rgbounds[j].cElements,
sizeof(INT), &cx, DO_NOT_SEEK); sizeof(INT), &cx, DO_NOT_SEEK);
MSFT_ReadLEDWords(& pTypeLibImpl->pTypeDesc[i].u.lpadesc->rgbounds[j].lLbound, MSFT_ReadLEDWords(& pTypeLibImpl->pTypeDesc[i].lpadesc->rgbounds[j].lLbound,
sizeof(INT), &cx, DO_NOT_SEEK); sizeof(INT), &cx, DO_NOT_SEEK);
} }
} }
else else
{ {
pTypeLibImpl->pTypeDesc[i].u.lpadesc = NULL; pTypeLibImpl->pTypeDesc[i].lpadesc = NULL;
ERR("didn't find array description data\n"); ERR("didn't find array description data\n");
} }
} }
...@@ -3803,19 +3801,19 @@ static WORD *SLTG_DoType(WORD *pType, char *pBlk, TYPEDESC *pTD, const sltg_ref_ ...@@ -3803,19 +3801,19 @@ static WORD *SLTG_DoType(WORD *pType, char *pBlk, TYPEDESC *pTD, const sltg_ref_
while(!done) { while(!done) {
if((*pType & 0xe00) == 0xe00) { if((*pType & 0xe00) == 0xe00) {
pTD->vt = VT_PTR; pTD->vt = VT_PTR;
pTD->u.lptdesc = heap_alloc_zero(sizeof(TYPEDESC)); pTD->lptdesc = heap_alloc_zero(sizeof(TYPEDESC));
pTD = pTD->u.lptdesc; pTD = pTD->lptdesc;
} }
switch(*pType & 0x3f) { switch(*pType & 0x3f) {
case VT_PTR: case VT_PTR:
pTD->vt = VT_PTR; pTD->vt = VT_PTR;
pTD->u.lptdesc = heap_alloc_zero(sizeof(TYPEDESC)); pTD->lptdesc = heap_alloc_zero(sizeof(TYPEDESC));
pTD = pTD->u.lptdesc; pTD = pTD->lptdesc;
break; break;
case VT_USERDEFINED: case VT_USERDEFINED:
pTD->vt = VT_USERDEFINED; pTD->vt = VT_USERDEFINED;
sltg_get_typelib_ref(ref_lookup, *(++pType) / 4, &pTD->u.hreftype); sltg_get_typelib_ref(ref_lookup, *(++pType) / 4, &pTD->hreftype);
done = TRUE; done = TRUE;
break; break;
...@@ -3827,12 +3825,12 @@ static WORD *SLTG_DoType(WORD *pType, char *pBlk, TYPEDESC *pTD, const sltg_ref_ ...@@ -3827,12 +3825,12 @@ static WORD *SLTG_DoType(WORD *pType, char *pBlk, TYPEDESC *pTD, const sltg_ref_
SAFEARRAY *pSA = (SAFEARRAY *)(pBlk + *(++pType)); SAFEARRAY *pSA = (SAFEARRAY *)(pBlk + *(++pType));
pTD->vt = VT_CARRAY; pTD->vt = VT_CARRAY;
pTD->u.lpadesc = heap_alloc_zero(sizeof(ARRAYDESC) + (pSA->cDims - 1) * sizeof(SAFEARRAYBOUND)); pTD->lpadesc = heap_alloc_zero(sizeof(ARRAYDESC) + (pSA->cDims - 1) * sizeof(SAFEARRAYBOUND));
pTD->u.lpadesc->cDims = pSA->cDims; pTD->lpadesc->cDims = pSA->cDims;
memcpy(pTD->u.lpadesc->rgbounds, pSA->rgsabound, memcpy(pTD->lpadesc->rgbounds, pSA->rgsabound,
pSA->cDims * sizeof(SAFEARRAYBOUND)); pSA->cDims * sizeof(SAFEARRAYBOUND));
pTD = &pTD->u.lpadesc->tdescElem; pTD = &pTD->lpadesc->tdescElem;
break; break;
} }
...@@ -3843,8 +3841,8 @@ static WORD *SLTG_DoType(WORD *pType, char *pBlk, TYPEDESC *pTD, const sltg_ref_ ...@@ -3843,8 +3841,8 @@ static WORD *SLTG_DoType(WORD *pType, char *pBlk, TYPEDESC *pTD, const sltg_ref_
pType++; pType++;
pTD->vt = VT_SAFEARRAY; pTD->vt = VT_SAFEARRAY;
pTD->u.lptdesc = heap_alloc_zero(sizeof(TYPEDESC)); pTD->lptdesc = heap_alloc_zero(sizeof(TYPEDESC));
pTD = pTD->u.lptdesc; pTD = pTD->lptdesc;
break; break;
} }
default: default:
...@@ -3862,19 +3860,19 @@ static WORD *SLTG_DoElem(WORD *pType, char *pBlk, ...@@ -3862,19 +3860,19 @@ static WORD *SLTG_DoElem(WORD *pType, char *pBlk,
{ {
/* Handle [in/out] first */ /* Handle [in/out] first */
if((*pType & 0xc000) == 0xc000) if((*pType & 0xc000) == 0xc000)
pElem->u.paramdesc.wParamFlags = PARAMFLAG_NONE; pElem->paramdesc.wParamFlags = PARAMFLAG_NONE;
else if(*pType & 0x8000) else if(*pType & 0x8000)
pElem->u.paramdesc.wParamFlags = PARAMFLAG_FIN | PARAMFLAG_FOUT; pElem->paramdesc.wParamFlags = PARAMFLAG_FIN | PARAMFLAG_FOUT;
else if(*pType & 0x4000) else if(*pType & 0x4000)
pElem->u.paramdesc.wParamFlags = PARAMFLAG_FOUT; pElem->paramdesc.wParamFlags = PARAMFLAG_FOUT;
else else
pElem->u.paramdesc.wParamFlags = PARAMFLAG_FIN; pElem->paramdesc.wParamFlags = PARAMFLAG_FIN;
if(*pType & 0x2000) if(*pType & 0x2000)
pElem->u.paramdesc.wParamFlags |= PARAMFLAG_FLCID; pElem->paramdesc.wParamFlags |= PARAMFLAG_FLCID;
if(*pType & 0x80) if(*pType & 0x80)
pElem->u.paramdesc.wParamFlags |= PARAMFLAG_FRETVAL; pElem->paramdesc.wParamFlags |= PARAMFLAG_FRETVAL;
return SLTG_DoType(pType, pBlk, &pElem->tdesc, ref_lookup); return SLTG_DoType(pType, pBlk, &pElem->tdesc, ref_lookup);
} }
...@@ -4059,10 +4057,10 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign ...@@ -4059,10 +4057,10 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign
else if (pItem->flags & 0x10) { else if (pItem->flags & 0x10) {
TRACE_(typelib)("VAR_CONST\n"); TRACE_(typelib)("VAR_CONST\n");
pVarDesc->vardesc.varkind = VAR_CONST; pVarDesc->vardesc.varkind = VAR_CONST;
pVarDesc->vardesc.u.lpvarValue = heap_alloc(sizeof(VARIANT)); pVarDesc->vardesc.lpvarValue = heap_alloc(sizeof(VARIANT));
V_VT(pVarDesc->vardesc.u.lpvarValue) = VT_INT; V_VT(pVarDesc->vardesc.lpvarValue) = VT_INT;
if (pItem->flags & 0x08) if (pItem->flags & 0x08)
V_INT(pVarDesc->vardesc.u.lpvarValue) = pItem->byte_offs; V_INT(pVarDesc->vardesc.lpvarValue) = pItem->byte_offs;
else { else {
switch (pVarDesc->vardesc.elemdescVar.tdesc.vt) switch (pVarDesc->vardesc.elemdescVar.tdesc.vt)
{ {
...@@ -4080,8 +4078,8 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign ...@@ -4080,8 +4078,8 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign
str = SysAllocStringLen(NULL, alloc_len); str = SysAllocStringLen(NULL, alloc_len);
MultiByteToWideChar(CP_ACP, 0, pBlk + pItem->byte_offs + 2, len, str, alloc_len); MultiByteToWideChar(CP_ACP, 0, pBlk + pItem->byte_offs + 2, len, str, alloc_len);
} }
V_VT(pVarDesc->vardesc.u.lpvarValue) = VT_BSTR; V_VT(pVarDesc->vardesc.lpvarValue) = VT_BSTR;
V_BSTR(pVarDesc->vardesc.u.lpvarValue) = str; V_BSTR(pVarDesc->vardesc.lpvarValue) = str;
break; break;
} }
case VT_I2: case VT_I2:
...@@ -4090,7 +4088,7 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign ...@@ -4090,7 +4088,7 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign
case VT_UI4: case VT_UI4:
case VT_INT: case VT_INT:
case VT_UINT: case VT_UINT:
V_INT(pVarDesc->vardesc.u.lpvarValue) = V_INT(pVarDesc->vardesc.lpvarValue) =
*(INT*)(pBlk + pItem->byte_offs); *(INT*)(pBlk + pItem->byte_offs);
break; break;
default: default:
...@@ -4100,7 +4098,7 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign ...@@ -4100,7 +4098,7 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign
} }
else { else {
TRACE_(typelib)("VAR_PERINSTANCE\n"); TRACE_(typelib)("VAR_PERINSTANCE\n");
pVarDesc->vardesc.u.oInst = pItem->byte_offs; pVarDesc->vardesc.oInst = pItem->byte_offs;
pVarDesc->vardesc.varkind = VAR_PERINSTANCE; pVarDesc->vardesc.varkind = VAR_PERINSTANCE;
} }
...@@ -4212,7 +4210,7 @@ static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, ...@@ -4212,7 +4210,7 @@ static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI,
/* Are we an optional param ? */ /* Are we an optional param ? */
if(pFuncDesc->funcdesc.cParams - param <= if(pFuncDesc->funcdesc.cParams - param <=
pFuncDesc->funcdesc.cParamsOpt) pFuncDesc->funcdesc.cParamsOpt)
pFuncDesc->funcdesc.lprgelemdescParam[param].u.paramdesc.wParamFlags |= PARAMFLAG_FOPT; pFuncDesc->funcdesc.lprgelemdescParam[param].paramdesc.wParamFlags |= PARAMFLAG_FOPT;
if(paramName) { if(paramName) {
pFuncDesc->pParamDesc[param].Name = SLTG_ReadName(pNameTable, pFuncDesc->pParamDesc[param].Name = SLTG_ReadName(pNameTable,
...@@ -4761,7 +4759,7 @@ static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface) ...@@ -4761,7 +4759,7 @@ static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface)
for (i = 0; i < This->ctTypeDesc; i++) for (i = 0; i < This->ctTypeDesc; i++)
if (This->pTypeDesc[i].vt == VT_CARRAY) if (This->pTypeDesc[i].vt == VT_CARRAY)
heap_free(This->pTypeDesc[i].u.lpadesc); heap_free(This->pTypeDesc[i].lpadesc);
heap_free(This->pTypeDesc); heap_free(This->pTypeDesc);
...@@ -5427,7 +5425,7 @@ static HRESULT WINAPI ITypeLibComp_fnBind( ...@@ -5427,7 +5425,7 @@ static HRESULT WINAPI ITypeLibComp_fnBind(
VAR_STATIC /* varkind */ VAR_STATIC /* varkind */
}; };
tdesc_appobject.u.hreftype = pTypeInfo->hreftype; tdesc_appobject.hreftype = pTypeInfo->hreftype;
tdesc_appobject.vt = VT_USERDEFINED; tdesc_appobject.vt = VT_USERDEFINED;
TRACE("found in implicit app object: %s\n", debugstr_w(szName)); TRACE("found in implicit app object: %s\n", debugstr_w(szName));
...@@ -5590,8 +5588,8 @@ static void typeinfo_release_funcdesc(TLBFuncDesc *func) ...@@ -5590,8 +5588,8 @@ static void typeinfo_release_funcdesc(TLBFuncDesc *func)
for (i = 0; i < func->funcdesc.cParams; ++i) for (i = 0; i < func->funcdesc.cParams; ++i)
{ {
ELEMDESC *elemdesc = &func->funcdesc.lprgelemdescParam[i]; ELEMDESC *elemdesc = &func->funcdesc.lprgelemdescParam[i];
if (elemdesc->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) if (elemdesc->paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
VariantClear(&elemdesc->u.paramdesc.pparamdescex->varDefaultValue); VariantClear(&elemdesc->paramdesc.pparamdescex->varDefaultValue);
TLB_FreeCustData(&func->pParamDesc[i].custdata_list); TLB_FreeCustData(&func->pParamDesc[i].custdata_list);
} }
heap_free(func->funcdesc.lprgelemdescParam); heap_free(func->funcdesc.lprgelemdescParam);
...@@ -5617,8 +5615,8 @@ static void ITypeInfoImpl_Destroy(ITypeInfoImpl *This) ...@@ -5617,8 +5615,8 @@ static void ITypeInfoImpl_Destroy(ITypeInfoImpl *This)
if (pVInfo->vardesc_create) { if (pVInfo->vardesc_create) {
TLB_FreeVarDesc(pVInfo->vardesc_create); TLB_FreeVarDesc(pVInfo->vardesc_create);
} else if (pVInfo->vardesc.varkind == VAR_CONST) { } else if (pVInfo->vardesc.varkind == VAR_CONST) {
VariantClear(pVInfo->vardesc.u.lpvarValue); VariantClear(pVInfo->vardesc.lpvarValue);
heap_free(pVInfo->vardesc.u.lpvarValue); heap_free(pVInfo->vardesc.lpvarValue);
} }
TLB_FreeCustData(&pVInfo->custdata_list); TLB_FreeCustData(&pVInfo->custdata_list);
} }
...@@ -5709,8 +5707,8 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeComp( ITypeInfo2 *iface, ...@@ -5709,8 +5707,8 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeComp( ITypeInfo2 *iface,
static SIZE_T TLB_SizeElemDesc( const ELEMDESC *elemdesc ) static SIZE_T TLB_SizeElemDesc( const ELEMDESC *elemdesc )
{ {
SIZE_T size = TLB_SizeTypeDesc(&elemdesc->tdesc, FALSE); SIZE_T size = TLB_SizeTypeDesc(&elemdesc->tdesc, FALSE);
if (elemdesc->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) if (elemdesc->paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
size += sizeof(*elemdesc->u.paramdesc.pparamdescex); size += sizeof(*elemdesc->paramdesc.pparamdescex);
return size; return size;
} }
...@@ -5718,10 +5716,10 @@ static HRESULT TLB_CopyElemDesc( const ELEMDESC *src, ELEMDESC *dest, char **buf ...@@ -5718,10 +5716,10 @@ static HRESULT TLB_CopyElemDesc( const ELEMDESC *src, ELEMDESC *dest, char **buf
{ {
*dest = *src; *dest = *src;
*buffer = TLB_CopyTypeDesc(&dest->tdesc, &src->tdesc, *buffer); *buffer = TLB_CopyTypeDesc(&dest->tdesc, &src->tdesc, *buffer);
if (src->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) if (src->paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
{ {
const PARAMDESCEX *pparamdescex_src = src->u.paramdesc.pparamdescex; const PARAMDESCEX *pparamdescex_src = src->paramdesc.pparamdescex;
PARAMDESCEX *pparamdescex_dest = dest->u.paramdesc.pparamdescex = (PARAMDESCEX *)*buffer; PARAMDESCEX *pparamdescex_dest = dest->paramdesc.pparamdescex = (PARAMDESCEX *)*buffer;
*buffer += sizeof(PARAMDESCEX); *buffer += sizeof(PARAMDESCEX);
*pparamdescex_dest = *pparamdescex_src; *pparamdescex_dest = *pparamdescex_src;
pparamdescex_dest->cBytes = sizeof(PARAMDESCEX); pparamdescex_dest->cBytes = sizeof(PARAMDESCEX);
...@@ -5730,7 +5728,7 @@ static HRESULT TLB_CopyElemDesc( const ELEMDESC *src, ELEMDESC *dest, char **buf ...@@ -5730,7 +5728,7 @@ static HRESULT TLB_CopyElemDesc( const ELEMDESC *src, ELEMDESC *dest, char **buf
(VARIANTARG *)&pparamdescex_src->varDefaultValue); (VARIANTARG *)&pparamdescex_src->varDefaultValue);
} }
else else
dest->u.paramdesc.pparamdescex = NULL; dest->paramdesc.pparamdescex = NULL;
return S_OK; return S_OK;
} }
...@@ -5746,8 +5744,8 @@ static HRESULT TLB_SanitizeVariant(VARIANT *var) ...@@ -5746,8 +5744,8 @@ static HRESULT TLB_SanitizeVariant(VARIANT *var)
static void TLB_FreeElemDesc( ELEMDESC *elemdesc ) static void TLB_FreeElemDesc( ELEMDESC *elemdesc )
{ {
if (elemdesc->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) if (elemdesc->paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
VariantClear(&elemdesc->u.paramdesc.pparamdescex->varDefaultValue); VariantClear(&elemdesc->paramdesc.pparamdescex->varDefaultValue);
} }
static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_ptr, BOOL dispinterface ) static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_ptr, BOOL dispinterface )
...@@ -5819,7 +5817,7 @@ static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_pt ...@@ -5819,7 +5817,7 @@ static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_pt
/* functions that have a [retval] parameter return this value into pVarResult. /* functions that have a [retval] parameter return this value into pVarResult.
* [retval] is always the last parameter (if present) */ * [retval] is always the last parameter (if present) */
if (dest->cParams && if (dest->cParams &&
(dest->lprgelemdescParam[dest->cParams - 1].u.paramdesc.wParamFlags & PARAMFLAG_FRETVAL)) (dest->lprgelemdescParam[dest->cParams - 1].paramdesc.wParamFlags & PARAMFLAG_FRETVAL))
{ {
ELEMDESC *elemdesc = &dest->lprgelemdescParam[dest->cParams - 1]; ELEMDESC *elemdesc = &dest->lprgelemdescParam[dest->cParams - 1];
if (elemdesc->tdesc.vt != VT_PTR) if (elemdesc->tdesc.vt != VT_PTR)
...@@ -5833,7 +5831,7 @@ static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_pt ...@@ -5833,7 +5831,7 @@ static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_pt
/* the type pointed to by this [retval] becomes elemdescFunc, /* the type pointed to by this [retval] becomes elemdescFunc,
* i.e. the function signature's return type. * i.e. the function signature's return type.
* We are using a flat buffer so there is no danger of leaking memory */ * We are using a flat buffer so there is no danger of leaking memory */
dest->elemdescFunc.tdesc = *elemdesc->tdesc.u.lptdesc; dest->elemdescFunc.tdesc = *elemdesc->tdesc.lptdesc;
/* remove the last parameter */ /* remove the last parameter */
dest->cParams--; dest->cParams--;
...@@ -5845,7 +5843,7 @@ static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_pt ...@@ -5845,7 +5843,7 @@ static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_pt
/* The now-last (except [retval], removed above) parameter might be labeled [lcid]. /* The now-last (except [retval], removed above) parameter might be labeled [lcid].
* If so it will be supplied from Invoke(lcid), so also not via DISPPARAMS::rgvarg */ * If so it will be supplied from Invoke(lcid), so also not via DISPPARAMS::rgvarg */
if (dest->cParams && (dest->lprgelemdescParam[dest->cParams - 1].u.paramdesc.wParamFlags & PARAMFLAG_FLCID)) if (dest->cParams && (dest->lprgelemdescParam[dest->cParams - 1].paramdesc.wParamFlags & PARAMFLAG_FLCID))
dest->cParams--; dest->cParams--;
} }
...@@ -5857,7 +5855,7 @@ static void TLB_FreeVarDesc(VARDESC *var_desc) ...@@ -5857,7 +5855,7 @@ static void TLB_FreeVarDesc(VARDESC *var_desc)
{ {
TLB_FreeElemDesc(&var_desc->elemdescVar); TLB_FreeElemDesc(&var_desc->elemdescVar);
if (var_desc->varkind == VAR_CONST) if (var_desc->varkind == VAR_CONST)
VariantClear(var_desc->u.lpvarValue); VariantClear(var_desc->lpvarValue);
SysFreeString((BSTR)var_desc); SysFreeString((BSTR)var_desc);
} }
...@@ -5933,14 +5931,14 @@ static inline void ITypeInfoImpl_ElemDescAddHrefOffset( LPELEMDESC pElemDesc, UI ...@@ -5933,14 +5931,14 @@ static inline void ITypeInfoImpl_ElemDescAddHrefOffset( LPELEMDESC pElemDesc, UI
switch (pTypeDesc->vt) switch (pTypeDesc->vt)
{ {
case VT_USERDEFINED: case VT_USERDEFINED:
pTypeDesc->u.hreftype += hrefoffset; pTypeDesc->hreftype += hrefoffset;
return; return;
case VT_PTR: case VT_PTR:
case VT_SAFEARRAY: case VT_SAFEARRAY:
pTypeDesc = pTypeDesc->u.lptdesc; pTypeDesc = pTypeDesc->lptdesc;
break; break;
case VT_CARRAY: case VT_CARRAY:
pTypeDesc = &pTypeDesc->u.lpadesc->tdescElem; pTypeDesc = &pTypeDesc->lpadesc->tdescElem;
break; break;
default: default:
return; return;
...@@ -6028,11 +6026,11 @@ static HRESULT TLB_AllocAndInitVarDesc( const VARDESC *src, VARDESC **dest_ptr ) ...@@ -6028,11 +6026,11 @@ static HRESULT TLB_AllocAndInitVarDesc( const VARDESC *src, VARDESC **dest_ptr )
{ {
HRESULT hr; HRESULT hr;
dest->u.lpvarValue = (VARIANT *)buffer; dest->lpvarValue = (VARIANT *)buffer;
*dest->u.lpvarValue = *src->u.lpvarValue; *dest->lpvarValue = *src->lpvarValue;
buffer += sizeof(VARIANT); buffer += sizeof(VARIANT);
VariantInit(dest->u.lpvarValue); VariantInit(dest->lpvarValue);
hr = VariantCopy(dest->u.lpvarValue, src->u.lpvarValue); hr = VariantCopy(dest->lpvarValue, src->lpvarValue);
if (FAILED(hr)) if (FAILED(hr))
{ {
SysFreeString((BSTR)dest); SysFreeString((BSTR)dest);
...@@ -6043,7 +6041,7 @@ static HRESULT TLB_AllocAndInitVarDesc( const VARDESC *src, VARDESC **dest_ptr ) ...@@ -6043,7 +6041,7 @@ static HRESULT TLB_AllocAndInitVarDesc( const VARDESC *src, VARDESC **dest_ptr )
if (FAILED(hr)) if (FAILED(hr))
{ {
if (src->varkind == VAR_CONST) if (src->varkind == VAR_CONST)
VariantClear(dest->u.lpvarValue); VariantClear(dest->lpvarValue);
SysFreeString((BSTR)dest); SysFreeString((BSTR)dest);
return hr; return hr;
} }
...@@ -6098,9 +6096,9 @@ static HRESULT typeinfo_getnames( ITypeInfo *iface, MEMBERID memid, BSTR *names, ...@@ -6098,9 +6096,9 @@ static HRESULT typeinfo_getnames( ITypeInfo *iface, MEMBERID memid, BSTR *names,
if (dispinterface && (func_desc->funcdesc.funckind != FUNC_DISPATCH)) if (dispinterface && (func_desc->funcdesc.funckind != FUNC_DISPATCH))
{ {
/* match the rewriting of special trailing parameters in TLB_AllocAndInitFuncDesc */ /* match the rewriting of special trailing parameters in TLB_AllocAndInitFuncDesc */
if ((params > 0) && (func_desc->funcdesc.lprgelemdescParam[params - 1].u.paramdesc.wParamFlags & PARAMFLAG_FRETVAL)) if ((params > 0) && (func_desc->funcdesc.lprgelemdescParam[params - 1].paramdesc.wParamFlags & PARAMFLAG_FRETVAL))
--params; /* Invoke(pVarResult) supplies the [retval] parameter, so it's hidden from DISPPARAMS */ --params; /* Invoke(pVarResult) supplies the [retval] parameter, so it's hidden from DISPPARAMS */
if ((params > 0) && (func_desc->funcdesc.lprgelemdescParam[params - 1].u.paramdesc.wParamFlags & PARAMFLAG_FLCID)) if ((params > 0) && (func_desc->funcdesc.lprgelemdescParam[params - 1].paramdesc.wParamFlags & PARAMFLAG_FLCID))
--params; /* Invoke(lcid) supplies the [lcid] parameter, so it's hidden from DISPPARAMS */ --params; /* Invoke(lcid) supplies the [lcid] parameter, so it's hidden from DISPPARAMS */
} }
...@@ -6985,10 +6983,10 @@ static HRESULT userdefined_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc, ...@@ -6985,10 +6983,10 @@ static HRESULT userdefined_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc,
ITypeInfo *tinfo2 = NULL; ITypeInfo *tinfo2 = NULL;
TYPEATTR *tattr = NULL; TYPEATTR *tattr = NULL;
hr = ITypeInfo_GetRefTypeInfo(tinfo, tdesc->u.hreftype, &tinfo2); hr = ITypeInfo_GetRefTypeInfo(tinfo, tdesc->hreftype, &tinfo2);
if (hr) if (hr)
{ {
ERR("Could not get typeinfo of hreftype %lx for VT_USERDEFINED, hr %#lx.\n", tdesc->u.hreftype, hr); ERR("Could not get typeinfo of hreftype %lx for VT_USERDEFINED, hr %#lx.\n", tdesc->hreftype, hr);
return hr; return hr;
} }
hr = ITypeInfo_GetTypeAttr(tinfo2, &tattr); hr = ITypeInfo_GetTypeAttr(tinfo2, &tattr);
...@@ -7051,20 +7049,20 @@ static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc, ...@@ -7051,20 +7049,20 @@ static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc,
/* enforce only one level of pointer indirection */ /* enforce only one level of pointer indirection */
if (!(*vt & VT_BYREF) && !(*vt & VT_ARRAY) && (tdesc->vt == VT_PTR)) if (!(*vt & VT_BYREF) && !(*vt & VT_ARRAY) && (tdesc->vt == VT_PTR))
{ {
tdesc = tdesc->u.lptdesc; tdesc = tdesc->lptdesc;
/* munch VT_PTR -> VT_USERDEFINED(interface) into VT_UNKNOWN or /* munch VT_PTR -> VT_USERDEFINED(interface) into VT_UNKNOWN or
* VT_DISPATCH and VT_PTR -> VT_PTR -> VT_USERDEFINED(interface) into * VT_DISPATCH and VT_PTR -> VT_PTR -> VT_USERDEFINED(interface) into
* VT_BYREF|VT_DISPATCH or VT_BYREF|VT_UNKNOWN */ * VT_BYREF|VT_DISPATCH or VT_BYREF|VT_UNKNOWN */
if ((tdesc->vt == VT_USERDEFINED) || if ((tdesc->vt == VT_USERDEFINED) ||
((tdesc->vt == VT_PTR) && (tdesc->u.lptdesc->vt == VT_USERDEFINED))) ((tdesc->vt == VT_PTR) && (tdesc->lptdesc->vt == VT_USERDEFINED)))
{ {
VARTYPE vt_userdefined = 0; VARTYPE vt_userdefined = 0;
const TYPEDESC *tdesc_userdefined = tdesc; const TYPEDESC *tdesc_userdefined = tdesc;
if (tdesc->vt == VT_PTR) if (tdesc->vt == VT_PTR)
{ {
vt_userdefined = VT_BYREF; vt_userdefined = VT_BYREF;
tdesc_userdefined = tdesc->u.lptdesc; tdesc_userdefined = tdesc->lptdesc;
} }
hr = userdefined_to_variantvt(tinfo, tdesc_userdefined, &vt_userdefined); hr = userdefined_to_variantvt(tinfo, tdesc_userdefined, &vt_userdefined);
if ((hr == S_OK) && if ((hr == S_OK) &&
...@@ -7096,7 +7094,7 @@ static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc, ...@@ -7096,7 +7094,7 @@ static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc,
break; break;
case VT_SAFEARRAY: case VT_SAFEARRAY:
*vt |= VT_ARRAY; *vt |= VT_ARRAY;
hr = typedescvt_to_variantvt(tinfo, tdesc->u.lptdesc, vt); hr = typedescvt_to_variantvt(tinfo, tdesc->lptdesc, vt);
break; break;
case VT_INT: case VT_INT:
*vt |= VT_I4; *vt |= VT_I4;
...@@ -7130,7 +7128,7 @@ static HRESULT get_iface_guid(ITypeInfo *tinfo, HREFTYPE href, GUID *guid) ...@@ -7130,7 +7128,7 @@ static HRESULT get_iface_guid(ITypeInfo *tinfo, HREFTYPE href, GUID *guid)
switch(tattr->typekind) { switch(tattr->typekind) {
case TKIND_ALIAS: case TKIND_ALIAS:
hres = get_iface_guid(tinfo2, tattr->tdescAlias.u.hreftype, guid); hres = get_iface_guid(tinfo2, tattr->tdescAlias.hreftype, guid);
break; break;
case TKIND_INTERFACE: case TKIND_INTERFACE:
...@@ -7282,7 +7280,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke( ...@@ -7282,7 +7280,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
TRACE("changing args\n"); TRACE("changing args\n");
for (i = 0; i < func_desc->cParams; i++) for (i = 0; i < func_desc->cParams; i++)
{ {
USHORT wParamFlags = func_desc->lprgelemdescParam[i].u.paramdesc.wParamFlags; USHORT wParamFlags = func_desc->lprgelemdescParam[i].paramdesc.wParamFlags;
TYPEDESC *tdesc = &func_desc->lprgelemdescParam[i].tdesc; TYPEDESC *tdesc = &func_desc->lprgelemdescParam[i].tdesc;
VARIANTARG *src_arg; VARIANTARG *src_arg;
...@@ -7433,16 +7431,16 @@ static HRESULT WINAPI ITypeInfo_fnInvoke( ...@@ -7433,16 +7431,16 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
prgpvarg[i] = src_arg; prgpvarg[i] = src_arg;
} }
if((tdesc->vt == VT_USERDEFINED || (tdesc->vt == VT_PTR && tdesc->u.lptdesc->vt == VT_USERDEFINED)) if((tdesc->vt == VT_USERDEFINED || (tdesc->vt == VT_PTR && tdesc->lptdesc->vt == VT_USERDEFINED))
&& (V_VT(prgpvarg[i]) == VT_DISPATCH || V_VT(prgpvarg[i]) == VT_UNKNOWN) && (V_VT(prgpvarg[i]) == VT_DISPATCH || V_VT(prgpvarg[i]) == VT_UNKNOWN)
&& V_UNKNOWN(prgpvarg[i])) { && V_UNKNOWN(prgpvarg[i])) {
IUnknown *userdefined_iface; IUnknown *userdefined_iface;
GUID guid; GUID guid;
if (tdesc->vt == VT_PTR) if (tdesc->vt == VT_PTR)
tdesc = tdesc->u.lptdesc; tdesc = tdesc->lptdesc;
hres = get_iface_guid((ITypeInfo*)iface, tdesc->u.hreftype, &guid); hres = get_iface_guid((ITypeInfo*)iface, tdesc->hreftype, &guid);
if(FAILED(hres)) if(FAILED(hres))
break; break;
...@@ -7462,7 +7460,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke( ...@@ -7462,7 +7460,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
arg = prgpvarg[i] = &rgvarg[i]; arg = prgpvarg[i] = &rgvarg[i];
if (wParamFlags & PARAMFLAG_FHASDEFAULT) if (wParamFlags & PARAMFLAG_FHASDEFAULT)
{ {
hres = VariantCopy(arg, &func_desc->lprgelemdescParam[i].u.paramdesc.pparamdescex->varDefaultValue); hres = VariantCopy(arg, &func_desc->lprgelemdescParam[i].paramdesc.pparamdescex->varDefaultValue);
if (FAILED(hres)) if (FAILED(hres))
break; break;
} }
...@@ -7513,7 +7511,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke( ...@@ -7513,7 +7511,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
for (i = 0; i < func_desc->cParams; i++) for (i = 0; i < func_desc->cParams; i++)
{ {
USHORT wParamFlags = func_desc->lprgelemdescParam[i].u.paramdesc.wParamFlags; USHORT wParamFlags = func_desc->lprgelemdescParam[i].paramdesc.wParamFlags;
if (wParamFlags & PARAMFLAG_FLCID) if (wParamFlags & PARAMFLAG_FLCID)
continue; continue;
...@@ -7621,7 +7619,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke( ...@@ -7621,7 +7619,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
if (SUCCEEDED(hres) && pVarResult && (func_desc->cParams == 1) && if (SUCCEEDED(hres) && pVarResult && (func_desc->cParams == 1) &&
(func_desc->invkind & INVOKE_PROPERTYGET) && (func_desc->invkind & INVOKE_PROPERTYGET) &&
(func_desc->lprgelemdescParam[0].u.paramdesc.wParamFlags & PARAMFLAG_FRETVAL) && (func_desc->lprgelemdescParam[0].paramdesc.wParamFlags & PARAMFLAG_FRETVAL) &&
(pDispParams->cArgs != 0)) (pDispParams->cArgs != 0))
{ {
if (V_VT(pVarResult) == VT_DISPATCH) if (V_VT(pVarResult) == VT_DISPATCH)
...@@ -8717,8 +8715,8 @@ HRESULT WINAPI CreateDispTypeInfo( ...@@ -8717,8 +8715,8 @@ HRESULT WINAPI CreateDispTypeInfo(
pFuncDesc->funcdesc.cScodes = 0; pFuncDesc->funcdesc.cScodes = 0;
pFuncDesc->funcdesc.wFuncFlags = 0; pFuncDesc->funcdesc.wFuncFlags = 0;
pFuncDesc->funcdesc.elemdescFunc.tdesc.vt = md->vtReturn; pFuncDesc->funcdesc.elemdescFunc.tdesc.vt = md->vtReturn;
pFuncDesc->funcdesc.elemdescFunc.u.paramdesc.wParamFlags = PARAMFLAG_NONE; pFuncDesc->funcdesc.elemdescFunc.paramdesc.wParamFlags = PARAMFLAG_NONE;
pFuncDesc->funcdesc.elemdescFunc.u.paramdesc.pparamdescex = NULL; pFuncDesc->funcdesc.elemdescFunc.paramdesc.pparamdescex = NULL;
pFuncDesc->funcdesc.lprgelemdescParam = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pFuncDesc->funcdesc.lprgelemdescParam = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
md->cArgs * sizeof(ELEMDESC)); md->cArgs * sizeof(ELEMDESC));
pFuncDesc->pParamDesc = TLBParDesc_Constructor(md->cArgs); pFuncDesc->pParamDesc = TLBParDesc_Constructor(md->cArgs);
...@@ -9489,17 +9487,17 @@ static DWORD WMSFT_append_typedesc(TYPEDESC *desc, WMSFT_TLBFile *file, DWORD *o ...@@ -9489,17 +9487,17 @@ static DWORD WMSFT_append_typedesc(TYPEDESC *desc, WMSFT_TLBFile *file, DWORD *o
if(vt == VT_PTR || vt == VT_SAFEARRAY){ if(vt == VT_PTR || vt == VT_SAFEARRAY){
DWORD mix; DWORD mix;
encoded[1] = WMSFT_append_typedesc(desc->u.lptdesc, file, &mix, out_size); encoded[1] = WMSFT_append_typedesc(desc->lptdesc, file, &mix, out_size);
encoded[0] = desc->vt | ((mix | VT_BYREF) << 16); encoded[0] = desc->vt | ((mix | VT_BYREF) << 16);
*out_mix = 0x7FFF; *out_mix = 0x7FFF;
*out_size += 2 * sizeof(DWORD); *out_size += 2 * sizeof(DWORD);
}else if(vt == VT_CARRAY){ }else if(vt == VT_CARRAY){
encoded[0] = desc->vt | (0x7FFE << 16); encoded[0] = desc->vt | (0x7FFE << 16);
encoded[1] = WMSFT_append_arraydesc(desc->u.lpadesc, file); encoded[1] = WMSFT_append_arraydesc(desc->lpadesc, file);
*out_mix = 0x7FFE; *out_mix = 0x7FFE;
}else if(vt == VT_USERDEFINED){ }else if(vt == VT_USERDEFINED){
encoded[0] = desc->vt | (0x7FFF << 16); encoded[0] = desc->vt | (0x7FFF << 16);
encoded[1] = desc->u.hreftype; encoded[1] = desc->hreftype;
*out_mix = 0x7FFF; /* FIXME: Should get TYPEKIND of the hreftype, e.g. TKIND_ENUM => VT_I4 */ *out_mix = 0x7FFF; /* FIXME: Should get TYPEKIND of the hreftype, e.g. TKIND_ENUM => VT_I4 */
}else{ }else{
TRACE("Mixing in-place, VT: 0x%x\n", desc->vt); TRACE("Mixing in-place, VT: 0x%x\n", desc->vt);
...@@ -9606,7 +9604,7 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info, ...@@ -9606,7 +9604,7 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info,
recorded_size += desc->funcdesc.cParams * sizeof(MSFT_ParameterInfo); recorded_size += desc->funcdesc.cParams * sizeof(MSFT_ParameterInfo);
for(j = 0; j < desc->funcdesc.cParams; ++j){ for(j = 0; j < desc->funcdesc.cParams; ++j){
if(desc->funcdesc.lprgelemdescParam[j].u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT){ if(desc->funcdesc.lprgelemdescParam[j].paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT){
recorded_size += desc->funcdesc.cParams * sizeof(INT); recorded_size += desc->funcdesc.cParams * sizeof(INT);
break; break;
} }
...@@ -9682,7 +9680,7 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info, ...@@ -9682,7 +9680,7 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info,
funcrecord->FKCCIC |= 0x2000; funcrecord->FKCCIC |= 0x2000;
for(j = 0; j < desc->funcdesc.cParams; ++j){ for(j = 0; j < desc->funcdesc.cParams; ++j){
if(desc->funcdesc.lprgelemdescParam[j].u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT){ if(desc->funcdesc.lprgelemdescParam[j].paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT){
paramdefault_size = sizeof(INT) * desc->funcdesc.cParams; paramdefault_size = sizeof(INT) * desc->funcdesc.cParams;
funcrecord->funcdescsize += sizeof(PARAMDESCEX); funcrecord->funcdescsize += sizeof(PARAMDESCEX);
} }
...@@ -9761,11 +9759,11 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info, ...@@ -9761,11 +9759,11 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info,
info->oName = desc->pParamDesc[j].Name->offset; info->oName = desc->pParamDesc[j].Name->offset;
else else
info->oName = -1; info->oName = -1;
info->Flags = desc->funcdesc.lprgelemdescParam[j].u.paramdesc.wParamFlags; info->Flags = desc->funcdesc.lprgelemdescParam[j].paramdesc.wParamFlags;
if(paramdefault_size){ if(paramdefault_size){
if(desc->funcdesc.lprgelemdescParam[j].u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) if(desc->funcdesc.lprgelemdescParam[j].paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
*paramdefault = WMSFT_encode_variant(&desc->funcdesc.lprgelemdescParam[j].u.paramdesc.pparamdescex->varDefaultValue, file); *paramdefault = WMSFT_encode_variant(&desc->funcdesc.lprgelemdescParam[j].paramdesc.pparamdescex->varDefaultValue, file);
else if(paramdefault_size) else if(paramdefault_size)
*paramdefault = -1; *paramdefault = -1;
++paramdefault; ++paramdefault;
...@@ -9795,9 +9793,9 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info, ...@@ -9795,9 +9793,9 @@ static DWORD WMSFT_compile_typeinfo_aux(ITypeInfoImpl *info,
if(desc->vardesc.varkind == VAR_CONST){ if(desc->vardesc.varkind == VAR_CONST){
varrecord->vardescsize += sizeof(VARIANT); varrecord->vardescsize += sizeof(VARIANT);
varrecord->OffsValue = WMSFT_encode_variant(desc->vardesc.u.lpvarValue, file); varrecord->OffsValue = WMSFT_encode_variant(desc->vardesc.lpvarValue, file);
}else }else
varrecord->OffsValue = desc->vardesc.u.oInst; varrecord->OffsValue = desc->vardesc.oInst;
/* res9? */ /* res9? */
if(desc->HelpStringContext != 0){ if(desc->HelpStringContext != 0){
...@@ -10756,10 +10754,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(ICreateTypeInfo2 *iface, ...@@ -10756,10 +10754,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(ICreateTypeInfo2 *iface,
heap_free(tmp_func_desc.funcdesc.lprgscode); heap_free(tmp_func_desc.funcdesc.lprgscode);
return hres; return hres;
} }
if (tmp_func_desc.funcdesc.lprgelemdescParam[i].u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT && if (tmp_func_desc.funcdesc.lprgelemdescParam[i].paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT &&
tmp_func_desc.funcdesc.lprgelemdescParam[i].tdesc.vt != VT_VARIANT && tmp_func_desc.funcdesc.lprgelemdescParam[i].tdesc.vt != VT_VARIANT &&
tmp_func_desc.funcdesc.lprgelemdescParam[i].tdesc.vt != VT_USERDEFINED){ tmp_func_desc.funcdesc.lprgelemdescParam[i].tdesc.vt != VT_USERDEFINED){
hres = TLB_SanitizeVariant(&tmp_func_desc.funcdesc.lprgelemdescParam[i].u.paramdesc.pparamdescex->varDefaultValue); hres = TLB_SanitizeVariant(&tmp_func_desc.funcdesc.lprgelemdescParam[i].paramdesc.pparamdescex->varDefaultValue);
if (FAILED(hres)) { if (FAILED(hres)) {
heap_free(tmp_func_desc.funcdesc.lprgelemdescParam); heap_free(tmp_func_desc.funcdesc.lprgelemdescParam);
heap_free(tmp_func_desc.funcdesc.lprgscode); heap_free(tmp_func_desc.funcdesc.lprgscode);
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#include <string.h> #include <string.h>
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
...@@ -1441,12 +1439,12 @@ static void free_embedded_arraydesc(ARRAYDESC *adesc) ...@@ -1441,12 +1439,12 @@ static void free_embedded_arraydesc(ARRAYDESC *adesc)
{ {
case VT_PTR: case VT_PTR:
case VT_SAFEARRAY: case VT_SAFEARRAY:
free_embedded_typedesc(adesc->tdescElem.u.lptdesc); free_embedded_typedesc(adesc->tdescElem.lptdesc);
CoTaskMemFree(adesc->tdescElem.u.lptdesc); CoTaskMemFree(adesc->tdescElem.lptdesc);
break; break;
case VT_CARRAY: case VT_CARRAY:
free_embedded_arraydesc(adesc->tdescElem.u.lpadesc); free_embedded_arraydesc(adesc->tdescElem.lpadesc);
CoTaskMemFree(adesc->tdescElem.u.lpadesc); CoTaskMemFree(adesc->tdescElem.lpadesc);
break; break;
} }
} }
...@@ -1457,12 +1455,12 @@ static void free_embedded_typedesc(TYPEDESC *tdesc) ...@@ -1457,12 +1455,12 @@ static void free_embedded_typedesc(TYPEDESC *tdesc)
{ {
case VT_PTR: case VT_PTR:
case VT_SAFEARRAY: case VT_SAFEARRAY:
free_embedded_typedesc(tdesc->u.lptdesc); free_embedded_typedesc(tdesc->lptdesc);
CoTaskMemFree(tdesc->u.lptdesc); CoTaskMemFree(tdesc->lptdesc);
break; break;
case VT_CARRAY: case VT_CARRAY:
free_embedded_arraydesc(tdesc->u.lpadesc); free_embedded_arraydesc(tdesc->lpadesc);
CoTaskMemFree(tdesc->u.lpadesc); CoTaskMemFree(tdesc->lpadesc);
break; break;
} }
} }
...@@ -1470,8 +1468,8 @@ static void free_embedded_typedesc(TYPEDESC *tdesc) ...@@ -1470,8 +1468,8 @@ static void free_embedded_typedesc(TYPEDESC *tdesc)
static void free_embedded_elemdesc(ELEMDESC *edesc) static void free_embedded_elemdesc(ELEMDESC *edesc)
{ {
free_embedded_typedesc(&edesc->tdesc); free_embedded_typedesc(&edesc->tdesc);
if(edesc->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) if(edesc->paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
CoTaskMemFree(edesc->u.paramdesc.pparamdescex); CoTaskMemFree(edesc->paramdesc.pparamdescex);
} }
/* ITypeComp */ /* ITypeComp */
...@@ -1999,7 +1997,7 @@ void CALLBACK ITypeInfo_ReleaseVarDesc_Proxy( ...@@ -1999,7 +1997,7 @@ void CALLBACK ITypeInfo_ReleaseVarDesc_Proxy(
CoTaskMemFree(pVarDesc->lpstrSchema); CoTaskMemFree(pVarDesc->lpstrSchema);
if(pVarDesc->varkind == VAR_CONST) if(pVarDesc->varkind == VAR_CONST)
CoTaskMemFree(pVarDesc->u.lpvarValue); CoTaskMemFree(pVarDesc->lpvarValue);
free_embedded_elemdesc(&pVarDesc->elemdescVar); free_embedded_elemdesc(&pVarDesc->elemdescVar);
CoTaskMemFree(pVarDesc); CoTaskMemFree(pVarDesc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment