Sync to Wine-20050419:

Daniel Remenak <dtremenak@gmail.com>
- Implemented VarIdiv.
- Return DISP_E_DIVBYZERO instead of crashing when asked to divide a
  variant by zero.
- Remove unused variable in _copy_arg.
Marcus Meissner <meissner@suse.de>
- Serialize NULL pointer interfaces correctly.
- Fixed VT_BSTR|VT_BYREF marshalling.
- Added VT_I4|VT_BYREF marshalling.
- Fixed ppvObject serializer (deref twice instead of once).
- Actually pass back return value of remote call in type marshaller.
- Format VT_UI1, VT_I1, VT_UI2, VT_I2 correctly.
- Added IDispatch::GetIDsOfNames() special case serializing.
- Handle VT_PTR / NULL marshalling correctly.
Mike Hearn <mike@navi.cx>
- Fix BSTR tracing in the typelib marshaller.
- Fix PARAMFLAG_FOUT typo in the tmarshaller.
Mike Hearn <mh@codeweavers.com>
Robert Shearman <rob@codeweavers.com>
- Implement VT_BYREF | VT_BSTR marshalling.
- Add more integer types for marshaling and unmarshaling.
- Implement VT_BYREF | VT_BSTR unmarshaling.
- Don't allocate memory for TKIND_DISPATCH/TKIND_INTERFACE
  unmarshaling as it will be lost in the success case and interferes
  with the failure case.
Robert Shearman <rob@codeweavers.com>
- Add outer unknown support for typelib marshaler.
Jakob Eriksson <jakov@vmlinux.org>
- Get rid of HeapAlloc casts.
Francois Gouget <fgouget@free.fr>
- Assorted spelling fixes.
Alex Villacis Lasso <a_villacis@palosanto.com>
- Fix leftover negative sign in height parameter for transparent
  bitmap.
- Properly announce whether bitmap is transparent in get_Attributes.
- GIF transparency is now palette-index based, instead of RGB based.
- Keep original bitmap and XOR mask separate, so that get_Handle
  returns original bitmap.
- Initialize [orig|himetric][Width|Height] for PICTYPE_ICON case.
- Fix failure to notice the use of a GIF palette index greater or equal
  to 128 for transparency.
- After Float->string conversion via sprintfW(), VarDecFromR[4|8] is
  forced to use US locale for string->Decimal conversion, to agree with
  sprintfW().

svn path=/trunk/; revision=15011
This commit is contained in:
Gé van Geldorp 2005-05-05 18:29:41 +00:00
parent 61e422828e
commit df82a2a2a8
9 changed files with 708 additions and 221 deletions

View file

