mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 22:52:54 +00:00
- Sync ole32 and oleaut32 with Wine 1.1.29
svn path=/trunk/; revision=42995
This commit is contained in:
parent
4480f2ca35
commit
1405554792
9 changed files with 105 additions and 511 deletions
|
@ -552,6 +552,7 @@ CompositeMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
|
||||||
IEnumMoniker *enumMoniker1,*enumMoniker2;
|
IEnumMoniker *enumMoniker1,*enumMoniker2;
|
||||||
IMoniker *tempMk1,*tempMk2;
|
IMoniker *tempMk1,*tempMk2;
|
||||||
HRESULT res1,res2,res;
|
HRESULT res1,res2,res;
|
||||||
|
BOOL done;
|
||||||
|
|
||||||
TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
|
TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
|
||||||
|
|
||||||
|
@ -567,27 +568,18 @@ CompositeMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
|
||||||
|
|
||||||
IMoniker_Enum(iface,TRUE,&enumMoniker2);
|
IMoniker_Enum(iface,TRUE,&enumMoniker2);
|
||||||
|
|
||||||
while(1){
|
do {
|
||||||
|
|
||||||
res1=IEnumMoniker_Next(enumMoniker1,1,&tempMk1,NULL);
|
res1=IEnumMoniker_Next(enumMoniker1,1,&tempMk1,NULL);
|
||||||
res2=IEnumMoniker_Next(enumMoniker2,1,&tempMk2,NULL);
|
res2=IEnumMoniker_Next(enumMoniker2,1,&tempMk2,NULL);
|
||||||
|
|
||||||
if((res1==S_OK)&&(res2==S_OK)){
|
if((res1==S_OK)&&(res2==S_OK)){
|
||||||
|
done = (res = IMoniker_IsEqual(tempMk1,tempMk2)) == S_FALSE;
|
||||||
if(IMoniker_IsEqual(tempMk1,tempMk2)==S_FALSE){
|
|
||||||
res= S_FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
else if ( (res1==S_FALSE) && (res2==S_FALSE) ){
|
else
|
||||||
res = S_OK;
|
{
|
||||||
break;
|
res = (res1==S_FALSE) && (res2==S_FALSE);
|
||||||
}
|
done = TRUE;
|
||||||
else{
|
|
||||||
res = S_FALSE;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res1==S_OK)
|
if (res1==S_OK)
|
||||||
|
@ -595,7 +587,7 @@ CompositeMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
|
||||||
|
|
||||||
if (res2==S_OK)
|
if (res2==S_OK)
|
||||||
IMoniker_Release(tempMk2);
|
IMoniker_Release(tempMk2);
|
||||||
}
|
} while (!done);
|
||||||
|
|
||||||
IEnumMoniker_Release(enumMoniker1);
|
IEnumMoniker_Release(enumMoniker1);
|
||||||
IEnumMoniker_Release(enumMoniker2);
|
IEnumMoniker_Release(enumMoniker2);
|
||||||
|
@ -989,12 +981,12 @@ static VOID GetAfterCommonPrefix(IMoniker* pGenMk,IMoniker* commonMk,IMoniker**
|
||||||
nbRestMk++;
|
nbRestMk++;
|
||||||
|
|
||||||
IMoniker_Release(tempMk1);
|
IMoniker_Release(tempMk1);
|
||||||
IMoniker_Release(tempMk1);
|
IMoniker_Release(tempMk2);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
IMoniker_Release(tempMk1);
|
IMoniker_Release(tempMk1);
|
||||||
IMoniker_Release(tempMk1);
|
IMoniker_Release(tempMk2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -397,7 +397,7 @@ static HRESULT WINAPI HGLOBALStreamImpl_Seek(
|
||||||
*/
|
*/
|
||||||
if (dlibMove.QuadPart < 0 && newPosition.QuadPart < -dlibMove.QuadPart) return STG_E_INVALIDFUNCTION;
|
if (dlibMove.QuadPart < 0 && newPosition.QuadPart < -dlibMove.QuadPart) return STG_E_INVALIDFUNCTION;
|
||||||
|
|
||||||
newPosition.QuadPart = RtlLargeIntegerAdd(newPosition.QuadPart, dlibMove.QuadPart);
|
newPosition.QuadPart += dlibMove.QuadPart;
|
||||||
|
|
||||||
if (plibNewPosition) *plibNewPosition = newPosition;
|
if (plibNewPosition) *plibNewPosition = newPosition;
|
||||||
This->currentPosition = newPosition;
|
This->currentPosition = newPosition;
|
||||||
|
|
|
@ -128,3 +128,12 @@ HRESULT WINAPI CoGetCallerTID(LPDWORD lpdwTID)
|
||||||
FIXME("stub!\n");
|
FIXME("stub!\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* CoGetCurrentLogicalThreadId [OLE32.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *pguid)
|
||||||
|
{
|
||||||
|
FIXME(": stub\n");
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
@ stdcall CoGetCallerTID(ptr)
|
@ stdcall CoGetCallerTID(ptr)
|
||||||
@ stdcall CoGetClassObject(ptr long ptr ptr ptr)
|
@ stdcall CoGetClassObject(ptr long ptr ptr ptr)
|
||||||
@ stdcall CoGetContextToken(ptr)
|
@ stdcall CoGetContextToken(ptr)
|
||||||
@ stub CoGetCurrentLogicalThreadId
|
@ stdcall CoGetCurrentLogicalThreadId(ptr)
|
||||||
@ stdcall CoGetCurrentProcess()
|
@ stdcall CoGetCurrentProcess()
|
||||||
@ stub CoGetInstanceFromFile #@ stdcall (ptr ptr ptr long wstr long ptr) return 0,ERR_NOTIMPLEMENTED
|
@ stub CoGetInstanceFromFile #@ stdcall (ptr ptr ptr long wstr long ptr) return 0,ERR_NOTIMPLEMENTED
|
||||||
@ stub CoGetInstanceFromIStorage #@ stdcall (ptr ptr ptr long ptr long ptr) return 0,ERR_NOTIMPLEMENTED
|
@ stub CoGetInstanceFromIStorage #@ stdcall (ptr ptr ptr long ptr long ptr) return 0,ERR_NOTIMPLEMENTED
|
||||||
|
|
|
@ -977,7 +977,7 @@ static void PropertyStorage_ByteSwapString(LPWSTR str, size_t len)
|
||||||
* FIXME: alignment?
|
* FIXME: alignment?
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
str[i] = le16toh(str[i]);
|
str[i] = lendian16toh(str[i]);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define PropertyStorage_ByteSwapString(s, l)
|
#define PropertyStorage_ByteSwapString(s, l)
|
||||||
|
|
|
@ -522,7 +522,7 @@ static HRESULT WINAPI StgStreamImpl_Seek(
|
||||||
return STG_E_INVALIDFUNCTION;
|
return STG_E_INVALIDFUNCTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
plibNewPosition->QuadPart = RtlLargeIntegerAdd( plibNewPosition->QuadPart, dlibMove.QuadPart );
|
plibNewPosition->QuadPart += dlibMove.QuadPart;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* tell the caller what we calculated
|
* tell the caller what we calculated
|
||||||
|
|
|
@ -3563,7 +3563,7 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
|
||||||
{
|
{
|
||||||
resRead = SmallBlockChainStream_ReadAt(*ppsbChain,
|
resRead = SmallBlockChainStream_ReadAt(*ppsbChain,
|
||||||
offset,
|
offset,
|
||||||
This->smallBlockSize,
|
min(This->smallBlockSize, size.u.LowPart - offset.u.LowPart),
|
||||||
buffer,
|
buffer,
|
||||||
&cbRead);
|
&cbRead);
|
||||||
if (FAILED(resRead))
|
if (FAILED(resRead))
|
||||||
|
@ -3582,7 +3582,7 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
|
||||||
if (FAILED(resWrite))
|
if (FAILED(resWrite))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
offset.u.LowPart += This->smallBlockSize;
|
offset.u.LowPart += cbRead;
|
||||||
}
|
}
|
||||||
} while (cbTotalRead.QuadPart < size.QuadPart);
|
} while (cbTotalRead.QuadPart < size.QuadPart);
|
||||||
HeapFree(GetProcessHeap(),0,buffer);
|
HeapFree(GetProcessHeap(),0,buffer);
|
||||||
|
@ -3663,7 +3663,8 @@ SmallBlockChainStream* Storage32Impl_BigBlocksToSmallBlocks(
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
resRead = BlockChainStream_ReadAt(*ppbbChain, offset,
|
resRead = BlockChainStream_ReadAt(*ppbbChain, offset,
|
||||||
This->bigBlockSize, buffer, &cbRead);
|
min(This->bigBlockSize, size.u.LowPart - offset.u.LowPart),
|
||||||
|
buffer, &cbRead);
|
||||||
|
|
||||||
if(FAILED(resRead))
|
if(FAILED(resRead))
|
||||||
break;
|
break;
|
||||||
|
@ -3678,7 +3679,7 @@ SmallBlockChainStream* Storage32Impl_BigBlocksToSmallBlocks(
|
||||||
if(FAILED(resWrite))
|
if(FAILED(resWrite))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
offset.u.LowPart += This->bigBlockSize;
|
offset.u.LowPart += cbRead;
|
||||||
}
|
}
|
||||||
}while(cbTotalRead.QuadPart < size.QuadPart);
|
}while(cbTotalRead.QuadPart < size.QuadPart);
|
||||||
HeapFree(GetProcessHeap(), 0, buffer);
|
HeapFree(GetProcessHeap(), 0, buffer);
|
||||||
|
@ -5917,7 +5918,7 @@ HRESULT WINAPI StgCreateDocfile(
|
||||||
*/
|
*/
|
||||||
hr = StorageBaseImpl_QueryInterface(
|
hr = StorageBaseImpl_QueryInterface(
|
||||||
(IStorage*)newStorage,
|
(IStorage*)newStorage,
|
||||||
(REFIID)&IID_IStorage,
|
&IID_IStorage,
|
||||||
(void**)ppstgOpen);
|
(void**)ppstgOpen);
|
||||||
end:
|
end:
|
||||||
TRACE("<-- %p r = %08x\n", *ppstgOpen, hr);
|
TRACE("<-- %p r = %08x\n", *ppstgOpen, hr);
|
||||||
|
@ -6221,7 +6222,7 @@ HRESULT WINAPI StgOpenStorage(
|
||||||
*/
|
*/
|
||||||
hr = StorageBaseImpl_QueryInterface(
|
hr = StorageBaseImpl_QueryInterface(
|
||||||
(IStorage*)newStorage,
|
(IStorage*)newStorage,
|
||||||
(REFIID)&IID_IStorage,
|
&IID_IStorage,
|
||||||
(void**)ppstgOpen);
|
(void**)ppstgOpen);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
@ -6275,7 +6276,7 @@ HRESULT WINAPI StgCreateDocfileOnILockBytes(
|
||||||
*/
|
*/
|
||||||
hr = StorageBaseImpl_QueryInterface(
|
hr = StorageBaseImpl_QueryInterface(
|
||||||
(IStorage*)newStorage,
|
(IStorage*)newStorage,
|
||||||
(REFIID)&IID_IStorage,
|
&IID_IStorage,
|
||||||
(void**)ppstgOpen);
|
(void**)ppstgOpen);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -6340,7 +6341,7 @@ HRESULT WINAPI StgOpenStorageOnILockBytes(
|
||||||
*/
|
*/
|
||||||
hr = StorageBaseImpl_QueryInterface(
|
hr = StorageBaseImpl_QueryInterface(
|
||||||
(IStorage*)newStorage,
|
(IStorage*)newStorage,
|
||||||
(REFIID)&IID_IStorage,
|
&IID_IStorage,
|
||||||
(void**)ppstgOpen);
|
(void**)ppstgOpen);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -7192,9 +7193,9 @@ static HRESULT STORAGE_WriteCompObj( LPSTORAGE pstg, CLSID *clsid,
|
||||||
debugstr_w(lpszUserType), debugstr_w(szClipName),
|
debugstr_w(lpszUserType), debugstr_w(szClipName),
|
||||||
debugstr_w(szProgIDName));
|
debugstr_w(szProgIDName));
|
||||||
|
|
||||||
/* Create a CompObj stream if it doesn't exist */
|
/* Create a CompObj stream */
|
||||||
r = IStorage_CreateStream(pstg, szwStreamName,
|
r = IStorage_CreateStream(pstg, szwStreamName,
|
||||||
STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pstm );
|
STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pstm );
|
||||||
if( FAILED (r) )
|
if( FAILED (r) )
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|
|
@ -46,28 +46,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef SONAME_LIBJPEG
|
|
||||||
/* This is a hack, so jpeglib.h does not redefine INT32 and the like*/
|
|
||||||
#define XMD_H
|
|
||||||
#define UINT8 JPEG_UINT8
|
|
||||||
#define UINT16 JPEG_UINT16
|
|
||||||
#define boolean jpeg_boolean
|
|
||||||
#undef HAVE_STDLIB_H
|
|
||||||
# include <jpeglib.h>
|
|
||||||
#undef HAVE_STDLIB_H
|
|
||||||
#define HAVE_STDLIB_H 1
|
|
||||||
#undef UINT8
|
|
||||||
#undef UINT16
|
|
||||||
#undef boolean
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_PNG_H
|
|
||||||
#include <png.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Must be before wine includes, the header has things conflicting with
|
|
||||||
* WINE headers.
|
|
||||||
*/
|
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
#define NONAMELESSUNION
|
#define NONAMELESSUNION
|
||||||
#define NONAMELESSSTRUCT
|
#define NONAMELESSSTRUCT
|
||||||
|
@ -1002,167 +980,6 @@ static HRESULT WINAPI OLEPictureImpl_IsDirty(
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SONAME_LIBJPEG
|
|
||||||
|
|
||||||
static void *libjpeg_handle;
|
|
||||||
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
|
|
||||||
MAKE_FUNCPTR(jpeg_std_error);
|
|
||||||
MAKE_FUNCPTR(jpeg_CreateDecompress);
|
|
||||||
MAKE_FUNCPTR(jpeg_read_header);
|
|
||||||
MAKE_FUNCPTR(jpeg_start_decompress);
|
|
||||||
MAKE_FUNCPTR(jpeg_read_scanlines);
|
|
||||||
MAKE_FUNCPTR(jpeg_finish_decompress);
|
|
||||||
MAKE_FUNCPTR(jpeg_destroy_decompress);
|
|
||||||
#undef MAKE_FUNCPTR
|
|
||||||
|
|
||||||
static void *load_libjpeg(void)
|
|
||||||
{
|
|
||||||
if((libjpeg_handle = wine_dlopen(SONAME_LIBJPEG, RTLD_NOW, NULL, 0)) != NULL) {
|
|
||||||
|
|
||||||
#define LOAD_FUNCPTR(f) \
|
|
||||||
if((p##f = wine_dlsym(libjpeg_handle, #f, NULL, 0)) == NULL) { \
|
|
||||||
libjpeg_handle = NULL; \
|
|
||||||
return NULL; \
|
|
||||||
}
|
|
||||||
|
|
||||||
LOAD_FUNCPTR(jpeg_std_error);
|
|
||||||
LOAD_FUNCPTR(jpeg_CreateDecompress);
|
|
||||||
LOAD_FUNCPTR(jpeg_read_header);
|
|
||||||
LOAD_FUNCPTR(jpeg_start_decompress);
|
|
||||||
LOAD_FUNCPTR(jpeg_read_scanlines);
|
|
||||||
LOAD_FUNCPTR(jpeg_finish_decompress);
|
|
||||||
LOAD_FUNCPTR(jpeg_destroy_decompress);
|
|
||||||
#undef LOAD_FUNCPTR
|
|
||||||
}
|
|
||||||
return libjpeg_handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* for the jpeg decompressor source manager. */
|
|
||||||
static void _jpeg_init_source(j_decompress_ptr cinfo) { }
|
|
||||||
|
|
||||||
static jpeg_boolean _jpeg_fill_input_buffer(j_decompress_ptr cinfo) {
|
|
||||||
ERR("(), should not get here.\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _jpeg_skip_input_data(j_decompress_ptr cinfo,long num_bytes) {
|
|
||||||
TRACE("Skipping %ld bytes...\n", num_bytes);
|
|
||||||
cinfo->src->next_input_byte += num_bytes;
|
|
||||||
cinfo->src->bytes_in_buffer -= num_bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
static jpeg_boolean _jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired) {
|
|
||||||
ERR("(desired=%d), should not get here.\n",desired);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
static void _jpeg_term_source(j_decompress_ptr cinfo) { }
|
|
||||||
#endif /* SONAME_LIBJPEG */
|
|
||||||
|
|
||||||
static HRESULT OLEPictureImpl_LoadJpeg(OLEPictureImpl *This, BYTE *xbuf, ULONG xread)
|
|
||||||
{
|
|
||||||
#ifdef SONAME_LIBJPEG
|
|
||||||
struct jpeg_decompress_struct jd;
|
|
||||||
struct jpeg_error_mgr jerr;
|
|
||||||
int ret;
|
|
||||||
JDIMENSION x;
|
|
||||||
JSAMPROW samprow,oldsamprow;
|
|
||||||
BITMAPINFOHEADER bmi;
|
|
||||||
LPBYTE bits;
|
|
||||||
HDC hdcref;
|
|
||||||
struct jpeg_source_mgr xjsm;
|
|
||||||
LPBYTE oldbits;
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
if(!libjpeg_handle) {
|
|
||||||
if(!load_libjpeg()) {
|
|
||||||
ERR("Failed reading JPEG because unable to find %s\n", SONAME_LIBJPEG);
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is basically so we can use in-memory data for jpeg decompression.
|
|
||||||
* We need to have all the functions.
|
|
||||||
*/
|
|
||||||
xjsm.next_input_byte = xbuf;
|
|
||||||
xjsm.bytes_in_buffer = xread;
|
|
||||||
xjsm.init_source = _jpeg_init_source;
|
|
||||||
xjsm.fill_input_buffer = _jpeg_fill_input_buffer;
|
|
||||||
xjsm.skip_input_data = _jpeg_skip_input_data;
|
|
||||||
xjsm.resync_to_restart = _jpeg_resync_to_restart;
|
|
||||||
xjsm.term_source = _jpeg_term_source;
|
|
||||||
|
|
||||||
jd.err = pjpeg_std_error(&jerr);
|
|
||||||
/* jpeg_create_decompress is a macro that expands to jpeg_CreateDecompress - see jpeglib.h
|
|
||||||
* jpeg_create_decompress(&jd); */
|
|
||||||
pjpeg_CreateDecompress(&jd, JPEG_LIB_VERSION, sizeof(struct jpeg_decompress_struct));
|
|
||||||
jd.src = &xjsm;
|
|
||||||
ret=pjpeg_read_header(&jd,TRUE);
|
|
||||||
jd.out_color_space = JCS_RGB;
|
|
||||||
pjpeg_start_decompress(&jd);
|
|
||||||
if (ret != JPEG_HEADER_OK) {
|
|
||||||
ERR("Jpeg image in stream has bad format, read header returned %d.\n",ret);
|
|
||||||
HeapFree(GetProcessHeap(),0,xbuf);
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bits = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
|
|
||||||
(jd.output_height+1) * ((jd.output_width*jd.output_components + 3) & ~3) );
|
|
||||||
samprow=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,jd.output_width*jd.output_components);
|
|
||||||
|
|
||||||
oldbits = bits;
|
|
||||||
oldsamprow = samprow;
|
|
||||||
while ( jd.output_scanline<jd.output_height ) {
|
|
||||||
x = pjpeg_read_scanlines(&jd,&samprow,1);
|
|
||||||
if (x != 1) {
|
|
||||||
ERR("failed to read current scanline?\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* We have to convert from RGB to BGR, see MSDN/ BITMAPINFOHEADER */
|
|
||||||
for(i=0;i<jd.output_width;i++,samprow+=jd.output_components) {
|
|
||||||
*(bits++) = *(samprow+2);
|
|
||||||
*(bits++) = *(samprow+1);
|
|
||||||
*(bits++) = *(samprow);
|
|
||||||
}
|
|
||||||
bits = (LPBYTE)(((UINT_PTR)bits + 3) & ~3);
|
|
||||||
samprow = oldsamprow;
|
|
||||||
}
|
|
||||||
bits = oldbits;
|
|
||||||
|
|
||||||
bmi.biSize = sizeof(bmi);
|
|
||||||
bmi.biWidth = jd.output_width;
|
|
||||||
bmi.biHeight = -jd.output_height;
|
|
||||||
bmi.biPlanes = 1;
|
|
||||||
bmi.biBitCount = jd.output_components<<3;
|
|
||||||
bmi.biCompression = BI_RGB;
|
|
||||||
bmi.biSizeImage = jd.output_height*jd.output_width*jd.output_components;
|
|
||||||
bmi.biXPelsPerMeter = 0;
|
|
||||||
bmi.biYPelsPerMeter = 0;
|
|
||||||
bmi.biClrUsed = 0;
|
|
||||||
bmi.biClrImportant = 0;
|
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(),0,samprow);
|
|
||||||
pjpeg_finish_decompress(&jd);
|
|
||||||
pjpeg_destroy_decompress(&jd);
|
|
||||||
hdcref = GetDC(0);
|
|
||||||
This->desc.u.bmp.hbitmap=CreateDIBitmap(
|
|
||||||
hdcref,
|
|
||||||
&bmi,
|
|
||||||
CBM_INIT,
|
|
||||||
bits,
|
|
||||||
(BITMAPINFO*)&bmi,
|
|
||||||
DIB_RGB_COLORS
|
|
||||||
);
|
|
||||||
ReleaseDC(0, hdcref);
|
|
||||||
This->desc.picType = PICTYPE_BITMAP;
|
|
||||||
OLEPictureImpl_SetBitmap(This);
|
|
||||||
HeapFree(GetProcessHeap(),0,bits);
|
|
||||||
return S_OK;
|
|
||||||
#else
|
|
||||||
ERR("Trying to load JPEG picture, but JPEG supported not compiled in.\n");
|
|
||||||
return E_FAIL;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT OLEPictureImpl_LoadDIB(OLEPictureImpl *This, BYTE *xbuf, ULONG xread)
|
static HRESULT OLEPictureImpl_LoadDIB(OLEPictureImpl *This, BYTE *xbuf, ULONG xread)
|
||||||
{
|
{
|
||||||
BITMAPFILEHEADER *bfh = (BITMAPFILEHEADER*)xbuf;
|
BITMAPFILEHEADER *bfh = (BITMAPFILEHEADER*)xbuf;
|
||||||
|
@ -1319,300 +1136,54 @@ end:
|
||||||
static HRESULT OLEPictureImpl_LoadWICDecoder(OLEPictureImpl *This, REFCLSID decoder_clsid, BYTE *xbuf, ULONG xread)
|
static HRESULT OLEPictureImpl_LoadWICDecoder(OLEPictureImpl *This, REFCLSID decoder_clsid, BYTE *xbuf, ULONG xread)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
IWICImagingFactory *factory;
|
||||||
IWICBitmapDecoder *decoder;
|
IWICBitmapDecoder *decoder;
|
||||||
IWICBitmapFrameDecode *framedecode;
|
IWICBitmapFrameDecode *framedecode;
|
||||||
HRESULT initresult;
|
HRESULT initresult;
|
||||||
HGLOBAL hdata;
|
IWICStream *stream;
|
||||||
BYTE *data;
|
|
||||||
IStream *stream;
|
|
||||||
|
|
||||||
hdata = GlobalAlloc(GMEM_MOVEABLE, xread);
|
|
||||||
if (!hdata) return E_OUTOFMEMORY;
|
|
||||||
|
|
||||||
data = GlobalLock(hdata);
|
|
||||||
memcpy(data, xbuf, xread);
|
|
||||||
GlobalUnlock(hdata);
|
|
||||||
|
|
||||||
hr = CreateStreamOnHGlobal(hdata, TRUE, &stream);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
GlobalFree(hdata);
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
initresult = CoInitialize(NULL);
|
initresult = CoInitialize(NULL);
|
||||||
|
|
||||||
hr = CoCreateInstance(decoder_clsid, NULL, CLSCTX_INPROC_SERVER,
|
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
|
||||||
&IID_IWICBitmapDecoder, (void**)&decoder);
|
&IID_IWICImagingFactory, (void**)&factory);
|
||||||
if (FAILED(hr)) goto end;
|
if (SUCCEEDED(hr)) /* created factory */
|
||||||
|
|
||||||
hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnLoad);
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
{
|
||||||
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
|
hr = IWICImagingFactory_CreateStream(factory, &stream);
|
||||||
if (SUCCEEDED(hr))
|
IWICImagingFactory_Release(factory);
|
||||||
{
|
|
||||||
hr = OLEPictureImpl_LoadWICSource(This, (IWICBitmapSource*)framedecode);
|
|
||||||
IWICBitmapFrameDecode_Release(framedecode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IWICBitmapDecoder_Release(decoder);
|
if (SUCCEEDED(hr)) /* created stream */
|
||||||
|
{
|
||||||
|
hr = IWICStream_InitializeFromMemory(stream, xbuf, xread);
|
||||||
|
|
||||||
|
if (SUCCEEDED(hr)) /* initialized stream */
|
||||||
|
{
|
||||||
|
hr = CoCreateInstance(decoder_clsid, NULL, CLSCTX_INPROC_SERVER,
|
||||||
|
&IID_IWICBitmapDecoder, (void**)&decoder);
|
||||||
|
if (SUCCEEDED(hr)) /* created decoder */
|
||||||
|
{
|
||||||
|
hr = IWICBitmapDecoder_Initialize(decoder, (IStream*)stream, WICDecodeMetadataCacheOnLoad);
|
||||||
|
|
||||||
|
if (SUCCEEDED(hr)) /* initialized decoder */
|
||||||
|
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
|
||||||
|
|
||||||
|
IWICBitmapDecoder_Release(decoder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IWICStream_Release(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SUCCEEDED(hr)) /* got framedecode */
|
||||||
|
{
|
||||||
|
hr = OLEPictureImpl_LoadWICSource(This, (IWICBitmapSource*)framedecode);
|
||||||
|
IWICBitmapFrameDecode_Release(framedecode);
|
||||||
|
}
|
||||||
|
|
||||||
end:
|
|
||||||
IStream_Release(stream);
|
|
||||||
if (SUCCEEDED(initresult)) CoUninitialize();
|
if (SUCCEEDED(initresult)) CoUninitialize();
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************
|
|
||||||
* start of PNG-specific code
|
|
||||||
* currently only supports colortype PNG_COLOR_TYPE_RGB
|
|
||||||
*/
|
|
||||||
#ifdef SONAME_LIBPNG
|
|
||||||
typedef struct{
|
|
||||||
ULONG position;
|
|
||||||
ULONG size;
|
|
||||||
BYTE * buff;
|
|
||||||
} png_io;
|
|
||||||
|
|
||||||
static void png_stream_read_data(png_structp png_ptr, png_bytep data,
|
|
||||||
png_size_t length)
|
|
||||||
{
|
|
||||||
png_io * io_ptr = png_ptr->io_ptr;
|
|
||||||
|
|
||||||
if(length + io_ptr->position > io_ptr->size){
|
|
||||||
length = io_ptr->size - io_ptr->position;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(data, io_ptr->buff + io_ptr->position, length);
|
|
||||||
|
|
||||||
io_ptr->position += length;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *libpng_handle;
|
|
||||||
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
|
|
||||||
MAKE_FUNCPTR(png_create_read_struct);
|
|
||||||
MAKE_FUNCPTR(png_create_info_struct);
|
|
||||||
MAKE_FUNCPTR(png_set_read_fn);
|
|
||||||
MAKE_FUNCPTR(png_read_info);
|
|
||||||
MAKE_FUNCPTR(png_read_image);
|
|
||||||
MAKE_FUNCPTR(png_get_rowbytes);
|
|
||||||
MAKE_FUNCPTR(png_set_bgr);
|
|
||||||
MAKE_FUNCPTR(png_destroy_read_struct);
|
|
||||||
MAKE_FUNCPTR(png_set_palette_to_rgb);
|
|
||||||
MAKE_FUNCPTR(png_read_update_info);
|
|
||||||
MAKE_FUNCPTR(png_get_tRNS);
|
|
||||||
MAKE_FUNCPTR(png_get_PLTE);
|
|
||||||
MAKE_FUNCPTR(png_set_expand);
|
|
||||||
#undef MAKE_FUNCPTR
|
|
||||||
|
|
||||||
static void *load_libpng(void)
|
|
||||||
{
|
|
||||||
if((libpng_handle = wine_dlopen(SONAME_LIBPNG, RTLD_NOW, NULL, 0)) != NULL) {
|
|
||||||
|
|
||||||
#define LOAD_FUNCPTR(f) \
|
|
||||||
if((p##f = wine_dlsym(libpng_handle, #f, NULL, 0)) == NULL) { \
|
|
||||||
libpng_handle = NULL; \
|
|
||||||
return NULL; \
|
|
||||||
}
|
|
||||||
LOAD_FUNCPTR(png_create_read_struct);
|
|
||||||
LOAD_FUNCPTR(png_create_info_struct);
|
|
||||||
LOAD_FUNCPTR(png_set_read_fn);
|
|
||||||
LOAD_FUNCPTR(png_read_info);
|
|
||||||
LOAD_FUNCPTR(png_read_image);
|
|
||||||
LOAD_FUNCPTR(png_get_rowbytes);
|
|
||||||
LOAD_FUNCPTR(png_set_bgr);
|
|
||||||
LOAD_FUNCPTR(png_destroy_read_struct);
|
|
||||||
LOAD_FUNCPTR(png_set_palette_to_rgb);
|
|
||||||
LOAD_FUNCPTR(png_read_update_info);
|
|
||||||
LOAD_FUNCPTR(png_get_tRNS);
|
|
||||||
LOAD_FUNCPTR(png_get_PLTE);
|
|
||||||
LOAD_FUNCPTR(png_set_expand);
|
|
||||||
|
|
||||||
#undef LOAD_FUNCPTR
|
|
||||||
}
|
|
||||||
return libpng_handle;
|
|
||||||
}
|
|
||||||
#endif /* SONAME_LIBPNG */
|
|
||||||
|
|
||||||
static HRESULT OLEPictureImpl_LoadPNG(OLEPictureImpl *This, BYTE *xbuf, ULONG xread)
|
|
||||||
{
|
|
||||||
#ifdef SONAME_LIBPNG
|
|
||||||
png_io io;
|
|
||||||
png_structp png_ptr = NULL;
|
|
||||||
png_infop info_ptr = NULL;
|
|
||||||
INT row, rowsize, height, width, num_trans, i, j;
|
|
||||||
png_bytep* row_pointers = NULL;
|
|
||||||
png_bytep pngdata = NULL;
|
|
||||||
BITMAPINFOHEADER bmi;
|
|
||||||
HDC hdcref = NULL, hdcXor, hdcMask;
|
|
||||||
HRESULT ret;
|
|
||||||
BOOL transparency;
|
|
||||||
png_bytep trans;
|
|
||||||
png_color_16p trans_values;
|
|
||||||
COLORREF white = RGB(255, 255, 255), black = RGB(0, 0, 0);
|
|
||||||
HBITMAP hbmoldXor, hbmoldMask, temp;
|
|
||||||
|
|
||||||
if(!libpng_handle) {
|
|
||||||
if(!load_libpng()) {
|
|
||||||
ERR("Failed reading PNG because unable to find %s\n",SONAME_LIBPNG);
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
io.size = xread;
|
|
||||||
io.position = 0;
|
|
||||||
io.buff = xbuf;
|
|
||||||
|
|
||||||
png_ptr = ppng_create_read_struct(PNG_LIBPNG_VER_STRING,
|
|
||||||
NULL, NULL, NULL);
|
|
||||||
|
|
||||||
if(setjmp(png_jmpbuf(png_ptr))){
|
|
||||||
TRACE("Error in libpng\n");
|
|
||||||
ret = E_FAIL;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
info_ptr = ppng_create_info_struct(png_ptr);
|
|
||||||
ppng_set_read_fn(png_ptr, &io, png_stream_read_data);
|
|
||||||
ppng_read_info(png_ptr, info_ptr);
|
|
||||||
|
|
||||||
if(!(png_ptr->color_type == PNG_COLOR_TYPE_RGB ||
|
|
||||||
png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
|
|
||||||
png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)){
|
|
||||||
FIXME("Unsupported .PNG type: %d\n", png_ptr->color_type);
|
|
||||||
ret = E_FAIL;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
transparency = (ppng_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &trans_values)
|
|
||||||
== PNG_INFO_tRNS);
|
|
||||||
|
|
||||||
/* sets format from anything to RGBA */
|
|
||||||
ppng_set_expand(png_ptr);
|
|
||||||
/* sets format to BGRA */
|
|
||||||
ppng_set_bgr(png_ptr);
|
|
||||||
|
|
||||||
ppng_read_update_info(png_ptr, info_ptr);
|
|
||||||
|
|
||||||
rowsize = ppng_get_rowbytes(png_ptr, info_ptr);
|
|
||||||
/* align rowsize to 4-byte boundary */
|
|
||||||
rowsize = (rowsize + 3) & ~3;
|
|
||||||
height = info_ptr->height;
|
|
||||||
width = info_ptr->width;
|
|
||||||
|
|
||||||
pngdata = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, height * rowsize);
|
|
||||||
row_pointers = HeapAlloc(GetProcessHeap(), 0, height * (sizeof(VOID *)));
|
|
||||||
|
|
||||||
if(!pngdata || !row_pointers){
|
|
||||||
ret = E_FAIL;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (row = 0; row < height; row++){
|
|
||||||
row_pointers[row] = pngdata + row * rowsize;
|
|
||||||
}
|
|
||||||
|
|
||||||
ppng_read_image(png_ptr, row_pointers);
|
|
||||||
|
|
||||||
bmi.biSize = sizeof(bmi);
|
|
||||||
bmi.biWidth = width;
|
|
||||||
bmi.biHeight = -height;
|
|
||||||
bmi.biPlanes = 1;
|
|
||||||
bmi.biBitCount = info_ptr->channels * 8;
|
|
||||||
bmi.biCompression = BI_RGB;
|
|
||||||
bmi.biSizeImage = height * rowsize;
|
|
||||||
bmi.biXPelsPerMeter = 0;
|
|
||||||
bmi.biYPelsPerMeter = 0;
|
|
||||||
bmi.biClrUsed = 0;
|
|
||||||
bmi.biClrImportant = 0;
|
|
||||||
|
|
||||||
hdcref = GetDC(0);
|
|
||||||
This->desc.u.bmp.hbitmap = CreateDIBitmap(
|
|
||||||
hdcref,
|
|
||||||
&bmi,
|
|
||||||
CBM_INIT,
|
|
||||||
pngdata,
|
|
||||||
(BITMAPINFO*)&bmi,
|
|
||||||
DIB_RGB_COLORS
|
|
||||||
);
|
|
||||||
|
|
||||||
/* only fully-transparent alpha is handled */
|
|
||||||
if((info_ptr->channels != 4) || !transparency){
|
|
||||||
ReleaseDC(0, hdcref);
|
|
||||||
goto succ;
|
|
||||||
}
|
|
||||||
|
|
||||||
This->hbmXor = CreateDIBitmap(
|
|
||||||
hdcref,
|
|
||||||
&bmi,
|
|
||||||
CBM_INIT,
|
|
||||||
pngdata,
|
|
||||||
(BITMAPINFO*)&bmi,
|
|
||||||
DIB_RGB_COLORS
|
|
||||||
);
|
|
||||||
|
|
||||||
/* set transparent pixels to black, all others to white */
|
|
||||||
for(i = 0; i < height; i++){
|
|
||||||
for(j = 3; j < rowsize; j += 4){
|
|
||||||
if(row_pointers[i][j] == 0)
|
|
||||||
*((DWORD*)(&row_pointers[i][j - 3])) = black;
|
|
||||||
else
|
|
||||||
*((DWORD*)(&row_pointers[i][j - 3])) = white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
temp = CreateDIBitmap(
|
|
||||||
hdcref,
|
|
||||||
&bmi,
|
|
||||||
CBM_INIT,
|
|
||||||
pngdata,
|
|
||||||
(BITMAPINFO*)&bmi,
|
|
||||||
DIB_RGB_COLORS
|
|
||||||
);
|
|
||||||
|
|
||||||
ReleaseDC(0, hdcref);
|
|
||||||
|
|
||||||
This->hbmMask = CreateBitmap(width,-height,1,1,NULL);
|
|
||||||
hdcXor = CreateCompatibleDC(NULL);
|
|
||||||
hdcMask = CreateCompatibleDC(NULL);
|
|
||||||
|
|
||||||
hbmoldXor = SelectObject(hdcXor,temp);
|
|
||||||
hbmoldMask = SelectObject(hdcMask,This->hbmMask);
|
|
||||||
SetBkColor(hdcXor,black);
|
|
||||||
BitBlt(hdcMask,0,0,width,height,hdcXor,0,0,SRCCOPY);
|
|
||||||
|
|
||||||
SelectObject(hdcXor,This->hbmXor);
|
|
||||||
DeleteObject(temp);
|
|
||||||
|
|
||||||
SetTextColor(hdcXor,white);
|
|
||||||
SetBkColor(hdcXor,black);
|
|
||||||
BitBlt(hdcXor,0,0,width,height,hdcMask,0,0,SRCAND);
|
|
||||||
|
|
||||||
SelectObject(hdcXor,hbmoldXor);
|
|
||||||
SelectObject(hdcMask,hbmoldMask);
|
|
||||||
|
|
||||||
DeleteDC(hdcXor);
|
|
||||||
DeleteDC(hdcMask);
|
|
||||||
|
|
||||||
succ:
|
|
||||||
This->desc.picType = PICTYPE_BITMAP;
|
|
||||||
OLEPictureImpl_SetBitmap(This);
|
|
||||||
ret = S_OK;
|
|
||||||
|
|
||||||
end:
|
|
||||||
if(png_ptr)
|
|
||||||
ppng_destroy_read_struct(&png_ptr, info_ptr ? &info_ptr : NULL, NULL);
|
|
||||||
HeapFree(GetProcessHeap(), 0, row_pointers);
|
|
||||||
HeapFree(GetProcessHeap(), 0, pngdata);
|
|
||||||
return ret;
|
|
||||||
#else /* SONAME_LIBPNG */
|
|
||||||
ERR("Trying to load PNG picture, but PNG supported not compiled in.\n");
|
|
||||||
return E_FAIL;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
* start of Icon-specific code
|
* start of Icon-specific code
|
||||||
*/
|
*/
|
||||||
|
@ -1889,13 +1460,13 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
|
||||||
hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICGifDecoder, xbuf, xread);
|
hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICGifDecoder, xbuf, xread);
|
||||||
break;
|
break;
|
||||||
case BITMAP_FORMAT_JPEG: /* JPEG */
|
case BITMAP_FORMAT_JPEG: /* JPEG */
|
||||||
hr = OLEPictureImpl_LoadJpeg(This, xbuf, xread);
|
hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICJpegDecoder, xbuf, xread);
|
||||||
break;
|
break;
|
||||||
case BITMAP_FORMAT_BMP: /* Bitmap */
|
case BITMAP_FORMAT_BMP: /* Bitmap */
|
||||||
hr = OLEPictureImpl_LoadDIB(This, xbuf, xread);
|
hr = OLEPictureImpl_LoadDIB(This, xbuf, xread);
|
||||||
break;
|
break;
|
||||||
case BITMAP_FORMAT_PNG: /* PNG */
|
case BITMAP_FORMAT_PNG: /* PNG */
|
||||||
hr = OLEPictureImpl_LoadPNG(This, xbuf, xread);
|
hr = OLEPictureImpl_LoadWICDecoder(This, &CLSID_WICPngDecoder, xbuf, xread);
|
||||||
break;
|
break;
|
||||||
case BITMAP_FORMAT_APM: /* APM */
|
case BITMAP_FORMAT_APM: /* APM */
|
||||||
hr = OLEPictureImpl_LoadAPM(This, xbuf, xread);
|
hr = OLEPictureImpl_LoadAPM(This, xbuf, xread);
|
||||||
|
|
|
@ -930,6 +930,7 @@ typedef struct tagITypeLibImpl
|
||||||
const ITypeCompVtbl *lpVtblTypeComp;
|
const ITypeCompVtbl *lpVtblTypeComp;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
TLIBATTR LibAttr; /* guid,lcid,syskind,version,flags */
|
TLIBATTR LibAttr; /* guid,lcid,syskind,version,flags */
|
||||||
|
LCID lcid;
|
||||||
|
|
||||||
/* strings can be stored in tlb as multibyte strings BUT they are *always*
|
/* strings can be stored in tlb as multibyte strings BUT they are *always*
|
||||||
* exported to the application as a UNICODE string.
|
* exported to the application as a UNICODE string.
|
||||||
|
@ -2878,6 +2879,8 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
|
||||||
pTypeLibImpl->LibAttr.wMinorVerNum = HIWORD(tlbHeader.version);
|
pTypeLibImpl->LibAttr.wMinorVerNum = HIWORD(tlbHeader.version);
|
||||||
pTypeLibImpl->LibAttr.wLibFlags = (WORD) tlbHeader.flags & 0xffff;/* check mask */
|
pTypeLibImpl->LibAttr.wLibFlags = (WORD) tlbHeader.flags & 0xffff;/* check mask */
|
||||||
|
|
||||||
|
pTypeLibImpl->lcid = tlbHeader.lcid;
|
||||||
|
|
||||||
/* name, eventually add to a hash table */
|
/* name, eventually add to a hash table */
|
||||||
pTypeLibImpl->Name = MSFT_ReadName(&cx, tlbHeader.NameOffset);
|
pTypeLibImpl->Name = MSFT_ReadName(&cx, tlbHeader.NameOffset);
|
||||||
|
|
||||||
|
@ -3099,9 +3102,9 @@ static DWORD SLTG_ReadLibBlk(LPVOID pLibBlk, ITypeLibImpl *pTypeLibImpl)
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
|
|
||||||
if(SUBLANGID(*(WORD*)ptr) == SUBLANG_NEUTRAL)
|
if(SUBLANGID(*(WORD*)ptr) == SUBLANG_NEUTRAL)
|
||||||
pTypeLibImpl->LibAttr.lcid = MAKELCID(MAKELANGID(PRIMARYLANGID(*(WORD*)ptr),0),0);
|
pTypeLibImpl->lcid = pTypeLibImpl->LibAttr.lcid = MAKELCID(MAKELANGID(PRIMARYLANGID(*(WORD*)ptr),0),0);
|
||||||
else
|
else
|
||||||
pTypeLibImpl->LibAttr.lcid = 0;
|
pTypeLibImpl->lcid = pTypeLibImpl->LibAttr.lcid = 0;
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
|
|
||||||
ptr += 4; /* skip res12 */
|
ptr += 4; /* skip res12 */
|
||||||
|
@ -3131,7 +3134,7 @@ typedef struct
|
||||||
static HRESULT sltg_get_typelib_ref(const sltg_ref_lookup_t *table, DWORD typeinfo_ref,
|
static HRESULT sltg_get_typelib_ref(const sltg_ref_lookup_t *table, DWORD typeinfo_ref,
|
||||||
HREFTYPE *typelib_ref)
|
HREFTYPE *typelib_ref)
|
||||||
{
|
{
|
||||||
if(typeinfo_ref < table->num)
|
if(table && typeinfo_ref < table->num)
|
||||||
{
|
{
|
||||||
*typelib_ref = table->refs[typeinfo_ref];
|
*typelib_ref = table->refs[typeinfo_ref];
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -6063,6 +6066,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
VARTYPE *rgvt = INVBUF_GET_ARG_TYPE_ARRAY(buffer, func_desc->cParams);
|
VARTYPE *rgvt = INVBUF_GET_ARG_TYPE_ARRAY(buffer, func_desc->cParams);
|
||||||
UINT cNamedArgs = pDispParams->cNamedArgs;
|
UINT cNamedArgs = pDispParams->cNamedArgs;
|
||||||
DISPID *rgdispidNamedArgs = pDispParams->rgdispidNamedArgs;
|
DISPID *rgdispidNamedArgs = pDispParams->rgdispidNamedArgs;
|
||||||
|
UINT vargs_converted=0;
|
||||||
|
|
||||||
hres = S_OK;
|
hres = S_OK;
|
||||||
|
|
||||||
|
@ -6100,6 +6104,15 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
USHORT wParamFlags = func_desc->lprgelemdescParam[i].u.paramdesc.wParamFlags;
|
USHORT wParamFlags = func_desc->lprgelemdescParam[i].u.paramdesc.wParamFlags;
|
||||||
VARIANTARG *src_arg;
|
VARIANTARG *src_arg;
|
||||||
|
|
||||||
|
if (wParamFlags & PARAMFLAG_FLCID)
|
||||||
|
{
|
||||||
|
VARIANTARG *arg;
|
||||||
|
arg = prgpvarg[i] = &rgvarg[i];
|
||||||
|
V_VT(arg) = VT_I4;
|
||||||
|
V_I4(arg) = This->pTypeLib->lcid;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (cNamedArgs)
|
if (cNamedArgs)
|
||||||
{
|
{
|
||||||
USHORT j;
|
USHORT j;
|
||||||
|
@ -6112,7 +6125,10 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
src_arg = i < pDispParams->cArgs ? &pDispParams->rgvarg[pDispParams->cArgs - 1 - i] : NULL;
|
{
|
||||||
|
src_arg = vargs_converted < pDispParams->cArgs ? &pDispParams->rgvarg[pDispParams->cArgs - 1 - vargs_converted] : NULL;
|
||||||
|
vargs_converted++;
|
||||||
|
}
|
||||||
|
|
||||||
if (wParamFlags & PARAMFLAG_FRETVAL)
|
if (wParamFlags & PARAMFLAG_FRETVAL)
|
||||||
{
|
{
|
||||||
|
@ -6278,10 +6294,15 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
V_VT(&varresult), func_desc->cParams, rgvt,
|
V_VT(&varresult), func_desc->cParams, rgvt,
|
||||||
prgpvarg, &varresult);
|
prgpvarg, &varresult);
|
||||||
|
|
||||||
|
vargs_converted = 0;
|
||||||
|
|
||||||
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].u.paramdesc.wParamFlags;
|
||||||
if (wParamFlags & PARAMFLAG_FRETVAL)
|
|
||||||
|
if (wParamFlags & PARAMFLAG_FLCID)
|
||||||
|
continue;
|
||||||
|
else if (wParamFlags & PARAMFLAG_FRETVAL)
|
||||||
{
|
{
|
||||||
if (TRACE_ON(ole))
|
if (TRACE_ON(ole))
|
||||||
{
|
{
|
||||||
|
@ -6309,11 +6330,11 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (i < pDispParams->cArgs)
|
else if (vargs_converted < pDispParams->cArgs)
|
||||||
{
|
{
|
||||||
if (wParamFlags & PARAMFLAG_FOUT)
|
if (wParamFlags & PARAMFLAG_FOUT)
|
||||||
{
|
{
|
||||||
VARIANTARG *arg = &pDispParams->rgvarg[pDispParams->cArgs - 1 - i];
|
VARIANTARG *arg = &pDispParams->rgvarg[pDispParams->cArgs - 1 - vargs_converted];
|
||||||
|
|
||||||
if ((rgvt[i] == VT_BYREF) && (V_VT(arg) != VT_BYREF))
|
if ((rgvt[i] == VT_BYREF) && (V_VT(arg) != VT_BYREF))
|
||||||
hres = VariantChangeType(arg, &rgvarg[i], 0, V_VT(arg));
|
hres = VariantChangeType(arg, &rgvarg[i], 0, V_VT(arg));
|
||||||
|
@ -6321,7 +6342,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
{
|
{
|
||||||
ERR("failed to convert param %d to vt %d\n", i,
|
ERR("failed to convert param %d to vt %d\n", i,
|
||||||
V_VT(&pDispParams->rgvarg[pDispParams->cArgs - 1 - i]));
|
V_VT(&pDispParams->rgvarg[pDispParams->cArgs - 1 - vargs_converted]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6354,6 +6375,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VariantClear(&rgvarg[i]);
|
VariantClear(&rgvarg[i]);
|
||||||
|
vargs_converted++;
|
||||||
}
|
}
|
||||||
else if (wParamFlags & PARAMFLAG_FOPT)
|
else if (wParamFlags & PARAMFLAG_FOPT)
|
||||||
{
|
{
|
||||||
|
@ -7047,13 +7069,12 @@ static HRESULT WINAPI ITypeInfo2_fnGetCustData(
|
||||||
|
|
||||||
TRACE("(%p) guid %s %s found!x)\n", This, debugstr_guid(guid), pCData? "" : "NOT");
|
TRACE("(%p) guid %s %s found!x)\n", This, debugstr_guid(guid), pCData? "" : "NOT");
|
||||||
|
|
||||||
if(pCData)
|
VariantInit( pVarVal);
|
||||||
{
|
if (pCData)
|
||||||
VariantInit( pVarVal);
|
|
||||||
VariantCopy( pVarVal, &pCData->data);
|
VariantCopy( pVarVal, &pCData->data);
|
||||||
return S_OK;
|
else
|
||||||
}
|
VariantClear( pVarVal );
|
||||||
return E_INVALIDARG; /* FIXME: correct? */
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ITypeInfo2::GetFuncCustData
|
/* ITypeInfo2::GetFuncCustData
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue