2003-04-26 04:11:41 +02:00
|
|
|
/*
|
|
|
|
* Misc marshalling routines
|
|
|
|
*
|
|
|
|
* Copyright 2002 Ove Kaaven
|
2003-09-12 02:22:55 +02:00
|
|
|
* Copyright 2003 Mike Hearn
|
2003-04-26 04:11:41 +02:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-04-26 04:11:41 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2003-04-26 04:11:41 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
2004-10-07 05:06:48 +02:00
|
|
|
#define COBJMACROS
|
2003-04-27 02:40:47 +02:00
|
|
|
#define NONAMELESSUNION
|
2004-10-07 05:06:48 +02:00
|
|
|
|
2003-04-26 04:11:41 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "oleauto.h"
|
2006-06-09 21:09:35 +02:00
|
|
|
#include "typelib.h"
|
2008-09-02 18:02:04 +02:00
|
|
|
#include "ocidl.h"
|
2003-04-26 04:11:41 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
|
|
|
|
2006-04-19 15:28:59 +02:00
|
|
|
#define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
|
|
|
|
#define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
|
|
|
|
#define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
|
|
|
|
#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
|
|
|
|
|
2015-03-08 09:04:29 +01:00
|
|
|
/* ole32 exports those, not defined in public headers */
|
|
|
|
ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG*, ULONG, ULONG, IUnknown*, REFIID);
|
|
|
|
unsigned char * __RPC_USER WdtpInterfacePointer_UserMarshal(ULONG*, ULONG, unsigned char*, IUnknown*, REFIID);
|
|
|
|
unsigned char * __RPC_USER WdtpInterfacePointer_UserUnmarshal(ULONG*, unsigned char*, IUnknown**, REFIID);
|
|
|
|
|
2007-08-01 22:44:48 +02:00
|
|
|
static void dump_user_flags(const ULONG *pFlags)
|
2006-01-27 12:54:22 +01:00
|
|
|
{
|
|
|
|
if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION)
|
|
|
|
TRACE("MAKELONG(NDR_LOCAL_REPRESENTATION, ");
|
|
|
|
else
|
|
|
|
TRACE("MAKELONG(0x%04x, ", HIWORD(*pFlags));
|
|
|
|
switch (LOWORD(*pFlags))
|
|
|
|
{
|
|
|
|
case MSHCTX_LOCAL: TRACE("MSHCTX_LOCAL)"); break;
|
|
|
|
case MSHCTX_NOSHAREDMEM: TRACE("MSHCTX_NOSHAREDMEM)"); break;
|
|
|
|
case MSHCTX_DIFFERENTMACHINE: TRACE("MSHCTX_DIFFERENTMACHINE)"); break;
|
|
|
|
case MSHCTX_INPROC: TRACE("MSHCTX_INPROC)"); break;
|
|
|
|
default: TRACE("%d)", LOWORD(*pFlags));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-26 04:11:41 +02:00
|
|
|
/* CLEANLOCALSTORAGE */
|
2006-04-19 15:28:59 +02:00
|
|
|
|
2006-05-07 22:26:45 +02:00
|
|
|
#define CLS_FUNCDESC 'f'
|
|
|
|
#define CLS_LIBATTR 'l'
|
|
|
|
#define CLS_TYPEATTR 't'
|
|
|
|
#define CLS_VARDESC 'v'
|
2003-04-26 04:11:41 +02:00
|
|
|
|
2006-11-08 23:43:28 +01:00
|
|
|
ULONG WINAPI CLEANLOCALSTORAGE_UserSize(ULONG *pFlags, ULONG Start, CLEANLOCALSTORAGE *pstg)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2006-04-19 15:28:59 +02:00
|
|
|
ALIGN_LENGTH(Start, 3);
|
|
|
|
return Start + sizeof(DWORD);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2006-11-08 23:43:45 +01:00
|
|
|
unsigned char * WINAPI CLEANLOCALSTORAGE_UserMarshal(ULONG *pFlags, unsigned char *Buffer, CLEANLOCALSTORAGE *pstg)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2006-04-19 15:28:59 +02:00
|
|
|
ALIGN_POINTER(Buffer, 3);
|
|
|
|
*(DWORD*)Buffer = pstg->flags;
|
2016-08-26 11:30:47 +02:00
|
|
|
|
|
|
|
if (!pstg->pInterface)
|
|
|
|
return Buffer + sizeof(DWORD);
|
|
|
|
|
2006-04-19 15:28:59 +02:00
|
|
|
switch(pstg->flags)
|
|
|
|
{
|
|
|
|
case CLS_LIBATTR:
|
|
|
|
ITypeLib_ReleaseTLibAttr((ITypeLib*)pstg->pInterface, *(TLIBATTR**)pstg->pStorage);
|
|
|
|
break;
|
|
|
|
case CLS_TYPEATTR:
|
|
|
|
ITypeInfo_ReleaseTypeAttr((ITypeInfo*)pstg->pInterface, *(TYPEATTR**)pstg->pStorage);
|
|
|
|
break;
|
|
|
|
case CLS_FUNCDESC:
|
|
|
|
ITypeInfo_ReleaseFuncDesc((ITypeInfo*)pstg->pInterface, *(FUNCDESC**)pstg->pStorage);
|
|
|
|
break;
|
|
|
|
case CLS_VARDESC:
|
|
|
|
ITypeInfo_ReleaseVarDesc((ITypeInfo*)pstg->pInterface, *(VARDESC**)pstg->pStorage);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2022-02-12 14:34:59 +01:00
|
|
|
ERR("Unknown type %lx\n", pstg->flags);
|
2006-04-19 15:28:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
*(VOID**)pstg->pStorage = NULL;
|
|
|
|
IUnknown_Release(pstg->pInterface);
|
|
|
|
pstg->pInterface = NULL;
|
|
|
|
|
|
|
|
return Buffer + sizeof(DWORD);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2006-11-08 23:44:00 +01:00
|
|
|
unsigned char * WINAPI CLEANLOCALSTORAGE_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, CLEANLOCALSTORAGE *pstr)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2006-04-19 15:28:59 +02:00
|
|
|
ALIGN_POINTER(Buffer, 3);
|
|
|
|
pstr->flags = *(DWORD*)Buffer;
|
|
|
|
return Buffer + sizeof(DWORD);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2006-11-08 23:44:10 +01:00
|
|
|
void WINAPI CLEANLOCALSTORAGE_UserFree(ULONG *pFlags, CLEANLOCALSTORAGE *pstr)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2006-04-19 15:28:59 +02:00
|
|
|
/* Nothing to do */
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* BSTR */
|
|
|
|
|
2006-04-29 15:40:28 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD len; /* No. of chars not including trailing '\0' */
|
|
|
|
DWORD byte_len; /* len * 2 or 0xffffffff if len == 0 */
|
|
|
|
DWORD len2; /* == len */
|
|
|
|
} bstr_wire_t;
|
|
|
|
|
2006-11-08 23:43:28 +01:00
|
|
|
ULONG WINAPI BSTR_UserSize(ULONG *pFlags, ULONG Start, BSTR *pstr)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%#lx, %lu, %p => %p\n", *pFlags, Start, pstr, *pstr);
|
2006-04-29 15:40:28 +02:00
|
|
|
if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr));
|
|
|
|
ALIGN_LENGTH(Start, 3);
|
2006-05-10 13:41:32 +02:00
|
|
|
Start += sizeof(bstr_wire_t) + ((SysStringByteLen(*pstr) + 1) & ~1);
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("returning %ld\n", Start);
|
2006-04-29 15:40:28 +02:00
|
|
|
return Start;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2006-11-08 23:43:45 +01:00
|
|
|
unsigned char * WINAPI BSTR_UserMarshal(ULONG *pFlags, unsigned char *Buffer, BSTR *pstr)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2006-04-29 15:40:28 +02:00
|
|
|
bstr_wire_t *header;
|
2006-05-10 13:41:32 +02:00
|
|
|
DWORD len = SysStringByteLen(*pstr);
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%#lx, %p, %p => %p\n", *pFlags, Buffer, pstr, *pstr);
|
2006-04-29 15:40:28 +02:00
|
|
|
if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr));
|
|
|
|
|
|
|
|
ALIGN_POINTER(Buffer, 3);
|
|
|
|
header = (bstr_wire_t*)Buffer;
|
2006-05-10 13:41:32 +02:00
|
|
|
header->len = header->len2 = (len + 1) / 2;
|
|
|
|
if (*pstr)
|
2006-04-29 15:40:28 +02:00
|
|
|
{
|
2006-05-10 13:41:32 +02:00
|
|
|
header->byte_len = len;
|
|
|
|
memcpy(header + 1, *pstr, header->len * 2);
|
2006-04-29 15:40:28 +02:00
|
|
|
}
|
|
|
|
else
|
2006-05-10 13:41:32 +02:00
|
|
|
header->byte_len = 0xffffffff; /* special case for a null bstr */
|
2006-04-29 15:40:28 +02:00
|
|
|
|
|
|
|
return Buffer + sizeof(*header) + sizeof(OLECHAR) * header->len;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2006-11-08 23:44:00 +01:00
|
|
|
unsigned char * WINAPI BSTR_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, BSTR *pstr)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2006-04-29 15:40:28 +02:00
|
|
|
bstr_wire_t *header;
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%#lx, %p, %p => %p\n", *pFlags, Buffer, pstr, *pstr);
|
2006-04-29 15:40:28 +02:00
|
|
|
|
|
|
|
ALIGN_POINTER(Buffer, 3);
|
|
|
|
header = (bstr_wire_t*)Buffer;
|
|
|
|
if(header->len != header->len2)
|
2022-02-12 14:34:59 +01:00
|
|
|
FIXME("len %#lx != len2 %#lx\n", header->len, header->len2);
|
2008-09-24 23:04:49 +02:00
|
|
|
|
2011-05-18 11:35:17 +02:00
|
|
|
if (header->byte_len == 0xffffffff)
|
|
|
|
{
|
|
|
|
SysFreeString(*pstr);
|
|
|
|
*pstr = NULL;
|
|
|
|
}
|
|
|
|
else SysReAllocStringLen( pstr, (OLECHAR *)(header + 1), header->len );
|
2006-05-10 13:41:32 +02:00
|
|
|
|
2006-04-29 15:40:28 +02:00
|
|
|
if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr));
|
|
|
|
return Buffer + sizeof(*header) + sizeof(OLECHAR) * header->len;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2006-11-08 23:44:10 +01:00
|
|
|
void WINAPI BSTR_UserFree(ULONG *pFlags, BSTR *pstr)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%#lx, %p => %p\n", *pFlags, pstr, *pstr);
|
2008-09-24 23:04:49 +02:00
|
|
|
SysFreeString(*pstr);
|
|
|
|
*pstr = NULL;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* VARIANT */
|
|
|
|
|
2006-05-05 13:18:41 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD clSize;
|
2011-08-03 11:36:33 +02:00
|
|
|
DWORD rpcReserved;
|
2006-05-05 13:18:41 +02:00
|
|
|
USHORT vt;
|
|
|
|
USHORT wReserved1;
|
|
|
|
USHORT wReserved2;
|
|
|
|
USHORT wReserved3;
|
|
|
|
DWORD switch_is;
|
|
|
|
} variant_wire_t;
|
|
|
|
|
2014-01-30 19:53:13 +01:00
|
|
|
unsigned int get_type_size(ULONG *pFlags, VARTYPE vt)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2007-12-07 15:14:05 +01:00
|
|
|
if (vt & VT_ARRAY) return 4;
|
2006-05-05 13:18:41 +02:00
|
|
|
|
2007-12-07 15:14:05 +01:00
|
|
|
switch (vt & ~VT_BYREF) {
|
2006-05-05 13:18:41 +02:00
|
|
|
case VT_EMPTY:
|
|
|
|
case VT_NULL:
|
|
|
|
return 0;
|
|
|
|
case VT_I1:
|
|
|
|
case VT_UI1:
|
|
|
|
return sizeof(CHAR);
|
|
|
|
case VT_I2:
|
|
|
|
case VT_UI2:
|
|
|
|
return sizeof(SHORT);
|
|
|
|
case VT_I4:
|
|
|
|
case VT_UI4:
|
2014-01-30 19:53:13 +01:00
|
|
|
case VT_HRESULT:
|
2006-05-05 13:18:41 +02:00
|
|
|
return sizeof(LONG);
|
|
|
|
case VT_INT:
|
|
|
|
case VT_UINT:
|
|
|
|
return sizeof(INT);
|
2018-10-15 05:41:02 +02:00
|
|
|
case VT_I8:
|
|
|
|
case VT_UI8:
|
|
|
|
return sizeof(LONGLONG);
|
2006-05-05 13:18:41 +02:00
|
|
|
case VT_R4:
|
|
|
|
return sizeof(FLOAT);
|
|
|
|
case VT_R8:
|
|
|
|
return sizeof(DOUBLE);
|
|
|
|
case VT_BOOL:
|
|
|
|
return sizeof(VARIANT_BOOL);
|
|
|
|
case VT_ERROR:
|
|
|
|
return sizeof(SCODE);
|
|
|
|
case VT_DATE:
|
|
|
|
return sizeof(DATE);
|
|
|
|
case VT_CY:
|
|
|
|
return sizeof(CY);
|
|
|
|
case VT_DECIMAL:
|
|
|
|
return sizeof(DECIMAL);
|
|
|
|
case VT_BSTR:
|
2009-07-10 19:13:27 +02:00
|
|
|
return sizeof(ULONG);
|
2006-05-05 13:18:41 +02:00
|
|
|
case VT_VARIANT:
|
|
|
|
return sizeof(VARIANT);
|
|
|
|
case VT_UNKNOWN:
|
|
|
|
case VT_DISPATCH:
|
|
|
|
case VT_RECORD:
|
|
|
|
return 0;
|
|
|
|
default:
|
2007-12-07 15:14:05 +01:00
|
|
|
FIXME("unhandled VT %d\n", vt);
|
2006-05-05 13:18:41 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2003-04-26 04:11:41 +02:00
|
|
|
|
2007-12-07 15:14:05 +01:00
|
|
|
static unsigned int get_type_alignment(ULONG *pFlags, VARTYPE vt)
|
2006-05-05 13:18:41 +02:00
|
|
|
{
|
2007-12-07 15:14:05 +01:00
|
|
|
unsigned int size = get_type_size(pFlags, vt);
|
|
|
|
if(vt & VT_BYREF) return 3;
|
2006-05-05 13:18:41 +02:00
|
|
|
if(size == 0) return 0;
|
|
|
|
if(size <= 4) return size - 1;
|
|
|
|
return 7;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2015-03-08 09:04:29 +01:00
|
|
|
/* WdtpInterfacePointer_UserSize takes care of 2 additional DWORDs to store marshalling buffer size */
|
2021-11-24 02:07:30 +01:00
|
|
|
static unsigned interface_user_size(ULONG *pFlags, ULONG Start, REFIID riid, IUnknown *punk)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2010-02-25 14:48:22 +01:00
|
|
|
ULONG size = 0;
|
|
|
|
|
|
|
|
if (punk)
|
|
|
|
{
|
2015-03-08 09:04:29 +01:00
|
|
|
size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), 0, punk, riid);
|
|
|
|
if (!size)
|
2010-02-25 14:48:22 +01:00
|
|
|
{
|
2015-03-08 09:04:29 +01:00
|
|
|
ERR("interface variant buffer size calculation failed\n");
|
2010-02-25 14:48:22 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2015-03-08 09:04:29 +01:00
|
|
|
size += sizeof(ULONG);
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("wire-size extra of interface variant is %ld.\n", size);
|
2021-11-24 02:07:30 +01:00
|
|
|
return Start + size;
|
2005-09-02 13:18:57 +02:00
|
|
|
}
|
2003-09-12 02:22:55 +02:00
|
|
|
|
2006-11-08 23:44:10 +01:00
|
|
|
static ULONG wire_extra_user_size(ULONG *pFlags, ULONG Start, VARIANT *pvar)
|
2005-09-02 13:18:57 +02:00
|
|
|
{
|
2006-05-05 13:18:41 +02:00
|
|
|
if (V_ISARRAY(pvar))
|
|
|
|
{
|
|
|
|
if (V_ISBYREF(pvar))
|
|
|
|
return LPSAFEARRAY_UserSize(pFlags, Start, V_ARRAYREF(pvar));
|
|
|
|
else
|
|
|
|
return LPSAFEARRAY_UserSize(pFlags, Start, &V_ARRAY(pvar));
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
2006-05-05 13:18:41 +02:00
|
|
|
|
2003-04-26 04:11:41 +02:00
|
|
|
switch (V_VT(pvar)) {
|
|
|
|
case VT_BSTR:
|
2006-05-05 13:18:41 +02:00
|
|
|
return BSTR_UserSize(pFlags, Start, &V_BSTR(pvar));
|
2003-04-26 04:11:41 +02:00
|
|
|
case VT_BSTR | VT_BYREF:
|
2006-05-05 13:18:41 +02:00
|
|
|
return BSTR_UserSize(pFlags, Start, V_BSTRREF(pvar));
|
2003-04-26 04:11:41 +02:00
|
|
|
case VT_VARIANT | VT_BYREF:
|
2006-05-05 13:18:41 +02:00
|
|
|
return VARIANT_UserSize(pFlags, Start, V_VARIANTREF(pvar));
|
2003-04-26 04:11:41 +02:00
|
|
|
case VT_UNKNOWN:
|
2021-11-24 02:07:30 +01:00
|
|
|
return interface_user_size(pFlags, Start, &IID_IUnknown, V_UNKNOWN(pvar));
|
2007-06-22 15:40:36 +02:00
|
|
|
case VT_UNKNOWN | VT_BYREF:
|
2021-11-24 02:07:30 +01:00
|
|
|
return interface_user_size(pFlags, Start, &IID_IUnknown, *V_UNKNOWNREF(pvar));
|
2003-04-26 04:11:41 +02:00
|
|
|
case VT_DISPATCH:
|
2021-11-24 02:07:30 +01:00
|
|
|
return interface_user_size(pFlags, Start, &IID_IDispatch, (IUnknown*)V_DISPATCH(pvar));
|
2007-06-22 15:40:36 +02:00
|
|
|
case VT_DISPATCH | VT_BYREF:
|
2021-11-24 02:07:30 +01:00
|
|
|
return interface_user_size(pFlags, Start, &IID_IDispatch, (IUnknown*)*V_DISPATCHREF(pvar));
|
2003-04-26 04:11:41 +02:00
|
|
|
case VT_RECORD:
|
|
|
|
FIXME("wire-size record\n");
|
2006-05-05 13:18:41 +02:00
|
|
|
return Start;
|
|
|
|
case VT_SAFEARRAY:
|
|
|
|
case VT_SAFEARRAY | VT_BYREF:
|
|
|
|
FIXME("wire-size safearray: shouldn't be marshaling this\n");
|
|
|
|
return Start;
|
2003-04-26 04:11:41 +02:00
|
|
|
default:
|
2006-05-05 13:18:41 +02:00
|
|
|
return Start;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-08 09:04:29 +01:00
|
|
|
/* helper: called for VT_DISPATCH variants to marshal the IDispatch* into the buffer */
|
2021-11-24 02:07:30 +01:00
|
|
|
static unsigned char* interface_user_marshal(ULONG *pFlags, unsigned char *Buffer,
|
2007-08-03 00:13:10 +02:00
|
|
|
REFIID riid, IUnknown *punk)
|
2005-09-02 13:18:57 +02:00
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%#lx, %p, %p.\n", *pFlags, Buffer, punk);
|
2003-09-12 02:22:55 +02:00
|
|
|
|
2015-03-08 09:04:29 +01:00
|
|
|
/* first DWORD is used to store pointer itself, truncated on win64 */
|
2010-02-25 14:48:22 +01:00
|
|
|
if(!punk)
|
|
|
|
{
|
|
|
|
memset(Buffer, 0, sizeof(ULONG));
|
|
|
|
return Buffer + sizeof(ULONG);
|
|
|
|
}
|
2015-03-08 09:04:29 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
*(DWORD*)Buffer = (DWORD_PTR)punk;
|
|
|
|
Buffer += sizeof(DWORD);
|
2003-09-12 02:22:55 +02:00
|
|
|
}
|
|
|
|
|
2015-03-08 09:04:29 +01:00
|
|
|
return WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), Buffer, punk, riid);
|
2003-09-12 02:22:55 +02:00
|
|
|
}
|
|
|
|
|
2015-03-08 09:04:29 +01:00
|
|
|
/* helper: called for VT_DISPATCH / VT_UNKNOWN variants to unmarshal the buffer */
|
2021-11-24 02:07:30 +01:00
|
|
|
static unsigned char *interface_user_unmarshal(ULONG *pFlags, unsigned char *Buffer,
|
2007-08-01 22:44:48 +02:00
|
|
|
REFIID riid, IUnknown **ppunk)
|
2005-09-02 13:18:57 +02:00
|
|
|
{
|
2015-03-08 09:04:29 +01:00
|
|
|
DWORD ptr;
|
2003-09-12 02:22:55 +02:00
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%#lx, %p, %p.\n", *pFlags, Buffer, ppunk);
|
2003-09-12 02:22:55 +02:00
|
|
|
|
2015-03-08 09:04:29 +01:00
|
|
|
/* skip pointer part itself */
|
|
|
|
ptr = *(DWORD*)Buffer;
|
|
|
|
Buffer += sizeof(DWORD);
|
2006-04-18 12:57:12 +02:00
|
|
|
|
2015-03-08 09:04:29 +01:00
|
|
|
if(!ptr)
|
|
|
|
return Buffer;
|
2003-09-12 02:22:55 +02:00
|
|
|
|
2015-03-08 09:04:29 +01:00
|
|
|
return WdtpInterfacePointer_UserUnmarshal(pFlags, Buffer, ppunk, riid);
|
2003-09-12 02:22:55 +02:00
|
|
|
}
|
|
|
|
|
2006-11-08 23:43:28 +01:00
|
|
|
ULONG WINAPI VARIANT_UserSize(ULONG *pFlags, ULONG Start, VARIANT *pvar)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2006-05-05 13:18:41 +02:00
|
|
|
int align;
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%#lx, %lu, %p.\n", *pFlags, Start, pvar);
|
2006-05-05 13:18:41 +02:00
|
|
|
TRACE("vt=%04x\n", V_VT(pvar));
|
|
|
|
|
|
|
|
ALIGN_LENGTH(Start, 7);
|
|
|
|
Start += sizeof(variant_wire_t);
|
|
|
|
if(V_VT(pvar) & VT_BYREF)
|
|
|
|
Start += 4;
|
|
|
|
|
2007-12-07 15:14:05 +01:00
|
|
|
align = get_type_alignment(pFlags, V_VT(pvar));
|
2006-05-05 13:18:41 +02:00
|
|
|
ALIGN_LENGTH(Start, align);
|
|
|
|
if(V_VT(pvar) == (VT_VARIANT | VT_BYREF))
|
|
|
|
Start += 4;
|
|
|
|
else
|
2007-12-07 15:14:05 +01:00
|
|
|
Start += get_type_size(pFlags, V_VT(pvar));
|
2006-05-05 13:18:41 +02:00
|
|
|
Start = wire_extra_user_size(pFlags, Start, pvar);
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("returning %ld\n", Start);
|
2006-05-05 13:18:41 +02:00
|
|
|
return Start;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2006-11-08 23:43:45 +01:00
|
|
|
unsigned char * WINAPI VARIANT_UserMarshal(ULONG *pFlags, unsigned char *Buffer, VARIANT *pvar)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2006-05-05 13:18:41 +02:00
|
|
|
variant_wire_t *header;
|
2006-11-08 23:43:45 +01:00
|
|
|
ULONG type_size;
|
2006-05-05 13:18:41 +02:00
|
|
|
int align;
|
|
|
|
unsigned char *Pos;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%#lx, %p, %p.\n", *pFlags, Buffer, pvar);
|
2006-05-05 13:18:41 +02:00
|
|
|
TRACE("vt=%04x\n", V_VT(pvar));
|
|
|
|
|
|
|
|
ALIGN_POINTER(Buffer, 7);
|
|
|
|
|
|
|
|
header = (variant_wire_t *)Buffer;
|
|
|
|
|
|
|
|
header->clSize = 0; /* fixed up at the end */
|
2011-08-03 11:36:33 +02:00
|
|
|
header->rpcReserved = 0;
|
2006-05-05 13:18:41 +02:00
|
|
|
header->vt = pvar->n1.n2.vt;
|
|
|
|
header->wReserved1 = pvar->n1.n2.wReserved1;
|
|
|
|
header->wReserved2 = pvar->n1.n2.wReserved2;
|
|
|
|
header->wReserved3 = pvar->n1.n2.wReserved3;
|
|
|
|
header->switch_is = pvar->n1.n2.vt;
|
|
|
|
if(header->switch_is & VT_ARRAY)
|
|
|
|
header->switch_is &= ~VT_TYPEMASK;
|
|
|
|
|
|
|
|
Pos = (unsigned char*)(header + 1);
|
2007-12-07 15:14:05 +01:00
|
|
|
type_size = get_type_size(pFlags, V_VT(pvar));
|
|
|
|
align = get_type_alignment(pFlags, V_VT(pvar));
|
2006-05-05 13:18:41 +02:00
|
|
|
ALIGN_POINTER(Pos, align);
|
|
|
|
|
|
|
|
if(header->vt & VT_BYREF)
|
|
|
|
{
|
|
|
|
*(DWORD *)Pos = max(type_size, 4);
|
|
|
|
Pos += 4;
|
|
|
|
if((header->vt & VT_TYPEMASK) != VT_VARIANT)
|
|
|
|
{
|
|
|
|
memcpy(Pos, pvar->n1.n2.n3.byref, type_size);
|
|
|
|
Pos += type_size;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*(DWORD*)Pos = 'U' | 's' << 8 | 'e' << 16 | 'r' << 24;
|
|
|
|
Pos += 4;
|
|
|
|
}
|
|
|
|
}
|
2003-04-26 04:11:41 +02:00
|
|
|
else
|
2006-05-05 13:18:41 +02:00
|
|
|
{
|
|
|
|
if((header->vt & VT_TYPEMASK) == VT_DECIMAL)
|
|
|
|
memcpy(Pos, pvar, type_size);
|
|
|
|
else
|
|
|
|
memcpy(Pos, &pvar->n1.n2.n3, type_size);
|
|
|
|
Pos += type_size;
|
|
|
|
}
|
2003-04-26 04:11:41 +02:00
|
|
|
|
2006-05-05 13:18:41 +02:00
|
|
|
if(header->vt & VT_ARRAY)
|
|
|
|
{
|
|
|
|
if(header->vt & VT_BYREF)
|
|
|
|
Pos = LPSAFEARRAY_UserMarshal(pFlags, Pos, V_ARRAYREF(pvar));
|
|
|
|
else
|
|
|
|
Pos = LPSAFEARRAY_UserMarshal(pFlags, Pos, &V_ARRAY(pvar));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (header->vt)
|
|
|
|
{
|
|
|
|
case VT_BSTR:
|
|
|
|
Pos = BSTR_UserMarshal(pFlags, Pos, &V_BSTR(pvar));
|
|
|
|
break;
|
|
|
|
case VT_BSTR | VT_BYREF:
|
|
|
|
Pos = BSTR_UserMarshal(pFlags, Pos, V_BSTRREF(pvar));
|
|
|
|
break;
|
|
|
|
case VT_VARIANT | VT_BYREF:
|
|
|
|
Pos = VARIANT_UserMarshal(pFlags, Pos, V_VARIANTREF(pvar));
|
|
|
|
break;
|
|
|
|
case VT_UNKNOWN:
|
2021-11-24 02:07:30 +01:00
|
|
|
Pos = interface_user_marshal(pFlags, Pos, &IID_IUnknown, V_UNKNOWN(pvar));
|
2007-06-22 15:40:36 +02:00
|
|
|
break;
|
|
|
|
case VT_UNKNOWN | VT_BYREF:
|
2021-11-24 02:07:30 +01:00
|
|
|
Pos = interface_user_marshal(pFlags, Pos, &IID_IUnknown, *V_UNKNOWNREF(pvar));
|
2006-05-05 13:18:41 +02:00
|
|
|
break;
|
|
|
|
case VT_DISPATCH:
|
2021-11-24 02:07:30 +01:00
|
|
|
Pos = interface_user_marshal(pFlags, Pos, &IID_IDispatch, (IUnknown*)V_DISPATCH(pvar));
|
2007-06-22 15:40:36 +02:00
|
|
|
break;
|
|
|
|
case VT_DISPATCH | VT_BYREF:
|
2021-11-24 02:07:30 +01:00
|
|
|
Pos = interface_user_marshal(pFlags, Pos, &IID_IDispatch, (IUnknown*)*V_DISPATCHREF(pvar));
|
2006-05-05 13:18:41 +02:00
|
|
|
break;
|
|
|
|
case VT_RECORD:
|
|
|
|
FIXME("handle BRECORD by val\n");
|
|
|
|
break;
|
|
|
|
case VT_RECORD | VT_BYREF:
|
|
|
|
FIXME("handle BRECORD by ref\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
header->clSize = ((Pos - Buffer) + 7) >> 3;
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("marshalled size %ld\n", header->clSize);
|
2006-05-05 13:18:41 +02:00
|
|
|
return Pos;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2006-11-08 23:44:00 +01:00
|
|
|
unsigned char * WINAPI VARIANT_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, VARIANT *pvar)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2006-05-05 13:18:41 +02:00
|
|
|
variant_wire_t *header;
|
2006-11-08 23:44:00 +01:00
|
|
|
ULONG type_size;
|
2006-05-05 13:18:41 +02:00
|
|
|
int align;
|
|
|
|
unsigned char *Pos;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%#lx, %p, %p.\n", *pFlags, Buffer, pvar);
|
2006-05-05 13:18:41 +02:00
|
|
|
|
|
|
|
ALIGN_POINTER(Buffer, 7);
|
|
|
|
|
|
|
|
header = (variant_wire_t *)Buffer;
|
|
|
|
|
|
|
|
Pos = (unsigned char*)(header + 1);
|
2007-12-07 15:14:05 +01:00
|
|
|
type_size = get_type_size(pFlags, header->vt);
|
|
|
|
align = get_type_alignment(pFlags, header->vt);
|
2006-05-05 13:18:41 +02:00
|
|
|
ALIGN_POINTER(Pos, align);
|
2003-04-26 04:11:41 +02:00
|
|
|
|
2006-05-05 13:18:41 +02:00
|
|
|
if(header->vt & VT_BYREF)
|
|
|
|
{
|
2009-11-25 10:54:27 +01:00
|
|
|
ULONG mem_size;
|
2006-05-05 13:18:41 +02:00
|
|
|
Pos += 4;
|
2009-11-25 10:54:27 +01:00
|
|
|
|
|
|
|
switch (header->vt & ~VT_BYREF)
|
|
|
|
{
|
|
|
|
/* these types have a different memory size compared to wire size */
|
|
|
|
case VT_UNKNOWN:
|
|
|
|
case VT_DISPATCH:
|
|
|
|
case VT_BSTR:
|
|
|
|
mem_size = sizeof(void *);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
mem_size = type_size;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-12-07 15:14:05 +01:00
|
|
|
if (V_VT(pvar) != header->vt)
|
|
|
|
{
|
|
|
|
VariantClear(pvar);
|
2009-11-25 10:54:27 +01:00
|
|
|
V_BYREF(pvar) = CoTaskMemAlloc(mem_size);
|
2016-01-13 09:51:23 +01:00
|
|
|
memset(V_BYREF(pvar), 0, mem_size);
|
2007-12-07 15:14:05 +01:00
|
|
|
}
|
|
|
|
else if (!V_BYREF(pvar))
|
2016-01-13 09:51:23 +01:00
|
|
|
{
|
2009-11-25 10:54:27 +01:00
|
|
|
V_BYREF(pvar) = CoTaskMemAlloc(mem_size);
|
2016-01-13 09:51:23 +01:00
|
|
|
memset(V_BYREF(pvar), 0, mem_size);
|
|
|
|
}
|
|
|
|
|
2016-01-13 09:51:44 +01:00
|
|
|
if(!(header->vt & VT_ARRAY)
|
|
|
|
&& (header->vt & VT_TYPEMASK) != VT_BSTR
|
|
|
|
&& (header->vt & VT_TYPEMASK) != VT_VARIANT
|
|
|
|
&& (header->vt & VT_TYPEMASK) != VT_UNKNOWN
|
|
|
|
&& (header->vt & VT_TYPEMASK) != VT_DISPATCH
|
|
|
|
&& (header->vt & VT_TYPEMASK) != VT_RECORD)
|
2016-01-13 09:51:23 +01:00
|
|
|
memcpy(V_BYREF(pvar), Pos, type_size);
|
2016-01-13 09:51:44 +01:00
|
|
|
|
2006-05-05 13:18:41 +02:00
|
|
|
if((header->vt & VT_TYPEMASK) != VT_VARIANT)
|
2007-12-07 15:14:05 +01:00
|
|
|
Pos += type_size;
|
2006-05-05 13:18:41 +02:00
|
|
|
else
|
|
|
|
Pos += 4;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
else
|
2006-05-05 13:18:41 +02:00
|
|
|
{
|
2007-12-07 15:14:05 +01:00
|
|
|
VariantClear(pvar);
|
2016-01-13 09:51:23 +01:00
|
|
|
if(header->vt & VT_ARRAY)
|
|
|
|
V_ARRAY(pvar) = NULL;
|
2016-01-13 09:51:44 +01:00
|
|
|
else if((header->vt & VT_TYPEMASK) == VT_BSTR)
|
|
|
|
V_BSTR(pvar) = NULL;
|
|
|
|
else if((header->vt & VT_TYPEMASK) == VT_UNKNOWN)
|
|
|
|
V_UNKNOWN(pvar) = NULL;
|
|
|
|
else if((header->vt & VT_TYPEMASK) == VT_DISPATCH)
|
|
|
|
V_DISPATCH(pvar) = NULL;
|
|
|
|
else if((header->vt & VT_TYPEMASK) == VT_RECORD)
|
|
|
|
V_RECORD(pvar) = NULL;
|
2016-01-13 09:51:23 +01:00
|
|
|
else if((header->vt & VT_TYPEMASK) == VT_DECIMAL)
|
2006-05-05 13:18:41 +02:00
|
|
|
memcpy(pvar, Pos, type_size);
|
|
|
|
else
|
|
|
|
memcpy(&pvar->n1.n2.n3, Pos, type_size);
|
|
|
|
Pos += type_size;
|
|
|
|
}
|
2003-04-26 04:11:41 +02:00
|
|
|
|
2007-12-07 15:14:05 +01:00
|
|
|
pvar->n1.n2.vt = header->vt;
|
|
|
|
pvar->n1.n2.wReserved1 = header->wReserved1;
|
|
|
|
pvar->n1.n2.wReserved2 = header->wReserved2;
|
|
|
|
pvar->n1.n2.wReserved3 = header->wReserved3;
|
|
|
|
|
2006-05-05 13:18:41 +02:00
|
|
|
if(header->vt & VT_ARRAY)
|
|
|
|
{
|
|
|
|
if(header->vt & VT_BYREF)
|
|
|
|
Pos = LPSAFEARRAY_UserUnmarshal(pFlags, Pos, V_ARRAYREF(pvar));
|
|
|
|
else
|
|
|
|
Pos = LPSAFEARRAY_UserUnmarshal(pFlags, Pos, &V_ARRAY(pvar));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (header->vt)
|
|
|
|
{
|
|
|
|
case VT_BSTR:
|
|
|
|
Pos = BSTR_UserUnmarshal(pFlags, Pos, &V_BSTR(pvar));
|
|
|
|
break;
|
|
|
|
case VT_BSTR | VT_BYREF:
|
|
|
|
Pos = BSTR_UserUnmarshal(pFlags, Pos, V_BSTRREF(pvar));
|
|
|
|
break;
|
|
|
|
case VT_VARIANT | VT_BYREF:
|
|
|
|
Pos = VARIANT_UserUnmarshal(pFlags, Pos, V_VARIANTREF(pvar));
|
|
|
|
break;
|
|
|
|
case VT_UNKNOWN:
|
2021-11-24 02:07:30 +01:00
|
|
|
Pos = interface_user_unmarshal(pFlags, Pos, &IID_IUnknown, &V_UNKNOWN(pvar));
|
2007-06-22 15:40:36 +02:00
|
|
|
break;
|
|
|
|
case VT_UNKNOWN | VT_BYREF:
|
2021-11-24 02:07:30 +01:00
|
|
|
Pos = interface_user_unmarshal(pFlags, Pos, &IID_IUnknown, V_UNKNOWNREF(pvar));
|
2006-05-05 13:18:41 +02:00
|
|
|
break;
|
|
|
|
case VT_DISPATCH:
|
2021-11-24 02:07:30 +01:00
|
|
|
Pos = interface_user_unmarshal(pFlags, Pos, &IID_IDispatch, (IUnknown**)&V_DISPATCH(pvar));
|
2007-06-22 15:40:36 +02:00
|
|
|
break;
|
|
|
|
case VT_DISPATCH | VT_BYREF:
|
2021-11-24 02:07:30 +01:00
|
|
|
Pos = interface_user_unmarshal(pFlags, Pos, &IID_IDispatch, (IUnknown**)V_DISPATCHREF(pvar));
|
2006-05-05 13:18:41 +02:00
|
|
|
break;
|
|
|
|
case VT_RECORD:
|
|
|
|
FIXME("handle BRECORD by val\n");
|
|
|
|
break;
|
|
|
|
case VT_RECORD | VT_BYREF:
|
|
|
|
FIXME("handle BRECORD by ref\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Pos;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2006-11-08 23:44:10 +01:00
|
|
|
void WINAPI VARIANT_UserFree(ULONG *pFlags, VARIANT *pvar)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
|
|
|
VARTYPE vt = V_VT(pvar);
|
|
|
|
PVOID ref = NULL;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%#lx, %p.\n", *pFlags, pvar);
|
2003-04-26 04:11:41 +02:00
|
|
|
TRACE("vt=%04x\n", V_VT(pvar));
|
|
|
|
|
|
|
|
if (vt & VT_BYREF) ref = pvar->n1.n2.n3.byref;
|
|
|
|
|
|
|
|
VariantClear(pvar);
|
|
|
|
if (!ref) return;
|
|
|
|
|
2006-05-05 16:49:57 +02:00
|
|
|
if(vt & VT_ARRAY)
|
2007-11-11 13:28:41 +01:00
|
|
|
{
|
|
|
|
if (vt & VT_BYREF)
|
|
|
|
LPSAFEARRAY_UserFree(pFlags, V_ARRAYREF(pvar));
|
|
|
|
else
|
|
|
|
LPSAFEARRAY_UserFree(pFlags, &V_ARRAY(pvar));
|
|
|
|
}
|
2006-05-05 16:49:57 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (vt)
|
|
|
|
{
|
|
|
|
case VT_BSTR | VT_BYREF:
|
|
|
|
BSTR_UserFree(pFlags, V_BSTRREF(pvar));
|
|
|
|
break;
|
|
|
|
case VT_VARIANT | VT_BYREF:
|
|
|
|
VARIANT_UserFree(pFlags, V_VARIANTREF(pvar));
|
|
|
|
break;
|
|
|
|
case VT_RECORD | VT_BYREF:
|
|
|
|
FIXME("handle BRECORD by ref\n");
|
|
|
|
break;
|
|
|
|
case VT_UNKNOWN | VT_BYREF:
|
|
|
|
case VT_DISPATCH | VT_BYREF:
|
2018-10-30 05:20:22 +01:00
|
|
|
if (*V_UNKNOWNREF(pvar))
|
|
|
|
IUnknown_Release(*V_UNKNOWNREF(pvar));
|
2006-05-05 16:49:57 +02:00
|
|
|
break;
|
|
|
|
}
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CoTaskMemFree(ref);
|
|
|
|
}
|
|
|
|
|
2006-01-27 12:54:22 +01:00
|
|
|
/* LPSAFEARRAY */
|
|
|
|
|
|
|
|
/* Get the number of cells in a SafeArray */
|
|
|
|
static ULONG SAFEARRAY_GetCellCount(const SAFEARRAY *psa)
|
|
|
|
{
|
|
|
|
const SAFEARRAYBOUND* psab = psa->rgsabound;
|
|
|
|
USHORT cCount = psa->cDims;
|
|
|
|
ULONG ulNumCells = 1;
|
|
|
|
|
|
|
|
while (cCount--)
|
|
|
|
{
|
|
|
|
/* This is a valid bordercase. See testcases. -Marcus */
|
|
|
|
if (!psab->cElements)
|
|
|
|
return 0;
|
|
|
|
ulNumCells *= psab->cElements;
|
|
|
|
psab++;
|
|
|
|
}
|
|
|
|
return ulNumCells;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline SF_TYPE SAFEARRAY_GetUnionType(SAFEARRAY *psa)
|
|
|
|
{
|
|
|
|
VARTYPE vt;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = SafeArrayGetVartype(psa, &vt);
|
|
|
|
if (FAILED(hr))
|
2007-01-30 13:39:37 +01:00
|
|
|
{
|
2007-06-22 16:10:04 +02:00
|
|
|
if(psa->fFeatures & FADF_VARIANT) return SF_VARIANT;
|
|
|
|
|
2007-01-30 13:39:37 +01:00
|
|
|
switch(psa->cbElements)
|
|
|
|
{
|
|
|
|
case 1: vt = VT_I1; break;
|
|
|
|
case 2: vt = VT_I2; break;
|
|
|
|
case 4: vt = VT_I4; break;
|
|
|
|
case 8: vt = VT_I8; break;
|
|
|
|
default:
|
|
|
|
RpcRaiseException(hr);
|
|
|
|
}
|
|
|
|
}
|
2006-01-27 12:54:22 +01:00
|
|
|
|
|
|
|
if (psa->fFeatures & FADF_HAVEIID)
|
|
|
|
return SF_HAVEIID;
|
|
|
|
|
|
|
|
switch (vt)
|
|
|
|
{
|
|
|
|
case VT_I1:
|
|
|
|
case VT_UI1: return SF_I1;
|
|
|
|
case VT_BOOL:
|
|
|
|
case VT_I2:
|
|
|
|
case VT_UI2: return SF_I2;
|
|
|
|
case VT_INT:
|
|
|
|
case VT_UINT:
|
|
|
|
case VT_I4:
|
|
|
|
case VT_UI4:
|
|
|
|
case VT_R4: return SF_I4;
|
|
|
|
case VT_DATE:
|
|
|
|
case VT_CY:
|
|
|
|
case VT_R8:
|
|
|
|
case VT_I8:
|
|
|
|
case VT_UI8: return SF_I8;
|
|
|
|
case VT_INT_PTR:
|
|
|
|
case VT_UINT_PTR: return (sizeof(UINT_PTR) == 4 ? SF_I4 : SF_I8);
|
|
|
|
case VT_BSTR: return SF_BSTR;
|
|
|
|
case VT_DISPATCH: return SF_DISPATCH;
|
|
|
|
case VT_VARIANT: return SF_VARIANT;
|
|
|
|
case VT_UNKNOWN: return SF_UNKNOWN;
|
|
|
|
/* Note: Return a non-zero size to indicate vt is valid. The actual size
|
|
|
|
* of a UDT is taken from the result of IRecordInfo_GetSize().
|
|
|
|
*/
|
|
|
|
case VT_RECORD: return SF_RECORD;
|
|
|
|
default: return SF_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-11 16:26:10 +01:00
|
|
|
static DWORD elem_wire_size(LPSAFEARRAY lpsa, SF_TYPE sftype)
|
|
|
|
{
|
2021-11-24 02:07:30 +01:00
|
|
|
switch (sftype)
|
|
|
|
{
|
|
|
|
case SF_BSTR:
|
|
|
|
case SF_HAVEIID:
|
|
|
|
case SF_UNKNOWN:
|
|
|
|
case SF_DISPATCH:
|
2009-12-11 16:26:10 +01:00
|
|
|
return sizeof(DWORD);
|
2021-11-24 02:07:30 +01:00
|
|
|
|
|
|
|
case SF_VARIANT:
|
2009-12-11 16:26:10 +01:00
|
|
|
return sizeof(variant_wire_t) - sizeof(DWORD);
|
2021-11-24 02:07:30 +01:00
|
|
|
|
|
|
|
default:
|
2009-12-11 16:26:10 +01:00
|
|
|
return lpsa->cbElements;
|
2021-11-24 02:07:30 +01:00
|
|
|
}
|
2009-12-11 16:26:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static DWORD elem_mem_size(wireSAFEARRAY wiresa, SF_TYPE sftype)
|
|
|
|
{
|
2021-11-24 02:07:30 +01:00
|
|
|
switch (sftype)
|
|
|
|
{
|
|
|
|
case SF_HAVEIID:
|
|
|
|
case SF_UNKNOWN:
|
|
|
|
case SF_DISPATCH:
|
|
|
|
return sizeof(void *);
|
|
|
|
|
|
|
|
case SF_BSTR:
|
2009-12-11 16:26:10 +01:00
|
|
|
return sizeof(BSTR);
|
2021-11-24 02:07:30 +01:00
|
|
|
|
|
|
|
case SF_VARIANT:
|
2009-12-11 16:26:10 +01:00
|
|
|
return sizeof(VARIANT);
|
2021-11-24 02:07:30 +01:00
|
|
|
|
|
|
|
default:
|
2009-12-11 16:26:10 +01:00
|
|
|
return wiresa->cbElements;
|
2021-11-24 02:07:30 +01:00
|
|
|
}
|
2009-12-11 16:26:10 +01:00
|
|
|
}
|
|
|
|
|
2006-11-08 23:43:28 +01:00
|
|
|
ULONG WINAPI LPSAFEARRAY_UserSize(ULONG *pFlags, ULONG StartingSize, LPSAFEARRAY *ppsa)
|
2006-01-27 12:54:22 +01:00
|
|
|
{
|
2006-11-08 23:43:28 +01:00
|
|
|
ULONG size = StartingSize;
|
2006-01-27 12:54:22 +01:00
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("("); dump_user_flags(pFlags); TRACE(", %ld, %p\n", StartingSize, *ppsa);
|
2006-01-27 12:54:22 +01:00
|
|
|
|
2006-05-03 18:30:35 +02:00
|
|
|
ALIGN_LENGTH(size, 3);
|
2009-04-07 13:27:49 +02:00
|
|
|
size += sizeof(ULONG);
|
2006-01-27 12:54:22 +01:00
|
|
|
if (*ppsa)
|
|
|
|
{
|
|
|
|
SAFEARRAY *psa = *ppsa;
|
|
|
|
ULONG ulCellCount = SAFEARRAY_GetCellCount(psa);
|
|
|
|
SF_TYPE sftype;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
size += sizeof(ULONG);
|
2009-07-10 19:13:27 +02:00
|
|
|
size += 2 * sizeof(USHORT) + 2 * sizeof(ULONG);
|
2006-01-27 12:54:22 +01:00
|
|
|
|
|
|
|
sftype = SAFEARRAY_GetUnionType(psa);
|
|
|
|
size += sizeof(ULONG);
|
|
|
|
|
|
|
|
size += sizeof(ULONG);
|
2009-04-07 13:27:49 +02:00
|
|
|
size += sizeof(ULONG);
|
2006-01-27 12:54:22 +01:00
|
|
|
if (sftype == SF_HAVEIID)
|
|
|
|
size += sizeof(IID);
|
|
|
|
|
|
|
|
size += sizeof(psa->rgsabound[0]) * psa->cDims;
|
|
|
|
|
|
|
|
size += sizeof(ULONG);
|
|
|
|
|
|
|
|
switch (sftype)
|
|
|
|
{
|
|
|
|
case SF_BSTR:
|
|
|
|
{
|
|
|
|
BSTR* lpBstr;
|
|
|
|
|
2009-02-09 09:45:52 +01:00
|
|
|
for (lpBstr = psa->pvData; ulCellCount; ulCellCount--, lpBstr++)
|
2006-01-27 12:54:22 +01:00
|
|
|
size = BSTR_UserSize(pFlags, size, lpBstr);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SF_DISPATCH:
|
|
|
|
case SF_UNKNOWN:
|
|
|
|
case SF_HAVEIID:
|
2021-11-24 02:07:30 +01:00
|
|
|
{
|
|
|
|
IUnknown **lpUnk;
|
|
|
|
GUID guid;
|
|
|
|
|
|
|
|
if (sftype == SF_HAVEIID)
|
|
|
|
SafeArrayGetIID(psa, &guid);
|
|
|
|
else if (sftype == SF_UNKNOWN)
|
|
|
|
guid = IID_IUnknown;
|
|
|
|
else
|
|
|
|
guid = IID_IDispatch;
|
|
|
|
|
|
|
|
for (lpUnk = psa->pvData; ulCellCount; ulCellCount--, lpUnk++)
|
|
|
|
size = interface_user_size(pFlags, size, &guid, *lpUnk);
|
|
|
|
|
2006-01-27 12:54:22 +01:00
|
|
|
break;
|
2021-11-24 02:07:30 +01:00
|
|
|
}
|
2006-01-27 12:54:22 +01:00
|
|
|
case SF_VARIANT:
|
|
|
|
{
|
|
|
|
VARIANT* lpVariant;
|
|
|
|
|
2009-02-09 09:45:52 +01:00
|
|
|
for (lpVariant = psa->pvData; ulCellCount; ulCellCount--, lpVariant++)
|
2006-01-27 12:54:22 +01:00
|
|
|
size = VARIANT_UserSize(pFlags, size, lpVariant);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SF_RECORD:
|
|
|
|
{
|
|
|
|
IRecordInfo* pRecInfo = NULL;
|
|
|
|
|
|
|
|
hr = SafeArrayGetRecordInfo(psa, &pRecInfo);
|
|
|
|
if (FAILED(hr))
|
|
|
|
RpcRaiseException(hr);
|
|
|
|
|
|
|
|
if (pRecInfo)
|
|
|
|
{
|
|
|
|
FIXME("size record info %p\n", pRecInfo);
|
|
|
|
|
|
|
|
IRecordInfo_Release(pRecInfo);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2006-05-03 18:30:35 +02:00
|
|
|
case SF_I8:
|
|
|
|
ALIGN_LENGTH(size, 7);
|
|
|
|
/* fallthrough */
|
2006-01-27 12:54:22 +01:00
|
|
|
case SF_I1:
|
|
|
|
case SF_I2:
|
|
|
|
case SF_I4:
|
|
|
|
size += ulCellCount * psa->cbElements;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2006-11-08 23:43:45 +01:00
|
|
|
unsigned char * WINAPI LPSAFEARRAY_UserMarshal(ULONG *pFlags, unsigned char *Buffer, LPSAFEARRAY *ppsa)
|
2006-01-27 12:54:22 +01:00
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("("); dump_user_flags(pFlags); TRACE(", %p, &%p\n", Buffer, *ppsa);
|
|
|
|
|
2006-05-03 18:30:35 +02:00
|
|
|
ALIGN_POINTER(Buffer, 3);
|
2009-04-07 13:27:49 +02:00
|
|
|
*(ULONG *)Buffer = *ppsa ? 0x1 : 0x0;
|
|
|
|
Buffer += sizeof(ULONG);
|
2006-01-27 12:54:22 +01:00
|
|
|
if (*ppsa)
|
|
|
|
{
|
|
|
|
VARTYPE vt;
|
|
|
|
SAFEARRAY *psa = *ppsa;
|
|
|
|
ULONG ulCellCount = SAFEARRAY_GetCellCount(psa);
|
2010-10-19 00:35:27 +02:00
|
|
|
SAFEARRAYBOUND *bound;
|
2006-01-27 12:54:22 +01:00
|
|
|
SF_TYPE sftype;
|
|
|
|
GUID guid;
|
2010-10-19 00:35:27 +02:00
|
|
|
INT i;
|
2006-01-27 12:54:22 +01:00
|
|
|
|
2009-12-11 16:26:10 +01:00
|
|
|
sftype = SAFEARRAY_GetUnionType(psa);
|
|
|
|
|
2006-01-27 12:54:22 +01:00
|
|
|
*(ULONG *)Buffer = psa->cDims;
|
|
|
|
Buffer += sizeof(ULONG);
|
2009-07-10 19:13:27 +02:00
|
|
|
*(USHORT *)Buffer = psa->cDims;
|
|
|
|
Buffer += sizeof(USHORT);
|
|
|
|
*(USHORT *)Buffer = psa->fFeatures;
|
|
|
|
Buffer += sizeof(USHORT);
|
2009-12-11 16:26:10 +01:00
|
|
|
*(ULONG *)Buffer = elem_wire_size(psa, sftype);
|
2009-07-10 19:13:27 +02:00
|
|
|
Buffer += sizeof(ULONG);
|
2006-01-27 12:54:22 +01:00
|
|
|
|
|
|
|
hr = SafeArrayGetVartype(psa, &vt);
|
2021-11-24 02:07:30 +01:00
|
|
|
if ((psa->fFeatures & FADF_HAVEIID) || FAILED(hr)) vt = 0;
|
2007-01-30 13:39:37 +01:00
|
|
|
|
2009-07-10 19:13:27 +02:00
|
|
|
*(ULONG *)Buffer = (USHORT)psa->cLocks | (vt << 16);
|
|
|
|
Buffer += sizeof(ULONG);
|
2006-01-27 12:54:22 +01:00
|
|
|
|
|
|
|
*(ULONG *)Buffer = sftype;
|
|
|
|
Buffer += sizeof(ULONG);
|
|
|
|
|
|
|
|
*(ULONG *)Buffer = ulCellCount;
|
|
|
|
Buffer += sizeof(ULONG);
|
2009-04-07 13:27:49 +02:00
|
|
|
*(ULONG *)Buffer = psa->pvData ? 0x2 : 0x0;
|
|
|
|
Buffer += sizeof(ULONG);
|
2006-01-27 12:54:22 +01:00
|
|
|
if (sftype == SF_HAVEIID)
|
|
|
|
{
|
|
|
|
SafeArrayGetIID(psa, &guid);
|
|
|
|
memcpy(Buffer, &guid, sizeof(guid));
|
|
|
|
Buffer += sizeof(guid);
|
|
|
|
}
|
|
|
|
|
2010-10-19 00:35:27 +02:00
|
|
|
/* bounds are marshaled in opposite order comparing to storage layout */
|
|
|
|
bound = (SAFEARRAYBOUND*)Buffer;
|
|
|
|
for (i = 0; i < psa->cDims; i++)
|
|
|
|
{
|
|
|
|
memcpy(bound++, &psa->rgsabound[psa->cDims-i-1], sizeof(psa->rgsabound[0]));
|
|
|
|
}
|
2006-01-27 12:54:22 +01:00
|
|
|
Buffer += sizeof(psa->rgsabound[0]) * psa->cDims;
|
|
|
|
|
|
|
|
*(ULONG *)Buffer = ulCellCount;
|
|
|
|
Buffer += sizeof(ULONG);
|
|
|
|
|
|
|
|
if (psa->pvData)
|
|
|
|
{
|
|
|
|
switch (sftype)
|
|
|
|
{
|
|
|
|
case SF_BSTR:
|
|
|
|
{
|
|
|
|
BSTR* lpBstr;
|
|
|
|
|
2009-02-09 09:45:52 +01:00
|
|
|
for (lpBstr = psa->pvData; ulCellCount; ulCellCount--, lpBstr++)
|
2006-01-27 12:54:22 +01:00
|
|
|
Buffer = BSTR_UserMarshal(pFlags, Buffer, lpBstr);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SF_DISPATCH:
|
|
|
|
case SF_UNKNOWN:
|
|
|
|
case SF_HAVEIID:
|
2021-11-24 02:07:30 +01:00
|
|
|
{
|
|
|
|
IUnknown **lpUnk;
|
|
|
|
const GUID *iid;
|
|
|
|
|
|
|
|
if (sftype == SF_HAVEIID)
|
|
|
|
iid = &guid;
|
|
|
|
else if (sftype == SF_UNKNOWN)
|
|
|
|
iid = &IID_IUnknown;
|
|
|
|
else
|
|
|
|
iid = &IID_IDispatch;
|
|
|
|
|
|
|
|
for (lpUnk = psa->pvData; ulCellCount; ulCellCount--, lpUnk++)
|
|
|
|
Buffer = interface_user_marshal(pFlags, Buffer, iid, *lpUnk);
|
|
|
|
|
2006-01-27 12:54:22 +01:00
|
|
|
break;
|
2021-11-24 02:07:30 +01:00
|
|
|
}
|
2006-01-27 12:54:22 +01:00
|
|
|
case SF_VARIANT:
|
|
|
|
{
|
|
|
|
VARIANT* lpVariant;
|
|
|
|
|
2009-02-09 09:45:52 +01:00
|
|
|
for (lpVariant = psa->pvData; ulCellCount; ulCellCount--, lpVariant++)
|
2006-01-27 12:54:22 +01:00
|
|
|
Buffer = VARIANT_UserMarshal(pFlags, Buffer, lpVariant);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SF_RECORD:
|
|
|
|
{
|
|
|
|
IRecordInfo* pRecInfo = NULL;
|
|
|
|
|
|
|
|
hr = SafeArrayGetRecordInfo(psa, &pRecInfo);
|
|
|
|
if (FAILED(hr))
|
|
|
|
RpcRaiseException(hr);
|
|
|
|
|
|
|
|
if (pRecInfo)
|
|
|
|
{
|
|
|
|
FIXME("write record info %p\n", pRecInfo);
|
|
|
|
|
|
|
|
IRecordInfo_Release(pRecInfo);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2006-05-03 18:30:35 +02:00
|
|
|
|
|
|
|
case SF_I8:
|
|
|
|
ALIGN_POINTER(Buffer, 7);
|
|
|
|
/* fallthrough */
|
2006-01-27 12:54:22 +01:00
|
|
|
case SF_I1:
|
|
|
|
case SF_I2:
|
|
|
|
case SF_I4:
|
|
|
|
/* Just copy the data over */
|
|
|
|
memcpy(Buffer, psa->pvData, ulCellCount * psa->cbElements);
|
|
|
|
Buffer += ulCellCount * psa->cbElements;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return Buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define FADF_AUTOSETFLAGS (FADF_HAVEIID | FADF_RECORD | FADF_HAVEVARTYPE | \
|
|
|
|
FADF_BSTR | FADF_UNKNOWN | FADF_DISPATCH | \
|
|
|
|
FADF_VARIANT | FADF_CREATEVECTOR)
|
|
|
|
|
2006-11-08 23:44:00 +01:00
|
|
|
unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, LPSAFEARRAY *ppsa)
|
2006-01-27 12:54:22 +01:00
|
|
|
{
|
2009-04-07 13:27:49 +02:00
|
|
|
ULONG ptr;
|
2006-01-27 12:54:22 +01:00
|
|
|
wireSAFEARRAY wiresa;
|
|
|
|
ULONG cDims;
|
|
|
|
HRESULT hr;
|
|
|
|
SF_TYPE sftype;
|
|
|
|
ULONG cell_count;
|
|
|
|
GUID guid;
|
|
|
|
VARTYPE vt;
|
|
|
|
SAFEARRAYBOUND *wiresab;
|
|
|
|
|
|
|
|
TRACE("("); dump_user_flags(pFlags); TRACE(", %p, %p\n", Buffer, ppsa);
|
|
|
|
|
2006-05-03 18:30:35 +02:00
|
|
|
ALIGN_POINTER(Buffer, 3);
|
2009-04-07 13:27:49 +02:00
|
|
|
ptr = *(ULONG *)Buffer;
|
|
|
|
Buffer += sizeof(ULONG);
|
2006-01-27 12:54:22 +01:00
|
|
|
|
|
|
|
if (!ptr)
|
|
|
|
{
|
2016-01-13 09:51:23 +01:00
|
|
|
SafeArrayDestroy(*ppsa);
|
2006-01-27 12:54:22 +01:00
|
|
|
*ppsa = NULL;
|
|
|
|
|
|
|
|
TRACE("NULL safe array unmarshaled\n");
|
|
|
|
|
|
|
|
return Buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
cDims = *(ULONG *)Buffer;
|
|
|
|
Buffer += sizeof(ULONG);
|
|
|
|
|
|
|
|
wiresa = (wireSAFEARRAY)Buffer;
|
2009-07-10 19:13:27 +02:00
|
|
|
Buffer += 2 * sizeof(USHORT) + 2 * sizeof(ULONG);
|
2006-01-27 12:54:22 +01:00
|
|
|
|
|
|
|
if (cDims != wiresa->cDims)
|
|
|
|
RpcRaiseException(RPC_S_INVALID_BOUND);
|
|
|
|
|
|
|
|
/* FIXME: there should be a limit on how large cDims can be */
|
|
|
|
|
|
|
|
vt = HIWORD(wiresa->cLocks);
|
|
|
|
|
|
|
|
sftype = *(ULONG *)Buffer;
|
|
|
|
Buffer += sizeof(ULONG);
|
|
|
|
|
|
|
|
cell_count = *(ULONG *)Buffer;
|
|
|
|
Buffer += sizeof(ULONG);
|
2009-04-07 13:27:49 +02:00
|
|
|
ptr = *(ULONG *)Buffer;
|
|
|
|
Buffer += sizeof(ULONG);
|
2006-01-27 12:54:22 +01:00
|
|
|
if (sftype == SF_HAVEIID)
|
|
|
|
{
|
|
|
|
memcpy(&guid, Buffer, sizeof(guid));
|
|
|
|
Buffer += sizeof(guid);
|
|
|
|
}
|
|
|
|
|
|
|
|
wiresab = (SAFEARRAYBOUND *)Buffer;
|
|
|
|
Buffer += sizeof(wiresab[0]) * wiresa->cDims;
|
|
|
|
|
2016-01-13 09:51:32 +01:00
|
|
|
if(*ppsa && (*ppsa)->cDims==wiresa->cDims)
|
|
|
|
{
|
|
|
|
if(((*ppsa)->fFeatures & ~FADF_AUTOSETFLAGS) != (wiresa->fFeatures & ~FADF_AUTOSETFLAGS))
|
|
|
|
RpcRaiseException(DISP_E_BADCALLEE);
|
|
|
|
|
|
|
|
if(SAFEARRAY_GetCellCount(*ppsa)*(*ppsa)->cbElements != cell_count*elem_mem_size(wiresa, sftype))
|
|
|
|
{
|
|
|
|
if((*ppsa)->fFeatures & (FADF_AUTO|FADF_STATIC|FADF_EMBEDDED|FADF_FIXEDSIZE))
|
|
|
|
RpcRaiseException(DISP_E_BADCALLEE);
|
|
|
|
|
|
|
|
hr = SafeArrayDestroyData(*ppsa);
|
|
|
|
if(FAILED(hr))
|
|
|
|
RpcRaiseException(hr);
|
|
|
|
}
|
|
|
|
memcpy((*ppsa)->rgsabound, wiresab, sizeof(*wiresab)*wiresa->cDims);
|
|
|
|
|
|
|
|
if((*ppsa)->fFeatures & FADF_HAVEVARTYPE)
|
|
|
|
((DWORD*)(*ppsa))[-1] = vt;
|
|
|
|
}
|
|
|
|
else if(vt)
|
2013-07-02 15:45:04 +02:00
|
|
|
{
|
2016-01-13 09:51:23 +01:00
|
|
|
SafeArrayDestroy(*ppsa);
|
2007-01-30 13:39:37 +01:00
|
|
|
*ppsa = SafeArrayCreateEx(vt, wiresa->cDims, wiresab, NULL);
|
2013-07-02 15:45:04 +02:00
|
|
|
if (!*ppsa) RpcRaiseException(E_OUTOFMEMORY);
|
|
|
|
}
|
2007-01-30 13:39:37 +01:00
|
|
|
else
|
|
|
|
{
|
2016-01-13 09:51:23 +01:00
|
|
|
SafeArrayDestroy(*ppsa);
|
2013-07-02 15:45:04 +02:00
|
|
|
if (FAILED(SafeArrayAllocDescriptor(wiresa->cDims, ppsa)))
|
|
|
|
RpcRaiseException(E_OUTOFMEMORY);
|
|
|
|
memcpy((*ppsa)->rgsabound, wiresab, sizeof(SAFEARRAYBOUND) * wiresa->cDims);
|
2007-01-30 13:39:37 +01:00
|
|
|
}
|
2006-01-27 12:54:22 +01:00
|
|
|
|
|
|
|
/* be careful about which flags we set since they could be a security
|
|
|
|
* risk */
|
2006-05-08 18:24:51 +02:00
|
|
|
(*ppsa)->fFeatures &= FADF_AUTOSETFLAGS;
|
|
|
|
(*ppsa)->fFeatures |= (wiresa->fFeatures & ~(FADF_AUTOSETFLAGS));
|
2006-01-27 12:54:22 +01:00
|
|
|
/* FIXME: there should be a limit on how large wiresa->cbElements can be */
|
2009-12-11 16:26:10 +01:00
|
|
|
(*ppsa)->cbElements = elem_mem_size(wiresa, sftype);
|
2006-01-27 12:54:22 +01:00
|
|
|
|
2007-12-07 15:13:57 +01:00
|
|
|
/* SafeArrayCreateEx allocates the data for us, but
|
|
|
|
* SafeArrayAllocDescriptor doesn't */
|
2016-01-13 09:51:32 +01:00
|
|
|
if(!(*ppsa)->pvData)
|
2007-12-07 15:13:57 +01:00
|
|
|
{
|
|
|
|
hr = SafeArrayAllocData(*ppsa);
|
|
|
|
if (FAILED(hr))
|
|
|
|
RpcRaiseException(hr);
|
|
|
|
}
|
2006-01-27 12:54:22 +01:00
|
|
|
|
|
|
|
if ((*(ULONG *)Buffer != cell_count) || (SAFEARRAY_GetCellCount(*ppsa) != cell_count))
|
|
|
|
RpcRaiseException(RPC_S_INVALID_BOUND);
|
|
|
|
Buffer += sizeof(ULONG);
|
|
|
|
|
|
|
|
if (ptr)
|
|
|
|
{
|
|
|
|
switch (sftype)
|
|
|
|
{
|
|
|
|
case SF_BSTR:
|
|
|
|
{
|
|
|
|
BSTR* lpBstr;
|
|
|
|
|
2009-02-09 09:45:52 +01:00
|
|
|
for (lpBstr = (*ppsa)->pvData; cell_count; cell_count--, lpBstr++)
|
2006-01-27 12:54:22 +01:00
|
|
|
Buffer = BSTR_UserUnmarshal(pFlags, Buffer, lpBstr);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SF_DISPATCH:
|
|
|
|
case SF_UNKNOWN:
|
|
|
|
case SF_HAVEIID:
|
2021-11-24 02:07:30 +01:00
|
|
|
{
|
|
|
|
IUnknown **lpUnk;
|
|
|
|
const GUID *iid;
|
|
|
|
|
|
|
|
if (sftype == SF_HAVEIID)
|
|
|
|
iid = &guid;
|
|
|
|
else if (sftype == SF_UNKNOWN)
|
|
|
|
iid = &IID_IUnknown;
|
|
|
|
else
|
|
|
|
iid = &IID_IDispatch;
|
|
|
|
|
|
|
|
for (lpUnk = (*ppsa)->pvData; cell_count; cell_count--, lpUnk++)
|
|
|
|
Buffer = interface_user_unmarshal(pFlags, Buffer, iid, lpUnk);
|
|
|
|
|
2006-01-27 12:54:22 +01:00
|
|
|
break;
|
2021-11-24 02:07:30 +01:00
|
|
|
}
|
2006-01-27 12:54:22 +01:00
|
|
|
case SF_VARIANT:
|
|
|
|
{
|
|
|
|
VARIANT* lpVariant;
|
|
|
|
|
2009-02-09 09:45:52 +01:00
|
|
|
for (lpVariant = (*ppsa)->pvData; cell_count; cell_count--, lpVariant++)
|
2006-01-27 12:54:22 +01:00
|
|
|
Buffer = VARIANT_UserUnmarshal(pFlags, Buffer, lpVariant);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SF_RECORD:
|
|
|
|
{
|
|
|
|
FIXME("set record info\n");
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2006-05-03 18:30:35 +02:00
|
|
|
|
|
|
|
case SF_I8:
|
|
|
|
ALIGN_POINTER(Buffer, 7);
|
|
|
|
/* fallthrough */
|
2006-01-27 12:54:22 +01:00
|
|
|
case SF_I1:
|
|
|
|
case SF_I2:
|
|
|
|
case SF_I4:
|
|
|
|
/* Just copy the data over */
|
|
|
|
memcpy((*ppsa)->pvData, Buffer, cell_count * (*ppsa)->cbElements);
|
|
|
|
Buffer += cell_count * (*ppsa)->cbElements;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("safe array unmarshaled: %p\n", *ppsa);
|
|
|
|
|
|
|
|
return Buffer;
|
|
|
|
}
|
|
|
|
|
2006-11-08 23:44:10 +01:00
|
|
|
void WINAPI LPSAFEARRAY_UserFree(ULONG *pFlags, LPSAFEARRAY *ppsa)
|
2006-01-27 12:54:22 +01:00
|
|
|
{
|
|
|
|
TRACE("("); dump_user_flags(pFlags); TRACE(", &%p\n", *ppsa);
|
|
|
|
|
|
|
|
SafeArrayDestroy(*ppsa);
|
2016-01-13 09:51:12 +01:00
|
|
|
*ppsa = NULL;
|
2006-01-27 12:54:22 +01:00
|
|
|
}
|
|
|
|
|
2008-09-02 18:02:04 +02:00
|
|
|
|
|
|
|
ULONG WINAPI HFONT_UserSize(ULONG *pFlags, ULONG Start, HFONT *phfont)
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char * WINAPI HFONT_UserMarshal(ULONG *pFlags, unsigned char *Buffer, HFONT *phfont)
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char * WINAPI HFONT_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, HFONT *phfont)
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WINAPI HFONT_UserFree(ULONG *pFlags, HFONT *phfont)
|
|
|
|
{
|
|
|
|
FIXME(":stub\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-04-26 04:11:41 +02:00
|
|
|
/* IDispatch */
|
|
|
|
/* exactly how Invoke is marshalled is not very clear to me yet,
|
|
|
|
* but the way I've done it seems to work for me */
|
|
|
|
|
|
|
|
HRESULT CALLBACK IDispatch_Invoke_Proxy(
|
|
|
|
IDispatch* This,
|
|
|
|
DISPID dispIdMember,
|
|
|
|
REFIID riid,
|
|
|
|
LCID lcid,
|
|
|
|
WORD wFlags,
|
|
|
|
DISPPARAMS* pDispParams,
|
|
|
|
VARIANT* pVarResult,
|
|
|
|
EXCEPINFO* pExcepInfo,
|
|
|
|
UINT* puArgErr)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
VARIANT VarResult;
|
|
|
|
UINT* rgVarRefIdx = NULL;
|
|
|
|
VARIANTARG* rgVarRef = NULL;
|
|
|
|
UINT u, cVarRef;
|
2005-06-12 12:42:36 +02:00
|
|
|
UINT uArgErr;
|
2005-10-31 16:43:53 +01:00
|
|
|
EXCEPINFO ExcepInfo;
|
2003-04-26 04:11:41 +02:00
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %ld, %s, %#lx, %x, %p, %p, %p, %p.\n", This,
|
2003-04-26 04:11:41 +02:00
|
|
|
dispIdMember, debugstr_guid(riid),
|
|
|
|
lcid, wFlags, pDispParams, pVarResult,
|
|
|
|
pExcepInfo, puArgErr);
|
|
|
|
|
|
|
|
/* [out] args can't be null, use dummy vars if needed */
|
|
|
|
if (!pVarResult) pVarResult = &VarResult;
|
2005-06-12 12:42:36 +02:00
|
|
|
if (!puArgErr) puArgErr = &uArgErr;
|
2005-10-31 16:43:53 +01:00
|
|
|
if (!pExcepInfo) pExcepInfo = &ExcepInfo;
|
2003-04-26 04:11:41 +02:00
|
|
|
|
|
|
|
/* count by-ref args */
|
|
|
|
for (cVarRef=0,u=0; u<pDispParams->cArgs; u++) {
|
|
|
|
VARIANTARG* arg = &pDispParams->rgvarg[u];
|
2005-02-22 15:54:01 +01:00
|
|
|
if (V_ISBYREF(arg)) {
|
2003-04-26 04:11:41 +02:00
|
|
|
cVarRef++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cVarRef) {
|
|
|
|
rgVarRefIdx = CoTaskMemAlloc(sizeof(UINT)*cVarRef);
|
|
|
|
rgVarRef = CoTaskMemAlloc(sizeof(VARIANTARG)*cVarRef);
|
|
|
|
/* make list of by-ref args */
|
|
|
|
for (cVarRef=0,u=0; u<pDispParams->cArgs; u++) {
|
|
|
|
VARIANTARG* arg = &pDispParams->rgvarg[u];
|
2005-02-22 15:54:01 +01:00
|
|
|
if (V_ISBYREF(arg)) {
|
2003-04-26 04:11:41 +02:00
|
|
|
rgVarRefIdx[cVarRef] = u;
|
|
|
|
VariantInit(&rgVarRef[cVarRef]);
|
2009-11-18 01:16:51 +01:00
|
|
|
VariantCopy(&rgVarRef[cVarRef], arg);
|
|
|
|
VariantClear(arg);
|
2003-04-26 04:11:41 +02:00
|
|
|
cVarRef++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* [out] args still can't be null,
|
|
|
|
* but we can point these anywhere in this case,
|
|
|
|
* since they won't be written to when cVarRef is 0 */
|
|
|
|
rgVarRefIdx = puArgErr;
|
|
|
|
rgVarRef = pVarResult;
|
|
|
|
}
|
|
|
|
TRACE("passed by ref: %d args\n", cVarRef);
|
|
|
|
hr = IDispatch_RemoteInvoke_Proxy(This,
|
|
|
|
dispIdMember,
|
|
|
|
riid,
|
|
|
|
lcid,
|
|
|
|
wFlags,
|
|
|
|
pDispParams,
|
|
|
|
pVarResult,
|
|
|
|
pExcepInfo,
|
|
|
|
puArgErr,
|
|
|
|
cVarRef,
|
|
|
|
rgVarRefIdx,
|
|
|
|
rgVarRef);
|
|
|
|
if (cVarRef) {
|
|
|
|
for (u=0; u<cVarRef; u++) {
|
|
|
|
unsigned i = rgVarRefIdx[u];
|
|
|
|
VariantCopy(&pDispParams->rgvarg[i],
|
|
|
|
&rgVarRef[u]);
|
|
|
|
VariantClear(&rgVarRef[u]);
|
|
|
|
}
|
|
|
|
CoTaskMemFree(rgVarRef);
|
|
|
|
CoTaskMemFree(rgVarRefIdx);
|
|
|
|
}
|
2005-10-31 16:43:53 +01:00
|
|
|
|
|
|
|
if(pExcepInfo == &ExcepInfo)
|
|
|
|
{
|
|
|
|
SysFreeString(pExcepInfo->bstrSource);
|
|
|
|
SysFreeString(pExcepInfo->bstrDescription);
|
|
|
|
SysFreeString(pExcepInfo->bstrHelpFile);
|
|
|
|
}
|
2003-04-26 04:11:41 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB IDispatch_Invoke_Stub(
|
|
|
|
IDispatch* This,
|
|
|
|
DISPID dispIdMember,
|
|
|
|
REFIID riid,
|
|
|
|
LCID lcid,
|
|
|
|
DWORD dwFlags,
|
|
|
|
DISPPARAMS* pDispParams,
|
|
|
|
VARIANT* pVarResult,
|
|
|
|
EXCEPINFO* pExcepInfo,
|
|
|
|
UINT* pArgErr,
|
|
|
|
UINT cVarRef,
|
|
|
|
UINT* rgVarRefIdx,
|
|
|
|
VARIANTARG* rgVarRef)
|
|
|
|
{
|
2005-06-12 12:42:36 +02:00
|
|
|
HRESULT hr = S_OK;
|
2003-04-26 04:11:41 +02:00
|
|
|
VARIANTARG *rgvarg, *arg;
|
|
|
|
UINT u;
|
|
|
|
|
2005-06-12 12:42:36 +02:00
|
|
|
/* initialize out parameters, so that they can be marshalled
|
|
|
|
* in case the real Invoke doesn't initialize them */
|
|
|
|
VariantInit(pVarResult);
|
|
|
|
memset(pExcepInfo, 0, sizeof(*pExcepInfo));
|
|
|
|
*pArgErr = 0;
|
|
|
|
|
2003-04-26 04:11:41 +02:00
|
|
|
/* let the real Invoke operate on a copy of the in parameters,
|
|
|
|
* so we don't risk losing pointers to allocated memory */
|
|
|
|
rgvarg = pDispParams->rgvarg;
|
|
|
|
arg = CoTaskMemAlloc(sizeof(VARIANTARG)*pDispParams->cArgs);
|
2005-06-12 12:42:36 +02:00
|
|
|
if (!arg) return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
/* init all args so we can call VariantClear on all the args if the copy
|
|
|
|
* below fails */
|
|
|
|
for (u = 0; u < pDispParams->cArgs; u++)
|
2003-04-26 04:11:41 +02:00
|
|
|
VariantInit(&arg[u]);
|
2005-06-12 12:42:36 +02:00
|
|
|
|
|
|
|
for (u = 0; u < pDispParams->cArgs; u++) {
|
|
|
|
hr = VariantCopy(&arg[u], &rgvarg[u]);
|
|
|
|
if (FAILED(hr))
|
|
|
|
break;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2005-06-12 12:42:36 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
2009-11-18 01:16:51 +01:00
|
|
|
/* copy ref args to arg array */
|
|
|
|
for (u=0; u<cVarRef; u++) {
|
|
|
|
unsigned i = rgVarRefIdx[u];
|
|
|
|
VariantCopy(&arg[i], &rgVarRef[u]);
|
|
|
|
}
|
|
|
|
|
2005-06-12 12:42:36 +02:00
|
|
|
pDispParams->rgvarg = arg;
|
2003-04-26 04:11:41 +02:00
|
|
|
|
2005-06-12 12:42:36 +02:00
|
|
|
hr = IDispatch_Invoke(This,
|
|
|
|
dispIdMember,
|
|
|
|
riid,
|
|
|
|
lcid,
|
|
|
|
dwFlags,
|
|
|
|
pDispParams,
|
|
|
|
pVarResult,
|
|
|
|
pExcepInfo,
|
|
|
|
pArgErr);
|
|
|
|
|
2009-11-18 01:16:51 +01:00
|
|
|
/* copy ref args from arg array */
|
2005-06-12 12:42:36 +02:00
|
|
|
for (u=0; u<cVarRef; u++) {
|
|
|
|
unsigned i = rgVarRefIdx[u];
|
|
|
|
VariantCopy(&rgVarRef[u], &arg[i]);
|
|
|
|
}
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
2005-06-12 12:42:36 +02:00
|
|
|
|
2003-04-26 04:11:41 +02:00
|
|
|
/* clear the duplicate argument list */
|
2005-06-12 12:42:36 +02:00
|
|
|
for (u=0; u<pDispParams->cArgs; u++)
|
2003-04-26 04:11:41 +02:00
|
|
|
VariantClear(&arg[u]);
|
2005-06-12 12:42:36 +02:00
|
|
|
|
2003-04-26 04:11:41 +02:00
|
|
|
pDispParams->rgvarg = rgvarg;
|
|
|
|
CoTaskMemFree(arg);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* IEnumVARIANT */
|
|
|
|
|
|
|
|
HRESULT CALLBACK IEnumVARIANT_Next_Proxy(
|
|
|
|
IEnumVARIANT* This,
|
|
|
|
ULONG celt,
|
|
|
|
VARIANT* rgVar,
|
|
|
|
ULONG* pCeltFetched)
|
|
|
|
{
|
|
|
|
ULONG fetched;
|
|
|
|
if (!pCeltFetched)
|
|
|
|
pCeltFetched = &fetched;
|
|
|
|
return IEnumVARIANT_RemoteNext_Proxy(This,
|
|
|
|
celt,
|
|
|
|
rgVar,
|
|
|
|
pCeltFetched);
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB IEnumVARIANT_Next_Stub(
|
|
|
|
IEnumVARIANT* This,
|
|
|
|
ULONG celt,
|
|
|
|
VARIANT* rgVar,
|
|
|
|
ULONG* pCeltFetched)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
*pCeltFetched = 0;
|
|
|
|
hr = IEnumVARIANT_Next(This,
|
|
|
|
celt,
|
|
|
|
rgVar,
|
|
|
|
pCeltFetched);
|
|
|
|
if (hr == S_OK) *pCeltFetched = celt;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2006-04-28 15:42:43 +02:00
|
|
|
/* TypeInfo related freers */
|
|
|
|
|
|
|
|
static void free_embedded_typedesc(TYPEDESC *tdesc);
|
|
|
|
static void free_embedded_arraydesc(ARRAYDESC *adesc)
|
|
|
|
{
|
|
|
|
switch(adesc->tdescElem.vt)
|
|
|
|
{
|
|
|
|
case VT_PTR:
|
|
|
|
case VT_SAFEARRAY:
|
|
|
|
free_embedded_typedesc(adesc->tdescElem.u.lptdesc);
|
|
|
|
CoTaskMemFree(adesc->tdescElem.u.lptdesc);
|
|
|
|
break;
|
|
|
|
case VT_CARRAY:
|
|
|
|
free_embedded_arraydesc(adesc->tdescElem.u.lpadesc);
|
|
|
|
CoTaskMemFree(adesc->tdescElem.u.lpadesc);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void free_embedded_typedesc(TYPEDESC *tdesc)
|
|
|
|
{
|
|
|
|
switch(tdesc->vt)
|
|
|
|
{
|
|
|
|
case VT_PTR:
|
|
|
|
case VT_SAFEARRAY:
|
|
|
|
free_embedded_typedesc(tdesc->u.lptdesc);
|
|
|
|
CoTaskMemFree(tdesc->u.lptdesc);
|
|
|
|
break;
|
|
|
|
case VT_CARRAY:
|
|
|
|
free_embedded_arraydesc(tdesc->u.lpadesc);
|
|
|
|
CoTaskMemFree(tdesc->u.lpadesc);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-28 15:48:38 +02:00
|
|
|
static void free_embedded_elemdesc(ELEMDESC *edesc)
|
|
|
|
{
|
|
|
|
free_embedded_typedesc(&edesc->tdesc);
|
|
|
|
if(edesc->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
|
|
|
|
CoTaskMemFree(edesc->u.paramdesc.pparamdescex);
|
|
|
|
}
|
|
|
|
|
2003-04-26 04:11:41 +02:00
|
|
|
/* ITypeComp */
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeComp_Bind_Proxy(
|
|
|
|
ITypeComp* This,
|
2016-08-26 11:30:47 +02:00
|
|
|
LPOLESTR name,
|
2003-04-26 04:11:41 +02:00
|
|
|
ULONG lHashVal,
|
2016-08-26 11:30:47 +02:00
|
|
|
WORD flags,
|
|
|
|
ITypeInfo **ti,
|
|
|
|
DESCKIND *desckind,
|
|
|
|
BINDPTR *bindptr)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2016-08-26 11:30:47 +02:00
|
|
|
CLEANLOCALSTORAGE stg = { 0 };
|
|
|
|
ITypeComp *typecomp;
|
|
|
|
FUNCDESC *funcdesc;
|
|
|
|
VARDESC *vardesc;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %s, %#lx, %#x, %p, %p, %p.\n", This, debugstr_w(name), lHashVal, flags, ti,
|
2016-08-26 11:30:47 +02:00
|
|
|
desckind, bindptr);
|
|
|
|
|
|
|
|
*desckind = DESCKIND_NONE;
|
|
|
|
memset(bindptr, 0, sizeof(*bindptr));
|
|
|
|
|
|
|
|
hr = ITypeComp_RemoteBind_Proxy(This, name, lHashVal, flags, ti, desckind,
|
|
|
|
&funcdesc, &vardesc, &typecomp, &stg);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
{
|
|
|
|
switch (*desckind)
|
|
|
|
{
|
|
|
|
case DESCKIND_FUNCDESC:
|
|
|
|
bindptr->lpfuncdesc = funcdesc;
|
|
|
|
break;
|
|
|
|
case DESCKIND_VARDESC:
|
|
|
|
case DESCKIND_IMPLICITAPPOBJ:
|
|
|
|
bindptr->lpvardesc = vardesc;
|
|
|
|
break;
|
|
|
|
case DESCKIND_TYPECOMP:
|
|
|
|
bindptr->lptcomp = typecomp;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeComp_Bind_Stub(
|
|
|
|
ITypeComp* This,
|
2016-08-26 11:30:47 +02:00
|
|
|
LPOLESTR name,
|
2003-04-26 04:11:41 +02:00
|
|
|
ULONG lHashVal,
|
2016-08-26 11:30:47 +02:00
|
|
|
WORD flags,
|
|
|
|
ITypeInfo **ti,
|
|
|
|
DESCKIND *desckind,
|
|
|
|
FUNCDESC **funcdesc,
|
|
|
|
VARDESC **vardesc,
|
|
|
|
ITypeComp **typecomp,
|
|
|
|
CLEANLOCALSTORAGE *stg)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2016-08-26 11:30:47 +02:00
|
|
|
BINDPTR bindptr;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %s, %#lx, %#x, %p, %p, %p, %p, %p, %p.\n", This, debugstr_w(name),
|
2016-08-26 11:30:47 +02:00
|
|
|
lHashVal, flags, ti, desckind, funcdesc, vardesc, typecomp, stg);
|
|
|
|
|
|
|
|
memset(stg, 0, sizeof(*stg));
|
|
|
|
memset(&bindptr, 0, sizeof(bindptr));
|
|
|
|
|
|
|
|
*funcdesc = NULL;
|
|
|
|
*vardesc = NULL;
|
|
|
|
*typecomp = NULL;
|
|
|
|
*ti = NULL;
|
|
|
|
|
|
|
|
hr = ITypeComp_Bind(This, name, lHashVal, flags, ti, desckind, &bindptr);
|
|
|
|
if(hr != S_OK)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
switch (*desckind)
|
|
|
|
{
|
|
|
|
case DESCKIND_FUNCDESC:
|
|
|
|
*funcdesc = bindptr.lpfuncdesc;
|
|
|
|
stg->pInterface = (IUnknown*)*ti;
|
|
|
|
stg->pStorage = funcdesc;
|
|
|
|
stg->flags = CLS_FUNCDESC;
|
|
|
|
break;
|
|
|
|
case DESCKIND_VARDESC:
|
|
|
|
case DESCKIND_IMPLICITAPPOBJ:
|
|
|
|
*vardesc = bindptr.lpvardesc;
|
|
|
|
stg->pInterface = (IUnknown*)*ti;
|
|
|
|
stg->pStorage = vardesc;
|
|
|
|
stg->flags = CLS_VARDESC;
|
|
|
|
break;
|
|
|
|
case DESCKIND_TYPECOMP:
|
|
|
|
*typecomp = bindptr.lptcomp;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stg->pInterface)
|
|
|
|
IUnknown_AddRef(stg->pInterface);
|
|
|
|
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeComp_BindType_Proxy(
|
|
|
|
ITypeComp* This,
|
2016-08-29 14:38:56 +02:00
|
|
|
LPOLESTR name,
|
2003-04-26 04:11:41 +02:00
|
|
|
ULONG lHashVal,
|
2016-08-29 14:38:56 +02:00
|
|
|
ITypeInfo **ti,
|
|
|
|
ITypeComp **typecomp)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2016-08-29 14:38:56 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %s, %#lx, %p, %p.\n", This, debugstr_w(name), lHashVal, ti, typecomp);
|
2016-08-29 14:38:56 +02:00
|
|
|
|
|
|
|
hr = ITypeComp_RemoteBindType_Proxy(This, name, lHashVal, ti);
|
|
|
|
if (hr == S_OK)
|
|
|
|
ITypeInfo_GetTypeComp(*ti, typecomp);
|
|
|
|
else if (typecomp)
|
|
|
|
*typecomp = NULL;
|
|
|
|
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeComp_BindType_Stub(
|
|
|
|
ITypeComp* This,
|
2016-08-29 14:38:56 +02:00
|
|
|
LPOLESTR name,
|
2003-04-26 04:11:41 +02:00
|
|
|
ULONG lHashVal,
|
2016-08-29 14:38:56 +02:00
|
|
|
ITypeInfo **ti)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2016-08-29 14:38:56 +02:00
|
|
|
ITypeComp *typecomp = NULL;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %s, %#lx, %p.\n", This, debugstr_w(name), lHashVal, ti);
|
2016-08-29 14:38:56 +02:00
|
|
|
|
|
|
|
hr = ITypeComp_BindType(This, name, lHashVal, ti, &typecomp);
|
|
|
|
|
|
|
|
if (typecomp)
|
|
|
|
ITypeComp_Release(typecomp);
|
|
|
|
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ITypeInfo */
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeInfo_GetTypeAttr_Proxy(
|
|
|
|
ITypeInfo* This,
|
|
|
|
TYPEATTR** ppTypeAttr)
|
2006-04-28 15:42:43 +02:00
|
|
|
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2006-04-28 15:42:43 +02:00
|
|
|
CLEANLOCALSTORAGE stg;
|
|
|
|
TRACE("(%p, %p)\n", This, ppTypeAttr);
|
|
|
|
|
|
|
|
stg.flags = 0;
|
|
|
|
stg.pStorage = NULL;
|
|
|
|
stg.pInterface = NULL;
|
|
|
|
|
|
|
|
return ITypeInfo_RemoteGetTypeAttr_Proxy(This, ppTypeAttr, &stg);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeInfo_GetTypeAttr_Stub(
|
|
|
|
ITypeInfo* This,
|
|
|
|
LPTYPEATTR* ppTypeAttr,
|
|
|
|
CLEANLOCALSTORAGE* pDummy)
|
|
|
|
{
|
2006-04-28 15:42:43 +02:00
|
|
|
HRESULT hr;
|
|
|
|
TRACE("(%p, %p)\n", This, ppTypeAttr);
|
|
|
|
|
|
|
|
hr = ITypeInfo_GetTypeAttr(This, ppTypeAttr);
|
|
|
|
if(hr != S_OK)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
pDummy->flags = CLS_TYPEATTR;
|
|
|
|
ITypeInfo_AddRef(This);
|
|
|
|
pDummy->pInterface = (IUnknown*)This;
|
|
|
|
pDummy->pStorage = ppTypeAttr;
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeInfo_GetFuncDesc_Proxy(
|
|
|
|
ITypeInfo* This,
|
|
|
|
UINT index,
|
|
|
|
FUNCDESC** ppFuncDesc)
|
|
|
|
{
|
2006-04-28 15:48:38 +02:00
|
|
|
CLEANLOCALSTORAGE stg;
|
|
|
|
TRACE("(%p, %d, %p)\n", This, index, ppFuncDesc);
|
|
|
|
|
|
|
|
stg.flags = 0;
|
|
|
|
stg.pStorage = NULL;
|
|
|
|
stg.pInterface = NULL;
|
|
|
|
|
|
|
|
return ITypeInfo_RemoteGetFuncDesc_Proxy(This, index, ppFuncDesc, &stg);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeInfo_GetFuncDesc_Stub(
|
|
|
|
ITypeInfo* This,
|
|
|
|
UINT index,
|
|
|
|
LPFUNCDESC* ppFuncDesc,
|
|
|
|
CLEANLOCALSTORAGE* pDummy)
|
|
|
|
{
|
2006-04-28 15:48:38 +02:00
|
|
|
HRESULT hr;
|
|
|
|
TRACE("(%p, %d, %p)\n", This, index, ppFuncDesc);
|
|
|
|
|
|
|
|
hr = ITypeInfo_GetFuncDesc(This, index, ppFuncDesc);
|
|
|
|
if(hr != S_OK)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
pDummy->flags = CLS_FUNCDESC;
|
|
|
|
ITypeInfo_AddRef(This);
|
|
|
|
pDummy->pInterface = (IUnknown*)This;
|
|
|
|
pDummy->pStorage = ppFuncDesc;
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeInfo_GetVarDesc_Proxy(
|
|
|
|
ITypeInfo* This,
|
|
|
|
UINT index,
|
|
|
|
VARDESC** ppVarDesc)
|
|
|
|
{
|
2006-05-07 23:00:51 +02:00
|
|
|
CLEANLOCALSTORAGE stg;
|
|
|
|
TRACE("(%p, %d, %p)\n", This, index, ppVarDesc);
|
|
|
|
|
|
|
|
stg.flags = 0;
|
|
|
|
stg.pStorage = NULL;
|
|
|
|
stg.pInterface = NULL;
|
|
|
|
|
|
|
|
return ITypeInfo_RemoteGetVarDesc_Proxy(This, index, ppVarDesc, &stg);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeInfo_GetVarDesc_Stub(
|
|
|
|
ITypeInfo* This,
|
|
|
|
UINT index,
|
|
|
|
LPVARDESC* ppVarDesc,
|
|
|
|
CLEANLOCALSTORAGE* pDummy)
|
|
|
|
{
|
2006-05-07 23:00:51 +02:00
|
|
|
HRESULT hr;
|
|
|
|
TRACE("(%p, %d, %p)\n", This, index, ppVarDesc);
|
|
|
|
|
|
|
|
hr = ITypeInfo_GetVarDesc(This, index, ppVarDesc);
|
|
|
|
if(hr != S_OK)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
pDummy->flags = CLS_VARDESC;
|
|
|
|
ITypeInfo_AddRef(This);
|
|
|
|
pDummy->pInterface = (IUnknown*)This;
|
|
|
|
pDummy->pStorage = ppVarDesc;
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeInfo_GetNames_Proxy(
|
|
|
|
ITypeInfo* This,
|
|
|
|
MEMBERID memid,
|
|
|
|
BSTR* rgBstrNames,
|
|
|
|
UINT cMaxNames,
|
|
|
|
UINT* pcNames)
|
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %#lx, %p, %d, %p.\n", This, memid, rgBstrNames, cMaxNames, pcNames);
|
2011-02-18 02:04:56 +01:00
|
|
|
|
|
|
|
return ITypeInfo_RemoteGetNames_Proxy(This, memid, rgBstrNames, cMaxNames, pcNames);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeInfo_GetNames_Stub(
|
|
|
|
ITypeInfo* This,
|
|
|
|
MEMBERID memid,
|
|
|
|
BSTR* rgBstrNames,
|
|
|
|
UINT cMaxNames,
|
|
|
|
UINT* pcNames)
|
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %#lx, %p, %d, %p.\n", This, memid, rgBstrNames, cMaxNames, pcNames);
|
2011-02-18 02:04:56 +01:00
|
|
|
|
|
|
|
return ITypeInfo_GetNames(This, memid, rgBstrNames, cMaxNames, pcNames);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeInfo_GetIDsOfNames_Proxy(
|
|
|
|
ITypeInfo* This,
|
|
|
|
LPOLESTR* rgszNames,
|
|
|
|
UINT cNames,
|
|
|
|
MEMBERID* pMemId)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeInfo_GetIDsOfNames_Stub(
|
|
|
|
ITypeInfo* This)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeInfo_Invoke_Proxy(
|
|
|
|
ITypeInfo* This,
|
|
|
|
PVOID pvInstance,
|
|
|
|
MEMBERID memid,
|
|
|
|
WORD wFlags,
|
|
|
|
DISPPARAMS* pDispParams,
|
|
|
|
VARIANT* pVarResult,
|
|
|
|
EXCEPINFO* pExcepInfo,
|
|
|
|
UINT* puArgErr)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeInfo_Invoke_Stub(
|
|
|
|
ITypeInfo* This)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2011-02-09 14:10:32 +01:00
|
|
|
HRESULT CALLBACK ITypeInfo_GetDocumentation_Proxy(ITypeInfo *This, MEMBERID memid,
|
|
|
|
BSTR *name, BSTR *doc_string,
|
|
|
|
DWORD *help_context, BSTR *help_file)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2011-02-09 14:10:32 +01:00
|
|
|
DWORD dummy_help_context, flags = 0;
|
|
|
|
BSTR dummy_name, dummy_doc_string, dummy_help_file;
|
2006-04-28 15:50:11 +02:00
|
|
|
HRESULT hr;
|
2022-02-12 14:34:59 +01:00
|
|
|
|
|
|
|
TRACE("%p, %#lx, %p, %p, %p, %p.\n", This, memid, name, doc_string, help_context, help_file);
|
2006-04-28 15:50:11 +02:00
|
|
|
|
2011-02-09 14:10:32 +01:00
|
|
|
if(!name) name = &dummy_name;
|
|
|
|
else flags = 1;
|
2006-04-28 15:50:11 +02:00
|
|
|
|
2011-02-09 14:10:32 +01:00
|
|
|
if(!doc_string) doc_string = &dummy_doc_string;
|
|
|
|
else flags |= 2;
|
2006-04-28 15:50:11 +02:00
|
|
|
|
2011-02-09 14:10:32 +01:00
|
|
|
if(!help_context) help_context = &dummy_help_context;
|
|
|
|
else flags |= 4;
|
|
|
|
|
|
|
|
if(!help_file) help_file = &dummy_help_file;
|
|
|
|
else flags |= 8;
|
|
|
|
|
|
|
|
hr = ITypeInfo_RemoteGetDocumentation_Proxy(This, memid, flags, name, doc_string, help_context, help_file);
|
|
|
|
|
|
|
|
/* We don't need to free the dummy BSTRs since the stub ensures that these will be NULLs. */
|
2006-04-28 15:50:11 +02:00
|
|
|
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2011-02-09 14:10:32 +01:00
|
|
|
HRESULT __RPC_STUB ITypeInfo_GetDocumentation_Stub(ITypeInfo *This, MEMBERID memid,
|
|
|
|
DWORD flags, BSTR *name, BSTR *doc_string,
|
|
|
|
DWORD *help_context, BSTR *help_file)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %#lx, %#lx, %p, %p, %p, %p.\n", This, memid, flags, name, doc_string, help_context, help_file);
|
2011-02-09 14:10:32 +01:00
|
|
|
|
|
|
|
*name = *doc_string = *help_file = NULL;
|
|
|
|
*help_context = 0;
|
|
|
|
|
|
|
|
if(!(flags & 1)) name = NULL;
|
|
|
|
if(!(flags & 2)) doc_string = NULL;
|
|
|
|
if(!(flags & 4)) help_context = NULL;
|
|
|
|
if(!(flags & 8)) help_file = NULL;
|
|
|
|
|
|
|
|
return ITypeInfo_GetDocumentation(This, memid, name, doc_string, help_context, help_file);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2011-02-11 11:08:43 +01:00
|
|
|
HRESULT CALLBACK ITypeInfo_GetDllEntry_Proxy(ITypeInfo *This, MEMBERID memid,
|
|
|
|
INVOKEKIND invkind, BSTR *dll_name,
|
|
|
|
BSTR* name, WORD *ordinal)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2011-02-11 11:08:43 +01:00
|
|
|
DWORD flags = 0;
|
|
|
|
BSTR dummy_dll_name, dummy_name;
|
|
|
|
WORD dummy_ordinal;
|
|
|
|
HRESULT hr;
|
2022-02-12 14:34:59 +01:00
|
|
|
|
|
|
|
TRACE("%p, %#lx, %#x, %p, %p, %p.\n", This, memid, invkind, dll_name, name, ordinal);
|
2011-02-11 11:08:43 +01:00
|
|
|
|
|
|
|
if(!dll_name) dll_name = &dummy_dll_name;
|
|
|
|
else flags = 1;
|
|
|
|
|
|
|
|
if(!name) name = &dummy_name;
|
|
|
|
else flags |= 2;
|
|
|
|
|
|
|
|
if(!ordinal) ordinal = &dummy_ordinal;
|
|
|
|
else flags |= 4;
|
|
|
|
|
|
|
|
hr = ITypeInfo_RemoteGetDllEntry_Proxy(This, memid, invkind, flags, dll_name, name, ordinal);
|
|
|
|
|
|
|
|
/* We don't need to free the dummy BSTRs since the stub ensures that these will be NULLs. */
|
|
|
|
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2011-02-11 11:08:43 +01:00
|
|
|
HRESULT __RPC_STUB ITypeInfo_GetDllEntry_Stub(ITypeInfo *This, MEMBERID memid,
|
|
|
|
INVOKEKIND invkind, DWORD flags,
|
|
|
|
BSTR *dll_name, BSTR *name,
|
|
|
|
WORD *ordinal)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %#lx, %x, %p, %p, %p.\n", This, memid, invkind, dll_name, name, ordinal);
|
2011-02-11 11:08:43 +01:00
|
|
|
|
|
|
|
*dll_name = *name = NULL;
|
|
|
|
*ordinal = 0;
|
|
|
|
|
|
|
|
if(!(flags & 1)) dll_name = NULL;
|
|
|
|
if(!(flags & 2)) name = NULL;
|
|
|
|
if(!(flags & 4)) ordinal = NULL;
|
|
|
|
|
|
|
|
return ITypeInfo_GetDllEntry(This, memid, invkind, dll_name, name, ordinal);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeInfo_AddressOfMember_Proxy(
|
|
|
|
ITypeInfo* This,
|
|
|
|
MEMBERID memid,
|
|
|
|
INVOKEKIND invKind,
|
|
|
|
PVOID* ppv)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeInfo_AddressOfMember_Stub(
|
|
|
|
ITypeInfo* This)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeInfo_CreateInstance_Proxy(
|
|
|
|
ITypeInfo* This,
|
|
|
|
IUnknown* pUnkOuter,
|
|
|
|
REFIID riid,
|
|
|
|
PVOID* ppvObj)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeInfo_CreateInstance_Stub(
|
|
|
|
ITypeInfo* This,
|
|
|
|
REFIID riid,
|
|
|
|
IUnknown** ppvObj)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeInfo_GetContainingTypeLib_Proxy(
|
|
|
|
ITypeInfo* This,
|
|
|
|
ITypeLib** ppTLib,
|
|
|
|
UINT* pIndex)
|
|
|
|
{
|
2005-10-18 16:09:58 +02:00
|
|
|
ITypeLib *pTL;
|
|
|
|
UINT index;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %p)\n", This, ppTLib, pIndex );
|
|
|
|
|
|
|
|
hr = ITypeInfo_RemoteGetContainingTypeLib_Proxy(This, &pTL, &index);
|
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
if(pIndex)
|
|
|
|
*pIndex = index;
|
|
|
|
|
|
|
|
if(ppTLib)
|
|
|
|
*ppTLib = pTL;
|
|
|
|
else
|
|
|
|
ITypeLib_Release(pTL);
|
|
|
|
}
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeInfo_GetContainingTypeLib_Stub(
|
|
|
|
ITypeInfo* This,
|
|
|
|
ITypeLib** ppTLib,
|
|
|
|
UINT* pIndex)
|
|
|
|
{
|
2005-10-18 16:09:58 +02:00
|
|
|
TRACE("(%p, %p, %p)\n", This, ppTLib, pIndex );
|
|
|
|
return ITypeInfo_GetContainingTypeLib(This, ppTLib, pIndex);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CALLBACK ITypeInfo_ReleaseTypeAttr_Proxy(
|
|
|
|
ITypeInfo* This,
|
|
|
|
TYPEATTR* pTypeAttr)
|
|
|
|
{
|
2006-04-28 15:42:43 +02:00
|
|
|
TRACE("(%p, %p)\n", This, pTypeAttr);
|
|
|
|
free_embedded_typedesc(&pTypeAttr->tdescAlias);
|
|
|
|
CoTaskMemFree(pTypeAttr);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeInfo_ReleaseTypeAttr_Stub(
|
|
|
|
ITypeInfo* This)
|
|
|
|
{
|
2006-04-28 15:42:43 +02:00
|
|
|
TRACE("nothing to do\n");
|
|
|
|
return S_OK;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CALLBACK ITypeInfo_ReleaseFuncDesc_Proxy(
|
|
|
|
ITypeInfo* This,
|
|
|
|
FUNCDESC* pFuncDesc)
|
|
|
|
{
|
2006-04-28 15:48:38 +02:00
|
|
|
SHORT param;
|
|
|
|
TRACE("(%p, %p)\n", This, pFuncDesc);
|
|
|
|
|
|
|
|
for(param = 0; param < pFuncDesc->cParams; param++)
|
|
|
|
free_embedded_elemdesc(pFuncDesc->lprgelemdescParam + param);
|
|
|
|
if(param)
|
|
|
|
CoTaskMemFree(pFuncDesc->lprgelemdescParam);
|
|
|
|
|
|
|
|
free_embedded_elemdesc(&pFuncDesc->elemdescFunc);
|
|
|
|
|
|
|
|
if(pFuncDesc->cScodes != 0 && pFuncDesc->cScodes != -1)
|
|
|
|
CoTaskMemFree(pFuncDesc->lprgscode);
|
|
|
|
|
|
|
|
CoTaskMemFree(pFuncDesc);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeInfo_ReleaseFuncDesc_Stub(
|
|
|
|
ITypeInfo* This)
|
|
|
|
{
|
2006-04-28 15:48:38 +02:00
|
|
|
TRACE("nothing to do\n");
|
|
|
|
return S_OK;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CALLBACK ITypeInfo_ReleaseVarDesc_Proxy(
|
|
|
|
ITypeInfo* This,
|
|
|
|
VARDESC* pVarDesc)
|
|
|
|
{
|
2006-05-07 23:00:51 +02:00
|
|
|
TRACE("(%p, %p)\n", This, pVarDesc);
|
|
|
|
|
2006-10-07 03:05:08 +02:00
|
|
|
CoTaskMemFree(pVarDesc->lpstrSchema);
|
2006-05-07 23:00:51 +02:00
|
|
|
|
|
|
|
if(pVarDesc->varkind == VAR_CONST)
|
|
|
|
CoTaskMemFree(pVarDesc->u.lpvarValue);
|
|
|
|
|
|
|
|
free_embedded_elemdesc(&pVarDesc->elemdescVar);
|
|
|
|
CoTaskMemFree(pVarDesc);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeInfo_ReleaseVarDesc_Stub(
|
|
|
|
ITypeInfo* This)
|
|
|
|
{
|
2006-05-07 23:00:51 +02:00
|
|
|
TRACE("nothing to do\n");
|
|
|
|
return S_OK;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ITypeInfo2 */
|
|
|
|
|
2011-02-11 11:19:32 +01:00
|
|
|
HRESULT CALLBACK ITypeInfo2_GetDocumentation2_Proxy(ITypeInfo2 *This, MEMBERID memid,
|
|
|
|
LCID lcid, BSTR *help_string,
|
|
|
|
DWORD *help_context, BSTR *help_dll)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2011-02-11 11:19:32 +01:00
|
|
|
DWORD dummy_help_context, flags = 0;
|
|
|
|
BSTR dummy_help_string, dummy_help_dll;
|
|
|
|
HRESULT hr;
|
2022-02-12 14:34:59 +01:00
|
|
|
|
|
|
|
TRACE("%p, %#lx, %#lx, %p, %p, %p.\n", This, memid, lcid, help_string, help_context, help_dll);
|
2011-02-11 11:19:32 +01:00
|
|
|
|
|
|
|
if(!help_string) help_string = &dummy_help_string;
|
|
|
|
else flags = 1;
|
|
|
|
|
|
|
|
if(!help_context) help_context = &dummy_help_context;
|
|
|
|
else flags |= 2;
|
|
|
|
|
|
|
|
if(!help_dll) help_dll = &dummy_help_dll;
|
|
|
|
else flags |= 4;
|
|
|
|
|
|
|
|
hr = ITypeInfo2_RemoteGetDocumentation2_Proxy(This, memid, lcid, flags, help_string, help_context, help_dll);
|
|
|
|
|
|
|
|
/* We don't need to free the dummy BSTRs since the stub ensures that these will be NULLs. */
|
|
|
|
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2011-02-11 11:19:32 +01:00
|
|
|
HRESULT __RPC_STUB ITypeInfo2_GetDocumentation2_Stub(ITypeInfo2 *This, MEMBERID memid,
|
|
|
|
LCID lcid, DWORD flags,
|
|
|
|
BSTR *help_string, DWORD *help_context,
|
|
|
|
BSTR *help_dll)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %#lx, %#lx, %#lx, %p, %p, %p.\n", This, memid, lcid, flags, help_string, help_context, help_dll);
|
2011-02-11 11:19:32 +01:00
|
|
|
|
|
|
|
*help_string = *help_dll = NULL;
|
|
|
|
*help_context = 0;
|
|
|
|
|
|
|
|
if(!(flags & 1)) help_string = NULL;
|
|
|
|
if(!(flags & 2)) help_context = NULL;
|
|
|
|
if(!(flags & 4)) help_dll = NULL;
|
|
|
|
|
|
|
|
return ITypeInfo2_GetDocumentation2(This, memid, lcid, help_string, help_context, help_dll);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ITypeLib */
|
|
|
|
|
|
|
|
UINT CALLBACK ITypeLib_GetTypeInfoCount_Proxy(
|
|
|
|
ITypeLib* This)
|
|
|
|
{
|
2005-10-20 13:35:30 +02:00
|
|
|
UINT count = 0;
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
ITypeLib_RemoteGetTypeInfoCount_Proxy(This, &count);
|
|
|
|
|
|
|
|
return count;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeLib_GetTypeInfoCount_Stub(
|
|
|
|
ITypeLib* This,
|
|
|
|
UINT* pcTInfo)
|
|
|
|
{
|
2005-10-20 13:35:30 +02:00
|
|
|
TRACE("(%p, %p)\n", This, pcTInfo);
|
|
|
|
*pcTInfo = ITypeLib_GetTypeInfoCount(This);
|
|
|
|
return S_OK;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeLib_GetLibAttr_Proxy(
|
|
|
|
ITypeLib* This,
|
|
|
|
TLIBATTR** ppTLibAttr)
|
|
|
|
{
|
2005-10-20 13:35:30 +02:00
|
|
|
CLEANLOCALSTORAGE stg;
|
|
|
|
TRACE("(%p, %p)\n", This, ppTLibAttr);
|
2006-04-19 15:28:59 +02:00
|
|
|
|
|
|
|
stg.flags = 0;
|
|
|
|
stg.pStorage = NULL;
|
|
|
|
stg.pInterface = NULL;
|
|
|
|
|
2005-10-20 13:35:30 +02:00
|
|
|
return ITypeLib_RemoteGetLibAttr_Proxy(This, ppTLibAttr, &stg);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeLib_GetLibAttr_Stub(
|
|
|
|
ITypeLib* This,
|
|
|
|
LPTLIBATTR* ppTLibAttr,
|
|
|
|
CLEANLOCALSTORAGE* pDummy)
|
|
|
|
{
|
2006-04-19 15:28:59 +02:00
|
|
|
HRESULT hr;
|
2005-10-20 13:35:30 +02:00
|
|
|
TRACE("(%p, %p)\n", This, ppTLibAttr);
|
2006-04-19 15:28:59 +02:00
|
|
|
|
|
|
|
hr = ITypeLib_GetLibAttr(This, ppTLibAttr);
|
|
|
|
if(hr != S_OK)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
pDummy->flags = CLS_LIBATTR;
|
|
|
|
ITypeLib_AddRef(This);
|
|
|
|
pDummy->pInterface = (IUnknown*)This;
|
|
|
|
pDummy->pStorage = ppTLibAttr;
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2011-02-11 11:24:51 +01:00
|
|
|
HRESULT CALLBACK ITypeLib_GetDocumentation_Proxy(ITypeLib *This, INT index, BSTR *name,
|
|
|
|
BSTR *doc_string, DWORD *help_context,
|
|
|
|
BSTR *help_file)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2011-02-11 11:24:51 +01:00
|
|
|
DWORD dummy_help_context, flags = 0;
|
|
|
|
BSTR dummy_name, dummy_doc_string, dummy_help_file;
|
|
|
|
HRESULT hr;
|
|
|
|
TRACE("(%p, %d, %p, %p, %p, %p)\n", This, index, name, doc_string, help_context, help_file);
|
|
|
|
|
|
|
|
if(!name) name = &dummy_name;
|
|
|
|
else flags = 1;
|
|
|
|
|
|
|
|
if(!doc_string) doc_string = &dummy_doc_string;
|
|
|
|
else flags |= 2;
|
|
|
|
|
|
|
|
if(!help_context) help_context = &dummy_help_context;
|
|
|
|
else flags |= 4;
|
|
|
|
|
|
|
|
if(!help_file) help_file = &dummy_help_file;
|
|
|
|
else flags |= 8;
|
|
|
|
|
|
|
|
hr = ITypeLib_RemoteGetDocumentation_Proxy(This, index, flags, name, doc_string, help_context, help_file);
|
|
|
|
|
|
|
|
/* We don't need to free the dummy BSTRs since the stub ensures that these will be NULLs. */
|
|
|
|
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2011-02-11 11:24:51 +01:00
|
|
|
HRESULT __RPC_STUB ITypeLib_GetDocumentation_Stub(ITypeLib *This, INT index, DWORD flags,
|
|
|
|
BSTR *name, BSTR *doc_string,
|
|
|
|
DWORD *help_context, BSTR *help_file)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %d, %#lx, %p, %p, %p, %p.\n", This, index, flags, name, doc_string, help_context, help_file);
|
2011-02-11 11:24:51 +01:00
|
|
|
|
|
|
|
*name = *doc_string = *help_file = NULL;
|
|
|
|
*help_context = 0;
|
|
|
|
|
|
|
|
if(!(flags & 1)) name = NULL;
|
|
|
|
if(!(flags & 2)) doc_string = NULL;
|
|
|
|
if(!(flags & 4)) help_context = NULL;
|
|
|
|
if(!(flags & 8)) help_file = NULL;
|
|
|
|
|
|
|
|
return ITypeLib_GetDocumentation(This, index, name, doc_string, help_context, help_file);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeLib_IsName_Proxy(
|
|
|
|
ITypeLib* This,
|
|
|
|
LPOLESTR szNameBuf,
|
|
|
|
ULONG lHashVal,
|
|
|
|
BOOL* pfName)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeLib_IsName_Stub(
|
|
|
|
ITypeLib* This,
|
|
|
|
LPOLESTR szNameBuf,
|
|
|
|
ULONG lHashVal,
|
|
|
|
BOOL* pfName,
|
|
|
|
BSTR* pBstrLibName)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeLib_FindName_Proxy(
|
|
|
|
ITypeLib* This,
|
|
|
|
LPOLESTR szNameBuf,
|
|
|
|
ULONG lHashVal,
|
|
|
|
ITypeInfo** ppTInfo,
|
|
|
|
MEMBERID* rgMemId,
|
|
|
|
USHORT* pcFound)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeLib_FindName_Stub(
|
|
|
|
ITypeLib* This,
|
|
|
|
LPOLESTR szNameBuf,
|
|
|
|
ULONG lHashVal,
|
|
|
|
ITypeInfo** ppTInfo,
|
|
|
|
MEMBERID* rgMemId,
|
|
|
|
USHORT* pcFound,
|
|
|
|
BSTR* pBstrLibName)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CALLBACK ITypeLib_ReleaseTLibAttr_Proxy(
|
|
|
|
ITypeLib* This,
|
|
|
|
TLIBATTR* pTLibAttr)
|
|
|
|
{
|
2005-10-20 13:35:30 +02:00
|
|
|
TRACE("(%p, %p)\n", This, pTLibAttr);
|
|
|
|
CoTaskMemFree(pTLibAttr);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeLib_ReleaseTLibAttr_Stub(
|
|
|
|
ITypeLib* This)
|
|
|
|
{
|
2005-10-20 13:35:30 +02:00
|
|
|
TRACE("nothing to do\n");
|
|
|
|
return S_OK;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ITypeLib2 */
|
|
|
|
|
|
|
|
HRESULT CALLBACK ITypeLib2_GetLibStatistics_Proxy(
|
|
|
|
ITypeLib2* This,
|
|
|
|
ULONG* pcUniqueNames,
|
|
|
|
ULONG* pcchUniqueNames)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB ITypeLib2_GetLibStatistics_Stub(
|
|
|
|
ITypeLib2* This,
|
|
|
|
ULONG* pcUniqueNames,
|
|
|
|
ULONG* pcchUniqueNames)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2011-02-11 11:29:41 +01:00
|
|
|
HRESULT CALLBACK ITypeLib2_GetDocumentation2_Proxy(ITypeLib2 *This, INT index,
|
|
|
|
LCID lcid, BSTR *help_string,
|
|
|
|
DWORD *help_context, BSTR *help_dll)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2011-02-11 11:29:41 +01:00
|
|
|
DWORD dummy_help_context, flags = 0;
|
|
|
|
BSTR dummy_help_string, dummy_help_dll;
|
|
|
|
HRESULT hr;
|
2022-02-12 14:34:59 +01:00
|
|
|
|
|
|
|
TRACE("%p, %d, %#lx, %p, %p, %p.\n", This, index, lcid, help_string, help_context, help_dll);
|
2011-02-11 11:29:41 +01:00
|
|
|
|
|
|
|
if(!help_string) help_string = &dummy_help_string;
|
|
|
|
else flags = 1;
|
|
|
|
|
|
|
|
if(!help_context) help_context = &dummy_help_context;
|
|
|
|
else flags |= 2;
|
|
|
|
|
|
|
|
if(!help_dll) help_dll = &dummy_help_dll;
|
|
|
|
else flags |= 4;
|
|
|
|
|
|
|
|
hr = ITypeLib2_RemoteGetDocumentation2_Proxy(This, index, lcid, flags, help_string, help_context, help_dll);
|
|
|
|
|
|
|
|
/* We don't need to free the dummy BSTRs since the stub ensures that these will be NULLs. */
|
|
|
|
|
|
|
|
return hr;
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
|
|
|
|
2011-02-11 11:29:41 +01:00
|
|
|
HRESULT __RPC_STUB ITypeLib2_GetDocumentation2_Stub(ITypeLib2 *This, INT index, LCID lcid,
|
|
|
|
DWORD flags, BSTR *help_string,
|
|
|
|
DWORD *help_context, BSTR *help_dll)
|
2003-04-26 04:11:41 +02:00
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %d, %#lx, %#lx, %p, %p, %p.\n", This, index, lcid, flags, help_string, help_context, help_dll);
|
2011-02-11 11:29:41 +01:00
|
|
|
|
|
|
|
*help_string = *help_dll = NULL;
|
|
|
|
*help_context = 0;
|
|
|
|
|
|
|
|
if(!(flags & 1)) help_string = NULL;
|
|
|
|
if(!(flags & 2)) help_context = NULL;
|
|
|
|
if(!(flags & 4)) help_dll = NULL;
|
|
|
|
|
|
|
|
return ITypeLib2_GetDocumentation2(This, index, lcid, help_string, help_context, help_dll);
|
2003-04-26 04:11:41 +02:00
|
|
|
}
|
2007-10-24 05:15:02 +02:00
|
|
|
|
|
|
|
HRESULT CALLBACK IPropertyBag_Read_Proxy(
|
|
|
|
IPropertyBag* This,
|
|
|
|
LPCOLESTR pszPropName,
|
|
|
|
VARIANT *pVar,
|
|
|
|
IErrorLog *pErrorLog)
|
|
|
|
{
|
2009-01-04 00:20:05 +01:00
|
|
|
IUnknown *pUnk = NULL;
|
|
|
|
TRACE("(%p, %s, %p, %p)\n", This, debugstr_w(pszPropName), pVar, pErrorLog);
|
|
|
|
|
|
|
|
if(!pVar)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
if(V_VT(pVar) & (VT_BYREF | VT_ARRAY | VT_VECTOR))
|
|
|
|
{
|
|
|
|
FIXME("Variant type %x is byref, array or vector. Not implemented.\n", V_VT(pVar));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(V_VT(pVar))
|
|
|
|
{
|
|
|
|
case VT_DISPATCH:
|
|
|
|
pUnk = (IUnknown*)V_DISPATCH(pVar);
|
|
|
|
break;
|
|
|
|
case VT_UNKNOWN:
|
|
|
|
pUnk = V_UNKNOWN(pVar);
|
|
|
|
break;
|
|
|
|
case VT_SAFEARRAY:
|
|
|
|
FIXME("Safearray support not yet implemented.\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
default:
|
2009-04-04 18:15:16 +02:00
|
|
|
FIXME("Unknown V_VT %d - support not yet implemented.\n", V_VT(pVar));
|
|
|
|
return E_NOTIMPL;
|
2009-01-04 00:20:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return IPropertyBag_RemoteRead_Proxy(This, pszPropName, pVar, pErrorLog,
|
|
|
|
V_VT(pVar), pUnk);
|
2007-10-24 05:15:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB IPropertyBag_Read_Stub(
|
|
|
|
IPropertyBag* This,
|
|
|
|
LPCOLESTR pszPropName,
|
|
|
|
VARIANT *pVar,
|
|
|
|
IErrorLog *pErrorLog,
|
|
|
|
DWORD varType,
|
|
|
|
IUnknown *pUnkObj)
|
|
|
|
{
|
2009-01-04 00:20:05 +01:00
|
|
|
IDispatch *disp;
|
|
|
|
HRESULT hr;
|
2022-02-12 14:34:59 +01:00
|
|
|
|
|
|
|
TRACE("%p, %s, %p, %p, %lx, %p.\n", This, debugstr_w(pszPropName), pVar,
|
2009-01-04 00:20:05 +01:00
|
|
|
pErrorLog, varType, pUnkObj);
|
|
|
|
|
|
|
|
if(varType & (VT_BYREF | VT_ARRAY | VT_VECTOR))
|
|
|
|
{
|
|
|
|
FIXME("Variant type %x is byref, array or vector. Not implemented.\n", V_VT(pVar));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
V_VT(pVar) = varType;
|
|
|
|
switch(varType)
|
|
|
|
{
|
|
|
|
case VT_DISPATCH:
|
|
|
|
hr = IUnknown_QueryInterface(pUnkObj, &IID_IDispatch, (LPVOID*)&disp);
|
|
|
|
if(FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
IUnknown_Release(pUnkObj);
|
|
|
|
V_DISPATCH(pVar) = disp;
|
|
|
|
break;
|
|
|
|
case VT_UNKNOWN:
|
|
|
|
V_UNKNOWN(pVar) = pUnkObj;
|
|
|
|
break;
|
|
|
|
case VT_BSTR:
|
2020-11-28 23:07:23 +01:00
|
|
|
V_BSTR(pVar) = SysAllocString(L"");
|
2009-01-04 00:20:05 +01:00
|
|
|
break;
|
|
|
|
case VT_SAFEARRAY:
|
|
|
|
FIXME("Safearray support not yet implemented.\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
hr = IPropertyBag_Read(This, pszPropName, pVar, pErrorLog);
|
|
|
|
if(FAILED(hr))
|
|
|
|
VariantClear(pVar);
|
|
|
|
|
|
|
|
return hr;
|
2007-10-24 05:15:02 +02:00
|
|
|
}
|
2008-09-02 18:02:04 +02:00
|
|
|
|
|
|
|
/* call_as/local stubs for ocidl.idl */
|
|
|
|
|
|
|
|
HRESULT CALLBACK IClassFactory2_CreateInstanceLic_Proxy(
|
|
|
|
IClassFactory2* This,
|
|
|
|
IUnknown *pUnkOuter,
|
|
|
|
IUnknown *pUnkReserved,
|
|
|
|
REFIID riid,
|
|
|
|
BSTR bstrKey,
|
|
|
|
PVOID *ppvObj)
|
|
|
|
{
|
2013-06-06 06:13:13 +02:00
|
|
|
TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppvObj);
|
|
|
|
|
|
|
|
*ppvObj = NULL;
|
|
|
|
|
|
|
|
if (pUnkOuter)
|
|
|
|
{
|
|
|
|
ERR("aggregation is not allowed on remote objects\n");
|
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
}
|
|
|
|
|
|
|
|
return IClassFactory2_RemoteCreateInstanceLic_Proxy(This, riid, bstrKey, (IUnknown**)ppvObj);
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB IClassFactory2_CreateInstanceLic_Stub(
|
|
|
|
IClassFactory2* This,
|
|
|
|
REFIID riid,
|
|
|
|
BSTR bstrKey,
|
|
|
|
IUnknown **ppvObj)
|
|
|
|
{
|
2013-06-06 06:13:13 +02:00
|
|
|
TRACE("(%s, %p)\n", debugstr_guid(riid), ppvObj);
|
|
|
|
return IClassFactory2_CreateInstanceLic(This, NULL, NULL, riid, bstrKey, (void**)ppvObj);
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK IEnumConnections_Next_Proxy(
|
|
|
|
IEnumConnections* This,
|
|
|
|
ULONG cConnections,
|
|
|
|
LPCONNECTDATA rgcd,
|
|
|
|
ULONG *pcFetched)
|
|
|
|
{
|
2015-05-07 10:05:26 +02:00
|
|
|
ULONG fetched;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%lu, %p, %p.\n", cConnections, rgcd, pcFetched);
|
2015-05-07 10:05:26 +02:00
|
|
|
|
|
|
|
if (!pcFetched)
|
|
|
|
pcFetched = &fetched;
|
|
|
|
|
|
|
|
return IEnumConnections_RemoteNext_Proxy(This, cConnections, rgcd, pcFetched);
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB IEnumConnections_Next_Stub(
|
|
|
|
IEnumConnections* This,
|
|
|
|
ULONG cConnections,
|
|
|
|
LPCONNECTDATA rgcd,
|
|
|
|
ULONG *pcFetched)
|
|
|
|
{
|
2015-05-07 10:05:26 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%lu, %p, %p.\n", cConnections, rgcd, pcFetched);
|
2015-05-07 10:05:26 +02:00
|
|
|
|
|
|
|
*pcFetched = 0;
|
|
|
|
hr = IEnumConnections_Next(This, cConnections, rgcd, pcFetched);
|
|
|
|
if (hr == S_OK)
|
|
|
|
*pcFetched = cConnections;
|
|
|
|
|
|
|
|
return hr;
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK IEnumConnectionPoints_Next_Proxy(
|
|
|
|
IEnumConnectionPoints* This,
|
|
|
|
ULONG cConnections,
|
2015-05-15 13:18:35 +02:00
|
|
|
IConnectionPoint **ppCP,
|
2008-09-02 18:02:04 +02:00
|
|
|
ULONG *pcFetched)
|
|
|
|
{
|
2015-05-15 13:18:35 +02:00
|
|
|
ULONG fetched;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%lu, %p %p.\n", cConnections, ppCP, pcFetched);
|
2015-05-15 13:18:35 +02:00
|
|
|
|
|
|
|
if (!pcFetched)
|
|
|
|
pcFetched = &fetched;
|
|
|
|
|
|
|
|
return IEnumConnectionPoints_RemoteNext_Proxy(This, cConnections, ppCP, pcFetched);
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB IEnumConnectionPoints_Next_Stub(
|
|
|
|
IEnumConnectionPoints* This,
|
|
|
|
ULONG cConnections,
|
2015-05-15 13:18:35 +02:00
|
|
|
IConnectionPoint **ppCP,
|
2008-09-02 18:02:04 +02:00
|
|
|
ULONG *pcFetched)
|
|
|
|
{
|
2015-05-15 13:18:35 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%lu, %p, %p.\n", cConnections, ppCP, pcFetched);
|
2015-05-15 13:18:35 +02:00
|
|
|
|
|
|
|
*pcFetched = 0;
|
|
|
|
hr = IEnumConnectionPoints_Next(This, cConnections, ppCP, pcFetched);
|
|
|
|
if (hr == S_OK)
|
|
|
|
*pcFetched = cConnections;
|
|
|
|
|
|
|
|
return hr;
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK IPersistMemory_Load_Proxy(
|
|
|
|
IPersistMemory* This,
|
|
|
|
LPVOID pMem,
|
|
|
|
ULONG cbSize)
|
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %lu.\n", pMem, cbSize);
|
2015-05-20 08:13:37 +02:00
|
|
|
|
|
|
|
if (!pMem)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
return IPersistMemory_RemoteLoad_Proxy(This, pMem, cbSize);
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB IPersistMemory_Load_Stub(
|
|
|
|
IPersistMemory* This,
|
|
|
|
BYTE *pMem,
|
|
|
|
ULONG cbSize)
|
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %lu.\n", pMem, cbSize);
|
2015-05-20 08:13:37 +02:00
|
|
|
return IPersistMemory_Load(This, pMem, cbSize);
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK IPersistMemory_Save_Proxy(
|
|
|
|
IPersistMemory* This,
|
|
|
|
LPVOID pMem,
|
|
|
|
BOOL fClearDirty,
|
|
|
|
ULONG cbSize)
|
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %d, %lu.\n", pMem, fClearDirty, cbSize);
|
2015-05-20 08:13:37 +02:00
|
|
|
|
|
|
|
if (!pMem)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
return IPersistMemory_RemoteSave_Proxy(This, pMem, fClearDirty, cbSize);
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB IPersistMemory_Save_Stub(
|
|
|
|
IPersistMemory* This,
|
|
|
|
BYTE *pMem,
|
|
|
|
BOOL fClearDirty,
|
|
|
|
ULONG cbSize)
|
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %d, %lu.\n", pMem, fClearDirty, cbSize);
|
2015-05-20 08:13:37 +02:00
|
|
|
return IPersistMemory_Save(This, pMem, fClearDirty, cbSize);
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CALLBACK IAdviseSinkEx_OnViewStatusChange_Proxy(
|
|
|
|
IAdviseSinkEx* This,
|
|
|
|
DWORD dwViewStatus)
|
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %#lx.\n", This, dwViewStatus);
|
2015-05-29 11:31:30 +02:00
|
|
|
IAdviseSinkEx_RemoteOnViewStatusChange_Proxy(This, dwViewStatus);
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB IAdviseSinkEx_OnViewStatusChange_Stub(
|
|
|
|
IAdviseSinkEx* This,
|
|
|
|
DWORD dwViewStatus)
|
|
|
|
{
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%p, %#lx.\n", This, dwViewStatus);
|
2015-05-29 11:31:30 +02:00
|
|
|
IAdviseSinkEx_OnViewStatusChange(This, dwViewStatus);
|
|
|
|
return S_OK;
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK IEnumOleUndoUnits_Next_Proxy(
|
|
|
|
IEnumOleUndoUnits* This,
|
|
|
|
ULONG cElt,
|
|
|
|
IOleUndoUnit **rgElt,
|
|
|
|
ULONG *pcEltFetched)
|
|
|
|
{
|
2015-05-29 11:31:30 +02:00
|
|
|
ULONG fetched;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%lu, %p %p.\n", cElt, rgElt, pcEltFetched);
|
2015-05-29 11:31:30 +02:00
|
|
|
|
|
|
|
if (!pcEltFetched)
|
|
|
|
pcEltFetched = &fetched;
|
|
|
|
|
|
|
|
return IEnumOleUndoUnits_RemoteNext_Proxy(This, cElt, rgElt, pcEltFetched);
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB IEnumOleUndoUnits_Next_Stub(
|
|
|
|
IEnumOleUndoUnits* This,
|
|
|
|
ULONG cElt,
|
|
|
|
IOleUndoUnit **rgElt,
|
|
|
|
ULONG *pcEltFetched)
|
|
|
|
{
|
2015-05-29 11:31:30 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-12 14:34:59 +01:00
|
|
|
TRACE("%lu, %p, %p.\n", cElt, rgElt, pcEltFetched);
|
2015-05-29 11:31:30 +02:00
|
|
|
|
|
|
|
*pcEltFetched = 0;
|
|
|
|
hr = IEnumOleUndoUnits_Next(This, cElt, rgElt, pcEltFetched);
|
|
|
|
if (hr == S_OK)
|
|
|
|
*pcEltFetched = cElt;
|
|
|
|
|
|
|
|
return hr;
|
2008-09-02 18:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT CALLBACK IQuickActivate_QuickActivate_Proxy(
|
|
|
|
IQuickActivate* This,
|
|
|
|
QACONTAINER *pQaContainer,
|
|
|
|
QACONTROL *pQaControl)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT __RPC_STUB IQuickActivate_QuickActivate_Stub(
|
|
|
|
IQuickActivate* This,
|
|
|
|
QACONTAINER *pQaContainer,
|
|
|
|
QACONTROL *pQaControl)
|
|
|
|
{
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|