@ -235,9 +235,8 @@ BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
* buffer for the character count and an extra character at the
* end for the NULL.
*/
newBuffer = (DWORD*)HeapAlloc(GetProcessHeap(),
0,
bufferSize + sizeof(WCHAR) + sizeof(DWORD));
newBuffer = HeapAlloc(GetProcessHeap(), 0,
bufferSize + sizeof(WCHAR) + sizeof(DWORD));
/*
* If the memory allocation failed, return a null pointer.
@ -350,9 +349,8 @@ BSTR WINAPI SysAllocStringByteLen(LPCSTR str, UINT len)
* buffer for the character count and an extra character at the
* end for the NULL.
*/
newBuffer = (DWORD*)HeapAlloc(GetProcessHeap(),
0,
len + sizeof(WCHAR) + sizeof(DWORD));
newBuffer = HeapAlloc(GetProcessHeap(), 0,
len + sizeof(WCHAR) + sizeof(DWORD));
/*
* If the memory allocation failed, return a null pointer.

View file

@ -148,7 +148,7 @@
149 stdcall SysStringByteLen(ptr)
150 stdcall SysAllocStringByteLen(ptr long)
152 stdcall VarEqv(ptr ptr ptr)
153 stub VarIdiv # stdcall (ptr ptr ptr)
153 stdcall VarIdiv(ptr ptr ptr)
154 stub VarImp # stdcall (ptr ptr ptr)
155 stdcall VarMod(ptr ptr ptr)
156 stdcall VarMul(ptr ptr ptr)

View file

@ -185,6 +185,36 @@ static void OLEPictureImpl_SetBitmap(OLEPictureImpl*This) {
DeleteDC(hdcRef);
}
static void OLEPictureImpl_SetIcon(OLEPictureImpl * This)
{
ICONINFO infoIcon;
TRACE("icon handle %p\n", This->desc.u.icon.hicon);
if (GetIconInfo(This->desc.u.icon.hicon, &infoIcon)) {
HDC hdcRef;
BITMAP bm;
TRACE("bitmap handle for icon is %p\n", infoIcon.hbmColor);
if(GetObjectA(infoIcon.hbmColor ? infoIcon.hbmColor : infoIcon.hbmMask, sizeof(bm), &bm) != sizeof(bm)) {
ERR("GetObject fails on icon bitmap\n");
return;
}
This->origWidth = bm.bmWidth;
This->origHeight = infoIcon.hbmColor ? bm.bmHeight : bm.bmHeight / 2;
/* see comment on HIMETRIC on OLEPictureImpl_SetBitmap() */
hdcRef = GetDC(0);
This->himetricWidth = (This->origWidth *2540)/GetDeviceCaps(hdcRef, LOGPIXELSX);
This->himetricHeight= (This->origHeight *2540)/GetDeviceCaps(hdcRef, LOGPIXELSY);
ReleaseDC(0, hdcRef);
DeleteObject(infoIcon.hbmMask);
if (infoIcon.hbmColor) DeleteObject(infoIcon.hbmColor);
} else {
ERR("GetIconInfo() fails on icon %p\n", This->desc.u.icon.hicon);
}
}
/************************************************************************
* OLEPictureImpl_Construct
*
@ -260,6 +290,8 @@ static OLEPictureImpl* OLEPictureImpl_Construct(LPPICTDESC pictDesc, BOOL fOwn)
break;
case PICTYPE_ICON:
OLEPictureImpl_SetIcon(newObject);
break;
case PICTYPE_ENHMETAFILE:
default:
FIXME("Unsupported type %d\n", pictDesc->picType);
@ -1071,7 +1103,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
eb = si->ExtensionBlocks + i;
if (eb->Function == 0xF9 && eb->ByteCount == 4) {
if ((eb->Bytes[0] & 1) == 1) {
transparent = eb->Bytes[3];
transparent = (unsigned char)eb->Bytes[3];
}
}
}
@ -1145,7 +1177,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
This->hbmMask = CreateBitmap(bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight, 1, 1, NULL);
hOldbitmap = SelectObject(hdc,This->desc.u.bmp.hbitmap);
hOldbitmap = SelectObject(hdc,This->desc.u.bmp.hbitmap);
hOldbitmapmask = SelectObject(hdcMask, This->hbmMask);
SetBkColor(hdc, This->rgbTrans);
BitBlt(hdcMask, 0, 0, bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight, hdc, 0, 0, SRCCOPY);
@ -1501,7 +1533,7 @@ static int serializeBMP(HBITMAP hBitmap, void ** ppBuffer, unsigned int * pLengt
BITMAPFILEHEADER * pFileHeader;
BITMAPINFO * pInfoHeader;
pInfoBitmap = (BITMAPINFO *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
pInfoBitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
/* Find out bitmap size and padded length */
@ -1511,8 +1543,7 @@ static int serializeBMP(HBITMAP hBitmap, void ** ppBuffer, unsigned int * pLengt
/* Fetch bitmap palette & pixel data */
pPixelData = (unsigned char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
pInfoBitmap->bmiHeader.biSizeImage);
pPixelData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pInfoBitmap->bmiHeader.biSizeImage);
GetDIBits(hDC, hBitmap, 0, pInfoBitmap->bmiHeader.biHeight, pPixelData, pInfoBitmap, DIB_RGB_COLORS);
/* Calculate the total length required for the BMP data */
@ -1530,7 +1561,7 @@ static int serializeBMP(HBITMAP hBitmap, void ** ppBuffer, unsigned int * pLengt
sizeof(BITMAPINFOHEADER) +
iNumPaletteEntries * sizeof(RGBQUAD) +
pInfoBitmap->bmiHeader.biSizeImage;
*ppBuffer = (void *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *pLength);
*ppBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *pLength);
/* Fill the BITMAPFILEHEADER */
pFileHeader = (BITMAPFILEHEADER *)(*ppBuffer);
@ -1569,7 +1600,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength)
unsigned char * pIconData = NULL;
unsigned int iDataSize = 0;
pInfoBitmap = (BITMAPINFO *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
pInfoBitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
/* Find out icon size */
hDC = GetDC(0);
@ -1603,7 +1634,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength)
*/
/* Let's start with one CURSORICONFILEDIR and one CURSORICONFILEDIRENTRY */
iDataSize += 3 * sizeof(WORD) + sizeof(CURSORICONFILEDIRENTRY) + sizeof(BITMAPINFOHEADER);
pIconData = (unsigned char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, iDataSize);
pIconData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, iDataSize);
/* Fill out the CURSORICONFILEDIR */
pIconDir = (CURSORICONFILEDIR *)pIconData;
@ -1651,7 +1682,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength)
iDataSize += pIconBitmapHeader->biHeight * iLengthScanLineMask;
pIconBitmapHeader->biSizeImage += pIconBitmapHeader->biHeight * iLengthScanLineMask;
pIconBitmapHeader->biHeight *= 2;
pIconData = (unsigned char *)HeapReAlloc(GetProcessHeap(), 0, pIconData, iDataSize);
pIconData = HeapReAlloc(GetProcessHeap(), 0, pIconData, iDataSize);
pIconEntry = (CURSORICONFILEDIRENTRY *)(pIconData + 3 * sizeof(WORD));
pIconBitmapHeader = (BITMAPINFOHEADER *)(pIconData + 3 * sizeof(WORD) + sizeof(CURSORICONFILEDIRENTRY));
pIconEntry->dwDIBSize = iDataSize - (3 * sizeof(WORD) + sizeof(CURSORICONFILEDIRENTRY));

View file

@ -647,7 +647,7 @@ SAFEARRAY* WINAPI SafeArrayCreateEx(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsa
/************************************************************************
* SafeArrayCreateVector (OLEAUT32.411)
*
* Create a one dimensional, contigous SafeArray.
* Create a one dimensional, contiguous SafeArray.
*
* PARAMS
* vt [I] Type to store in the safe array
@ -674,7 +674,7 @@ SAFEARRAY* WINAPI SafeArrayCreateVector(VARTYPE vt, LONG lLbound, ULONG cElement
/************************************************************************
* SafeArrayCreateVectorEx (OLEAUT32.411)
*
* Create a one dimensional, contigous SafeArray.
* Create a one dimensional, contiguous SafeArray.
*
* PARAMS
* vt [I] Type to store in the safe array

File diff suppressed because it is too large Load diff

View file

@ -1625,25 +1625,25 @@ MSFT_DoFuncs(TLBContext* pcx,
* member information is stored in a data structure at offset
* indicated by the memoffset field of the typeinfo structure
* There are several distinctive parts.
* the first part starts with a field that holds the total length
* The first part starts with a field that holds the total length
* of this (first) part excluding this field. Then follow the records,
* for each member there is one record.
*
* First entry is always the length of the record (including this
* The first entry is always the length of the record (including this
* length word).
* Rest of the record depends on the type of the member. If there is
* a field indicating the member type (function variable intereface etc)
* The rest of the record depends on the type of the member. If there is
* a field indicating the member type (function, variable, interface, etc)
* I have not found it yet. At this time we depend on the information
* in the type info and the usual order how things are stored.
*
* Second follows an array sized nrMEM*sizeof(INT) with a memeber id
* Second follows an array sized nrMEM*sizeof(INT) with a member id
* for each member;
*
* Third is a equal sized array with file offsets to the name entry
* Third is an equal sized array with file offsets to the name entry
* of each member.
*
* Forth and last (?) part is an array with offsets to the records in the
* first part of this file segment.
* The fourth and last (?) part is an array with offsets to the records
* in the first part of this file segment.
*/
int infolen, nameoffset, reclength, nrattributes, i;
@ -4516,7 +4516,6 @@ _copy_arg( ITypeInfo2 *tinfo, TYPEDESC *tdesc,
DWORD *argpos, VARIANT *arg, VARTYPE vt
) {
UINT arglen = _argsize(vt)*sizeof(DWORD);
VARTYPE oldvt;
VARIANT va;
if ((vt==VT_PTR) && tdesc && (tdesc->u.lptdesc->vt == VT_VARIANT)) {
@ -4650,7 +4649,6 @@ _copy_arg( ITypeInfo2 *tinfo, TYPEDESC *tdesc,
return hres;
}
oldvt = V_VT(arg);
VariantInit(&va);
if (VariantChangeType(&va,arg,0,vt)==S_OK) {
memcpy(argpos,&V_I4(&va), arglen);
@ -4687,7 +4685,7 @@ DispCallFunc(
dump_Variant(prgpvarg[i]);
argsize += _argsize(prgvt[i]);
}
args = (DWORD*)HeapAlloc(GetProcessHeap(),0,sizeof(DWORD)*argsize);
args = HeapAlloc(GetProcessHeap(),0,sizeof(DWORD)*argsize);
args[0] = (DWORD)pvInstance; /* this is the fake IDispatch interface pointer */
argspos = 1;
for (i=0;i<cActuals;i++) {
@ -4760,8 +4758,8 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
}
}
args = (DWORD*)HeapAlloc(GetProcessHeap(),0,sizeof(DWORD)*numargs);
args2 = (DWORD*)HeapAlloc(GetProcessHeap(),0,sizeof(DWORD)*numargs2);
args = HeapAlloc(GetProcessHeap(),0,sizeof(DWORD)*numargs);
args2 = HeapAlloc(GetProcessHeap(),0,sizeof(DWORD)*numargs2);
args[0] = (DWORD)pIUnk;
argspos = 1; args2pos = 0;

View file

@ -169,7 +169,7 @@ typedef struct tagMSFT_ImpInfo {
/* function description data */
typedef struct {
/* INT recsize; record size including some xtra stuff */
INT DataType; /* data type of the memeber, eg return of function */
INT DataType; /* data type of the member, eg return of function */
INT Flags; /* something to do with attribute flags (LOWORD) */
#ifdef WORDS_BIGENDIAN
INT16 funcdescsize; /* size of reconstituted FUNCDESC and related structs */
@ -184,7 +184,7 @@ typedef struct {
/* bit 3 that parameter has default values */
/* calling convention (bits 4-7 ) */
/* bit 8 indicates that custom data is present */
/* Invokation kind (bits 9-12 ) */
/* Invocation kind (bits 9-12 ) */
/* function kind (eg virtual), bits 13-15 */
#ifdef WORDS_BIGENDIAN
INT16 nroargs; /* nr of optional arguments */

View file

@ -3,6 +3,8 @@
*
* Copyright 1998 Jean-Claude Cote
* Copyright 2003 Jon Griffiths
* Copyright 2005 Daniel Remenak
*
* The alorithm for conversion from Julian days to day/month/year is based on
* that devised by Henry Fliegel, as implemented in PostgreSQL, which is
* Copyright 1994-7 Regents of the University of California
@ -3008,11 +3010,13 @@ HRESULT WINAPI VarDiv(LPVARIANT left, LPVARIANT right, LPVARIANT result)
}
switch (resvt) {
case VT_R8:
if (V_R8(&rv) == 0) return DISP_E_DIVBYZERO;
V_VT(result) = resvt;
V_R8(result) = V_R8(&lv) / V_R8(&rv);
rc = S_OK;
break;
case VT_I4:
if (V_I4(&rv) == 0) return DISP_E_DIVBYZERO;
V_VT(result) = resvt;
V_I4(result) = V_I4(&lv) / V_I4(&rv);
rc = S_OK;
@ -4155,9 +4159,57 @@ HRESULT WINAPI VarRound(LPVARIANT pVarIn, int deci, LPVARIANT pVarOut)
return hRet;
}
/**********************************************************************
* VarIdiv [OLEAUT32.153]
*
* Converts input variants to integers and divides them.
*
* PARAMS
* left [I] Left hand variant
* right [I] Right hand variant
* result [O] Destination for quotient
*
* RETURNS
* Success: S_OK. result contains the quotient.
* Failure: An HRESULT error code indicating the error.
*
* NOTES
* If either expression is null, null is returned, as per MSDN
*/
HRESULT WINAPI VarIdiv(LPVARIANT left, LPVARIANT right, LPVARIANT result)
{
VARIANT lv, rv;
HRESULT hr;
VariantInit(&lv);
VariantInit(&rv);
if ((V_VT(left) == VT_NULL) || (V_VT(right) == VT_NULL)) {
hr = VariantChangeType(result, result, 0, VT_NULL);
if (FAILED(hr)) {
/* This should never happen */
FIXME("Failed to convert return value to VT_NULL.\n");
return hr;
}
return S_OK;
}
hr = VariantChangeType(&lv, left, 0, VT_I4);
if (FAILED(hr)) {
return hr;
}
hr = VariantChangeType(&rv, right, 0, VT_I4);
if (FAILED(hr)) {
return hr;
}
hr = VarDiv(&lv, &rv, result);
return hr;
}
/**********************************************************************
* VarMod [OLEAUT32.154]
* VarMod [OLEAUT32.155]
*
* Perform the modulus operation of the right hand variant on the left
*

View file

@ -3990,6 +3990,8 @@ HRESULT WINAPI VarDecFromI4(LONG lIn, DECIMAL* pDecOut)
return S_OK;
}
#define LOCALE_EN_US (MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT))
/************************************************************************
* VarDecFromR4 (OLEAUT32.193)
*
@ -4007,7 +4009,7 @@ HRESULT WINAPI VarDecFromR4(FLOAT fltIn, DECIMAL* pDecOut)
WCHAR buff[256];
sprintfW( buff, szFloatFormatW, fltIn );
return _VarDecFromStr(buff, LOCALE_SYSTEM_DEFAULT, 0, pDecOut);
return _VarDecFromStr(buff, LOCALE_EN_US, 0, pDecOut);
}
/************************************************************************
@ -4027,7 +4029,7 @@ HRESULT WINAPI VarDecFromR8(double dblIn, DECIMAL* pDecOut)
WCHAR buff[256];
sprintfW( buff, szDoubleFormatW, dblIn );
return _VarDecFromStr(buff, LOCALE_USER_DEFAULT, 0, pDecOut);
return _VarDecFromStr(buff, LOCALE_EN_US, 0, pDecOut);
}
/************************************************************************