2 * Misc marshalling routines
4 * Copyright 2002 Ove Kaaven
5 * Copyright 2003 Mike Hearn
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(ole);
42 #define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
43 #define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
44 #define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
45 #define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
47 /* FIXME: not supposed to be here */
49 const CLSID CLSID_PSDispatch = {
50 0x20420, 0, 0, {0xC0, 0, 0, 0, 0, 0, 0, 0x46}
53 static CStdPSFactoryBuffer PSFactoryBuffer;
55 CSTDSTUBBUFFERRELEASE(&PSFactoryBuffer)
57 extern const ExtendedProxyFileInfo oaidl_ProxyFileInfo;
59 const ProxyFileInfo* OLEAUT32_ProxyFileList[] = {
64 HRESULT OLEAUTPS_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
66 return NdrDllGetClassObject(rclsid, riid, ppv, OLEAUT32_ProxyFileList,
67 &CLSID_PSDispatch, &PSFactoryBuffer);
70 static void dump_user_flags(unsigned long *pFlags)
72 if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION)
73 TRACE("MAKELONG(NDR_LOCAL_REPRESENTATION, ");
75 TRACE("MAKELONG(0x%04x, ", HIWORD(*pFlags));
76 switch (LOWORD(*pFlags))
78 case MSHCTX_LOCAL: TRACE("MSHCTX_LOCAL)"); break;
79 case MSHCTX_NOSHAREDMEM: TRACE("MSHCTX_NOSHAREDMEM)"); break;
80 case MSHCTX_DIFFERENTMACHINE: TRACE("MSHCTX_DIFFERENTMACHINE)"); break;
81 case MSHCTX_INPROC: TRACE("MSHCTX_INPROC)"); break;
82 default: TRACE("%d)", LOWORD(*pFlags));
86 /* CLEANLOCALSTORAGE */
88 #define CLS_FUNCDESC 'f'
89 #define CLS_LIBATTR 'l'
90 #define CLS_TYPEATTR 't'
91 #define CLS_VARDESC 'v'
93 unsigned long WINAPI CLEANLOCALSTORAGE_UserSize(unsigned long *pFlags, unsigned long Start, CLEANLOCALSTORAGE *pstg)
95 ALIGN_LENGTH(Start, 3);
96 return Start + sizeof(DWORD);
99 unsigned char * WINAPI CLEANLOCALSTORAGE_UserMarshal(unsigned long *pFlags, unsigned char *Buffer, CLEANLOCALSTORAGE *pstg)
101 ALIGN_POINTER(Buffer, 3);
102 *(DWORD*)Buffer = pstg->flags;
106 ITypeLib_ReleaseTLibAttr((ITypeLib*)pstg->pInterface, *(TLIBATTR**)pstg->pStorage);
109 ITypeInfo_ReleaseTypeAttr((ITypeInfo*)pstg->pInterface, *(TYPEATTR**)pstg->pStorage);
112 ITypeInfo_ReleaseFuncDesc((ITypeInfo*)pstg->pInterface, *(FUNCDESC**)pstg->pStorage);
115 ITypeInfo_ReleaseVarDesc((ITypeInfo*)pstg->pInterface, *(VARDESC**)pstg->pStorage);
119 ERR("Unknown type %lx\n", pstg->flags);
122 *(VOID**)pstg->pStorage = NULL;
123 IUnknown_Release(pstg->pInterface);
124 pstg->pInterface = NULL;
126 return Buffer + sizeof(DWORD);
129 unsigned char * WINAPI CLEANLOCALSTORAGE_UserUnmarshal(unsigned long *pFlags, unsigned char *Buffer, CLEANLOCALSTORAGE *pstr)
131 ALIGN_POINTER(Buffer, 3);
132 pstr->flags = *(DWORD*)Buffer;
133 return Buffer + sizeof(DWORD);
136 void WINAPI CLEANLOCALSTORAGE_UserFree(unsigned long *pFlags, CLEANLOCALSTORAGE *pstr)
145 DWORD len; /* No. of chars not including trailing '\0' */
146 DWORD byte_len; /* len * 2 or 0xffffffff if len == 0 */
147 DWORD len2; /* == len */
150 unsigned long WINAPI BSTR_UserSize(unsigned long *pFlags, unsigned long Start, BSTR *pstr)
152 TRACE("(%lx,%ld,%p) => %p\n", *pFlags, Start, pstr, *pstr);
153 if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr));
154 ALIGN_LENGTH(Start, 3);
155 Start += sizeof(bstr_wire_t) + ((SysStringByteLen(*pstr) + 1) & ~1);
156 TRACE("returning %ld\n", Start);
160 unsigned char * WINAPI BSTR_UserMarshal(unsigned long *pFlags, unsigned char *Buffer, BSTR *pstr)
163 DWORD len = SysStringByteLen(*pstr);
165 TRACE("(%lx,%p,%p) => %p\n", *pFlags, Buffer, pstr, *pstr);
166 if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr));
168 ALIGN_POINTER(Buffer, 3);
169 header = (bstr_wire_t*)Buffer;
170 header->len = header->len2 = (len + 1) / 2;
173 header->byte_len = len;
174 memcpy(header + 1, *pstr, header->len * 2);
177 header->byte_len = 0xffffffff; /* special case for a null bstr */
179 return Buffer + sizeof(*header) + sizeof(OLECHAR) * header->len;
182 unsigned char * WINAPI BSTR_UserUnmarshal(unsigned long *pFlags, unsigned char *Buffer, BSTR *pstr)
185 TRACE("(%lx,%p,%p) => %p\n", *pFlags, Buffer, pstr, *pstr);
187 ALIGN_POINTER(Buffer, 3);
188 header = (bstr_wire_t*)Buffer;
189 if(header->len != header->len2)
190 FIXME("len %08lx != len2 %08lx\n", header->len, header->len2);
194 SysFreeString(*pstr);
198 if(header->byte_len != 0xffffffff)
199 *pstr = SysAllocStringByteLen((char*)(header + 1), header->byte_len);
201 if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr));
202 return Buffer + sizeof(*header) + sizeof(OLECHAR) * header->len;
205 void WINAPI BSTR_UserFree(unsigned long *pFlags, BSTR *pstr)
207 TRACE("(%lx,%p) => %p\n", *pFlags, pstr, *pstr);
210 SysFreeString(*pstr);
228 static unsigned int get_type_size(unsigned long *pFlags, VARIANT *pvar)
230 if (V_VT(pvar) & VT_ARRAY) return 4;
232 switch (V_VT(pvar) & ~VT_BYREF) {
241 return sizeof(SHORT);
249 return sizeof(FLOAT);
251 return sizeof(DOUBLE);
253 return sizeof(VARIANT_BOOL);
255 return sizeof(SCODE);
261 return sizeof(DECIMAL);
265 return sizeof(VARIANT);
271 FIXME("unhandled VT %d\n", V_VT(pvar));
276 static unsigned int get_type_alignment(unsigned long *pFlags, VARIANT *pvar)
278 unsigned int size = get_type_size(pFlags, pvar);
279 if(V_VT(pvar) & VT_BYREF) return 3;
280 if(size == 0) return 0;
281 if(size <= 4) return size - 1;
285 static unsigned interface_variant_size(unsigned long *pFlags, REFIID riid, VARIANT *pvar)
289 /* find the buffer size of the marshalled dispatch interface */
290 hr = CoGetMarshalSizeMax(&size, riid, V_UNKNOWN(pvar), LOWORD(*pFlags), NULL, MSHLFLAGS_NORMAL);
292 if (!V_DISPATCH(pvar))
293 WARN("NULL dispatch pointer\n");
295 ERR("Dispatch variant buffer size calculation failed, HRESULT=0x%lx\n", hr);
298 size += sizeof(ULONG); /* we have to store the buffersize in the stream */
299 TRACE("wire-size extra of dispatch variant is %ld\n", size);
303 static unsigned long wire_extra_user_size(unsigned long *pFlags, unsigned long Start, VARIANT *pvar)
308 return LPSAFEARRAY_UserSize(pFlags, Start, V_ARRAYREF(pvar));
310 return LPSAFEARRAY_UserSize(pFlags, Start, &V_ARRAY(pvar));
313 switch (V_VT(pvar)) {
315 return BSTR_UserSize(pFlags, Start, &V_BSTR(pvar));
316 case VT_BSTR | VT_BYREF:
317 return BSTR_UserSize(pFlags, Start, V_BSTRREF(pvar));
318 case VT_VARIANT | VT_BYREF:
319 return VARIANT_UserSize(pFlags, Start, V_VARIANTREF(pvar));
321 return Start + interface_variant_size(pFlags, &IID_IUnknown, pvar);
323 return Start + interface_variant_size(pFlags, &IID_IDispatch, pvar);
325 FIXME("wire-size record\n");
328 case VT_SAFEARRAY | VT_BYREF:
329 FIXME("wire-size safearray: shouldn't be marshaling this\n");
336 /* helper: called for VT_DISPATCH variants to marshal the IDispatch* into the buffer. returns Buffer on failure, new position otherwise */
337 static unsigned char* interface_variant_marshal(unsigned long *pFlags, unsigned char *Buffer, REFIID riid, VARIANT *pvar)
341 void *working_memlocked;
342 unsigned char *oldpos;
346 TRACE("pFlags=%ld, Buffer=%p, pvar=%p\n", *pFlags, Buffer, pvar);
350 /* CoMarshalInterface needs a stream, whereas at this level we are operating in terms of buffers.
351 * We create a stream on an HGLOBAL, so we can simply do a memcpy to move it to the buffer.
352 * in rpcrt4/ndr_ole.c, a simple IStream implementation is wrapped around the buffer object,
353 * but that would be overkill here, hence this implementation. We save the size because the unmarshal
354 * code has no way to know how long the marshalled buffer is. */
356 size = wire_extra_user_size(pFlags, 0, pvar);
358 working_mem = GlobalAlloc(0, size);
359 if (!working_mem) return oldpos;
361 hr = CreateStreamOnHGlobal(working_mem, TRUE, &working);
363 GlobalFree(working_mem);
367 hr = CoMarshalInterface(working, riid, V_UNKNOWN(pvar), LOWORD(*pFlags), NULL, MSHLFLAGS_NORMAL);
369 IStream_Release(working); /* this also releases the hglobal */
373 working_memlocked = GlobalLock(working_mem);
374 memcpy(Buffer, &size, sizeof(ULONG)); /* copy the buffersize */
375 memcpy(Buffer + sizeof(ULONG), working_memlocked, size - sizeof(ULONG));
376 GlobalUnlock(working_mem);
378 IStream_Release(working);
380 /* size includes the ULONG for the size written above */
381 TRACE("done, size=%ld\n", size);
382 return Buffer + size;
385 /* helper: called for VT_DISPATCH / VT_UNKNOWN variants to unmarshal the buffer. returns Buffer on failure, new position otherwise */
386 static unsigned char *interface_variant_unmarshal(unsigned long *pFlags, unsigned char *Buffer, REFIID riid, VARIANT *pvar)
390 void *working_memlocked;
391 unsigned char *oldpos;
395 TRACE("pFlags=%ld, Buffer=%p, pvar=%p\n", *pFlags, Buffer, pvar);
399 /* get the buffersize */
400 memcpy(&size, Buffer, sizeof(ULONG));
401 TRACE("buffersize=%ld\n", size);
403 working_mem = GlobalAlloc(0, size);
404 if (!working_mem) return oldpos;
406 hr = CreateStreamOnHGlobal(working_mem, TRUE, &working);
408 GlobalFree(working_mem);
412 working_memlocked = GlobalLock(working_mem);
414 /* now we copy the contents of the marshalling buffer to working_memlocked, unlock it, and demarshal the stream */
415 memcpy(working_memlocked, Buffer + sizeof(ULONG), size);
416 GlobalUnlock(working_mem);
418 hr = CoUnmarshalInterface(working, riid, (void**)&V_UNKNOWN(pvar));
420 IStream_Release(working);
424 IStream_Release(working); /* this also frees the underlying hglobal */
426 /* size includes the ULONG for the size written above */
427 TRACE("done, processed=%ld bytes\n", size);
428 return Buffer + size;
432 unsigned long WINAPI VARIANT_UserSize(unsigned long *pFlags, unsigned long Start, VARIANT *pvar)
435 TRACE("(%lx,%ld,%p)\n", *pFlags, Start, pvar);
436 TRACE("vt=%04x\n", V_VT(pvar));
438 ALIGN_LENGTH(Start, 7);
439 Start += sizeof(variant_wire_t);
440 if(V_VT(pvar) & VT_BYREF)
443 align = get_type_alignment(pFlags, pvar);
444 ALIGN_LENGTH(Start, align);
445 if(V_VT(pvar) == (VT_VARIANT | VT_BYREF))
448 Start += get_type_size(pFlags, pvar);
449 Start = wire_extra_user_size(pFlags, Start, pvar);
451 TRACE("returning %ld\n", Start);
455 unsigned char * WINAPI VARIANT_UserMarshal(unsigned long *pFlags, unsigned char *Buffer, VARIANT *pvar)
457 variant_wire_t *header;
458 unsigned long type_size;
462 TRACE("(%lx,%p,%p)\n", *pFlags, Buffer, pvar);
463 TRACE("vt=%04x\n", V_VT(pvar));
465 ALIGN_POINTER(Buffer, 7);
467 header = (variant_wire_t *)Buffer;
469 header->clSize = 0; /* fixed up at the end */
470 header->rpcReserverd = 0;
471 header->vt = pvar->n1.n2.vt;
472 header->wReserved1 = pvar->n1.n2.wReserved1;
473 header->wReserved2 = pvar->n1.n2.wReserved2;
474 header->wReserved3 = pvar->n1.n2.wReserved3;
475 header->switch_is = pvar->n1.n2.vt;
476 if(header->switch_is & VT_ARRAY)
477 header->switch_is &= ~VT_TYPEMASK;
479 Pos = (unsigned char*)(header + 1);
480 type_size = get_type_size(pFlags, pvar);
481 align = get_type_alignment(pFlags, pvar);
482 ALIGN_POINTER(Pos, align);
484 if(header->vt & VT_BYREF)
486 *(DWORD *)Pos = max(type_size, 4);
488 if((header->vt & VT_TYPEMASK) != VT_VARIANT)
490 memcpy(Pos, pvar->n1.n2.n3.byref, type_size);
495 *(DWORD*)Pos = 'U' | 's' << 8 | 'e' << 16 | 'r' << 24;
501 if((header->vt & VT_TYPEMASK) == VT_DECIMAL)
502 memcpy(Pos, pvar, type_size);
504 memcpy(Pos, &pvar->n1.n2.n3, type_size);
508 if(header->vt & VT_ARRAY)
510 if(header->vt & VT_BYREF)
511 Pos = LPSAFEARRAY_UserMarshal(pFlags, Pos, V_ARRAYREF(pvar));
513 Pos = LPSAFEARRAY_UserMarshal(pFlags, Pos, &V_ARRAY(pvar));
520 Pos = BSTR_UserMarshal(pFlags, Pos, &V_BSTR(pvar));
522 case VT_BSTR | VT_BYREF:
523 Pos = BSTR_UserMarshal(pFlags, Pos, V_BSTRREF(pvar));
525 case VT_VARIANT | VT_BYREF:
526 Pos = VARIANT_UserMarshal(pFlags, Pos, V_VARIANTREF(pvar));
528 case VT_DISPATCH | VT_BYREF:
529 FIXME("handle DISPATCH by ref\n");
532 /* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */
533 Pos = interface_variant_marshal(pFlags, Pos, &IID_IUnknown, pvar);
536 /* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */
537 Pos = interface_variant_marshal(pFlags, Pos, &IID_IDispatch, pvar);
540 FIXME("handle BRECORD by val\n");
542 case VT_RECORD | VT_BYREF:
543 FIXME("handle BRECORD by ref\n");
547 header->clSize = ((Pos - Buffer) + 7) >> 3;
548 TRACE("marshalled size=%ld\n", header->clSize);
552 unsigned char * WINAPI VARIANT_UserUnmarshal(unsigned long *pFlags, unsigned char *Buffer, VARIANT *pvar)
554 variant_wire_t *header;
555 unsigned long type_size;
559 TRACE("(%lx,%p,%p)\n", *pFlags, Buffer, pvar);
561 ALIGN_POINTER(Buffer, 7);
564 header = (variant_wire_t *)Buffer;
566 pvar->n1.n2.vt = header->vt;
567 pvar->n1.n2.wReserved1 = header->wReserved1;
568 pvar->n1.n2.wReserved2 = header->wReserved2;
569 pvar->n1.n2.wReserved3 = header->wReserved3;
571 Pos = (unsigned char*)(header + 1);
572 type_size = get_type_size(pFlags, pvar);
573 align = get_type_alignment(pFlags, pvar);
574 ALIGN_POINTER(Pos, align);
576 if(header->vt & VT_BYREF)
579 pvar->n1.n2.n3.byref = CoTaskMemAlloc(type_size);
580 memcpy(pvar->n1.n2.n3.byref, Pos, type_size);
581 if((header->vt & VT_TYPEMASK) != VT_VARIANT)
588 if((header->vt & VT_TYPEMASK) == VT_DECIMAL)
589 memcpy(pvar, Pos, type_size);
591 memcpy(&pvar->n1.n2.n3, Pos, type_size);
595 if(header->vt & VT_ARRAY)
597 if(header->vt & VT_BYREF)
598 Pos = LPSAFEARRAY_UserUnmarshal(pFlags, Pos, V_ARRAYREF(pvar));
600 Pos = LPSAFEARRAY_UserUnmarshal(pFlags, Pos, &V_ARRAY(pvar));
608 Pos = BSTR_UserUnmarshal(pFlags, Pos, &V_BSTR(pvar));
610 case VT_BSTR | VT_BYREF:
611 *V_BSTRREF(pvar) = NULL;
612 Pos = BSTR_UserUnmarshal(pFlags, Pos, V_BSTRREF(pvar));
614 case VT_VARIANT | VT_BYREF:
615 Pos = VARIANT_UserUnmarshal(pFlags, Pos, V_VARIANTREF(pvar));
617 case VT_DISPATCH | VT_BYREF:
618 FIXME("handle DISPATCH by ref\n");
621 /* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */
622 Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IUnknown, pvar);
625 /* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */
626 Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IDispatch, pvar);
629 FIXME("handle BRECORD by val\n");
631 case VT_RECORD | VT_BYREF:
632 FIXME("handle BRECORD by ref\n");
639 void WINAPI VARIANT_UserFree(unsigned long *pFlags, VARIANT *pvar)
641 VARTYPE vt = V_VT(pvar);
644 TRACE("(%lx,%p)\n", *pFlags, pvar);
645 TRACE("vt=%04x\n", V_VT(pvar));
647 if (vt & VT_BYREF) ref = pvar->n1.n2.n3.byref;
653 LPSAFEARRAY_UserFree(pFlags, V_ARRAYREF(pvar));
658 case VT_BSTR | VT_BYREF:
659 BSTR_UserFree(pFlags, V_BSTRREF(pvar));
661 case VT_VARIANT | VT_BYREF:
662 VARIANT_UserFree(pFlags, V_VARIANTREF(pvar));
664 case VT_RECORD | VT_BYREF:
665 FIXME("handle BRECORD by ref\n");
667 case VT_UNKNOWN | VT_BYREF:
668 case VT_DISPATCH | VT_BYREF:
669 IUnknown_Release(*V_UNKNOWNREF(pvar));
679 /* Get the number of cells in a SafeArray */
680 static ULONG SAFEARRAY_GetCellCount(const SAFEARRAY *psa)
682 const SAFEARRAYBOUND* psab = psa->rgsabound;
683 USHORT cCount = psa->cDims;
684 ULONG ulNumCells = 1;
688 /* This is a valid bordercase. See testcases. -Marcus */
689 if (!psab->cElements)
691 ulNumCells *= psab->cElements;
697 static inline SF_TYPE SAFEARRAY_GetUnionType(SAFEARRAY *psa)
702 hr = SafeArrayGetVartype(psa, &vt);
704 RpcRaiseException(hr);
706 if (psa->fFeatures & FADF_HAVEIID)
712 case VT_UI1: return SF_I1;
715 case VT_UI2: return SF_I2;
720 case VT_R4: return SF_I4;
725 case VT_UI8: return SF_I8;
727 case VT_UINT_PTR: return (sizeof(UINT_PTR) == 4 ? SF_I4 : SF_I8);
728 case VT_BSTR: return SF_BSTR;
729 case VT_DISPATCH: return SF_DISPATCH;
730 case VT_VARIANT: return SF_VARIANT;
731 case VT_UNKNOWN: return SF_UNKNOWN;
732 /* Note: Return a non-zero size to indicate vt is valid. The actual size
733 * of a UDT is taken from the result of IRecordInfo_GetSize().
735 case VT_RECORD: return SF_RECORD;
736 default: return SF_ERROR;
740 unsigned long WINAPI LPSAFEARRAY_UserSize(unsigned long *pFlags, unsigned long StartingSize, LPSAFEARRAY *ppsa)
742 unsigned long size = StartingSize;
744 TRACE("("); dump_user_flags(pFlags); TRACE(", %ld, %p\n", StartingSize, *ppsa);
746 ALIGN_LENGTH(size, 3);
747 size += sizeof(ULONG_PTR);
750 SAFEARRAY *psa = *ppsa;
751 ULONG ulCellCount = SAFEARRAY_GetCellCount(psa);
755 size += sizeof(ULONG);
756 size += FIELD_OFFSET(struct _wireSAFEARRAY, uArrayStructs);
758 sftype = SAFEARRAY_GetUnionType(psa);
759 size += sizeof(ULONG);
761 size += sizeof(ULONG);
762 size += sizeof(ULONG_PTR);
763 if (sftype == SF_HAVEIID)
766 size += sizeof(psa->rgsabound[0]) * psa->cDims;
768 size += sizeof(ULONG);
776 for (lpBstr = (BSTR*)psa->pvData; ulCellCount; ulCellCount--, lpBstr++)
777 size = BSTR_UserSize(pFlags, size, lpBstr);
784 FIXME("size interfaces\n");
790 for (lpVariant = (VARIANT*)psa->pvData; ulCellCount; ulCellCount--, lpVariant++)
791 size = VARIANT_UserSize(pFlags, size, lpVariant);
797 IRecordInfo* pRecInfo = NULL;
799 hr = SafeArrayGetRecordInfo(psa, &pRecInfo);
801 RpcRaiseException(hr);
805 FIXME("size record info %p\n", pRecInfo);
807 IRecordInfo_Release(pRecInfo);
812 ALIGN_LENGTH(size, 7);
817 size += ulCellCount * psa->cbElements;
828 unsigned char * WINAPI LPSAFEARRAY_UserMarshal(unsigned long *pFlags, unsigned char *Buffer, LPSAFEARRAY *ppsa)
832 TRACE("("); dump_user_flags(pFlags); TRACE(", %p, &%p\n", Buffer, *ppsa);
834 ALIGN_POINTER(Buffer, 3);
835 *(ULONG_PTR *)Buffer = *ppsa ? TRUE : FALSE;
836 Buffer += sizeof(ULONG_PTR);
840 SAFEARRAY *psa = *ppsa;
841 ULONG ulCellCount = SAFEARRAY_GetCellCount(psa);
842 wireSAFEARRAY wiresa;
846 *(ULONG *)Buffer = psa->cDims;
847 Buffer += sizeof(ULONG);
848 wiresa = (wireSAFEARRAY)Buffer;
849 wiresa->cDims = psa->cDims;
850 wiresa->fFeatures = psa->fFeatures;
851 wiresa->cbElements = psa->cbElements;
853 hr = SafeArrayGetVartype(psa, &vt);
855 RpcRaiseException(hr);
856 wiresa->cLocks = (USHORT)psa->cLocks | (vt << 16);
858 Buffer += FIELD_OFFSET(struct _wireSAFEARRAY, uArrayStructs);
860 sftype = SAFEARRAY_GetUnionType(psa);
861 *(ULONG *)Buffer = sftype;
862 Buffer += sizeof(ULONG);
864 *(ULONG *)Buffer = ulCellCount;
865 Buffer += sizeof(ULONG);
866 *(ULONG_PTR *)Buffer = (ULONG_PTR)psa->pvData;
867 Buffer += sizeof(ULONG_PTR);
868 if (sftype == SF_HAVEIID)
870 SafeArrayGetIID(psa, &guid);
871 memcpy(Buffer, &guid, sizeof(guid));
872 Buffer += sizeof(guid);
875 memcpy(Buffer, psa->rgsabound, sizeof(psa->rgsabound[0]) * psa->cDims);
876 Buffer += sizeof(psa->rgsabound[0]) * psa->cDims;
878 *(ULONG *)Buffer = ulCellCount;
879 Buffer += sizeof(ULONG);
889 for (lpBstr = (BSTR*)psa->pvData; ulCellCount; ulCellCount--, lpBstr++)
890 Buffer = BSTR_UserMarshal(pFlags, Buffer, lpBstr);
897 FIXME("marshal interfaces\n");
903 for (lpVariant = (VARIANT*)psa->pvData; ulCellCount; ulCellCount--, lpVariant++)
904 Buffer = VARIANT_UserMarshal(pFlags, Buffer, lpVariant);
910 IRecordInfo* pRecInfo = NULL;
912 hr = SafeArrayGetRecordInfo(psa, &pRecInfo);
914 RpcRaiseException(hr);
918 FIXME("write record info %p\n", pRecInfo);
920 IRecordInfo_Release(pRecInfo);
926 ALIGN_POINTER(Buffer, 7);
931 /* Just copy the data over */
932 memcpy(Buffer, psa->pvData, ulCellCount * psa->cbElements);
933 Buffer += ulCellCount * psa->cbElements;
944 #define FADF_AUTOSETFLAGS (FADF_HAVEIID | FADF_RECORD | FADF_HAVEVARTYPE | \
945 FADF_BSTR | FADF_UNKNOWN | FADF_DISPATCH | \
946 FADF_VARIANT | FADF_CREATEVECTOR)
948 unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(unsigned long *pFlags, unsigned char *Buffer, LPSAFEARRAY *ppsa)
951 wireSAFEARRAY wiresa;
958 SAFEARRAYBOUND *wiresab;
960 TRACE("("); dump_user_flags(pFlags); TRACE(", %p, %p\n", Buffer, ppsa);
962 ALIGN_POINTER(Buffer, 3);
963 ptr = *(ULONG_PTR *)Buffer;
964 Buffer += sizeof(ULONG_PTR);
970 TRACE("NULL safe array unmarshaled\n");
975 cDims = *(ULONG *)Buffer;
976 Buffer += sizeof(ULONG);
978 wiresa = (wireSAFEARRAY)Buffer;
979 Buffer += FIELD_OFFSET(struct _wireSAFEARRAY, uArrayStructs);
981 if (cDims != wiresa->cDims)
982 RpcRaiseException(RPC_S_INVALID_BOUND);
984 /* FIXME: there should be a limit on how large cDims can be */
986 vt = HIWORD(wiresa->cLocks);
988 sftype = *(ULONG *)Buffer;
989 Buffer += sizeof(ULONG);
991 cell_count = *(ULONG *)Buffer;
992 Buffer += sizeof(ULONG);
993 ptr = *(ULONG_PTR *)Buffer;
994 Buffer += sizeof(ULONG_PTR);
995 if (sftype == SF_HAVEIID)
997 memcpy(&guid, Buffer, sizeof(guid));
998 Buffer += sizeof(guid);
1001 wiresab = (SAFEARRAYBOUND *)Buffer;
1002 Buffer += sizeof(wiresab[0]) * wiresa->cDims;
1004 *ppsa = SafeArrayCreateEx(vt, wiresa->cDims, wiresab, NULL);
1006 RpcRaiseException(E_OUTOFMEMORY);
1008 /* be careful about which flags we set since they could be a security
1010 (*ppsa)->fFeatures &= FADF_AUTOSETFLAGS;
1011 (*ppsa)->fFeatures |= (wiresa->fFeatures & ~(FADF_AUTOSETFLAGS));
1012 /* FIXME: there should be a limit on how large wiresa->cbElements can be */
1013 (*ppsa)->cbElements = wiresa->cbElements;
1014 (*ppsa)->cLocks = LOWORD(wiresa->cLocks);
1016 hr = SafeArrayAllocData(*ppsa);
1018 RpcRaiseException(hr);
1020 if ((*(ULONG *)Buffer != cell_count) || (SAFEARRAY_GetCellCount(*ppsa) != cell_count))
1021 RpcRaiseException(RPC_S_INVALID_BOUND);
1022 Buffer += sizeof(ULONG);
1032 for (lpBstr = (BSTR*)(*ppsa)->pvData; cell_count; cell_count--, lpBstr++)
1033 Buffer = BSTR_UserUnmarshal(pFlags, Buffer, lpBstr);
1040 FIXME("marshal interfaces\n");
1046 for (lpVariant = (VARIANT*)(*ppsa)->pvData; cell_count; cell_count--, lpVariant++)
1047 Buffer = VARIANT_UserUnmarshal(pFlags, Buffer, lpVariant);
1053 FIXME("set record info\n");
1059 ALIGN_POINTER(Buffer, 7);
1064 /* Just copy the data over */
1065 memcpy((*ppsa)->pvData, Buffer, cell_count * (*ppsa)->cbElements);
1066 Buffer += cell_count * (*ppsa)->cbElements;
1073 TRACE("safe array unmarshaled: %p\n", *ppsa);
1078 void WINAPI LPSAFEARRAY_UserFree(unsigned long *pFlags, LPSAFEARRAY *ppsa)
1080 TRACE("("); dump_user_flags(pFlags); TRACE(", &%p\n", *ppsa);
1082 SafeArrayDestroy(*ppsa);
1086 /* exactly how Invoke is marshalled is not very clear to me yet,
1087 * but the way I've done it seems to work for me */
1089 HRESULT CALLBACK IDispatch_Invoke_Proxy(
1091 DISPID dispIdMember,
1095 DISPPARAMS* pDispParams,
1096 VARIANT* pVarResult,
1097 EXCEPINFO* pExcepInfo,
1102 UINT* rgVarRefIdx = NULL;
1103 VARIANTARG* rgVarRef = NULL;
1106 EXCEPINFO ExcepInfo;
1108 TRACE("(%p)->(%ld,%s,%lx,%x,%p,%p,%p,%p)\n", This,
1109 dispIdMember, debugstr_guid(riid),
1110 lcid, wFlags, pDispParams, pVarResult,
1111 pExcepInfo, puArgErr);
1113 /* [out] args can't be null, use dummy vars if needed */
1114 if (!pVarResult) pVarResult = &VarResult;
1115 if (!puArgErr) puArgErr = &uArgErr;
1116 if (!pExcepInfo) pExcepInfo = &ExcepInfo;
1118 /* count by-ref args */
1119 for (cVarRef=0,u=0; u<pDispParams->cArgs; u++) {
1120 VARIANTARG* arg = &pDispParams->rgvarg[u];
1121 if (V_ISBYREF(arg)) {
1126 rgVarRefIdx = CoTaskMemAlloc(sizeof(UINT)*cVarRef);
1127 rgVarRef = CoTaskMemAlloc(sizeof(VARIANTARG)*cVarRef);
1128 /* make list of by-ref args */
1129 for (cVarRef=0,u=0; u<pDispParams->cArgs; u++) {
1130 VARIANTARG* arg = &pDispParams->rgvarg[u];
1131 if (V_ISBYREF(arg)) {
1132 rgVarRefIdx[cVarRef] = u;
1133 VariantInit(&rgVarRef[cVarRef]);
1138 /* [out] args still can't be null,
1139 * but we can point these anywhere in this case,
1140 * since they won't be written to when cVarRef is 0 */
1141 rgVarRefIdx = puArgErr;
1142 rgVarRef = pVarResult;
1144 TRACE("passed by ref: %d args\n", cVarRef);
1145 hr = IDispatch_RemoteInvoke_Proxy(This,
1158 for (u=0; u<cVarRef; u++) {
1159 unsigned i = rgVarRefIdx[u];
1160 VariantCopy(&pDispParams->rgvarg[i],
1162 VariantClear(&rgVarRef[u]);
1164 CoTaskMemFree(rgVarRef);
1165 CoTaskMemFree(rgVarRefIdx);
1168 if(pExcepInfo == &ExcepInfo)
1170 SysFreeString(pExcepInfo->bstrSource);
1171 SysFreeString(pExcepInfo->bstrDescription);
1172 SysFreeString(pExcepInfo->bstrHelpFile);
1177 HRESULT __RPC_STUB IDispatch_Invoke_Stub(
1179 DISPID dispIdMember,
1183 DISPPARAMS* pDispParams,
1184 VARIANT* pVarResult,
1185 EXCEPINFO* pExcepInfo,
1189 VARIANTARG* rgVarRef)
1192 VARIANTARG *rgvarg, *arg;
1195 /* initialize out parameters, so that they can be marshalled
1196 * in case the real Invoke doesn't initialize them */
1197 VariantInit(pVarResult);
1198 memset(pExcepInfo, 0, sizeof(*pExcepInfo));
1201 /* let the real Invoke operate on a copy of the in parameters,
1202 * so we don't risk losing pointers to allocated memory */
1203 rgvarg = pDispParams->rgvarg;
1204 arg = CoTaskMemAlloc(sizeof(VARIANTARG)*pDispParams->cArgs);
1205 if (!arg) return E_OUTOFMEMORY;
1207 /* init all args so we can call VariantClear on all the args if the copy
1209 for (u = 0; u < pDispParams->cArgs; u++)
1210 VariantInit(&arg[u]);
1212 for (u = 0; u < pDispParams->cArgs; u++) {
1213 hr = VariantCopy(&arg[u], &rgvarg[u]);
1218 if (SUCCEEDED(hr)) {
1219 pDispParams->rgvarg = arg;
1221 hr = IDispatch_Invoke(This,
1231 /* copy ref args to out list */
1232 for (u=0; u<cVarRef; u++) {
1233 unsigned i = rgVarRefIdx[u];
1234 VariantInit(&rgVarRef[u]);
1235 VariantCopy(&rgVarRef[u], &arg[i]);
1236 /* clear original if equal, to avoid double-free */
1237 if (V_BYREF(&rgVarRef[u]) == V_BYREF(&rgvarg[i]))
1238 VariantClear(&rgvarg[i]);
1242 /* clear the duplicate argument list */
1243 for (u=0; u<pDispParams->cArgs; u++)
1244 VariantClear(&arg[u]);
1246 pDispParams->rgvarg = rgvarg;
1254 HRESULT CALLBACK IEnumVARIANT_Next_Proxy(
1258 ULONG* pCeltFetched)
1262 pCeltFetched = &fetched;
1263 return IEnumVARIANT_RemoteNext_Proxy(This,
1269 HRESULT __RPC_STUB IEnumVARIANT_Next_Stub(
1273 ULONG* pCeltFetched)
1277 hr = IEnumVARIANT_Next(This,
1281 if (hr == S_OK) *pCeltFetched = celt;
1285 /* TypeInfo related freers */
1287 static void free_embedded_typedesc(TYPEDESC *tdesc);
1288 static void free_embedded_arraydesc(ARRAYDESC *adesc)
1290 switch(adesc->tdescElem.vt)
1294 free_embedded_typedesc(adesc->tdescElem.u.lptdesc);
1295 CoTaskMemFree(adesc->tdescElem.u.lptdesc);
1298 free_embedded_arraydesc(adesc->tdescElem.u.lpadesc);
1299 CoTaskMemFree(adesc->tdescElem.u.lpadesc);
1304 static void free_embedded_typedesc(TYPEDESC *tdesc)
1310 free_embedded_typedesc(tdesc->u.lptdesc);
1311 CoTaskMemFree(tdesc->u.lptdesc);
1314 free_embedded_arraydesc(tdesc->u.lpadesc);
1315 CoTaskMemFree(tdesc->u.lpadesc);
1320 static void free_embedded_elemdesc(ELEMDESC *edesc)
1322 free_embedded_typedesc(&edesc->tdesc);
1323 if(edesc->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
1324 CoTaskMemFree(edesc->u.paramdesc.pparamdescex);
1329 HRESULT CALLBACK ITypeComp_Bind_Proxy(
1334 ITypeInfo** ppTInfo,
1335 DESCKIND* pDescKind,
1338 FIXME("not implemented\n");
1342 HRESULT __RPC_STUB ITypeComp_Bind_Stub(
1347 ITypeInfo** ppTInfo,
1348 DESCKIND* pDescKind,
1349 LPFUNCDESC* ppFuncDesc,
1350 LPVARDESC* ppVarDesc,
1351 ITypeComp** ppTypeComp,
1352 CLEANLOCALSTORAGE* pDummy)
1354 FIXME("not implemented\n");
1358 HRESULT CALLBACK ITypeComp_BindType_Proxy(
1362 ITypeInfo** ppTInfo,
1363 ITypeComp** ppTComp)
1365 FIXME("not implemented\n");
1369 HRESULT __RPC_STUB ITypeComp_BindType_Stub(
1373 ITypeInfo** ppTInfo)
1375 FIXME("not implemented\n");
1381 HRESULT CALLBACK ITypeInfo_GetTypeAttr_Proxy(
1383 TYPEATTR** ppTypeAttr)
1386 CLEANLOCALSTORAGE stg;
1387 TRACE("(%p, %p)\n", This, ppTypeAttr);
1390 stg.pStorage = NULL;
1391 stg.pInterface = NULL;
1393 return ITypeInfo_RemoteGetTypeAttr_Proxy(This, ppTypeAttr, &stg);
1396 HRESULT __RPC_STUB ITypeInfo_GetTypeAttr_Stub(
1398 LPTYPEATTR* ppTypeAttr,
1399 CLEANLOCALSTORAGE* pDummy)
1402 TRACE("(%p, %p)\n", This, ppTypeAttr);
1404 hr = ITypeInfo_GetTypeAttr(This, ppTypeAttr);
1408 pDummy->flags = CLS_TYPEATTR;
1409 ITypeInfo_AddRef(This);
1410 pDummy->pInterface = (IUnknown*)This;
1411 pDummy->pStorage = ppTypeAttr;
1415 HRESULT CALLBACK ITypeInfo_GetFuncDesc_Proxy(
1418 FUNCDESC** ppFuncDesc)
1420 CLEANLOCALSTORAGE stg;
1421 TRACE("(%p, %d, %p)\n", This, index, ppFuncDesc);
1424 stg.pStorage = NULL;
1425 stg.pInterface = NULL;
1427 return ITypeInfo_RemoteGetFuncDesc_Proxy(This, index, ppFuncDesc, &stg);
1430 HRESULT __RPC_STUB ITypeInfo_GetFuncDesc_Stub(
1433 LPFUNCDESC* ppFuncDesc,
1434 CLEANLOCALSTORAGE* pDummy)
1437 TRACE("(%p, %d, %p)\n", This, index, ppFuncDesc);
1439 hr = ITypeInfo_GetFuncDesc(This, index, ppFuncDesc);
1443 pDummy->flags = CLS_FUNCDESC;
1444 ITypeInfo_AddRef(This);
1445 pDummy->pInterface = (IUnknown*)This;
1446 pDummy->pStorage = ppFuncDesc;
1450 HRESULT CALLBACK ITypeInfo_GetVarDesc_Proxy(
1453 VARDESC** ppVarDesc)
1455 CLEANLOCALSTORAGE stg;
1456 TRACE("(%p, %d, %p)\n", This, index, ppVarDesc);
1459 stg.pStorage = NULL;
1460 stg.pInterface = NULL;
1462 return ITypeInfo_RemoteGetVarDesc_Proxy(This, index, ppVarDesc, &stg);
1465 HRESULT __RPC_STUB ITypeInfo_GetVarDesc_Stub(
1468 LPVARDESC* ppVarDesc,
1469 CLEANLOCALSTORAGE* pDummy)
1472 TRACE("(%p, %d, %p)\n", This, index, ppVarDesc);
1474 hr = ITypeInfo_GetVarDesc(This, index, ppVarDesc);
1478 pDummy->flags = CLS_VARDESC;
1479 ITypeInfo_AddRef(This);
1480 pDummy->pInterface = (IUnknown*)This;
1481 pDummy->pStorage = ppVarDesc;
1485 HRESULT CALLBACK ITypeInfo_GetNames_Proxy(
1492 FIXME("not implemented\n");
1496 HRESULT __RPC_STUB ITypeInfo_GetNames_Stub(
1503 FIXME("not implemented\n");
1507 HRESULT CALLBACK ITypeInfo_GetIDsOfNames_Proxy(
1509 LPOLESTR* rgszNames,
1513 FIXME("not implemented\n");
1517 HRESULT __RPC_STUB ITypeInfo_GetIDsOfNames_Stub(
1520 FIXME("not implemented\n");
1524 HRESULT CALLBACK ITypeInfo_Invoke_Proxy(
1529 DISPPARAMS* pDispParams,
1530 VARIANT* pVarResult,
1531 EXCEPINFO* pExcepInfo,
1534 FIXME("not implemented\n");
1538 HRESULT __RPC_STUB ITypeInfo_Invoke_Stub(
1541 FIXME("not implemented\n");
1545 HRESULT CALLBACK ITypeInfo_GetDocumentation_Proxy(
1549 BSTR* pBstrDocString,
1550 DWORD* pdwHelpContext,
1551 BSTR* pBstrHelpFile)
1554 BSTR name, doc_string, help_file;
1556 TRACE("(%p, %08lx, %p, %p, %p, %p)\n", This, memid, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
1558 /* FIXME: presumably refPtrFlags is supposed to be a bitmask of which ptrs we actually want? */
1559 hr = ITypeInfo_RemoteGetDocumentation_Proxy(This, memid, 0, &name, &doc_string, &help_context, &help_file);
1562 if(pBstrName) *pBstrName = name;
1563 else SysFreeString(name);
1565 if(pBstrDocString) *pBstrDocString = doc_string;
1566 else SysFreeString(doc_string);
1568 if(pBstrHelpFile) *pBstrHelpFile = help_file;
1569 else SysFreeString(help_file);
1571 if(pdwHelpContext) *pdwHelpContext = help_context;
1576 HRESULT __RPC_STUB ITypeInfo_GetDocumentation_Stub(
1581 BSTR* pBstrDocString,
1582 DWORD* pdwHelpContext,
1583 BSTR* pBstrHelpFile)
1585 TRACE("(%p, %08lx, %08lx, %p, %p, %p, %p)\n", This, memid, refPtrFlags, pBstrName, pBstrDocString,
1586 pdwHelpContext, pBstrHelpFile);
1587 return ITypeInfo_GetDocumentation(This, memid, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
1590 HRESULT CALLBACK ITypeInfo_GetDllEntry_Proxy(
1598 FIXME("not implemented\n");
1602 HRESULT __RPC_STUB ITypeInfo_GetDllEntry_Stub(
1611 FIXME("not implemented\n");
1615 HRESULT CALLBACK ITypeInfo_AddressOfMember_Proxy(
1621 FIXME("not implemented\n");
1625 HRESULT __RPC_STUB ITypeInfo_AddressOfMember_Stub(
1628 FIXME("not implemented\n");
1632 HRESULT CALLBACK ITypeInfo_CreateInstance_Proxy(
1634 IUnknown* pUnkOuter,
1638 FIXME("not implemented\n");
1642 HRESULT __RPC_STUB ITypeInfo_CreateInstance_Stub(
1647 FIXME("not implemented\n");
1651 HRESULT CALLBACK ITypeInfo_GetContainingTypeLib_Proxy(
1660 TRACE("(%p, %p, %p)\n", This, ppTLib, pIndex );
1662 hr = ITypeInfo_RemoteGetContainingTypeLib_Proxy(This, &pTL, &index);
1671 ITypeLib_Release(pTL);
1676 HRESULT __RPC_STUB ITypeInfo_GetContainingTypeLib_Stub(
1681 TRACE("(%p, %p, %p)\n", This, ppTLib, pIndex );
1682 return ITypeInfo_GetContainingTypeLib(This, ppTLib, pIndex);
1685 void CALLBACK ITypeInfo_ReleaseTypeAttr_Proxy(
1687 TYPEATTR* pTypeAttr)
1689 TRACE("(%p, %p)\n", This, pTypeAttr);
1690 free_embedded_typedesc(&pTypeAttr->tdescAlias);
1691 CoTaskMemFree(pTypeAttr);
1694 HRESULT __RPC_STUB ITypeInfo_ReleaseTypeAttr_Stub(
1697 TRACE("nothing to do\n");
1701 void CALLBACK ITypeInfo_ReleaseFuncDesc_Proxy(
1703 FUNCDESC* pFuncDesc)
1706 TRACE("(%p, %p)\n", This, pFuncDesc);
1708 for(param = 0; param < pFuncDesc->cParams; param++)
1709 free_embedded_elemdesc(pFuncDesc->lprgelemdescParam + param);
1711 CoTaskMemFree(pFuncDesc->lprgelemdescParam);
1713 free_embedded_elemdesc(&pFuncDesc->elemdescFunc);
1715 if(pFuncDesc->cScodes != 0 && pFuncDesc->cScodes != -1)
1716 CoTaskMemFree(pFuncDesc->lprgscode);
1718 CoTaskMemFree(pFuncDesc);
1721 HRESULT __RPC_STUB ITypeInfo_ReleaseFuncDesc_Stub(
1724 TRACE("nothing to do\n");
1728 void CALLBACK ITypeInfo_ReleaseVarDesc_Proxy(
1732 TRACE("(%p, %p)\n", This, pVarDesc);
1734 if(pVarDesc->lpstrSchema)
1735 CoTaskMemFree(pVarDesc->lpstrSchema);
1737 if(pVarDesc->varkind == VAR_CONST)
1738 CoTaskMemFree(pVarDesc->u.lpvarValue);
1740 free_embedded_elemdesc(&pVarDesc->elemdescVar);
1741 CoTaskMemFree(pVarDesc);
1744 HRESULT __RPC_STUB ITypeInfo_ReleaseVarDesc_Stub(
1747 TRACE("nothing to do\n");
1754 HRESULT CALLBACK ITypeInfo2_GetDocumentation2_Proxy(
1758 BSTR* pbstrHelpString,
1759 DWORD* pdwHelpStringContext,
1760 BSTR* pbstrHelpStringDll)
1762 FIXME("not implemented\n");
1766 HRESULT __RPC_STUB ITypeInfo2_GetDocumentation2_Stub(
1771 BSTR* pbstrHelpString,
1772 DWORD* pdwHelpStringContext,
1773 BSTR* pbstrHelpStringDll)
1775 FIXME("not implemented\n");
1781 UINT CALLBACK ITypeLib_GetTypeInfoCount_Proxy(
1785 TRACE("(%p)\n", This);
1787 ITypeLib_RemoteGetTypeInfoCount_Proxy(This, &count);
1792 HRESULT __RPC_STUB ITypeLib_GetTypeInfoCount_Stub(
1796 TRACE("(%p, %p)\n", This, pcTInfo);
1797 *pcTInfo = ITypeLib_GetTypeInfoCount(This);
1801 HRESULT CALLBACK ITypeLib_GetLibAttr_Proxy(
1803 TLIBATTR** ppTLibAttr)
1805 CLEANLOCALSTORAGE stg;
1806 TRACE("(%p, %p)\n", This, ppTLibAttr);
1809 stg.pStorage = NULL;
1810 stg.pInterface = NULL;
1812 return ITypeLib_RemoteGetLibAttr_Proxy(This, ppTLibAttr, &stg);
1815 HRESULT __RPC_STUB ITypeLib_GetLibAttr_Stub(
1817 LPTLIBATTR* ppTLibAttr,
1818 CLEANLOCALSTORAGE* pDummy)
1821 TRACE("(%p, %p)\n", This, ppTLibAttr);
1823 hr = ITypeLib_GetLibAttr(This, ppTLibAttr);
1827 pDummy->flags = CLS_LIBATTR;
1828 ITypeLib_AddRef(This);
1829 pDummy->pInterface = (IUnknown*)This;
1830 pDummy->pStorage = ppTLibAttr;
1834 HRESULT CALLBACK ITypeLib_GetDocumentation_Proxy(
1838 BSTR* pBstrDocString,
1839 DWORD* pdwHelpContext,
1840 BSTR* pBstrHelpFile)
1842 FIXME("not implemented\n");
1846 HRESULT __RPC_STUB ITypeLib_GetDocumentation_Stub(
1851 BSTR* pBstrDocString,
1852 DWORD* pdwHelpContext,
1853 BSTR* pBstrHelpFile)
1855 FIXME("not implemented\n");
1859 HRESULT CALLBACK ITypeLib_IsName_Proxy(
1865 FIXME("not implemented\n");
1869 HRESULT __RPC_STUB ITypeLib_IsName_Stub(
1876 FIXME("not implemented\n");
1880 HRESULT CALLBACK ITypeLib_FindName_Proxy(
1884 ITypeInfo** ppTInfo,
1888 FIXME("not implemented\n");
1892 HRESULT __RPC_STUB ITypeLib_FindName_Stub(
1896 ITypeInfo** ppTInfo,
1901 FIXME("not implemented\n");
1905 void CALLBACK ITypeLib_ReleaseTLibAttr_Proxy(
1907 TLIBATTR* pTLibAttr)
1909 TRACE("(%p, %p)\n", This, pTLibAttr);
1910 CoTaskMemFree(pTLibAttr);
1913 HRESULT __RPC_STUB ITypeLib_ReleaseTLibAttr_Stub(
1916 TRACE("nothing to do\n");
1923 HRESULT CALLBACK ITypeLib2_GetLibStatistics_Proxy(
1925 ULONG* pcUniqueNames,
1926 ULONG* pcchUniqueNames)
1928 FIXME("not implemented\n");
1932 HRESULT __RPC_STUB ITypeLib2_GetLibStatistics_Stub(
1934 ULONG* pcUniqueNames,
1935 ULONG* pcchUniqueNames)
1937 FIXME("not implemented\n");
1941 HRESULT CALLBACK ITypeLib2_GetDocumentation2_Proxy(
1945 BSTR* pbstrHelpString,
1946 DWORD* pdwHelpStringContext,
1947 BSTR* pbstrHelpStringDll)
1949 FIXME("not implemented\n");
1953 HRESULT __RPC_STUB ITypeLib2_GetDocumentation2_Stub(
1958 BSTR* pbstrHelpString,
1959 DWORD* pdwHelpStringContext,
1960 BSTR* pbstrHelpStringDll)
1962 FIXME("not implemented\n");