mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
Autosyncing with Wine HEAD
svn path=/trunk/; revision=31813
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -291,6 +291,10 @@ BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
|
||||
*/
|
||||
int WINAPI SysReAllocStringLen(BSTR* old, const OLECHAR* str, unsigned int len)
|
||||
{
|
||||
/* Detect integer overflow. */
|
||||
if (len >= ((UINT_MAX-sizeof(WCHAR)-sizeof(DWORD))/sizeof(WCHAR)))
|
||||
return 0;
|
||||
|
||||
if (*old!=NULL) {
|
||||
DWORD newbytelen = len*sizeof(WCHAR);
|
||||
DWORD *ptr = HeapReAlloc(GetProcessHeap(),0,((DWORD*)*old)-1,newbytelen+sizeof(WCHAR)+sizeof(DWORD));
|
||||
@@ -340,6 +344,10 @@ BSTR WINAPI SysAllocStringByteLen(LPCSTR str, UINT len)
|
||||
DWORD* newBuffer;
|
||||
char* stringBuffer;
|
||||
|
||||
/* Detect integer overflow. */
|
||||
if (len >= (UINT_MAX-sizeof(WCHAR)-sizeof(DWORD)))
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* Allocate a new buffer to hold the string.
|
||||
* don't forget to keep an empty spot at the beginning of the
|
||||
@@ -574,7 +582,7 @@ HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
|
||||
* Currently the versions returned are 2.20 for Win3.1, 2.30 for Win95 & NT 3.51,
|
||||
* and 2.40 for all later versions. The build number is maximum, i.e. 0xffff.
|
||||
*/
|
||||
ULONG WINAPI OaBuildVersion()
|
||||
ULONG WINAPI OaBuildVersion(void)
|
||||
{
|
||||
switch(GetVersion() & 0x8000ffff) /* mask off build number */
|
||||
{
|
||||
|
||||
@@ -1,30 +1,17 @@
|
||||
<module name="oleaut32" type="win32dll" baseaddress="${BASEADDRESS_OLEAUT32}" installbase="system32" installname="oleaut32.dll" allowwarnings="true">
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<group>
|
||||
<module name="oleaut32" type="win32dll" baseaddress="${BASEADDRESS_OLEAUT32}" installbase="system32" installname="oleaut32.dll" allowwarnings="true" entrypoint="0">
|
||||
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
|
||||
<importlibrary definition="oleaut32.spec.def" />
|
||||
<include base="oleaut32">.</include>
|
||||
<include base="ReactOS">include/reactos/wine</include>
|
||||
<define name="__REACTOS__" />
|
||||
<define name="__WINESRC__" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_IE">0x600</define>
|
||||
<define name="_WIN32_WINNT">0x501</define>
|
||||
<define name="WINVER">0x501</define>
|
||||
<library>wine</library>
|
||||
<library>ole32</library>
|
||||
<library>rpcrt4</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>advapi32</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
<library>comctl32</library>
|
||||
<library>urlmon</library>
|
||||
<library>uuid</library>
|
||||
<library>pseh</library>
|
||||
<define name="WINVER">0x600</define>
|
||||
<define name="_WIN32_WINNT">0x600</define>
|
||||
<file>connpt.c</file>
|
||||
<file>dispatch.c</file>
|
||||
<file>hash.c</file>
|
||||
<file>oaidl_p.c</file>
|
||||
<file>oleaut.c</file>
|
||||
<file>olefont.c</file>
|
||||
<file>olepicture.c</file>
|
||||
@@ -41,5 +28,24 @@
|
||||
<file>variant.c</file>
|
||||
<file>vartype.c</file>
|
||||
<file>oleaut32.rc</file>
|
||||
<file>oleaut32_oaidl.idl</file>
|
||||
<include base="oleaut32" root="intermediate">.</include>
|
||||
<file>oleaut32.spec</file>
|
||||
<library>oleaut32_oleaut32_oaidl_proxy</library>
|
||||
<library>wine</library>
|
||||
<library>ole32</library>
|
||||
<library>rpcrt4</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>advapi32</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
<library>comctl32</library>
|
||||
<library>urlmon</library>
|
||||
<library>uuid</library>
|
||||
<library>pseh</library>
|
||||
</module>
|
||||
<module name="oleaut32_oleaut32_oaidl_proxy" type="rpcproxy" allowwarnings="true">
|
||||
<file>oleaut32_oaidl.idl</file>
|
||||
</module>
|
||||
</group>
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
125 stdcall VarBoolFromStr(wstr long long ptr)
|
||||
126 stdcall VarBoolFromDisp(ptr long ptr)
|
||||
127 stdcall VarFormatCurrency(ptr long long long long long ptr)
|
||||
128 stub VarWeekdayName # stdcall (long long long long ptr)
|
||||
128 stdcall VarWeekdayName(long long long long ptr)
|
||||
129 stdcall VarMonthName(long long long ptr)
|
||||
130 stdcall VarUI1FromI2(long ptr)
|
||||
131 stdcall VarUI1FromI4(long ptr)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Korean resources for oleaut32
|
||||
*
|
||||
*
|
||||
*
|
||||
*Copyright 2005 YunSong Hwang([email protected])
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
|
||||
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN
|
||||
LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
{
|
||||
|
||||
@@ -26,6 +26,6 @@ STRINGTABLE DISCARDABLE
|
||||
IDS_FALSE "Falskt"
|
||||
IDS_YES "Ja"
|
||||
IDS_NO "Nej"
|
||||
IDS_ON "PÕ"
|
||||
IDS_ON "På"
|
||||
IDS_OFF "Av"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2007 Google (Dan Hipschman)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/* The header file generated from this includes rpc.h, which ends up
|
||||
including oaidl.h at some point. This will cause all sorts of errors
|
||||
so the easiest thing to do is just comment out our entire header. */
|
||||
|
||||
cpp_quote("#if 0 /* oleaut32_oaidl.idl hack */")
|
||||
#include "oaidl.idl"
|
||||
cpp_quote("#endif /* oleaut32_oaidl.idl hack */")
|
||||
@@ -113,11 +113,11 @@ Index: oleaut32.rbuild
|
||||
===================================================================
|
||||
--- oleaut32.rbuild (revision 23782)
|
||||
+++ oleaut32.rbuild (working copy)
|
||||
@@ -20,6 +20,7 @@
|
||||
@@ -43,6 +43,7 @@
|
||||
<library>comctl32</library>
|
||||
<library>urlmon</library>
|
||||
<library>uuid</library>
|
||||
+ <library>pseh</library>
|
||||
<file>connpt.c</file>
|
||||
<file>dispatch.c</file>
|
||||
<file>hash.c</file>
|
||||
</module>
|
||||
<module name="oleaut32_oleaut32_oaidl_proxy" type="rpcproxy" allowwarnings="true">
|
||||
<file>oleaut32_oaidl.idl</file>
|
||||
|
||||
@@ -1269,7 +1269,7 @@ static HRESULT WINAPI OLEFontImpl_GetIDsOfNames(
|
||||
* OLEFontImpl_Invoke (IDispatch)
|
||||
*
|
||||
* See Windows documentation for more details on IDispatch methods.
|
||||
*
|
||||
*
|
||||
* Note: Do not call _put_Xxx methods, since setting things here
|
||||
* should not call notify functions as I found out debugging the generic
|
||||
* MS VB5 installer.
|
||||
@@ -2100,7 +2100,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistPropertyBag_Save(
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static const IPersistPropertyBagVtbl OLEFontImpl_IPersistPropertyBag_VTable =
|
||||
static const IPersistPropertyBagVtbl OLEFontImpl_IPersistPropertyBag_VTable =
|
||||
{
|
||||
OLEFontImpl_IPersistPropertyBag_QueryInterface,
|
||||
OLEFontImpl_IPersistPropertyBag_AddRef,
|
||||
@@ -2178,7 +2178,7 @@ static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_InitNew(
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IPersistStreamInitVtbl OLEFontImpl_IPersistStreamInit_VTable =
|
||||
static const IPersistStreamInitVtbl OLEFontImpl_IPersistStreamInit_VTable =
|
||||
{
|
||||
OLEFontImpl_IPersistStreamInit_QueryInterface,
|
||||
OLEFontImpl_IPersistStreamInit_AddRef,
|
||||
|
||||
@@ -90,6 +90,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
#include "pshpack1.h"
|
||||
|
||||
/* Header for Aldus Placable Metafiles - a standard metafile follows */
|
||||
typedef struct _APM_HEADER
|
||||
{
|
||||
DWORD key;
|
||||
WORD handle;
|
||||
SHORT left;
|
||||
SHORT top;
|
||||
SHORT right;
|
||||
SHORT bottom;
|
||||
WORD inch;
|
||||
DWORD reserved;
|
||||
WORD checksum;
|
||||
} APM_HEADER;
|
||||
|
||||
typedef struct {
|
||||
BYTE bWidth;
|
||||
BYTE bHeight;
|
||||
@@ -545,7 +559,7 @@ static HRESULT WINAPI OLEPictureImpl_get_hPal(IPicture *iface,
|
||||
return E_POINTER;
|
||||
|
||||
switch (This->desc.picType) {
|
||||
case PICTYPE_UNINITIALIZED:
|
||||
case (UINT)PICTYPE_UNINITIALIZED:
|
||||
case PICTYPE_NONE:
|
||||
*phandle = 0;
|
||||
hres = S_FALSE;
|
||||
@@ -554,8 +568,10 @@ static HRESULT WINAPI OLEPictureImpl_get_hPal(IPicture *iface,
|
||||
*phandle = (OLE_HANDLE)This->desc.u.bmp.hpal;
|
||||
hres = S_OK;
|
||||
break;
|
||||
case PICTYPE_ICON:
|
||||
case PICTYPE_METAFILE:
|
||||
hres = E_FAIL;
|
||||
break;
|
||||
case PICTYPE_ICON:
|
||||
case PICTYPE_ENHMETAFILE:
|
||||
default:
|
||||
FIXME("unimplemented for type %d. Returning 0 palette.\n",
|
||||
@@ -655,10 +671,10 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
|
||||
SetWindowExtEx(hdcMask, This->himetricWidth, This->himetricHeight, NULL);
|
||||
SetViewportOrgEx(hdcMask, 0, This->origHeight, NULL);
|
||||
SetViewportExtEx(hdcMask, This->origWidth, -This->origHeight, NULL);
|
||||
|
||||
SetBkColor(hdc, RGB(255, 255, 255));
|
||||
SetTextColor(hdc, RGB(0, 0, 0));
|
||||
StretchBlt(hdc, x, y, cx, cy, hdcMask, xSrc, ySrc, cxSrc, cySrc, SRCAND);
|
||||
|
||||
SetBkColor(hdc, RGB(255, 255, 255));
|
||||
SetTextColor(hdc, RGB(0, 0, 0));
|
||||
StretchBlt(hdc, x, y, cx, cy, hdcMask, xSrc, ySrc, cxSrc, cySrc, SRCAND);
|
||||
StretchBlt(hdc, x, y, cx, cy, hdcBmp, xSrc, ySrc, cxSrc, cySrc, SRCPAINT);
|
||||
|
||||
SelectObject(hdcMask, hOldbm);
|
||||
@@ -678,12 +694,27 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
|
||||
break;
|
||||
|
||||
case PICTYPE_METAFILE:
|
||||
PlayMetaFile(hdc, This->desc.u.wmf.hmeta);
|
||||
{
|
||||
POINT prevOrg;
|
||||
SIZE prevExt;
|
||||
int oldmode;
|
||||
|
||||
oldmode = SetMapMode(hdc, MM_ANISOTROPIC);
|
||||
SetViewportOrgEx(hdc, x, y, &prevOrg);
|
||||
SetViewportExtEx(hdc, cx, cy, &prevExt);
|
||||
|
||||
if (!PlayMetaFile(hdc, This->desc.u.wmf.hmeta))
|
||||
ERR("PlayMetaFile failed!\n");
|
||||
|
||||
SetViewportExtEx(hdc, prevExt.cx, prevExt.cy, NULL);
|
||||
SetViewportOrgEx(hdc, prevOrg.x, prevOrg.y, NULL);
|
||||
SetMapMode(hdc, oldmode);
|
||||
break;
|
||||
}
|
||||
|
||||
case PICTYPE_ENHMETAFILE:
|
||||
{
|
||||
RECT rc = { x, y, cx, cy };
|
||||
RECT rc = { x, y, x + cx, y + cy };
|
||||
PlayEnhMetaFile(hdc, This->desc.u.emf.hemf, &rc);
|
||||
break;
|
||||
}
|
||||
@@ -1058,7 +1089,7 @@ static HRESULT OLEPictureImpl_LoadGif(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
|
||||
if (!cm) cm = gif->SColorMap;
|
||||
bmi = HeapAlloc(GetProcessHeap(),0,sizeof(BITMAPINFOHEADER)+(cm->ColorCount)*sizeof(RGBQUAD));
|
||||
bytes= HeapAlloc(GetProcessHeap(),0,padding*gif->SHeight);
|
||||
|
||||
|
||||
/* look for the transparent color extension */
|
||||
for (i = 0; i < si->ExtensionBlockCount; ++i) {
|
||||
eb = si->ExtensionBlocks + i;
|
||||
@@ -1133,7 +1164,7 @@ static HRESULT OLEPictureImpl_LoadGif(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
|
||||
/* Create the Mask */
|
||||
HDC hdc = CreateCompatibleDC(0);
|
||||
HDC hdcMask = CreateCompatibleDC(0);
|
||||
HBITMAP hOldbitmap;
|
||||
HBITMAP hOldbitmap;
|
||||
HBITMAP hOldbitmapmask;
|
||||
|
||||
unsigned int monopadding = (((unsigned)(gif->SWidth + 31)) >> 5) << 2;
|
||||
@@ -1192,7 +1223,7 @@ static HRESULT OLEPictureImpl_LoadGif(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
|
||||
SelectObject(hdc, This->hbmXor);
|
||||
SetBkColor(hdc, RGB(0,0,0));
|
||||
SetTextColor(hdc, RGB(255,255,255));
|
||||
BitBlt(hdc, 0, 0, bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight,
|
||||
BitBlt(hdc, 0, 0, bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight,
|
||||
hdcMask, 0, 0, SRCAND);
|
||||
|
||||
SelectObject(hdc, hOldbitmap);
|
||||
@@ -1201,7 +1232,7 @@ static HRESULT OLEPictureImpl_LoadGif(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
|
||||
DeleteDC(hdc);
|
||||
DeleteObject(hTempMask);
|
||||
}
|
||||
|
||||
|
||||
DeleteDC(hdcref);
|
||||
This->desc.picType = PICTYPE_BITMAP;
|
||||
OLEPictureImpl_SetBitmap(This);
|
||||
@@ -1376,6 +1407,9 @@ 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)
|
||||
@@ -1397,6 +1431,9 @@ static void *load_libpng(void)
|
||||
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
|
||||
}
|
||||
@@ -1410,13 +1447,17 @@ static HRESULT OLEPictureImpl_LoadPNG(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
|
||||
png_io io;
|
||||
png_structp png_ptr = NULL;
|
||||
png_infop info_ptr = NULL;
|
||||
INT row, rowsize, height, width;
|
||||
INT row, rowsize, height, width, num_trans, i, j;
|
||||
png_bytep* row_pointers = NULL;
|
||||
png_bytep pngdata = NULL;
|
||||
BITMAPINFOHEADER bmi;
|
||||
HDC hdcref = NULL;
|
||||
HDC hdcref = NULL, hdcXor, hdcMask;
|
||||
HRESULT ret;
|
||||
BOOL set_bgr = FALSE;
|
||||
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()) {
|
||||
@@ -1435,7 +1476,7 @@ static HRESULT OLEPictureImpl_LoadPNG(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
|
||||
if(setjmp(png_jmpbuf(png_ptr))){
|
||||
TRACE("Error in libpng\n");
|
||||
ret = E_FAIL;
|
||||
goto pngend;
|
||||
goto end;
|
||||
}
|
||||
|
||||
info_ptr = ppng_create_info_struct(png_ptr);
|
||||
@@ -1443,22 +1484,20 @@ static HRESULT OLEPictureImpl_LoadPNG(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
|
||||
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_PALETTE ||
|
||||
png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)){
|
||||
FIXME("Unsupported .PNG type: %d\n", png_ptr->color_type);
|
||||
ret = E_FAIL;
|
||||
goto pngend;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
|
||||
ppng_set_palette_to_rgb(png_ptr);
|
||||
set_bgr = TRUE;
|
||||
}
|
||||
transparency = (ppng_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &trans_values)
|
||||
== PNG_INFO_tRNS);
|
||||
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_RGB ||
|
||||
png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
|
||||
set_bgr){
|
||||
ppng_set_bgr(png_ptr);
|
||||
}
|
||||
/* 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);
|
||||
|
||||
@@ -1473,7 +1512,7 @@ static HRESULT OLEPictureImpl_LoadPNG(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
|
||||
|
||||
if(!pngdata || !row_pointers){
|
||||
ret = E_FAIL;
|
||||
goto pngend;
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (row = 0; row < height; row++){
|
||||
@@ -1503,12 +1542,71 @@ static HRESULT OLEPictureImpl_LoadPNG(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
|
||||
(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;
|
||||
|
||||
pngend:
|
||||
end:
|
||||
if(png_ptr)
|
||||
ppng_destroy_read_struct(&png_ptr,
|
||||
(info_ptr ? &info_ptr : (png_infopp) NULL),
|
||||
@@ -1623,6 +1721,25 @@ static HRESULT OLEPictureImpl_LoadMetafile(OLEPictureImpl *This,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT OLEPictureImpl_LoadAPM(OLEPictureImpl *This,
|
||||
const BYTE *data, ULONG size)
|
||||
{
|
||||
APM_HEADER *header = (APM_HEADER *)data;
|
||||
HRESULT hr;
|
||||
|
||||
if (size < sizeof(APM_HEADER))
|
||||
return E_FAIL;
|
||||
if (header->key != 0x9ac6cdd7)
|
||||
return E_FAIL;
|
||||
|
||||
if ((hr = OLEPictureImpl_LoadMetafile(This, data + sizeof(APM_HEADER), size - sizeof(*header))) != S_OK)
|
||||
return hr;
|
||||
|
||||
This->himetricWidth = MulDiv((INT)header->right - header->left, 2540, header->inch);
|
||||
This->himetricHeight = MulDiv((INT)header->bottom - header->top, 2540, header->inch);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* OLEPictureImpl_IPersistStream_Load (IUnknown)
|
||||
*
|
||||
@@ -1644,7 +1761,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
|
||||
WORD magic;
|
||||
STATSTG statstg;
|
||||
OLEPictureImpl *This = impl_from_IPersistStream(iface);
|
||||
|
||||
|
||||
TRACE("(%p,%p)\n",This,pStm);
|
||||
|
||||
/****************************************************************************************
|
||||
@@ -1682,9 +1799,9 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
|
||||
}
|
||||
headerread += xread;
|
||||
xread = 0;
|
||||
|
||||
|
||||
if (!memcmp(&(header[0]),"lt\0\0", 4) && (statfailed || (header[1] + headerread <= statstg.cbSize.QuadPart))) {
|
||||
if (toread != 0 && toread != header[1])
|
||||
if (toread != 0 && toread != header[1])
|
||||
FIXME("varying lengths of image data (prev=%u curr=%u), only last one will be used\n",
|
||||
toread, header[1]);
|
||||
toread = header[1];
|
||||
@@ -1693,11 +1810,12 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
|
||||
if (!memcmp(&(header[0]), "GIF8", 4) || /* GIF header */
|
||||
!memcmp(&(header[0]), "BM", 2) || /* BMP header */
|
||||
!memcmp(&(header[0]), "\xff\xd8", 2) || /* JPEG header */
|
||||
(header[0] == EMR_HEADER) || /* EMF header */
|
||||
(header[1] > statstg.cbSize.QuadPart)|| /* invalid size */
|
||||
(header[1]==0)
|
||||
) {/* Found start of bitmap data */
|
||||
headerisdata = TRUE;
|
||||
if (toread == 0)
|
||||
if (toread == 0)
|
||||
toread = statstg.cbSize.QuadPart-8;
|
||||
else toread -= 8;
|
||||
xread = 8;
|
||||
@@ -1780,6 +1898,9 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
|
||||
case 0x5089: /* PNG */
|
||||
hr = OLEPictureImpl_LoadPNG(This, xbuf, xread);
|
||||
break;
|
||||
case 0xcdd7: /* APM */
|
||||
hr = OLEPictureImpl_LoadAPM(This, xbuf, xread);
|
||||
break;
|
||||
case 0x0000: { /* ICON , first word is dwReserved */
|
||||
hr = OLEPictureImpl_LoadIcon(This, xbuf, xread);
|
||||
break;
|
||||
@@ -1951,7 +2072,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength)
|
||||
|| (pInfoBitmap->bmiHeader.biBitCount == 24)
|
||||
|| (pInfoBitmap->bmiHeader.biBitCount == 32 && pInfoBitmap->bmiHeader.biCompression == BI_RGB)) {
|
||||
iNumEntriesPalette = pInfoBitmap->bmiHeader.biClrUsed;
|
||||
if (iNumEntriesPalette > 256) iNumEntriesPalette = 256;
|
||||
if (iNumEntriesPalette > 256) iNumEntriesPalette = 256;
|
||||
} else if ((pInfoBitmap->bmiHeader.biBitCount == 16 || pInfoBitmap->bmiHeader.biBitCount == 32)
|
||||
&& pInfoBitmap->bmiHeader.biCompression == BI_BITFIELDS) {
|
||||
iNumEntriesPalette = 3;
|
||||
@@ -2246,9 +2367,33 @@ static HRESULT WINAPI OLEPictureImpl_GetIDsOfNames(
|
||||
LCID lcid,
|
||||
DISPID* rgDispId)
|
||||
{
|
||||
FIXME("():Stub\n");
|
||||
ITypeInfo * pTInfo;
|
||||
HRESULT hres;
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p,%s,%p,cNames=%d,lcid=%04x,%p)\n", iface, debugstr_guid(riid),
|
||||
rgszNames, cNames, (int)lcid, rgDispId);
|
||||
|
||||
if (cNames == 0)
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* retrieve type information */
|
||||
hres = OLEPictureImpl_GetTypeInfo(iface, 0, lcid, &pTInfo);
|
||||
|
||||
if (FAILED(hres))
|
||||
{
|
||||
ERR("GetTypeInfo failed.\n");
|
||||
return hres;
|
||||
}
|
||||
|
||||
/* convert names to DISPIDs */
|
||||
hres = DispGetIDsOfNames (pTInfo, rgszNames, cNames, rgDispId);
|
||||
ITypeInfo_Release(pTInfo);
|
||||
|
||||
return hres;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
@@ -2553,9 +2698,9 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller,
|
||||
|
||||
if (!ppvRet) return E_POINTER;
|
||||
|
||||
if (strncmpW(szURLorPath, file, 7) == 0) {
|
||||
if (strncmpW(szURLorPath, file, 7) == 0) {
|
||||
szURLorPath += 7;
|
||||
|
||||
|
||||
hFile = CreateFileW(szURLorPath, GENERIC_READ, 0, NULL, OPEN_EXISTING,
|
||||
0, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
@@ -2576,12 +2721,12 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller,
|
||||
}
|
||||
}
|
||||
CloseHandle(hFile);
|
||||
|
||||
|
||||
if (!hGlobal)
|
||||
return E_UNEXPECTED;
|
||||
|
||||
hRes = CreateStreamOnHGlobal(hGlobal, TRUE, &stream);
|
||||
if (FAILED(hRes))
|
||||
if (FAILED(hRes))
|
||||
{
|
||||
GlobalFree(hGlobal);
|
||||
return hRes;
|
||||
@@ -2591,11 +2736,11 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller,
|
||||
IBindCtx *pbc;
|
||||
|
||||
hRes = CreateBindCtx(0, &pbc);
|
||||
if (SUCCEEDED(hRes))
|
||||
if (SUCCEEDED(hRes))
|
||||
{
|
||||
hRes = CreateURLMoniker(NULL, szURLorPath, &pmnk);
|
||||
if (SUCCEEDED(hRes))
|
||||
{
|
||||
{
|
||||
hRes = IMoniker_BindToStorage(pmnk, pbc, NULL, &IID_IStream, (LPVOID*)&stream);
|
||||
IMoniker_Release(pmnk);
|
||||
}
|
||||
@@ -2605,13 +2750,13 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller,
|
||||
return hRes;
|
||||
}
|
||||
|
||||
hRes = CoCreateInstance(&CLSID_StdPicture, punkCaller, CLSCTX_INPROC_SERVER,
|
||||
hRes = CoCreateInstance(&CLSID_StdPicture, punkCaller, CLSCTX_INPROC_SERVER,
|
||||
&IID_IPicture, (LPVOID*)&ipicture);
|
||||
if (hRes != S_OK) {
|
||||
IStream_Release(stream);
|
||||
return hRes;
|
||||
}
|
||||
|
||||
|
||||
hRes = IPicture_QueryInterface(ipicture, &IID_IPersistStream, (LPVOID*)&pStream);
|
||||
if (hRes) {
|
||||
IStream_Release(stream);
|
||||
@@ -2619,7 +2764,7 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller,
|
||||
return hRes;
|
||||
}
|
||||
|
||||
hRes = IPersistStream_Load(pStream, stream);
|
||||
hRes = IPersistStream_Load(pStream, stream);
|
||||
IPersistStream_Release(pStream);
|
||||
IStream_Release(stream);
|
||||
|
||||
@@ -2631,7 +2776,7 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller,
|
||||
hRes = IPicture_QueryInterface(ipicture,riid,ppvRet);
|
||||
if (hRes)
|
||||
FIXME("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
|
||||
|
||||
|
||||
IPicture_Release(ipicture);
|
||||
return hRes;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ static HRESULT copy_to_variant(void *src, VARIANT *pvar, enum VARENUM vt)
|
||||
#define CASE_COPY(x) \
|
||||
case VT_ ## x: \
|
||||
V_ ## x(pvar) = *(typeof(V_ ## x(pvar))*)src; \
|
||||
break
|
||||
break
|
||||
|
||||
switch(vt) {
|
||||
CASE_COPY(I2);
|
||||
@@ -241,7 +241,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordClear(IRecordInfo *iface, PVOID pvEx
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordCopy(IRecordInfo *iface, PVOID pvExi
|
||||
IRecordInfoImpl *This = (IRecordInfoImpl*)iface;
|
||||
|
||||
TRACE("(%p)->(%p %p)\n", This, pvExisting, pvNew);
|
||||
|
||||
|
||||
if(!pvExisting || !pvNew)
|
||||
return E_INVALIDARG;
|
||||
|
||||
@@ -288,12 +288,12 @@ static HRESULT WINAPI IRecordInfoImpl_GetName(IRecordInfo *iface, BSTR *pbstrNam
|
||||
static HRESULT WINAPI IRecordInfoImpl_GetSize(IRecordInfo *iface, ULONG *pcbSize)
|
||||
{
|
||||
IRecordInfoImpl *This = (IRecordInfoImpl*)iface;
|
||||
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pcbSize);
|
||||
|
||||
if(!pcbSize)
|
||||
return E_INVALIDARG;
|
||||
|
||||
|
||||
*pcbSize = This->size;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -329,7 +329,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetField(IRecordInfo *iface, PVOID pvData,
|
||||
break;
|
||||
if(i == This->n_vars)
|
||||
return TYPE_E_FIELDNOTFOUND;
|
||||
|
||||
|
||||
VariantClear(pvarField);
|
||||
return copy_to_variant(((PBYTE)pvData)+This->fields[i].offset, pvarField,
|
||||
This->fields[i].vt);
|
||||
@@ -427,7 +427,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetFieldNames(IRecordInfo *iface, ULONG *p
|
||||
for(i=0; i<n; i++)
|
||||
rgBstrNames[i] = SysAllocString(This->fields[i].name);
|
||||
}
|
||||
|
||||
|
||||
*pcNames = n;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -459,7 +459,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordCreateCopy(IRecordInfo *iface, PVOID
|
||||
|
||||
if(!pvSource || !ppvDest)
|
||||
return E_INVALIDARG;
|
||||
|
||||
|
||||
*ppvDest = IRecordInfo_RecordCreate(iface);
|
||||
return IRecordInfo_RecordCopy(iface, pvSource, *ppvDest);
|
||||
}
|
||||
@@ -511,7 +511,7 @@ HRESULT WINAPI GetRecordInfoFromGuids(REFGUID rGuidTypeLib, ULONG uVerMajor,
|
||||
ITypeInfo *pTypeInfo;
|
||||
ITypeLib *pTypeLib;
|
||||
HRESULT hres;
|
||||
|
||||
|
||||
TRACE("(%p,%d,%d,%d,%p,%p)\n", rGuidTypeLib, uVerMajor, uVerMinor,
|
||||
lcid, rGuidTypeInfo, ppRecInfo);
|
||||
|
||||
@@ -548,7 +548,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
|
||||
|
||||
if(!pTI || !ppRecInfo)
|
||||
return E_INVALIDARG;
|
||||
|
||||
|
||||
hres = ITypeInfo_GetTypeAttr(pTI, &typeattr);
|
||||
if(FAILED(hres) || !typeattr) {
|
||||
WARN("GetTypeAttr failed: %08x\n", hres);
|
||||
@@ -614,7 +614,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
|
||||
WARN("GetDocumentation failed: %08x\n", hres);
|
||||
ITypeInfo_ReleaseVarDesc(pTypeInfo, vardesc);
|
||||
}
|
||||
|
||||
|
||||
*ppRecInfo = (IRecordInfo*)ret;
|
||||
|
||||
return S_OK;
|
||||
|
||||
@@ -108,9 +108,6 @@ static LONG register_key_defvalueW(HKEY base, WCHAR const *name,
|
||||
WCHAR const *value);
|
||||
static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
|
||||
char const *value);
|
||||
static LONG recursive_delete_key(HKEY key);
|
||||
static LONG recursive_delete_keyA(HKEY base, char const *name);
|
||||
static LONG recursive_delete_keyW(HKEY base, WCHAR const *name);
|
||||
|
||||
/***********************************************************************
|
||||
* register_interfaces
|
||||
@@ -199,7 +196,8 @@ static HRESULT unregister_interfaces(struct regsvr_interface const *list)
|
||||
WCHAR buf[39];
|
||||
|
||||
StringFromGUID2(list->iid, buf, 39);
|
||||
res = recursive_delete_keyW(interface_key, buf);
|
||||
res = RegDeleteTreeW(interface_key, buf);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
RegCloseKey(interface_key);
|
||||
@@ -309,11 +307,13 @@ static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
|
||||
WCHAR buf[39];
|
||||
|
||||
StringFromGUID2(list->clsid, buf, 39);
|
||||
res = recursive_delete_keyW(coclass_key, buf);
|
||||
res = RegDeleteTreeW(coclass_key, buf);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
|
||||
|
||||
if (list->progid) {
|
||||
res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->progid);
|
||||
res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
|
||||
}
|
||||
}
|
||||
@@ -375,70 +375,6 @@ static LONG register_key_defvalueA(
|
||||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* recursive_delete_key
|
||||
*/
|
||||
static LONG recursive_delete_key(HKEY key)
|
||||
{
|
||||
LONG res;
|
||||
WCHAR subkey_name[MAX_PATH];
|
||||
DWORD cName;
|
||||
HKEY subkey;
|
||||
|
||||
for (;;) {
|
||||
cName = sizeof(subkey_name) / sizeof(WCHAR);
|
||||
res = RegEnumKeyExW(key, 0, subkey_name, &cName,
|
||||
NULL, NULL, NULL, NULL);
|
||||
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) {
|
||||
res = ERROR_SUCCESS; /* presumably we're done enumerating */
|
||||
break;
|
||||
}
|
||||
res = RegOpenKeyExW(key, subkey_name, 0,
|
||||
KEY_READ | KEY_WRITE, &subkey);
|
||||
if (res == ERROR_FILE_NOT_FOUND) continue;
|
||||
if (res != ERROR_SUCCESS) break;
|
||||
|
||||
res = recursive_delete_key(subkey);
|
||||
RegCloseKey(subkey);
|
||||
if (res != ERROR_SUCCESS) break;
|
||||
}
|
||||
|
||||
if (res == ERROR_SUCCESS) res = RegDeleteKeyW(key, 0);
|
||||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* recursive_delete_keyA
|
||||
*/
|
||||
static LONG recursive_delete_keyA(HKEY base, char const *name)
|
||||
{
|
||||
LONG res;
|
||||
HKEY key;
|
||||
|
||||
res = RegOpenKeyExA(base, name, 0, KEY_READ | KEY_WRITE, &key);
|
||||
if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
|
||||
if (res != ERROR_SUCCESS) return res;
|
||||
res = recursive_delete_key(key);
|
||||
RegCloseKey(key);
|
||||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* recursive_delete_keyW
|
||||
*/
|
||||
static LONG recursive_delete_keyW(HKEY base, WCHAR const *name)
|
||||
{
|
||||
LONG res;
|
||||
HKEY key;
|
||||
|
||||
res = RegOpenKeyExW(base, name, 0, KEY_READ | KEY_WRITE, &key);
|
||||
if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
|
||||
if (res != ERROR_SUCCESS) return res;
|
||||
res = recursive_delete_key(key);
|
||||
RegCloseKey(key);
|
||||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* coclass list
|
||||
*/
|
||||
|
||||
@@ -449,7 +449,7 @@ HRESULT WINAPI SafeArrayAllocDescriptor(UINT cDims, SAFEARRAY **ppsaOut)
|
||||
LONG allocSize;
|
||||
|
||||
TRACE("(%d,%p)\n", cDims, ppsaOut);
|
||||
|
||||
|
||||
if (!cDims || cDims >= 0x10000) /* Maximum 65535 dimensions */
|
||||
return E_INVALIDARG;
|
||||
|
||||
@@ -493,7 +493,7 @@ HRESULT WINAPI SafeArrayAllocDescriptorEx(VARTYPE vt, UINT cDims, SAFEARRAY **pp
|
||||
HRESULT hRet = E_UNEXPECTED;
|
||||
|
||||
TRACE("(%d->%s,%d,%p)\n", vt, debugstr_vt(vt), cDims, ppsaOut);
|
||||
|
||||
|
||||
cbElements = SAFEARRAY_GetVTSize(vt);
|
||||
if (!cbElements)
|
||||
WARN("Creating a descriptor with an invalid VARTYPE!\n");
|
||||
@@ -526,9 +526,9 @@ HRESULT WINAPI SafeArrayAllocDescriptorEx(VARTYPE vt, UINT cDims, SAFEARRAY **pp
|
||||
HRESULT WINAPI SafeArrayAllocData(SAFEARRAY *psa)
|
||||
{
|
||||
HRESULT hRet = E_INVALIDARG;
|
||||
|
||||
|
||||
TRACE("(%p)\n", psa);
|
||||
|
||||
|
||||
if (psa)
|
||||
{
|
||||
ULONG ulSize = SAFEARRAY_GetCellCount(psa);
|
||||
@@ -599,9 +599,9 @@ SAFEARRAY* WINAPI SafeArrayCreateEx(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsa
|
||||
ULONG ulSize = 0;
|
||||
IRecordInfo* iRecInfo = (IRecordInfo*)pvExtra;
|
||||
SAFEARRAY* psa;
|
||||
|
||||
|
||||
TRACE("(%d->%s,%d,%p,%p)\n", vt, debugstr_vt(vt), cDims, rgsabound, pvExtra);
|
||||
|
||||
|
||||
if (vt == VT_RECORD)
|
||||
{
|
||||
if (!iRecInfo)
|
||||
@@ -646,7 +646,7 @@ SAFEARRAY* WINAPI SafeArrayCreateEx(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsa
|
||||
SAFEARRAY* WINAPI SafeArrayCreateVector(VARTYPE vt, LONG lLbound, ULONG cElements)
|
||||
{
|
||||
TRACE("(%d->%s,%d,%d\n", vt, debugstr_vt(vt), lLbound, cElements);
|
||||
|
||||
|
||||
if (vt == VT_RECORD)
|
||||
return NULL;
|
||||
|
||||
@@ -678,7 +678,7 @@ SAFEARRAY* WINAPI SafeArrayCreateVectorEx(VARTYPE vt, LONG lLbound, ULONG cEleme
|
||||
SAFEARRAY* psa;
|
||||
|
||||
TRACE("(%d->%s,%d,%d,%p\n", vt, debugstr_vt(vt), lLbound, cElements, pvExtra);
|
||||
|
||||
|
||||
if (vt == VT_RECORD)
|
||||
{
|
||||
if (!iRecInfo)
|
||||
@@ -724,7 +724,7 @@ SAFEARRAY* WINAPI SafeArrayCreateVectorEx(VARTYPE vt, LONG lLbound, ULONG cEleme
|
||||
HRESULT WINAPI SafeArrayDestroyDescriptor(SAFEARRAY *psa)
|
||||
{
|
||||
TRACE("(%p)\n", psa);
|
||||
|
||||
|
||||
if (psa)
|
||||
{
|
||||
LPVOID lpv = (char*)psa - SAFEARRAY_HIDDEN_SIZE;
|
||||
@@ -767,7 +767,7 @@ HRESULT WINAPI SafeArrayLock(SAFEARRAY *psa)
|
||||
ULONG ulLocks;
|
||||
|
||||
TRACE("(%p)\n", psa);
|
||||
|
||||
|
||||
if (!psa)
|
||||
return E_INVALIDARG;
|
||||
|
||||
@@ -801,7 +801,7 @@ HRESULT WINAPI SafeArrayLock(SAFEARRAY *psa)
|
||||
HRESULT WINAPI SafeArrayUnlock(SAFEARRAY *psa)
|
||||
{
|
||||
TRACE("(%p)\n", psa);
|
||||
|
||||
|
||||
if (!psa)
|
||||
return E_INVALIDARG;
|
||||
|
||||
@@ -918,7 +918,7 @@ HRESULT WINAPI SafeArrayGetElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData
|
||||
HRESULT hRet;
|
||||
|
||||
TRACE("(%p,%p,%p)\n", psa, rgIndices, pvData);
|
||||
|
||||
|
||||
if (!psa || !rgIndices || !pvData)
|
||||
return E_INVALIDARG;
|
||||
|
||||
@@ -994,7 +994,7 @@ HRESULT WINAPI SafeArrayGetElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData
|
||||
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
|
||||
{
|
||||
TRACE("(%p,%d,%p)\n", psa, nDim, plUbound);
|
||||
|
||||
|
||||
if (!psa || !plUbound)
|
||||
return E_INVALIDARG;
|
||||
|
||||
@@ -1054,7 +1054,7 @@ HRESULT WINAPI SafeArrayGetLBound(SAFEARRAY *psa, UINT nDim, LONG *plLbound)
|
||||
*/
|
||||
UINT WINAPI SafeArrayGetDim(SAFEARRAY *psa)
|
||||
{
|
||||
TRACE("(%p) returning %d\n", psa, psa ? psa->cDims : 0u);
|
||||
TRACE("(%p) returning %d\n", psa, psa ? psa->cDims : 0u);
|
||||
return psa ? psa->cDims : 0;
|
||||
}
|
||||
|
||||
@@ -1161,7 +1161,7 @@ HRESULT WINAPI SafeArrayPtrOfIndex(SAFEARRAY *psa, LONG *rgIndices, void **ppvDa
|
||||
LONG c1;
|
||||
|
||||
TRACE("(%p,%p,%p)\n", psa, rgIndices, ppvData);
|
||||
|
||||
|
||||
/* The general formula for locating the cell number of an entry in an n
|
||||
* dimensional array (where cn = coordinate in dimension dn) is:
|
||||
*
|
||||
@@ -1218,7 +1218,7 @@ HRESULT WINAPI SafeArrayPtrOfIndex(SAFEARRAY *psa, LONG *rgIndices, void **ppvDa
|
||||
HRESULT WINAPI SafeArrayDestroyData(SAFEARRAY *psa)
|
||||
{
|
||||
TRACE("(%p)\n", psa);
|
||||
|
||||
|
||||
if (!psa)
|
||||
return E_INVALIDARG;
|
||||
|
||||
@@ -1274,7 +1274,7 @@ HRESULT WINAPI SafeArrayCopyData(SAFEARRAY *psaSource, SAFEARRAY *psaTarget)
|
||||
int dim;
|
||||
|
||||
TRACE("(%p,%p)\n", psaSource, psaTarget);
|
||||
|
||||
|
||||
if (!psaSource || !psaTarget ||
|
||||
psaSource->cDims != psaTarget->cDims ||
|
||||
psaSource->cbElements != psaTarget->cbElements)
|
||||
@@ -1387,7 +1387,7 @@ HRESULT WINAPI SafeArrayCopy(SAFEARRAY *psa, SAFEARRAY **ppsaOut)
|
||||
if ((*ppsaOut)->pvData)
|
||||
{
|
||||
hRet = SAFEARRAY_CopyData(psa, *ppsaOut);
|
||||
|
||||
|
||||
if (SUCCEEDED(hRet))
|
||||
return hRet;
|
||||
|
||||
@@ -1420,7 +1420,7 @@ HRESULT WINAPI SafeArrayRedim(SAFEARRAY *psa, SAFEARRAYBOUND *psabound)
|
||||
SAFEARRAYBOUND *oldBounds;
|
||||
|
||||
TRACE("(%p,%p)\n", psa, psabound);
|
||||
|
||||
|
||||
if (!psa || psa->fFeatures & FADF_FIXEDSIZE || !psabound)
|
||||
return E_INVALIDARG;
|
||||
|
||||
@@ -1534,7 +1534,7 @@ HRESULT WINAPI SafeArraySetRecordInfo(SAFEARRAY *psa, IRecordInfo *pRinfo)
|
||||
IRecordInfo** dest = (IRecordInfo**)psa;
|
||||
|
||||
TRACE("(%p,%p)\n", psa, pRinfo);
|
||||
|
||||
|
||||
if (!psa || !(psa->fFeatures & FADF_RECORD))
|
||||
return E_INVALIDARG;
|
||||
|
||||
@@ -1659,7 +1659,7 @@ HRESULT WINAPI VectorFromBstr(BSTR bstr, SAFEARRAY **ppsa)
|
||||
SAFEARRAYBOUND sab;
|
||||
|
||||
TRACE("(%p,%p)\n", bstr, ppsa);
|
||||
|
||||
|
||||
if (!ppsa)
|
||||
return E_INVALIDARG;
|
||||
|
||||
|
||||
@@ -135,41 +135,41 @@ _unmarshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN *pUnk) {
|
||||
DWORD xsize;
|
||||
|
||||
TRACE("...%s...\n",debugstr_guid(riid));
|
||||
|
||||
|
||||
*pUnk = NULL;
|
||||
hres = xbuf_get(buf,(LPBYTE)&xsize,sizeof(xsize));
|
||||
if (hres) {
|
||||
ERR("xbuf_get failed\n");
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
||||
if (xsize == 0) return S_OK;
|
||||
|
||||
|
||||
hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
|
||||
if (hres) {
|
||||
ERR("Stream create failed %x\n",hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
||||
hres = IStream_Write(pStm,buf->base+buf->curoff,xsize,&res);
|
||||
if (hres) {
|
||||
ERR("stream write %x\n",hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
||||
memset(&seekto,0,sizeof(seekto));
|
||||
hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos);
|
||||
if (hres) {
|
||||
ERR("Failed Seek %x\n",hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
||||
hres = CoUnmarshalInterface(pStm,riid,(LPVOID*)pUnk);
|
||||
if (hres) {
|
||||
ERR("Unmarshalling interface %s failed with %x\n",debugstr_guid(riid),hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
||||
IStream_Release(pStm);
|
||||
return xbuf_skip(buf,xsize);
|
||||
}
|
||||
@@ -199,25 +199,25 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
|
||||
hres = E_FAIL;
|
||||
|
||||
TRACE("...%s...\n",debugstr_guid(riid));
|
||||
|
||||
|
||||
hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
|
||||
if (hres) {
|
||||
ERR("Stream create failed %x\n",hres);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
hres = CoMarshalInterface(pStm,riid,pUnk,0,NULL,0);
|
||||
if (hres) {
|
||||
ERR("Marshalling interface %s failed with %x\n", debugstr_guid(riid), hres);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
hres = IStream_Stat(pStm,&ststg,0);
|
||||
if (hres) {
|
||||
ERR("Stream stat failed\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
tempbuf = HeapAlloc(GetProcessHeap(), 0, ststg.cbSize.u.LowPart);
|
||||
memset(&seekto,0,sizeof(seekto));
|
||||
hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos);
|
||||
@@ -225,22 +225,22 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
|
||||
ERR("Failed Seek %x\n",hres);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
hres = IStream_Read(pStm,tempbuf,ststg.cbSize.u.LowPart,&res);
|
||||
if (hres) {
|
||||
ERR("Failed Read %x\n",hres);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
xsize = ststg.cbSize.u.LowPart;
|
||||
xbuf_add(buf,(LPBYTE)&xsize,sizeof(xsize));
|
||||
hres = xbuf_add(buf,tempbuf,ststg.cbSize.u.LowPart);
|
||||
|
||||
|
||||
HeapFree(GetProcessHeap(),0,tempbuf);
|
||||
IStream_Release(pStm);
|
||||
|
||||
|
||||
return hres;
|
||||
|
||||
|
||||
fail:
|
||||
xsize = 0;
|
||||
xbuf_add(buf,(LPBYTE)&xsize,sizeof(xsize));
|
||||
@@ -372,12 +372,13 @@ static HRESULT num_of_funcs(ITypeInfo *tinfo, unsigned int *num)
|
||||
typedef struct _TMAsmProxy {
|
||||
BYTE popleax;
|
||||
BYTE pushlval;
|
||||
BYTE nr;
|
||||
DWORD nr;
|
||||
BYTE pushleax;
|
||||
BYTE lcall;
|
||||
DWORD xcall;
|
||||
BYTE lret;
|
||||
WORD bytestopop;
|
||||
BYTE nop;
|
||||
} TMAsmProxy;
|
||||
|
||||
#include "poppack.h"
|
||||
@@ -470,7 +471,9 @@ TMProxyImpl_Connect(
|
||||
HRESULT hr = TMarshalDispatchChannel_Create(pRpcChannelBuffer, &This->iid, &pDelegateChannel);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
return IRpcProxyBuffer_Connect(This->dispatch_proxy, pDelegateChannel);
|
||||
hr = IRpcProxyBuffer_Connect(This->dispatch_proxy, pDelegateChannel);
|
||||
IRpcChannelBuffer_Release(pDelegateChannel);
|
||||
return hr;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
@@ -570,6 +573,7 @@ serialize_param(
|
||||
return S_OK;
|
||||
case VT_I8:
|
||||
case VT_UI8:
|
||||
case VT_R8:
|
||||
case VT_CY:
|
||||
hres = S_OK;
|
||||
if (debugout) TRACE_(olerelay)("%x%x\n",arg[0],arg[1]);
|
||||
@@ -633,7 +637,7 @@ serialize_param(
|
||||
DWORD len;
|
||||
if (!*bstr) {
|
||||
/* -1 means "null string" which is equivalent to empty string */
|
||||
len = -1;
|
||||
len = -1;
|
||||
hres = xbuf_add(buf, (LPBYTE)&len,sizeof(DWORD));
|
||||
if (hres) return hres;
|
||||
} else {
|
||||
@@ -651,7 +655,7 @@ serialize_param(
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
case VT_BSTR: {
|
||||
if (debugout) {
|
||||
if (*arg)
|
||||
@@ -897,6 +901,7 @@ deserialize_param(
|
||||
}
|
||||
case VT_I8:
|
||||
case VT_UI8:
|
||||
case VT_R8:
|
||||
case VT_CY:
|
||||
if (readit) {
|
||||
hres = xbuf_get(buf,(LPBYTE)arg,8);
|
||||
@@ -967,6 +972,7 @@ deserialize_param(
|
||||
hres = xbuf_get(buf,(LPBYTE)str,len*sizeof(WCHAR));
|
||||
if (hres) {
|
||||
ERR("Failed to read BSTR.\n");
|
||||
HeapFree(GetProcessHeap(),0,str);
|
||||
return hres;
|
||||
}
|
||||
*bstr = CoTaskMemAlloc(sizeof(BSTR *));
|
||||
@@ -997,6 +1003,7 @@ deserialize_param(
|
||||
hres = xbuf_get(buf,(LPBYTE)str,len*sizeof(WCHAR));
|
||||
if (hres) {
|
||||
ERR("Failed to read BSTR.\n");
|
||||
HeapFree(GetProcessHeap(),0,str);
|
||||
return hres;
|
||||
}
|
||||
*arg = (DWORD)SysAllocStringLen(str,len);
|
||||
@@ -1040,7 +1047,7 @@ deserialize_param(
|
||||
ITypeInfo_ReleaseTypeAttr(tinfo2, tattr);
|
||||
ITypeInfo_Release(tinfo2);
|
||||
}
|
||||
/* read it in all cases, we need to know if we have
|
||||
/* read it in all cases, we need to know if we have
|
||||
* NULL pointer or not.
|
||||
*/
|
||||
hres = xbuf_get(buf,(LPBYTE)&cookie,sizeof(cookie));
|
||||
@@ -1707,7 +1714,7 @@ static HRESULT init_proxy_entry_point(TMProxyImpl *proxy, unsigned int num)
|
||||
* arg3 arg2 arg1 <method> <returnptr>
|
||||
*/
|
||||
xasm->popleax = 0x58;
|
||||
xasm->pushlval = 0x6a;
|
||||
xasm->pushlval = 0x68;
|
||||
xasm->nr = num;
|
||||
xasm->pushleax = 0x50;
|
||||
xasm->lcall = 0xe8; /* relative jump */
|
||||
@@ -1715,6 +1722,7 @@ static HRESULT init_proxy_entry_point(TMProxyImpl *proxy, unsigned int num)
|
||||
xasm->xcall -= (DWORD)&(xasm->lret);
|
||||
xasm->lret = 0xc2;
|
||||
xasm->bytestopop = (nrofargs+2)*4; /* pop args, This, iMethod */
|
||||
xasm->nop = 0x90;
|
||||
proxy->lpvtbl[num] = xasm;
|
||||
#else
|
||||
FIXME("not implemented on non i386\n");
|
||||
@@ -1752,7 +1760,7 @@ PSFacBuf_CreateProxy(
|
||||
proxy = CoTaskMemAlloc(sizeof(TMProxyImpl));
|
||||
if (!proxy) return E_OUTOFMEMORY;
|
||||
|
||||
assert(sizeof(TMAsmProxy) == 12);
|
||||
assert(sizeof(TMAsmProxy) == 16);
|
||||
|
||||
proxy->dispatch = NULL;
|
||||
proxy->dispatch_proxy = NULL;
|
||||
@@ -1892,7 +1900,7 @@ TMStubImpl_AddRef(LPRPCSTUBBUFFER iface)
|
||||
{
|
||||
TMStubImpl *This = (TMStubImpl *)iface;
|
||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||
|
||||
|
||||
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
|
||||
|
||||
return refCount;
|
||||
|
||||
@@ -147,7 +147,7 @@ static void FromLEDWords(void *p_Val, int p_iSize)
|
||||
/*
|
||||
* Find a typelib key which matches a requested maj.min version.
|
||||
*/
|
||||
static BOOL find_typelib_key( REFGUID guid, WORD *wMaj, WORD *wMin )
|
||||
static BOOL find_typelib_key( REFGUID guid, WORD wMaj, WORD *wMin )
|
||||
{
|
||||
static const WCHAR typelibW[] = {'T','y','p','e','l','i','b','\\',0};
|
||||
WCHAR buffer[60];
|
||||
@@ -172,7 +172,7 @@ static BOOL find_typelib_key( REFGUID guid, WORD *wMaj, WORD *wMin )
|
||||
{
|
||||
TRACE("found %s: %x.%x\n", debugstr_w(buffer), v_maj, v_min);
|
||||
|
||||
if (*wMaj == v_maj)
|
||||
if (wMaj == v_maj)
|
||||
{
|
||||
if (*wMin == v_min)
|
||||
{
|
||||
@@ -274,7 +274,7 @@ HRESULT WINAPI QueryPathOfRegTypeLib(
|
||||
|
||||
TRACE_(typelib)("(%s, %x.%x, 0x%x, %p)\n", debugstr_guid(guid), wMaj, wMin, lcid, path);
|
||||
|
||||
if (!find_typelib_key( guid, &wMaj, &wMin )) return TYPE_E_LIBNOTREGISTERED;
|
||||
if (!find_typelib_key( guid, wMaj, &wMin )) return TYPE_E_LIBNOTREGISTERED;
|
||||
get_typelib_key( guid, wMaj, wMin, buffer );
|
||||
|
||||
res = RegOpenKeyExW( HKEY_CLASSES_ROOT, buffer, 0, KEY_READ, &hkey );
|
||||
@@ -1421,11 +1421,24 @@ static void *TLB_CopyTypeDesc( TYPEDESC *dest, const TYPEDESC *src, void *buffer
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/* free custom data allocated by MSFT_CustData */
|
||||
static inline void TLB_FreeCustData(TLBCustData *pCustData)
|
||||
{
|
||||
TLBCustData *pCustDataNext;
|
||||
for (; pCustData; pCustData = pCustDataNext)
|
||||
{
|
||||
VariantClear(&pCustData->data);
|
||||
|
||||
pCustDataNext = pCustData->next;
|
||||
TLB_Free(pCustData);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Functions for reading MSFT typelibs (those created by CreateTypeLib2)
|
||||
*/
|
||||
static inline unsigned int MSFT_Tell(TLBContext *pcx)
|
||||
static inline unsigned int MSFT_Tell(const TLBContext *pcx)
|
||||
{
|
||||
return pcx->pos;
|
||||
}
|
||||
@@ -2588,7 +2601,7 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
|
||||
}
|
||||
|
||||
|
||||
static BSTR TLB_MultiByteToBSTR(char *ptr)
|
||||
static BSTR TLB_MultiByteToBSTR(const char *ptr)
|
||||
{
|
||||
DWORD len;
|
||||
WCHAR *nameW;
|
||||
@@ -2602,7 +2615,7 @@ static BSTR TLB_MultiByteToBSTR(char *ptr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL TLB_GUIDFromString(char *str, GUID *guid)
|
||||
static BOOL TLB_GUIDFromString(const char *str, GUID *guid)
|
||||
{
|
||||
char b[3];
|
||||
int i;
|
||||
@@ -2624,14 +2637,14 @@ static BOOL TLB_GUIDFromString(char *str, GUID *guid)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static WORD SLTG_ReadString(char *ptr, BSTR *pBstr)
|
||||
static WORD SLTG_ReadString(const char *ptr, BSTR *pBstr)
|
||||
{
|
||||
WORD bytelen;
|
||||
DWORD len;
|
||||
WCHAR *nameW;
|
||||
|
||||
*pBstr = NULL;
|
||||
bytelen = *(WORD*)ptr;
|
||||
bytelen = *(const WORD*)ptr;
|
||||
if(bytelen == 0xffff) return 2;
|
||||
len = MultiByteToWideChar(CP_ACP, 0, ptr + 2, bytelen, NULL, 0);
|
||||
nameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
@@ -2641,12 +2654,12 @@ static WORD SLTG_ReadString(char *ptr, BSTR *pBstr)
|
||||
return bytelen + 2;
|
||||
}
|
||||
|
||||
static WORD SLTG_ReadStringA(char *ptr, char **str)
|
||||
static WORD SLTG_ReadStringA(const char *ptr, char **str)
|
||||
{
|
||||
WORD bytelen;
|
||||
|
||||
*str = NULL;
|
||||
bytelen = *(WORD*)ptr;
|
||||
bytelen = *(const WORD*)ptr;
|
||||
if(bytelen == 0xffff) return 2;
|
||||
*str = HeapAlloc(GetProcessHeap(), 0, bytelen + 1);
|
||||
memcpy(*str, ptr + 2, bytelen);
|
||||
@@ -2711,7 +2724,8 @@ typedef struct
|
||||
HREFTYPE refs[1];
|
||||
} sltg_ref_lookup_t;
|
||||
|
||||
static HRESULT sltg_get_typelib_ref(sltg_ref_lookup_t *table, DWORD typeinfo_ref, HREFTYPE *typelib_ref)
|
||||
static HRESULT sltg_get_typelib_ref(const sltg_ref_lookup_t *table, DWORD typeinfo_ref,
|
||||
HREFTYPE *typelib_ref)
|
||||
{
|
||||
if(typeinfo_ref < table->num)
|
||||
{
|
||||
@@ -2724,7 +2738,7 @@ static HRESULT sltg_get_typelib_ref(sltg_ref_lookup_t *table, DWORD typeinfo_ref
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static WORD *SLTG_DoType(WORD *pType, char *pBlk, TYPEDESC *pTD, sltg_ref_lookup_t *ref_lookup)
|
||||
static WORD *SLTG_DoType(WORD *pType, char *pBlk, TYPEDESC *pTD, const sltg_ref_lookup_t *ref_lookup)
|
||||
{
|
||||
BOOL done = FALSE;
|
||||
|
||||
@@ -2790,7 +2804,8 @@ static WORD *SLTG_DoType(WORD *pType, char *pBlk, TYPEDESC *pTD, sltg_ref_lookup
|
||||
return pType;
|
||||
}
|
||||
|
||||
static WORD *SLTG_DoElem(WORD *pType, char *pBlk, ELEMDESC *pElem, sltg_ref_lookup_t *ref_lookup)
|
||||
static WORD *SLTG_DoElem(WORD *pType, char *pBlk,
|
||||
ELEMDESC *pElem, const sltg_ref_lookup_t *ref_lookup)
|
||||
{
|
||||
/* Handle [in/out] first */
|
||||
if((*pType & 0xc000) == 0xc000)
|
||||
@@ -2899,7 +2914,7 @@ static sltg_ref_lookup_t *SLTG_DoRefs(SLTG_RefInfo *pRef, ITypeLibImpl *pTL,
|
||||
}
|
||||
|
||||
static char *SLTG_DoImpls(char *pBlk, ITypeInfoImpl *pTI,
|
||||
BOOL OneOnly, sltg_ref_lookup_t *ref_lookup)
|
||||
BOOL OneOnly, const sltg_ref_lookup_t *ref_lookup)
|
||||
{
|
||||
SLTG_ImplInfo *info;
|
||||
TLBImplType **ppImplType = &pTI->impltypelist;
|
||||
@@ -2929,7 +2944,8 @@ static char *SLTG_DoImpls(char *pBlk, ITypeInfoImpl *pTI,
|
||||
return (char*)info;
|
||||
}
|
||||
|
||||
static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsigned short cVars, char *pNameTable, sltg_ref_lookup_t *ref_lookup)
|
||||
static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsigned short cVars,
|
||||
const char *pNameTable, const sltg_ref_lookup_t *ref_lookup)
|
||||
{
|
||||
TLBVarDesc **ppVarDesc = &pTI->varlist;
|
||||
BSTR bstrPrevName = NULL;
|
||||
@@ -3003,7 +3019,8 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign
|
||||
pTI->TypeAttr.cVars = cVars;
|
||||
}
|
||||
|
||||
static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsigned short cFuncs, char *pNameTable, sltg_ref_lookup_t *ref_lookup)
|
||||
static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI,
|
||||
unsigned short cFuncs, char *pNameTable, const sltg_ref_lookup_t *ref_lookup)
|
||||
{
|
||||
SLTG_Function *pFunc;
|
||||
unsigned short i;
|
||||
@@ -3072,7 +3089,7 @@ static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsig
|
||||
pointing at an alpha-numeric char. However if *pArg is
|
||||
0xffff or 0xfffe then the param has no name, the former
|
||||
meaning that the next WORD is the type, the latter
|
||||
meaning the the next WORD is an offset to the type. */
|
||||
meaning that the next WORD is an offset to the type. */
|
||||
|
||||
HaveOffs = FALSE;
|
||||
if(*pArg == 0xffff)
|
||||
@@ -3138,7 +3155,7 @@ static void SLTG_ProcessCoClass(char *pBlk, ITypeInfoImpl *pTI,
|
||||
|
||||
static void SLTG_ProcessInterface(char *pBlk, ITypeInfoImpl *pTI,
|
||||
char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
|
||||
SLTG_TypeInfoTail *pTITail)
|
||||
const SLTG_TypeInfoTail *pTITail)
|
||||
{
|
||||
char *pFirstItem, *pNextItem;
|
||||
sltg_ref_lookup_t *ref_lookup = NULL;
|
||||
@@ -3164,15 +3181,15 @@ static void SLTG_ProcessInterface(char *pBlk, ITypeInfoImpl *pTI,
|
||||
}
|
||||
|
||||
static void SLTG_ProcessRecord(char *pBlk, ITypeInfoImpl *pTI,
|
||||
char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
|
||||
SLTG_TypeInfoTail *pTITail)
|
||||
const char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
|
||||
const SLTG_TypeInfoTail *pTITail)
|
||||
{
|
||||
SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable, NULL);
|
||||
}
|
||||
|
||||
static void SLTG_ProcessAlias(char *pBlk, ITypeInfoImpl *pTI,
|
||||
char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
|
||||
SLTG_TypeInfoTail *pTITail)
|
||||
const SLTG_TypeInfoTail *pTITail)
|
||||
{
|
||||
WORD *pType;
|
||||
sltg_ref_lookup_t *ref_lookup = NULL;
|
||||
@@ -3198,7 +3215,7 @@ static void SLTG_ProcessAlias(char *pBlk, ITypeInfoImpl *pTI,
|
||||
|
||||
static void SLTG_ProcessDispatch(char *pBlk, ITypeInfoImpl *pTI,
|
||||
char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
|
||||
SLTG_TypeInfoTail *pTITail)
|
||||
const SLTG_TypeInfoTail *pTITail)
|
||||
{
|
||||
sltg_ref_lookup_t *ref_lookup = NULL;
|
||||
if (pTIHeader->href_table != 0xffffffff)
|
||||
@@ -3222,15 +3239,15 @@ static void SLTG_ProcessDispatch(char *pBlk, ITypeInfoImpl *pTI,
|
||||
}
|
||||
|
||||
static void SLTG_ProcessEnum(char *pBlk, ITypeInfoImpl *pTI,
|
||||
char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
|
||||
SLTG_TypeInfoTail *pTITail)
|
||||
const char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
|
||||
const SLTG_TypeInfoTail *pTITail)
|
||||
{
|
||||
SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable, NULL);
|
||||
}
|
||||
|
||||
static void SLTG_ProcessModule(char *pBlk, ITypeInfoImpl *pTI,
|
||||
char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
|
||||
SLTG_TypeInfoTail *pTITail)
|
||||
const SLTG_TypeInfoTail *pTITail)
|
||||
{
|
||||
sltg_ref_lookup_t *ref_lookup = NULL;
|
||||
if (pTIHeader->href_table != 0xffffffff)
|
||||
@@ -3753,8 +3770,8 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoType(
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
int i;
|
||||
ITypeInfoImpl *pTInfo = This->pTypeInfo;
|
||||
|
||||
if ((ITypeLib2_fnGetTypeInfoCount(iface) < index + 1) || (index < 0))
|
||||
|
||||
if (ITypeLib2_fnGetTypeInfoCount(iface) < index + 1)
|
||||
return TYPE_E_ELEMENTNOTFOUND;
|
||||
|
||||
TRACE("(%p) index %d\n", This, index);
|
||||
@@ -4470,7 +4487,6 @@ static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
|
||||
TLBFuncDesc *pFInfo, *pFInfoNext;
|
||||
TLBVarDesc *pVInfo, *pVInfoNext;
|
||||
TLBImplType *pImpl, *pImplNext;
|
||||
TLBCustData *pCustData, *pCustDataNext;
|
||||
|
||||
TRACE("destroying ITypeInfo(%p)\n",This);
|
||||
|
||||
@@ -4510,14 +4526,8 @@ static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
|
||||
}
|
||||
TLB_Free(pFInfo->funcdesc.lprgelemdescParam);
|
||||
TLB_Free(pFInfo->pParamDesc);
|
||||
for (pCustData = This->pCustData; pCustData; pCustData = pCustDataNext)
|
||||
{
|
||||
VariantClear(&pCustData->data);
|
||||
|
||||
pCustDataNext = pCustData->next;
|
||||
TLB_Free(pCustData);
|
||||
}
|
||||
if (HIWORD(pFInfo->Entry) != 0 && pFInfo->Entry != (BSTR)-1)
|
||||
TLB_FreeCustData(pFInfo->pCustData);
|
||||
if (HIWORD(pFInfo->Entry) != 0 && pFInfo->Entry != (BSTR)-1)
|
||||
SysFreeString(pFInfo->Entry);
|
||||
SysFreeString(pFInfo->HelpString);
|
||||
SysFreeString(pFInfo->Name);
|
||||
@@ -4532,23 +4542,18 @@ static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
|
||||
VariantClear(pVInfo->vardesc.u.lpvarValue);
|
||||
TLB_Free(pVInfo->vardesc.u.lpvarValue);
|
||||
}
|
||||
TLB_FreeCustData(pVInfo->pCustData);
|
||||
SysFreeString(pVInfo->Name);
|
||||
pVInfoNext = pVInfo->next;
|
||||
TLB_Free(pVInfo);
|
||||
}
|
||||
for(pImpl = This->impltypelist; pImpl; pImpl = pImplNext)
|
||||
{
|
||||
for (pCustData = pImpl->pCustData; pCustData; pCustData = pCustDataNext)
|
||||
{
|
||||
VariantClear(&pCustData->data);
|
||||
|
||||
pCustDataNext = pCustData->next;
|
||||
TLB_Free(pCustData);
|
||||
}
|
||||
TLB_FreeCustData(pImpl->pCustData);
|
||||
pImplNext = pImpl->next;
|
||||
TLB_Free(pImpl);
|
||||
}
|
||||
TLB_Free(This->pCustData);
|
||||
TLB_FreeCustData(This->pCustData);
|
||||
|
||||
finish_free:
|
||||
if (This->next)
|
||||
@@ -4636,7 +4641,7 @@ static HRESULT TLB_CopyElemDesc( const ELEMDESC *src, ELEMDESC *dest, char **buf
|
||||
*buffer += sizeof(PARAMDESCEX);
|
||||
memcpy(pparamdescex_dest, pparamdescex_src, sizeof(PARAMDESCEX));
|
||||
VariantInit(&pparamdescex_dest->varDefaultValue);
|
||||
return VariantCopy(&pparamdescex_dest->varDefaultValue,
|
||||
return VariantCopy(&pparamdescex_dest->varDefaultValue,
|
||||
(VARIANTARG *)&pparamdescex_src->varDefaultValue);
|
||||
}
|
||||
else
|
||||
@@ -4670,6 +4675,8 @@ static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_pt
|
||||
if (!dest) return E_OUTOFMEMORY;
|
||||
|
||||
memcpy(dest, src, sizeof(FUNCDESC));
|
||||
if (dispinterface) /* overwrite funckind */
|
||||
dest->funckind = FUNC_DISPATCH;
|
||||
buffer = (char *)(dest + 1);
|
||||
|
||||
dest->lprgscode = (SCODE *)buffer;
|
||||
@@ -4793,7 +4800,7 @@ static HRESULT ITypeInfoImpl_GetInternalDispatchFuncDesc( ITypeInfo *iface,
|
||||
*funcs = implemented_funcs + This->TypeAttr.cFuncs;
|
||||
else
|
||||
*hrefoffset = 0;
|
||||
|
||||
|
||||
if (index < implemented_funcs)
|
||||
return E_INVALIDARG;
|
||||
return ITypeInfoImpl_GetInternalFuncDesc(iface, index - implemented_funcs,
|
||||
@@ -5372,7 +5379,7 @@ static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc,
|
||||
tdesc = tdesc->u.lptdesc;
|
||||
|
||||
/* 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 */
|
||||
if ((tdesc->vt == VT_USERDEFINED) ||
|
||||
((tdesc->vt == VT_PTR) && (tdesc->u.lptdesc->vt == VT_USERDEFINED)))
|
||||
@@ -5385,7 +5392,7 @@ static HRESULT typedescvt_to_variantvt(ITypeInfo *tinfo, const TYPEDESC *tdesc,
|
||||
tdesc_userdefined = tdesc->u.lptdesc;
|
||||
}
|
||||
hr = userdefined_to_variantvt(tinfo, tdesc_userdefined, &vt_userdefined);
|
||||
if ((hr == S_OK) &&
|
||||
if ((hr == S_OK) &&
|
||||
(((vt_userdefined & VT_TYPEMASK) == VT_UNKNOWN) ||
|
||||
((vt_userdefined & VT_TYPEMASK) == VT_DISPATCH)))
|
||||
{
|
||||
@@ -5587,7 +5594,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
|
||||
TRACE("invoking:\n");
|
||||
dump_TLBFuncDescOne(pFuncInfo);
|
||||
}
|
||||
|
||||
|
||||
switch (func_desc->funckind) {
|
||||
case FUNC_PUREVIRTUAL:
|
||||
case FUNC_VIRTUAL: {
|
||||
@@ -5989,7 +5996,7 @@ func_fail:
|
||||
|
||||
hres = ITypeInfo2_GetVarDesc(iface, var_index, &var_desc);
|
||||
if(FAILED(hres)) return hres;
|
||||
|
||||
|
||||
FIXME("varseek: Found memid, but variable-based invoking not supported\n");
|
||||
dump_VARDESC(var_desc);
|
||||
ITypeInfo2_ReleaseVarDesc(iface, var_desc);
|
||||
@@ -6418,19 +6425,19 @@ static HRESULT WINAPI ITypeInfo_fnGetContainingTypeLib( ITypeInfo2 *iface,
|
||||
ITypeLib * *ppTLib, UINT *pIndex)
|
||||
{
|
||||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
|
||||
|
||||
/* If a pointer is null, we simply ignore it, the ATL in particular passes pIndex as 0 */
|
||||
if (pIndex) {
|
||||
*pIndex=This->index;
|
||||
TRACE("returning pIndex=%d\n", *pIndex);
|
||||
}
|
||||
|
||||
|
||||
if (ppTLib) {
|
||||
*ppTLib=(LPTYPELIB )(This->pTypeLib);
|
||||
ITypeLib2_AddRef(*ppTLib);
|
||||
TRACE("returning ppTLib=%p\n", *ppTLib);
|
||||
}
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -6641,7 +6648,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetParamCustData(
|
||||
|
||||
for(i=0, pFDesc=This->funclist; i!=indexFunc && pFDesc; i++,pFDesc=pFDesc->next);
|
||||
|
||||
if(pFDesc && indexParam >=0 && indexParam<pFDesc->funcdesc.cParams)
|
||||
if(pFDesc && indexParam<pFDesc->funcdesc.cParams)
|
||||
for(pCData=pFDesc->pParamDesc[indexParam].pCustData; pCData;
|
||||
pCData = pCData->next)
|
||||
if( IsEqualIID(guid, &pCData->guid)) break;
|
||||
@@ -6874,7 +6881,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllParamCustData( ITypeInfo2 * iface,
|
||||
for(i=0, pFDesc=This->funclist; i!=indexFunc && pFDesc; i++,
|
||||
pFDesc=pFDesc->next)
|
||||
;
|
||||
if(pFDesc && indexParam >=0 && indexParam<pFDesc->funcdesc.cParams){
|
||||
if(pFDesc && indexParam<pFDesc->funcdesc.cParams){
|
||||
pCustData->prgCustData =
|
||||
TLB_Alloc(pFDesc->pParamDesc[indexParam].ctCustData *
|
||||
sizeof(CUSTDATAITEM));
|
||||
|
||||
@@ -153,6 +153,9 @@ HRESULT WINAPI LoadTypeLib16(
|
||||
*| OLE 2.1 NT 1993-95 ?? ???
|
||||
*| OLE 2.3.1 W95 23 700
|
||||
*| OLE2 4.0 NT4SP6 1993-98 40 4277
|
||||
*| OLE 2.1 W2K 2000 10 3029
|
||||
*| OLE 2.1 WXP 2002 10 3029
|
||||
*| OLE 2.1 Vista 2007 10 3029
|
||||
*/
|
||||
DWORD WINAPI OaBuildVersion16(void)
|
||||
{
|
||||
@@ -171,6 +174,12 @@ DWORD WINAPI OaBuildVersion16(void)
|
||||
return MAKELONG(3024, 10); /* W98 SE */
|
||||
case 0x00000004: /* NT4 */
|
||||
return MAKELONG(4277, 40); /* NT4 SP6 */
|
||||
case 0x00000005: /* W2K */
|
||||
return MAKELONG(3029, 10); /* W2K SP4 */
|
||||
case 0x00000105: /* WXP */
|
||||
return MAKELONG(3029, 10); /* WXP SP2 */
|
||||
case 0x00000006: /* Vista */
|
||||
return MAKELONG(3029, 10); /* Vista */
|
||||
default:
|
||||
FIXME("Version value not known yet. Please investigate it!\n");
|
||||
return 0;
|
||||
|
||||
@@ -322,7 +322,7 @@ static int ctl2_find_guid(
|
||||
*/
|
||||
static int ctl2_find_name(
|
||||
ICreateTypeLib2Impl *This, /* [I] The typelib to operate against. */
|
||||
char *name) /* [I] The encoded name to find. */
|
||||
const char *name) /* [I] The encoded name to find. */
|
||||
{
|
||||
int offset;
|
||||
int *namestruct;
|
||||
@@ -331,7 +331,7 @@ static int ctl2_find_name(
|
||||
while (offset != -1) {
|
||||
namestruct = (int *)&This->typelib_segment_data[MSFT_SEG_NAME][offset];
|
||||
|
||||
if (!((namestruct[2] ^ *((int *)name)) & 0xffff00ff)) {
|
||||
if (!((namestruct[2] ^ *((const int *)name)) & 0xffff00ff)) {
|
||||
/* hash codes and lengths match, final test */
|
||||
if (!strncasecmp(name+4, (void *)(namestruct+3), name[0])) break;
|
||||
}
|
||||
@@ -828,7 +828,7 @@ static HRESULT ctl2_set_custdata(
|
||||
*/
|
||||
static int ctl2_encode_typedesc(
|
||||
ICreateTypeLib2Impl *This, /* [I] The type library in which to encode the TYPEDESC. */
|
||||
TYPEDESC *tdesc, /* [I] The type description to encode. */
|
||||
const TYPEDESC *tdesc, /* [I] The type description to encode. */
|
||||
int *encoded_tdesc, /* [O] The encoded type description. */
|
||||
int *width, /* [O] The width of the type, or NULL. */
|
||||
int *alignment, /* [O] The alignment of the type, or NULL. */
|
||||
@@ -924,7 +924,7 @@ static int ctl2_encode_typedesc(
|
||||
|
||||
if (typeoffset == This->typelib_segdir[MSFT_SEG_TYPEDESC].length) {
|
||||
int mix_field;
|
||||
|
||||
|
||||
if (target_type & 0x80000000) {
|
||||
mix_field = ((target_type >> 16) & 0x3fff) | VT_BYREF;
|
||||
} else {
|
||||
@@ -959,7 +959,7 @@ static int ctl2_encode_typedesc(
|
||||
|
||||
if (typeoffset == This->typelib_segdir[MSFT_SEG_TYPEDESC].length) {
|
||||
int mix_field;
|
||||
|
||||
|
||||
if (target_type & 0x80000000) {
|
||||
mix_field = ((target_type >> 16) & VT_TYPEMASK) | VT_ARRAY;
|
||||
} else {
|
||||
@@ -1200,7 +1200,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetGuid(ICreateTypeInfo2 *iface, REFGUI
|
||||
guidentry.next_hash = -1;
|
||||
|
||||
offset = ctl2_alloc_guid(This->typelib, &guidentry);
|
||||
|
||||
|
||||
if (offset == -1) return E_OUTOFMEMORY;
|
||||
|
||||
This->typeinfo->posguid = offset;
|
||||
@@ -1382,7 +1382,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
|
||||
FIXME("{%d,%p,%p,%d,%d,%d,%d,%d,%d,%d,{%d},%d}\n", pFuncDesc->memid, pFuncDesc->lprgscode, pFuncDesc->lprgelemdescParam, pFuncDesc->funckind, pFuncDesc->invkind, pFuncDesc->callconv, pFuncDesc->cParams, pFuncDesc->cParamsOpt, pFuncDesc->oVft, pFuncDesc->cScodes, pFuncDesc->elemdescFunc.tdesc.vt, pFuncDesc->wFuncFlags);
|
||||
/* FIXME("{%d, %d}\n", pFuncDesc->lprgelemdescParam[0].tdesc.vt, pFuncDesc->lprgelemdescParam[1].tdesc.vt); */
|
||||
/* return E_OUTOFMEMORY; */
|
||||
|
||||
|
||||
if (!This->typedata) {
|
||||
This->typedata = HeapAlloc(GetProcessHeap(), 0, 0x2000);
|
||||
This->typedata[0] = 0;
|
||||
@@ -1658,7 +1658,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddVarDesc(
|
||||
This->datawidth += var_alignment - 1;
|
||||
This->datawidth &= ~(var_alignment - 1);
|
||||
typedata[4] = This->datawidth;
|
||||
|
||||
|
||||
/* add the new variable to the total data width */
|
||||
This->datawidth += var_datawidth;
|
||||
|
||||
@@ -2468,7 +2468,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetContainingTypeLib(
|
||||
ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
|
||||
|
||||
TRACE("(%p,%p,%p)\n", iface, ppTLib, pIndex);
|
||||
|
||||
|
||||
*ppTLib = (ITypeLib *)&This->typelib->lpVtblTypeLib2;
|
||||
This->typelib->ref++;
|
||||
*pIndex = This->typeinfo->typekind >> 16;
|
||||
@@ -3135,7 +3135,7 @@ static HRESULT WINAPI ICreateTypeLib2_fnSetGuid(ICreateTypeLib2 * iface, REFGUID
|
||||
guidentry.next_hash = -1;
|
||||
|
||||
offset = ctl2_alloc_guid(This, &guidentry);
|
||||
|
||||
|
||||
if (offset == -1) return E_OUTOFMEMORY;
|
||||
|
||||
This->typelib_header.posguid = offset;
|
||||
@@ -3225,7 +3225,7 @@ static HRESULT WINAPI ICreateTypeLib2_fnSetLibFlags(ICreateTypeLib2 * iface, UIN
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static int ctl2_write_chunk(HANDLE hFile, void *segment, int length)
|
||||
static int ctl2_write_chunk(HANDLE hFile, const void *segment, int length)
|
||||
{
|
||||
DWORD dwWritten;
|
||||
if (!WriteFile(hFile, segment, length, &dwWritten, 0)) {
|
||||
@@ -3493,7 +3493,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfo(
|
||||
|
||||
TRACE("(%p,%d,%p)\n", iface, index, ppTInfo);
|
||||
|
||||
if ((index < 0) || (index >= This->typelib_header.nrtypeinfos)) {
|
||||
if (index >= This->typelib_header.nrtypeinfos) {
|
||||
return TYPE_E_ELEMENTNOTFOUND;
|
||||
}
|
||||
|
||||
@@ -3514,7 +3514,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoType(
|
||||
|
||||
TRACE("(%p,%d,%p)\n", iface, index, pTKind);
|
||||
|
||||
if ((index < 0) || (index >= This->typelib_header.nrtypeinfos)) {
|
||||
if (index >= This->typelib_header.nrtypeinfos) {
|
||||
return TYPE_E_ELEMENTNOTFOUND;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,11 @@ static void *ungif_calloc( size_t num, size_t sz )
|
||||
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, num*sz );
|
||||
}
|
||||
|
||||
static void *ungif_realloc( void *ptr, size_t sz )
|
||||
{
|
||||
return HeapReAlloc( GetProcessHeap(), 0, ptr, sz );
|
||||
}
|
||||
|
||||
static void ungif_free( void *ptr )
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
@@ -102,7 +107,7 @@ typedef struct GifFilePrivateType {
|
||||
static int DGifGetWord(GifFileType *GifFile, GifWord *Word);
|
||||
static int DGifSetupDecompress(GifFileType *GifFile);
|
||||
static int DGifDecompressLine(GifFileType *GifFile, GifPixelType *Line, int LineLen);
|
||||
static int DGifGetPrefixChar(GifPrefixType *Prefix, int Code, int ClearCode);
|
||||
static int DGifGetPrefixChar(const GifPrefixType *Prefix, int Code, int ClearCode);
|
||||
static int DGifDecompressInput(GifFileType *GifFile, int *Code);
|
||||
static int DGifBufferedInput(GifFileType *GifFile, GifByteType *Buf,
|
||||
GifByteType *NextByte);
|
||||
@@ -187,14 +192,14 @@ FreeMapObject(ColorMapObject * Object) {
|
||||
static int
|
||||
AddExtensionBlock(SavedImage * New,
|
||||
int Len,
|
||||
unsigned char ExtData[]) {
|
||||
const unsigned char ExtData[]) {
|
||||
|
||||
ExtensionBlock *ep;
|
||||
|
||||
if (New->ExtensionBlocks == NULL)
|
||||
New->ExtensionBlocks = ungif_alloc(sizeof(ExtensionBlock));
|
||||
else
|
||||
New->ExtensionBlocks = realloc(New->ExtensionBlocks,
|
||||
New->ExtensionBlocks = ungif_realloc(New->ExtensionBlocks,
|
||||
sizeof(ExtensionBlock) *
|
||||
(New->ExtensionBlockCount + 1));
|
||||
|
||||
@@ -387,7 +392,7 @@ DGifGetImageDesc(GifFileType * GifFile) {
|
||||
}
|
||||
|
||||
if (GifFile->SavedImages) {
|
||||
if ((GifFile->SavedImages = realloc(GifFile->SavedImages,
|
||||
if ((GifFile->SavedImages = ungif_realloc(GifFile->SavedImages,
|
||||
sizeof(SavedImage) *
|
||||
(GifFile->ImageCount + 1))) == NULL) {
|
||||
return GIF_ERROR;
|
||||
@@ -637,17 +642,17 @@ DGifDecompressLine(GifFileType * GifFile,
|
||||
Private->MaxCode1 = 1 << Private->RunningBits;
|
||||
LastCode = Private->LastCode = NO_SUCH_CODE;
|
||||
} else {
|
||||
/* Its regular code - if in pixel range simply add it to output
|
||||
/* It's a regular code - if in pixel range simply add it to output
|
||||
* stream, otherwise trace to codes linked list until the prefix
|
||||
* is in pixel range: */
|
||||
if (CrntCode < ClearCode) {
|
||||
/* This is simple - its pixel scalar, so add it to output: */
|
||||
Line[i++] = CrntCode;
|
||||
} else {
|
||||
/* Its a code to needed to be traced: trace the linked list
|
||||
/* It's a code to be traced: trace the linked list
|
||||
* until the prefix is a pixel, while pushing the suffix
|
||||
* pixels on our stack. If we done, pop the stack in reverse
|
||||
* (thats what stack is good for!) order to output. */
|
||||
* order (that's what stack is good for!) for output. */
|
||||
if (Prefix[CrntCode] == NO_SUCH_CODE) {
|
||||
/* Only allowed if CrntCode is exactly the running code:
|
||||
* In that case CrntCode = XXXCode, CrntCode or the
|
||||
@@ -718,7 +723,7 @@ DGifDecompressLine(GifFileType * GifFile,
|
||||
* the maximum possible if image O.k. - LZ_MAX_CODE times.
|
||||
*****************************************************************************/
|
||||
static int
|
||||
DGifGetPrefixChar(GifPrefixType *Prefix,
|
||||
DGifGetPrefixChar(const GifPrefixType *Prefix,
|
||||
int Code,
|
||||
int ClearCode) {
|
||||
|
||||
|
||||
@@ -49,10 +49,10 @@ static CStdPSFactoryBuffer PSFactoryBuffer;
|
||||
|
||||
CSTDSTUBBUFFERRELEASE(&PSFactoryBuffer)
|
||||
|
||||
extern const ExtendedProxyFileInfo oaidl_ProxyFileInfo;
|
||||
extern const ExtendedProxyFileInfo oleaut32_oaidl_ProxyFileInfo;
|
||||
|
||||
static const ProxyFileInfo *OLEAUT32_ProxyFileList[] = {
|
||||
&oaidl_ProxyFileInfo,
|
||||
&oleaut32_oaidl_ProxyFileInfo,
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -62,7 +62,7 @@ HRESULT OLEAUTPS_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
||||
&CLSID_PSDispatch, &PSFactoryBuffer);
|
||||
}
|
||||
|
||||
static void dump_user_flags(ULONG *pFlags)
|
||||
static void dump_user_flags(const ULONG *pFlags)
|
||||
{
|
||||
if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION)
|
||||
TRACE("MAKELONG(NDR_LOCAL_REPRESENTATION, ");
|
||||
@@ -101,10 +101,10 @@ unsigned char * WINAPI CLEANLOCALSTORAGE_UserMarshal(ULONG *pFlags, unsigned cha
|
||||
ITypeLib_ReleaseTLibAttr((ITypeLib*)pstg->pInterface, *(TLIBATTR**)pstg->pStorage);
|
||||
break;
|
||||
case CLS_TYPEATTR:
|
||||
ITypeInfo_ReleaseTypeAttr((ITypeInfo*)pstg->pInterface, *(TYPEATTR**)pstg->pStorage);
|
||||
ITypeInfo_ReleaseTypeAttr((ITypeInfo*)pstg->pInterface, *(TYPEATTR**)pstg->pStorage);
|
||||
break;
|
||||
case CLS_FUNCDESC:
|
||||
ITypeInfo_ReleaseFuncDesc((ITypeInfo*)pstg->pInterface, *(FUNCDESC**)pstg->pStorage);
|
||||
ITypeInfo_ReleaseFuncDesc((ITypeInfo*)pstg->pInterface, *(FUNCDESC**)pstg->pStorage);
|
||||
break;
|
||||
case CLS_VARDESC:
|
||||
ITypeInfo_ReleaseVarDesc((ITypeInfo*)pstg->pInterface, *(VARDESC**)pstg->pStorage);
|
||||
@@ -183,7 +183,7 @@ unsigned char * WINAPI BSTR_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer,
|
||||
header = (bstr_wire_t*)Buffer;
|
||||
if(header->len != header->len2)
|
||||
FIXME("len %08x != len2 %08x\n", header->len, header->len2);
|
||||
|
||||
|
||||
if(*pstr)
|
||||
{
|
||||
SysFreeString(*pstr);
|
||||
@@ -220,11 +220,11 @@ typedef struct
|
||||
DWORD switch_is;
|
||||
} variant_wire_t;
|
||||
|
||||
static unsigned int get_type_size(ULONG *pFlags, VARIANT *pvar)
|
||||
static unsigned int get_type_size(ULONG *pFlags, VARTYPE vt)
|
||||
{
|
||||
if (V_VT(pvar) & VT_ARRAY) return 4;
|
||||
if (vt & VT_ARRAY) return 4;
|
||||
|
||||
switch (V_VT(pvar) & ~VT_BYREF) {
|
||||
switch (vt & ~VT_BYREF) {
|
||||
case VT_EMPTY:
|
||||
case VT_NULL:
|
||||
return 0;
|
||||
@@ -263,21 +263,21 @@ static unsigned int get_type_size(ULONG *pFlags, VARIANT *pvar)
|
||||
case VT_RECORD:
|
||||
return 0;
|
||||
default:
|
||||
FIXME("unhandled VT %d\n", V_VT(pvar));
|
||||
FIXME("unhandled VT %d\n", vt);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int get_type_alignment(ULONG *pFlags, VARIANT *pvar)
|
||||
static unsigned int get_type_alignment(ULONG *pFlags, VARTYPE vt)
|
||||
{
|
||||
unsigned int size = get_type_size(pFlags, pvar);
|
||||
if(V_VT(pvar) & VT_BYREF) return 3;
|
||||
unsigned int size = get_type_size(pFlags, vt);
|
||||
if(vt & VT_BYREF) return 3;
|
||||
if(size == 0) return 0;
|
||||
if(size <= 4) return size - 1;
|
||||
return 7;
|
||||
}
|
||||
|
||||
static unsigned interface_variant_size(ULONG *pFlags, REFIID riid, IUnknown *punk)
|
||||
static unsigned interface_variant_size(const ULONG *pFlags, REFIID riid, IUnknown *punk)
|
||||
{
|
||||
ULONG size;
|
||||
HRESULT hr;
|
||||
@@ -301,7 +301,7 @@ static ULONG wire_extra_user_size(ULONG *pFlags, ULONG Start, VARIANT *pvar)
|
||||
{
|
||||
if (V_ISBYREF(pvar))
|
||||
return LPSAFEARRAY_UserSize(pFlags, Start, V_ARRAYREF(pvar));
|
||||
else
|
||||
else
|
||||
return LPSAFEARRAY_UserSize(pFlags, Start, &V_ARRAY(pvar));
|
||||
}
|
||||
|
||||
@@ -333,19 +333,20 @@ static ULONG wire_extra_user_size(ULONG *pFlags, ULONG Start, VARIANT *pvar)
|
||||
}
|
||||
|
||||
/* helper: called for VT_DISPATCH variants to marshal the IDispatch* into the buffer. returns Buffer on failure, new position otherwise */
|
||||
static unsigned char* interface_variant_marshal(ULONG *pFlags, unsigned char *Buffer, REFIID riid, IUnknown *punk)
|
||||
static unsigned char* interface_variant_marshal(const ULONG *pFlags, unsigned char *Buffer,
|
||||
REFIID riid, IUnknown *punk)
|
||||
{
|
||||
IStream *working;
|
||||
IStream *working;
|
||||
HGLOBAL working_mem;
|
||||
void *working_memlocked;
|
||||
unsigned char *oldpos;
|
||||
ULONG size;
|
||||
HRESULT hr;
|
||||
|
||||
|
||||
TRACE("pFlags=%d, Buffer=%p, pUnk=%p\n", *pFlags, Buffer, punk);
|
||||
|
||||
oldpos = Buffer;
|
||||
|
||||
|
||||
/* CoMarshalInterface needs a stream, whereas at this level we are operating in terms of buffers.
|
||||
* We create a stream on an HGLOBAL, so we can simply do a memcpy to move it to the buffer.
|
||||
* in rpcrt4/ndr_ole.c, a simple IStream implementation is wrapped around the buffer object,
|
||||
@@ -353,7 +354,7 @@ static unsigned char* interface_variant_marshal(ULONG *pFlags, unsigned char *Bu
|
||||
* code has no way to know how long the marshalled buffer is. */
|
||||
|
||||
size = interface_variant_size(pFlags, riid, punk);
|
||||
|
||||
|
||||
working_mem = GlobalAlloc(0, size);
|
||||
if (!working_mem) return oldpos;
|
||||
|
||||
@@ -362,7 +363,7 @@ static unsigned char* interface_variant_marshal(ULONG *pFlags, unsigned char *Bu
|
||||
GlobalFree(working_mem);
|
||||
return oldpos;
|
||||
}
|
||||
|
||||
|
||||
hr = CoMarshalInterface(working, riid, punk, LOWORD(*pFlags), NULL, MSHLFLAGS_NORMAL);
|
||||
if (hr != S_OK) {
|
||||
IStream_Release(working); /* this also releases the hglobal */
|
||||
@@ -382,7 +383,8 @@ static unsigned char* interface_variant_marshal(ULONG *pFlags, unsigned char *Bu
|
||||
}
|
||||
|
||||
/* helper: called for VT_DISPATCH / VT_UNKNOWN variants to unmarshal the buffer. returns Buffer on failure, new position otherwise */
|
||||
static unsigned char *interface_variant_unmarshal(ULONG *pFlags, unsigned char *Buffer, REFIID riid, IUnknown **ppunk)
|
||||
static unsigned char *interface_variant_unmarshal(const ULONG *pFlags, unsigned char *Buffer,
|
||||
REFIID riid, IUnknown **ppunk)
|
||||
{
|
||||
IStream *working;
|
||||
HGLOBAL working_mem;
|
||||
@@ -390,7 +392,7 @@ static unsigned char *interface_variant_unmarshal(ULONG *pFlags, unsigned char *
|
||||
unsigned char *oldpos;
|
||||
ULONG size;
|
||||
HRESULT hr;
|
||||
|
||||
|
||||
TRACE("pFlags=%d, Buffer=%p, ppUnk=%p\n", *pFlags, Buffer, ppunk);
|
||||
|
||||
oldpos = Buffer;
|
||||
@@ -409,7 +411,7 @@ static unsigned char *interface_variant_unmarshal(ULONG *pFlags, unsigned char *
|
||||
}
|
||||
|
||||
working_memlocked = GlobalLock(working_mem);
|
||||
|
||||
|
||||
/* now we copy the contents of the marshalling buffer to working_memlocked, unlock it, and demarshal the stream */
|
||||
memcpy(working_memlocked, Buffer + sizeof(ULONG), size);
|
||||
GlobalUnlock(working_mem);
|
||||
@@ -439,12 +441,12 @@ ULONG WINAPI VARIANT_UserSize(ULONG *pFlags, ULONG Start, VARIANT *pvar)
|
||||
if(V_VT(pvar) & VT_BYREF)
|
||||
Start += 4;
|
||||
|
||||
align = get_type_alignment(pFlags, pvar);
|
||||
align = get_type_alignment(pFlags, V_VT(pvar));
|
||||
ALIGN_LENGTH(Start, align);
|
||||
if(V_VT(pvar) == (VT_VARIANT | VT_BYREF))
|
||||
Start += 4;
|
||||
else
|
||||
Start += get_type_size(pFlags, pvar);
|
||||
Start += get_type_size(pFlags, V_VT(pvar));
|
||||
Start = wire_extra_user_size(pFlags, Start, pvar);
|
||||
|
||||
TRACE("returning %d\n", Start);
|
||||
@@ -463,7 +465,7 @@ unsigned char * WINAPI VARIANT_UserMarshal(ULONG *pFlags, unsigned char *Buffer,
|
||||
|
||||
ALIGN_POINTER(Buffer, 7);
|
||||
|
||||
header = (variant_wire_t *)Buffer;
|
||||
header = (variant_wire_t *)Buffer;
|
||||
|
||||
header->clSize = 0; /* fixed up at the end */
|
||||
header->rpcReserverd = 0;
|
||||
@@ -476,8 +478,8 @@ unsigned char * WINAPI VARIANT_UserMarshal(ULONG *pFlags, unsigned char *Buffer,
|
||||
header->switch_is &= ~VT_TYPEMASK;
|
||||
|
||||
Pos = (unsigned char*)(header + 1);
|
||||
type_size = get_type_size(pFlags, pvar);
|
||||
align = get_type_alignment(pFlags, pvar);
|
||||
type_size = get_type_size(pFlags, V_VT(pvar));
|
||||
align = get_type_alignment(pFlags, V_VT(pvar));
|
||||
ALIGN_POINTER(Pos, align);
|
||||
|
||||
if(header->vt & VT_BYREF)
|
||||
@@ -494,7 +496,7 @@ unsigned char * WINAPI VARIANT_UserMarshal(ULONG *pFlags, unsigned char *Buffer,
|
||||
*(DWORD*)Pos = 'U' | 's' << 8 | 'e' << 16 | 'r' << 24;
|
||||
Pos += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if((header->vt & VT_TYPEMASK) == VT_DECIMAL)
|
||||
@@ -563,32 +565,33 @@ unsigned char * WINAPI VARIANT_UserUnmarshal(ULONG *pFlags, unsigned char *Buffe
|
||||
TRACE("(%x,%p,%p)\n", *pFlags, Buffer, pvar);
|
||||
|
||||
ALIGN_POINTER(Buffer, 7);
|
||||
VariantClear(pvar);
|
||||
|
||||
header = (variant_wire_t *)Buffer;
|
||||
|
||||
pvar->n1.n2.vt = header->vt;
|
||||
pvar->n1.n2.wReserved1 = header->wReserved1;
|
||||
pvar->n1.n2.wReserved2 = header->wReserved2;
|
||||
pvar->n1.n2.wReserved3 = header->wReserved3;
|
||||
|
||||
header = (variant_wire_t *)Buffer;
|
||||
|
||||
Pos = (unsigned char*)(header + 1);
|
||||
type_size = get_type_size(pFlags, pvar);
|
||||
align = get_type_alignment(pFlags, pvar);
|
||||
type_size = get_type_size(pFlags, header->vt);
|
||||
align = get_type_alignment(pFlags, header->vt);
|
||||
ALIGN_POINTER(Pos, align);
|
||||
|
||||
if(header->vt & VT_BYREF)
|
||||
{
|
||||
Pos += 4;
|
||||
pvar->n1.n2.n3.byref = CoTaskMemAlloc(type_size);
|
||||
memcpy(pvar->n1.n2.n3.byref, Pos, type_size);
|
||||
if (V_VT(pvar) != header->vt)
|
||||
{
|
||||
VariantClear(pvar);
|
||||
V_BYREF(pvar) = CoTaskMemAlloc(type_size);
|
||||
}
|
||||
else if (!V_BYREF(pvar))
|
||||
V_BYREF(pvar) = CoTaskMemAlloc(type_size);
|
||||
memcpy(V_BYREF(pvar), Pos, type_size);
|
||||
if((header->vt & VT_TYPEMASK) != VT_VARIANT)
|
||||
Pos += type_size;
|
||||
Pos += type_size;
|
||||
else
|
||||
Pos += 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
VariantClear(pvar);
|
||||
if((header->vt & VT_TYPEMASK) == VT_DECIMAL)
|
||||
memcpy(pvar, Pos, type_size);
|
||||
else
|
||||
@@ -596,6 +599,11 @@ unsigned char * WINAPI VARIANT_UserUnmarshal(ULONG *pFlags, unsigned char *Buffe
|
||||
Pos += type_size;
|
||||
}
|
||||
|
||||
pvar->n1.n2.vt = header->vt;
|
||||
pvar->n1.n2.wReserved1 = header->wReserved1;
|
||||
pvar->n1.n2.wReserved2 = header->wReserved2;
|
||||
pvar->n1.n2.wReserved3 = header->wReserved3;
|
||||
|
||||
if(header->vt & VT_ARRAY)
|
||||
{
|
||||
if(header->vt & VT_BYREF)
|
||||
@@ -659,7 +667,12 @@ void WINAPI VARIANT_UserFree(ULONG *pFlags, VARIANT *pvar)
|
||||
if (!ref) return;
|
||||
|
||||
if(vt & VT_ARRAY)
|
||||
LPSAFEARRAY_UserFree(pFlags, V_ARRAYREF(pvar));
|
||||
{
|
||||
if (vt & VT_BYREF)
|
||||
LPSAFEARRAY_UserFree(pFlags, V_ARRAYREF(pvar));
|
||||
else
|
||||
LPSAFEARRAY_UserFree(pFlags, &V_ARRAY(pvar));
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (vt)
|
||||
@@ -1041,9 +1054,14 @@ unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *B
|
||||
(*ppsa)->cbElements = wiresa->cbElements;
|
||||
(*ppsa)->cLocks = LOWORD(wiresa->cLocks);
|
||||
|
||||
hr = SafeArrayAllocData(*ppsa);
|
||||
if (FAILED(hr))
|
||||
RpcRaiseException(hr);
|
||||
/* SafeArrayCreateEx allocates the data for us, but
|
||||
* SafeArrayAllocDescriptor doesn't */
|
||||
if(!vt)
|
||||
{
|
||||
hr = SafeArrayAllocData(*ppsa);
|
||||
if (FAILED(hr))
|
||||
RpcRaiseException(hr);
|
||||
}
|
||||
|
||||
if ((*(ULONG *)Buffer != cell_count) || (SAFEARRAY_GetCellCount(*ppsa) != cell_count))
|
||||
RpcRaiseException(RPC_S_INVALID_BOUND);
|
||||
@@ -1686,7 +1704,7 @@ HRESULT CALLBACK ITypeInfo_GetContainingTypeLib_Proxy(
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p, %p, %p)\n", This, ppTLib, pIndex );
|
||||
|
||||
|
||||
hr = ITypeInfo_RemoteGetContainingTypeLib_Proxy(This, &pTL, &index);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
@@ -1812,7 +1830,7 @@ UINT CALLBACK ITypeLib_GetTypeInfoCount_Proxy(
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
ITypeLib_RemoteGetTypeInfoCount_Proxy(This, &count);
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -1836,7 +1854,7 @@ HRESULT CALLBACK ITypeLib_GetLibAttr_Proxy(
|
||||
stg.pStorage = NULL;
|
||||
stg.pInterface = NULL;
|
||||
|
||||
return ITypeLib_RemoteGetLibAttr_Proxy(This, ppTLibAttr, &stg);
|
||||
return ITypeLib_RemoteGetLibAttr_Proxy(This, ppTLibAttr, &stg);
|
||||
}
|
||||
|
||||
HRESULT __RPC_STUB ITypeLib_GetLibAttr_Stub(
|
||||
@@ -1846,7 +1864,7 @@ HRESULT __RPC_STUB ITypeLib_GetLibAttr_Stub(
|
||||
{
|
||||
HRESULT hr;
|
||||
TRACE("(%p, %p)\n", This, ppTLibAttr);
|
||||
|
||||
|
||||
hr = ITypeLib_GetLibAttr(This, ppTLibAttr);
|
||||
if(hr != S_OK)
|
||||
return hr;
|
||||
@@ -1989,3 +2007,25 @@ HRESULT __RPC_STUB ITypeLib2_GetDocumentation2_Stub(
|
||||
FIXME("not implemented\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HRESULT CALLBACK IPropertyBag_Read_Proxy(
|
||||
IPropertyBag* This,
|
||||
LPCOLESTR pszPropName,
|
||||
VARIANT *pVar,
|
||||
IErrorLog *pErrorLog)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HRESULT __RPC_STUB IPropertyBag_Read_Stub(
|
||||
IPropertyBag* This,
|
||||
LPCOLESTR pszPropName,
|
||||
VARIANT *pVar,
|
||||
IErrorLog *pErrorLog,
|
||||
DWORD varType,
|
||||
IUnknown *pUnkObj)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -1492,7 +1492,7 @@ VARIANT_FormatNumber_Bool:
|
||||
}
|
||||
if (localeValue)
|
||||
{
|
||||
if (GetLocaleInfoW(lcid, localeValue, pBuff,
|
||||
if (GetLocaleInfoW(lcid, localeValue, pBuff,
|
||||
sizeof(buff)/sizeof(WCHAR)-(pBuff-buff)))
|
||||
{
|
||||
TRACE("added %s\n", debugstr_w(pBuff));
|
||||
@@ -2498,3 +2498,73 @@ HRESULT WINAPI VarMonthName(INT iMonth, INT fAbbrev, ULONG dwFlags, BSTR *pbstrO
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* VarWeekdayName [OLEAUT32.129]
|
||||
*
|
||||
* Print the specified weekday as localized name.
|
||||
*
|
||||
* PARAMS
|
||||
* iWeekday [I] day of week, 1..7, 1="the first day of the week"
|
||||
* fAbbrev [I] 0 - full name, !0 - abbreviated name
|
||||
* iFirstDay [I] first day of week,
|
||||
* 0=system default, 1=Sunday, 2=Monday, .. (contrary to MSDN)
|
||||
* dwFlags [I] flag stuff. only VAR_CALENDAR_HIJRI possible.
|
||||
* pbstrOut [O] Destination for weekday name.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: S_OK, pbstrOut contains the name.
|
||||
* Failure: E_INVALIDARG, if any parameter is invalid.
|
||||
* E_OUTOFMEMORY, if enough memory cannot be allocated.
|
||||
*/
|
||||
HRESULT WINAPI VarWeekdayName(INT iWeekday, INT fAbbrev, INT iFirstDay,
|
||||
ULONG dwFlags, BSTR *pbstrOut)
|
||||
{
|
||||
DWORD localeValue;
|
||||
INT size;
|
||||
|
||||
/* Windows XP oleaut32.dll doesn't allow iWekday==0, contrary to MSDN */
|
||||
if (iWeekday < 1 || iWeekday > 7)
|
||||
return E_INVALIDARG;
|
||||
if (iFirstDay < 0 || iFirstDay > 7)
|
||||
return E_INVALIDARG;
|
||||
if (!pbstrOut)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (dwFlags)
|
||||
FIXME("Does not support dwFlags 0x%x, ignoring.\n", dwFlags);
|
||||
|
||||
/* If we have to use the default firstDay, find which one it is */
|
||||
if (iFirstDay == 0) {
|
||||
DWORD firstDay;
|
||||
localeValue = LOCALE_RETURN_NUMBER | LOCALE_IFIRSTDAYOFWEEK;
|
||||
size = GetLocaleInfoW(LOCALE_USER_DEFAULT, localeValue,
|
||||
(LPWSTR)&firstDay, sizeof(firstDay) / sizeof(WCHAR));
|
||||
if (!size) {
|
||||
ERR("GetLocaleInfo 0x%x failed.\n", localeValue);
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
iFirstDay = firstDay + 2;
|
||||
}
|
||||
|
||||
/* Determine what we need to return */
|
||||
localeValue = fAbbrev ? LOCALE_SABBREVDAYNAME1 : LOCALE_SDAYNAME1;
|
||||
localeValue += (7 + iWeekday - 1 + iFirstDay - 2) % 7;
|
||||
|
||||
/* Determine the size of the data, allocate memory and retrieve the data */
|
||||
size = GetLocaleInfoW(LOCALE_USER_DEFAULT, localeValue, NULL, 0);
|
||||
if (!size) {
|
||||
ERR("GetLocaleInfo 0x%x failed.\n", localeValue);
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
*pbstrOut = SysAllocStringLen(NULL, size - 1);
|
||||
if (!*pbstrOut)
|
||||
return E_OUTOFMEMORY;
|
||||
size = GetLocaleInfoW(LOCALE_USER_DEFAULT, localeValue, *pbstrOut, size);
|
||||
if (!size) {
|
||||
ERR("GetLocaleInfo 0x%x failed in 2nd stage?!\n", localeValue);
|
||||
SysFreeString(*pbstrOut);
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -1312,7 +1312,7 @@ HRESULT WINAPI VarDateFromUdateEx(UDATE *pUdateIn, LCID lcid, ULONG dwFlags, DAT
|
||||
|
||||
if (lcid != MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT))
|
||||
FIXME("lcid possibly not handled, treating as en-us\n");
|
||||
|
||||
|
||||
memcpy(&ud, pUdateIn, sizeof(ud));
|
||||
|
||||
if (dwFlags & VAR_VALIDDATE)
|
||||
@@ -1356,7 +1356,7 @@ HRESULT WINAPI VarDateFromUdateEx(UDATE *pUdateIn, LCID lcid, ULONG dwFlags, DAT
|
||||
HRESULT WINAPI VarDateFromUdate(UDATE *pUdateIn, ULONG dwFlags, DATE *pDateOut)
|
||||
{
|
||||
LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
|
||||
|
||||
|
||||
return VarDateFromUdateEx(pUdateIn, lcid, dwFlags, pDateOut);
|
||||
}
|
||||
|
||||
@@ -2759,7 +2759,7 @@ HRESULT WINAPI VarCmp(LPVARIANT left, LPVARIANT right, LCID lcid, DWORD flags)
|
||||
VARTYPE breserv = V_VT(bstrv) & ~VT_TYPEMASK;
|
||||
VARTYPE nreserv = V_VT(nonbv) & ~VT_TYPEMASK;
|
||||
|
||||
if (!breserv && !nreserv)
|
||||
if (!breserv && !nreserv)
|
||||
/* No VT_RESERVED set ==> BSTR always greater */
|
||||
rc = VARCMP_GT;
|
||||
else if (breserv && !nreserv) {
|
||||
@@ -5164,7 +5164,7 @@ VarRound_Exit:
|
||||
/**********************************************************************
|
||||
* VarIdiv [OLEAUT32.153]
|
||||
*
|
||||
* Converts input variants to integers and divides them.
|
||||
* Converts input variants to integers and divides them.
|
||||
*
|
||||
* PARAMS
|
||||
* left [I] Left hand variant
|
||||
@@ -5875,7 +5875,10 @@ HRESULT WINAPI VarImp(LPVARIANT left, LPVARIANT right, LPVARIANT result)
|
||||
if (FAILED(hres)) goto VarImp_Exit;
|
||||
|
||||
if (rightvt == VT_NULL)
|
||||
{
|
||||
memset( &rv, 0, sizeof(rv) );
|
||||
V_VT(&rv) = resvt;
|
||||
}
|
||||
else
|
||||
{
|
||||
hres = VariantCopy(&rv, right);
|
||||
|
||||
@@ -4153,7 +4153,7 @@ typedef struct DECIMAL_internal
|
||||
static HRESULT VARIANT_DI_FromR4(float source, VARIANT_DI * dest);
|
||||
static HRESULT VARIANT_DI_FromR8(double source, VARIANT_DI * dest);
|
||||
static void VARIANT_DIFromDec(const DECIMAL * from, VARIANT_DI * to);
|
||||
static void VARIANT_DecFromDI(VARIANT_DI * from, DECIMAL * to);
|
||||
static void VARIANT_DecFromDI(const VARIANT_DI * from, DECIMAL * to);
|
||||
|
||||
/************************************************************************
|
||||
* VarDecFromR4 (OLEAUT32.193)
|
||||
@@ -4623,7 +4623,7 @@ static void VARIANT_DIFromDec(const DECIMAL * from, VARIANT_DI * to)
|
||||
to->bitsnum[2] = DEC_HI32(from);
|
||||
}
|
||||
|
||||
static void VARIANT_DecFromDI(VARIANT_DI * from, DECIMAL * to)
|
||||
static void VARIANT_DecFromDI(const VARIANT_DI * from, DECIMAL * to)
|
||||
{
|
||||
if (from->sign) {
|
||||
DEC_SIGNSCALE(to) = SIGNSCALE(DECIMAL_NEG, from->scale);
|
||||
@@ -4659,20 +4659,20 @@ static unsigned char VARIANT_int_divbychar(DWORD * p, unsigned int n, unsigned c
|
||||
unsigned char remainder = 0;
|
||||
ULONGLONG iTempDividend;
|
||||
signed int i;
|
||||
|
||||
|
||||
for (i = n - 1; i >= 0 && !p[i]; i--); /* skip leading zeros */
|
||||
for (; i >= 0; i--) {
|
||||
iTempDividend = ((ULONGLONG)remainder << 32) + p[i];
|
||||
remainder = iTempDividend % divisor;
|
||||
p[i] = iTempDividend / divisor;
|
||||
}
|
||||
|
||||
|
||||
return remainder;
|
||||
}
|
||||
}
|
||||
|
||||
/* check to test if encoded number is a zero. Returns 1 if zero, 0 for nonzero */
|
||||
static int VARIANT_int_iszero(DWORD * p, unsigned int n)
|
||||
static int VARIANT_int_iszero(const DWORD * p, unsigned int n)
|
||||
{
|
||||
for (; n > 0; n--) if (*p++ != 0) return 0;
|
||||
return 1;
|
||||
@@ -4683,7 +4683,7 @@ static int VARIANT_int_iszero(DWORD * p, unsigned int n)
|
||||
digits when scale > 0 in order to fit an overflowing result. Final overflow
|
||||
flag is returned.
|
||||
*/
|
||||
static int VARIANT_DI_mul(VARIANT_DI * a, VARIANT_DI * b, VARIANT_DI * result)
|
||||
static int VARIANT_DI_mul(const VARIANT_DI * a, const VARIANT_DI * b, VARIANT_DI * result)
|
||||
{
|
||||
int r_overflow = 0;
|
||||
DWORD running[6];
|
||||
@@ -4706,17 +4706,17 @@ static int VARIANT_DI_mul(VARIANT_DI * a, VARIANT_DI * b, VARIANT_DI * result)
|
||||
result->sign = 0;
|
||||
} else {
|
||||
unsigned char remainder = 0;
|
||||
int iA;
|
||||
int iA;
|
||||
|
||||
/* perform actual multiplication */
|
||||
for (iA = 0; iA <= mulstart; iA++) {
|
||||
ULONG iOverflowMul;
|
||||
int iB;
|
||||
|
||||
|
||||
for (iOverflowMul = 0, iB = 0; iB < sizeof(b->bitsnum)/sizeof(DWORD); iB++) {
|
||||
ULONG iRV;
|
||||
int iR;
|
||||
|
||||
|
||||
iRV = VARIANT_Mul(b->bitsnum[iB], a->bitsnum[iA], &iOverflowMul);
|
||||
iR = iA + iB;
|
||||
do {
|
||||
@@ -4748,12 +4748,12 @@ static int VARIANT_DI_mul(VARIANT_DI * a, VARIANT_DI * b, VARIANT_DI * result)
|
||||
while (result->scale > 0 && !VARIANT_int_iszero(
|
||||
running + sizeof(result->bitsnum) / sizeof(DWORD),
|
||||
(sizeof(running) - sizeof(result->bitsnum)) / sizeof(DWORD))) {
|
||||
|
||||
|
||||
remainder = VARIANT_int_divbychar(running, sizeof(running) / sizeof(DWORD), 10);
|
||||
if (remainder > 0) WARN("losing significant digits (remainder %u)...\n", remainder);
|
||||
result->scale--;
|
||||
}
|
||||
|
||||
|
||||
/* round up the result - native oleaut32 does this */
|
||||
if (remainder >= 5) {
|
||||
unsigned int i;
|
||||
@@ -4768,7 +4768,7 @@ static int VARIANT_DI_mul(VARIANT_DI * a, VARIANT_DI * b, VARIANT_DI * result)
|
||||
and copy result bits into result structure
|
||||
*/
|
||||
r_overflow = !VARIANT_int_iszero(
|
||||
running + sizeof(result->bitsnum)/sizeof(DWORD),
|
||||
running + sizeof(result->bitsnum)/sizeof(DWORD),
|
||||
(sizeof(running) - sizeof(result->bitsnum))/sizeof(DWORD));
|
||||
memcpy(result->bitsnum, running, sizeof(result->bitsnum));
|
||||
}
|
||||
@@ -4779,7 +4779,7 @@ static int VARIANT_DI_mul(VARIANT_DI * a, VARIANT_DI * b, VARIANT_DI * result)
|
||||
hardcoded (period for decimal separator, dash as negative sign). Returns 0 for
|
||||
success, nonzero if insufficient space in output buffer.
|
||||
*/
|
||||
static int VARIANT_DI_tostringW(VARIANT_DI * a, WCHAR * s, unsigned int n)
|
||||
static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n)
|
||||
{
|
||||
int overflow = 0;
|
||||
DWORD quotient[3];
|
||||
@@ -4847,7 +4847,7 @@ static int VARIANT_DI_tostringW(VARIANT_DI * a, WCHAR * s, unsigned int n)
|
||||
} else {
|
||||
memmove(s + periodpos + 1, s + periodpos, (i + 1 - periodpos) * sizeof(WCHAR));
|
||||
s[periodpos] = '.'; i++;
|
||||
|
||||
|
||||
/* remove extra zeros at the end, if any */
|
||||
while (s[i - 1] == '0') s[--i] = '\0';
|
||||
if (s[i - 1] == '.') s[--i] = '\0';
|
||||
@@ -4863,14 +4863,14 @@ static void VARIANT_int_shiftleft(DWORD * p, unsigned int n, unsigned int shift)
|
||||
{
|
||||
DWORD shifted;
|
||||
unsigned int i;
|
||||
|
||||
|
||||
/* shift whole DWORDs to the left */
|
||||
while (shift >= 32)
|
||||
{
|
||||
memmove(p + 1, p, (n - 1) * sizeof(DWORD));
|
||||
*p = 0; shift -= 32;
|
||||
}
|
||||
|
||||
|
||||
/* shift remainder (1..31 bits) */
|
||||
shifted = 0;
|
||||
if (shift > 0) for (i = 0; i < n; i++)
|
||||
@@ -4886,7 +4886,7 @@ static void VARIANT_int_shiftleft(DWORD * p, unsigned int n, unsigned int shift)
|
||||
Value at v is incremented by the value at p. Any size is supported, provided
|
||||
that v is not shorter than p. Any unapplied carry is returned as a result.
|
||||
*/
|
||||
static unsigned char VARIANT_int_add(DWORD * v, unsigned int nv, DWORD * p,
|
||||
static unsigned char VARIANT_int_add(DWORD * v, unsigned int nv, const DWORD * p,
|
||||
unsigned int np)
|
||||
{
|
||||
unsigned char carry = 0;
|
||||
@@ -4912,11 +4912,11 @@ static unsigned char VARIANT_int_add(DWORD * v, unsigned int nv, DWORD * p,
|
||||
return carry;
|
||||
}
|
||||
|
||||
/* perform integral division with operand p as dividend. Parameter n indicates
|
||||
number of available DWORDs in divisor p, but available space in p must be
|
||||
actually at least 2 * n DWORDs, because the remainder of the integral
|
||||
division is built in the next n DWORDs past the start of the quotient. This
|
||||
routine replaces the dividend in p with the quotient, and appends n
|
||||
/* perform integral division with operand p as dividend. Parameter n indicates
|
||||
number of available DWORDs in divisor p, but available space in p must be
|
||||
actually at least 2 * n DWORDs, because the remainder of the integral
|
||||
division is built in the next n DWORDs past the start of the quotient. This
|
||||
routine replaces the dividend in p with the quotient, and appends n
|
||||
additional DWORDs for the remainder.
|
||||
|
||||
Thanks to Lee & Mark Atkinson for their book _Using_C_ (my very first book on
|
||||
@@ -4925,7 +4925,7 @@ static unsigned char VARIANT_int_add(DWORD * v, unsigned int nv, DWORD * p,
|
||||
was then heavily modified by me (Alex Villacis Lasso) in order to handle
|
||||
variably-scaled integers such as the MS DECIMAL representation.
|
||||
*/
|
||||
static void VARIANT_int_div(DWORD * p, unsigned int n, DWORD * divisor,
|
||||
static void VARIANT_int_div(DWORD * p, unsigned int n, const DWORD * divisor,
|
||||
unsigned int dn)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -4961,15 +4961,15 @@ static unsigned char VARIANT_int_mulbychar(DWORD * p, unsigned int n, unsigned c
|
||||
{
|
||||
unsigned int i;
|
||||
ULONG iOverflowMul;
|
||||
|
||||
|
||||
for (iOverflowMul = 0, i = 0; i < n; i++)
|
||||
p[i] = VARIANT_Mul(p[i], m, &iOverflowMul);
|
||||
return (unsigned char)iOverflowMul;
|
||||
}
|
||||
|
||||
/* increment value in A by the value indicated in B, with scale adjusting.
|
||||
Modifies parameters by adjusting scales. Returns 0 if addition was
|
||||
successful, nonzero if a parameter underflowed before it could be
|
||||
/* increment value in A by the value indicated in B, with scale adjusting.
|
||||
Modifies parameters by adjusting scales. Returns 0 if addition was
|
||||
successful, nonzero if a parameter underflowed before it could be
|
||||
successfully used in the addition.
|
||||
*/
|
||||
static int VARIANT_int_addlossy(
|
||||
@@ -5126,7 +5126,8 @@ static int VARIANT_int_addlossy(
|
||||
0 if the division was completed (even if quotient is set to 0), or nonzero
|
||||
in case of quotient overflow.
|
||||
*/
|
||||
static HRESULT VARIANT_DI_div(VARIANT_DI * dividend, VARIANT_DI * divisor, VARIANT_DI * quotient)
|
||||
static HRESULT VARIANT_DI_div(const VARIANT_DI * dividend, const VARIANT_DI * divisor,
|
||||
VARIANT_DI * quotient)
|
||||
{
|
||||
HRESULT r_overflow = S_OK;
|
||||
|
||||
@@ -5511,14 +5512,14 @@ HRESULT WINAPI VarDecDiv(const DECIMAL* pDecLeft, const DECIMAL* pDecRight, DECI
|
||||
if (di_result.scale > DEC_MAX_SCALE)
|
||||
{
|
||||
unsigned char remainder = 0;
|
||||
|
||||
|
||||
/* division underflowed. In order to comply with the MSDN
|
||||
specifications for DECIMAL ranges, some significant digits
|
||||
must be removed
|
||||
*/
|
||||
WARN("result scale is %u, scaling (with loss of significant digits)...\n",
|
||||
di_result.scale);
|
||||
while (di_result.scale > DEC_MAX_SCALE &&
|
||||
while (di_result.scale > DEC_MAX_SCALE &&
|
||||
!VARIANT_int_iszero(di_result.bitsnum, sizeof(di_result.bitsnum) / sizeof(DWORD)))
|
||||
{
|
||||
remainder = VARIANT_int_divbychar(di_result.bitsnum, sizeof(di_result.bitsnum) / sizeof(DWORD), 10);
|
||||
@@ -5583,7 +5584,7 @@ HRESULT WINAPI VarDecMul(const DECIMAL* pDecLeft, const DECIMAL* pDecRight, DECI
|
||||
*/
|
||||
WARN("result scale is %u, scaling (with loss of significant digits)...\n",
|
||||
di_result.scale);
|
||||
while (di_result.scale > DEC_MAX_SCALE &&
|
||||
while (di_result.scale > DEC_MAX_SCALE &&
|
||||
!VARIANT_int_iszero(di_result.bitsnum, sizeof(di_result.bitsnum)/sizeof(DWORD)))
|
||||
{
|
||||
VARIANT_int_divbychar(di_result.bitsnum, sizeof(di_result.bitsnum)/sizeof(DWORD), 10);
|
||||
@@ -6342,14 +6343,14 @@ HRESULT WINAPI VarBstrFromI4(LONG lIn, LCID lcid, ULONG dwFlags, BSTR* pbstrOut)
|
||||
return VARIANT_BstrFromUInt(ul64, lcid, dwFlags, pbstrOut);
|
||||
}
|
||||
|
||||
static BSTR VARIANT_BstrReplaceDecimal(WCHAR * buff, LCID lcid, ULONG dwFlags)
|
||||
static BSTR VARIANT_BstrReplaceDecimal(const WCHAR * buff, LCID lcid, ULONG dwFlags)
|
||||
{
|
||||
BSTR bstrOut;
|
||||
WCHAR lpDecimalSep[16];
|
||||
|
||||
/* Native oleaut32 uses the locale-specific decimal separator even in the
|
||||
absence of the LOCALE_USE_NLS flag. For example, the Spanish/Latin
|
||||
American locales will see "one thousand and one tenth" as "1000,1"
|
||||
absence of the LOCALE_USE_NLS flag. For example, the Spanish/Latin
|
||||
American locales will see "one thousand and one tenth" as "1000,1"
|
||||
instead of "1000.1" (notice the comma). The following code checks for
|
||||
the need to replace the decimal separator, and if so, will prepare an
|
||||
appropriate NUMBERFMTW structure to do the job via GetNumberFormatW().
|
||||
@@ -6789,7 +6790,7 @@ HRESULT WINAPI VarBstrFromDec(DECIMAL* pDecIn, LCID lcid, ULONG dwFlags, BSTR* p
|
||||
{
|
||||
*pbstrOut = VARIANT_BstrReplaceDecimal(buff, lcid, dwFlags);
|
||||
}
|
||||
|
||||
|
||||
TRACE("returning %s\n", debugstr_w(*pbstrOut));
|
||||
return *pbstrOut ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user