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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(ole);
43 #define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
44 #define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
45 #define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
46 #define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
48 static CStdPSFactoryBuffer PSFactoryBuffer;
50 CSTDSTUBBUFFERRELEASE(&PSFactoryBuffer)
52 extern const ExtendedProxyFileInfo oaidl_ProxyFileInfo;
54 const ProxyFileInfo* OLEAUT32_ProxyFileList[] = {
59 HRESULT OLEAUTPS_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
61 return NdrDllGetClassObject(rclsid, riid, ppv, OLEAUT32_ProxyFileList,
62 &CLSID_PSDispatch, &PSFactoryBuffer);
65 static void dump_user_flags(ULONG *pFlags)
67 if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION)
68 TRACE("MAKELONG(NDR_LOCAL_REPRESENTATION, ");
70 TRACE("MAKELONG(0x%04x, ", HIWORD(*pFlags));
71 switch (LOWORD(*pFlags))
73 case MSHCTX_LOCAL: TRACE("MSHCTX_LOCAL)"); break;
74 case MSHCTX_NOSHAREDMEM: TRACE("MSHCTX_NOSHAREDMEM)"); break;
75 case MSHCTX_DIFFERENTMACHINE: TRACE("MSHCTX_DIFFERENTMACHINE)"); break;
76 case MSHCTX_INPROC: TRACE("MSHCTX_INPROC)"); break;
77 default: TRACE("%d)", LOWORD(*pFlags));
81 /* CLEANLOCALSTORAGE */
83 #define CLS_FUNCDESC 'f'
84 #define CLS_LIBATTR 'l'
85 #define CLS_TYPEATTR 't'
86 #define CLS_VARDESC 'v'
88 ULONG WINAPI CLEANLOCALSTORAGE_UserSize(ULONG *pFlags, ULONG Start, CLEANLOCALSTORAGE *pstg)
90 ALIGN_LENGTH(Start, 3);
91 return Start + sizeof(DWORD);
94 unsigned char * WINAPI CLEANLOCALSTORAGE_UserMarshal(ULONG *pFlags, unsigned char *Buffer, CLEANLOCALSTORAGE *pstg)
96 ALIGN_POINTER(Buffer, 3);
97 *(DWORD*)Buffer = pstg->flags;
101 ITypeLib_ReleaseTLibAttr((ITypeLib*)pstg->pInterface, *(TLIBATTR**)pstg->pStorage);
104 ITypeInfo_ReleaseTypeAttr((ITypeInfo*)pstg->pInterface, *(TYPEATTR**)pstg->pStorage);
107 ITypeInfo_ReleaseFuncDesc((ITypeInfo*)pstg->pInterface, *(FUNCDESC**)pstg->pStorage);
110 ITypeInfo_ReleaseVarDesc((ITypeInfo*)pstg->pInterface, *(VARDESC**)pstg->pStorage);
114 ERR("Unknown type %x\n", pstg->flags);
117 *(VOID**)pstg->pStorage = NULL;
118 IUnknown_Release(pstg->pInterface);
119 pstg->pInterface = NULL;
121 return Buffer + sizeof(DWORD);
124 unsigned char * WINAPI CLEANLOCALSTORAGE_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, CLEANLOCALSTORAGE *pstr)
126 ALIGN_POINTER(Buffer, 3);
127 pstr->flags = *(DWORD*)Buffer;
128 return Buffer + sizeof(DWORD);
131 void WINAPI CLEANLOCALSTORAGE_UserFree(ULONG *pFlags, CLEANLOCALSTORAGE *pstr)
140 DWORD len; /* No. of chars not including trailing '\0' */
141 DWORD byte_len; /* len * 2 or 0xffffffff if len == 0 */
142 DWORD len2; /* == len */
145 ULONG WINAPI BSTR_UserSize(ULONG *pFlags, ULONG Start, BSTR *pstr)
147 TRACE("(%lx,%ld,%p) => %p\n", *pFlags, Start, pstr, *pstr);
148 if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr));
149 ALIGN_LENGTH(Start, 3);
150 Start += sizeof(bstr_wire_t) + ((SysStringByteLen(*pstr) + 1) & ~1);
151 TRACE("returning %ld\n", Start);
155 unsigned char * WINAPI BSTR_UserMarshal(ULONG *pFlags, unsigned char *Buffer, BSTR *pstr)
158 DWORD len = SysStringByteLen(*pstr);
160 TRACE("(%lx,%p,%p) => %p\n", *pFlags, Buffer, pstr, *pstr);
161 if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr));
163 ALIGN_POINTER(Buffer, 3);
164 header = (bstr_wire_t*)Buffer;
165 header->len = header->len2 = (len + 1) / 2;
168 header->byte_len = len;
169 memcpy(header + 1, *pstr, header->len * 2);
172 header->byte_len = 0xffffffff; /* special case for a null bstr */
174 return Buffer + sizeof(*header) + sizeof(OLECHAR) * header->len;
177 unsigned char * WINAPI BSTR_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, BSTR *pstr)
180 TRACE("(%lx,%p,%p) => %p\n", *pFlags, Buffer, pstr, *pstr);
182 ALIGN_POINTER(Buffer, 3);
183 header = (bstr_wire_t*)Buffer;
184 if(header->len != header->len2)
185 FIXME("len %08x != len2 %08x\n", header->len, header->len2);
189 SysFreeString(*pstr);
193 if(header->byte_len != 0xffffffff)
194 *pstr = SysAllocStringByteLen((char*)(header + 1), header->byte_len);
196 if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr));
197 return Buffer + sizeof(*header) + sizeof(OLECHAR) * header->len;
200 void WINAPI BSTR_UserFree(ULONG *pFlags, BSTR *pstr)
202 TRACE("(%lx,%p) => %p\n", *pFlags, pstr, *pstr);
205 SysFreeString(*pstr);
223 static unsigned int get_type_size(ULONG *pFlags, VARIANT *pvar)
225 if (V_VT(pvar) & VT_ARRAY) return 4;
227 switch (V_VT(pvar) & ~VT_BYREF) {
236 return sizeof(SHORT);
244 return sizeof(FLOAT);
246 return sizeof(DOUBLE);
248 return sizeof(VARIANT_BOOL);
250 return sizeof(SCODE);
256 return sizeof(DECIMAL);
260 return sizeof(VARIANT);
266 FIXME("unhandled VT %d\n", V_VT(pvar));
271 static unsigned int get_type_alignment(ULONG *pFlags, VARIANT *pvar)
273 unsigned int size = get_type_size(pFlags, pvar);
274 if(V_VT(pvar) & VT_BYREF) return 3;
275 if(size == 0) return 0;
276 if(size <= 4) return size - 1;
280 static unsigned interface_variant_size(ULONG *pFlags, REFIID riid, VARIANT *pvar)
284 /* find the buffer size of the marshalled dispatch interface */
285 hr = CoGetMarshalSizeMax(&size, riid, V_UNKNOWN(pvar), LOWORD(*pFlags), NULL, MSHLFLAGS_NORMAL);
287 if (!V_DISPATCH(pvar))
288 WARN("NULL dispatch pointer\n");
290 ERR("Dispatch variant buffer size calculation failed, HRESULT=0x%x\n", hr);
293 size += sizeof(ULONG); /* we have to store the buffersize in the stream */
294 TRACE("wire-size extra of dispatch variant is %d\n", size);
298 static ULONG wire_extra_user_size(ULONG *pFlags, ULONG Start, VARIANT *pvar)
303 return LPSAFEARRAY_UserSize(pFlags, Start, V_ARRAYREF(pvar));
305 return LPSAFEARRAY_UserSize(pFlags, Start, &V_ARRAY(pvar));
308 switch (V_VT(pvar)) {
310 return BSTR_UserSize(pFlags, Start, &V_BSTR(pvar));
311 case VT_BSTR | VT_BYREF:
312 return BSTR_UserSize(pFlags, Start, V_BSTRREF(pvar));
313 case VT_VARIANT | VT_BYREF:
314 return VARIANT_UserSize(pFlags, Start, V_VARIANTREF(pvar));
316 return Start + interface_variant_size(pFlags, &IID_IUnknown, pvar);
318 return Start + interface_variant_size(pFlags, &IID_IDispatch, pvar);
320 FIXME("wire-size record\n");
323 case VT_SAFEARRAY | VT_BYREF:
324 FIXME("wire-size safearray: shouldn't be marshaling this\n");
331 /* helper: called for VT_DISPATCH variants to marshal the IDispatch* into the buffer. returns Buffer on failure, new position otherwise */
332 static unsigned char* interface_variant_marshal(ULONG *pFlags, unsigned char *Buffer, REFIID riid, VARIANT *pvar)
336 void *working_memlocked;
337 unsigned char *oldpos;
341 TRACE("pFlags=%ld, Buffer=%p, pvar=%p\n", *pFlags, Buffer, pvar);
345 /* CoMarshalInterface needs a stream, whereas at this level we are operating in terms of buffers.
346 * We create a stream on an HGLOBAL, so we can simply do a memcpy to move it to the buffer.
347 * in rpcrt4/ndr_ole.c, a simple IStream implementation is wrapped around the buffer object,
348 * but that would be overkill here, hence this implementation. We save the size because the unmarshal
349 * code has no way to know how long the marshalled buffer is. */
351 size = wire_extra_user_size(pFlags, 0, pvar);
353 working_mem = GlobalAlloc(0, size);
354 if (!working_mem) return oldpos;
356 hr = CreateStreamOnHGlobal(working_mem, TRUE, &working);
358 GlobalFree(working_mem);
362 hr = CoMarshalInterface(working, riid, V_UNKNOWN(pvar), LOWORD(*pFlags), NULL, MSHLFLAGS_NORMAL);
364 IStream_Release(working); /* this also releases the hglobal */
368 working_memlocked = GlobalLock(working_mem);
369 memcpy(Buffer, &size, sizeof(ULONG)); /* copy the buffersize */
370 memcpy(Buffer + sizeof(ULONG), working_memlocked, size - sizeof(ULONG));
371 GlobalUnlock(working_mem);
373 IStream_Release(working);
375 /* size includes the ULONG for the size written above */
376 TRACE("done, size=%d\n", size);
377 return Buffer + size;
380 /* helper: called for VT_DISPATCH / VT_UNKNOWN variants to unmarshal the buffer. returns Buffer on failure, new position otherwise */
381 static unsigned char *interface_variant_unmarshal(ULONG *pFlags, unsigned char *Buffer, REFIID riid, VARIANT *pvar)
385 void *working_memlocked;
386 unsigned char *oldpos;
390 TRACE("pFlags=%ld, Buffer=%p, pvar=%p\n", *pFlags, Buffer, pvar);
394 /* get the buffersize */
395 memcpy(&size, Buffer, sizeof(ULONG));
396 TRACE("buffersize=%d\n", size);
398 working_mem = GlobalAlloc(0, size);
399 if (!working_mem) return oldpos;
401 hr = CreateStreamOnHGlobal(working_mem, TRUE, &working);
403 GlobalFree(working_mem);
407 working_memlocked = GlobalLock(working_mem);
409 /* now we copy the contents of the marshalling buffer to working_memlocked, unlock it, and demarshal the stream */
410 memcpy(working_memlocked, Buffer + sizeof(ULONG), size);
411 GlobalUnlock(working_mem);
413 hr = CoUnmarshalInterface(working, riid, (void**)&V_UNKNOWN(pvar));
415 IStream_Release(working);
419 IStream_Release(working); /* this also frees the underlying hglobal */
421 /* size includes the ULONG for the size written above */
422 TRACE("done, processed=%d bytes\n", size);
423 return Buffer + size;
427 ULONG WINAPI VARIANT_UserSize(ULONG *pFlags, ULONG Start, VARIANT *pvar)
430 TRACE("(%lx,%ld,%p)\n", *pFlags, Start, pvar);
431 TRACE("vt=%04x\n", V_VT(pvar));
433 ALIGN_LENGTH(Start, 7);
434 Start += sizeof(variant_wire_t);
435 if(V_VT(pvar) & VT_BYREF)
438 align = get_type_alignment(pFlags, pvar);
439 ALIGN_LENGTH(Start, align);
440 if(V_VT(pvar) == (VT_VARIANT | VT_BYREF))
443 Start += get_type_size(pFlags, pvar);
444 Start = wire_extra_user_size(pFlags, Start, pvar);
446 TRACE("returning %ld\n", Start);
450 unsigned char * WINAPI VARIANT_UserMarshal(ULONG *pFlags, unsigned char *Buffer, VARIANT *pvar)
452 variant_wire_t *header;
457 TRACE("(%lx,%p,%p)\n", *pFlags, Buffer, pvar);
458 TRACE("vt=%04x\n", V_VT(pvar));
460 ALIGN_POINTER(Buffer, 7);
462 header = (variant_wire_t *)Buffer;
464 header->clSize = 0; /* fixed up at the end */
465 header->rpcReserverd = 0;
466 header->vt = pvar->n1.n2.vt;
467 header->wReserved1 = pvar->n1.n2.wReserved1;
468 header->wReserved2 = pvar->n1.n2.wReserved2;
469 header->wReserved3 = pvar->n1.n2.wReserved3;
470 header->switch_is = pvar->n1.n2.vt;
471 if(header->switch_is & VT_ARRAY)
472 header->switch_is &= ~VT_TYPEMASK;
474 Pos = (unsigned char*)(header + 1);
475 type_size = get_type_size(pFlags, pvar);
476 align = get_type_alignment(pFlags, pvar);
477 ALIGN_POINTER(Pos, align);
479 if(header->vt & VT_BYREF)
481 *(DWORD *)Pos = max(type_size, 4);
483 if((header->vt & VT_TYPEMASK) != VT_VARIANT)
485 memcpy(Pos, pvar->n1.n2.n3.byref, type_size);
490 *(DWORD*)Pos = 'U' | 's' << 8 | 'e' << 16 | 'r' << 24;
496 if((header->vt & VT_TYPEMASK) == VT_DECIMAL)
497 memcpy(Pos, pvar, type_size);
499 memcpy(Pos, &pvar->n1.n2.n3, type_size);
503 if(header->vt & VT_ARRAY)
505 if(header->vt & VT_BYREF)
506 Pos = LPSAFEARRAY_UserMarshal(pFlags, Pos, V_ARRAYREF(pvar));
508 Pos = LPSAFEARRAY_UserMarshal(pFlags, Pos, &V_ARRAY(pvar));
515 Pos = BSTR_UserMarshal(pFlags, Pos, &V_BSTR(pvar));
517 case VT_BSTR | VT_BYREF:
518 Pos = BSTR_UserMarshal(pFlags, Pos, V_BSTRREF(pvar));
520 case VT_VARIANT | VT_BYREF:
521 Pos = VARIANT_UserMarshal(pFlags, Pos, V_VARIANTREF(pvar));
523 case VT_DISPATCH | VT_BYREF:
524 FIXME("handle DISPATCH by ref\n");
527 /* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */
528 Pos = interface_variant_marshal(pFlags, Pos, &IID_IUnknown, pvar);
531 /* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */
532 Pos = interface_variant_marshal(pFlags, Pos, &IID_IDispatch, pvar);
535 FIXME("handle BRECORD by val\n");
537 case VT_RECORD | VT_BYREF:
538 FIXME("handle BRECORD by ref\n");
542 header->clSize = ((Pos - Buffer) + 7) >> 3;
543 TRACE("marshalled size=%d\n", header->clSize);
547 unsigned char * WINAPI VARIANT_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, VARIANT *pvar)
549 variant_wire_t *header;
554 TRACE("(%lx,%p,%p)\n", *pFlags, Buffer, pvar);
556 ALIGN_POINTER(Buffer, 7);
559 header = (variant_wire_t *)Buffer;
561 pvar->n1.n2.vt = header->vt;
562 pvar->n1.n2.wReserved1 = header->wReserved1;
563 pvar->n1.n2.wReserved2 = header->wReserved2;
564 pvar->n1.n2.wReserved3 = header->wReserved3;
566 Pos = (unsigned char*)(header + 1);
567 type_size = get_type_size(pFlags, pvar);
568 align = get_type_alignment(pFlags, pvar);
569 ALIGN_POINTER(Pos, align);
571 if(header->vt & VT_BYREF)
574 pvar->n1.n2.n3.byref = CoTaskMemAlloc(type_size);
575 memcpy(pvar->n1.n2.n3.byref, Pos, type_size);
576 if((header->vt & VT_TYPEMASK) != VT_VARIANT)
583 if((header->vt & VT_TYPEMASK) == VT_DECIMAL)
584 memcpy(pvar, Pos, type_size);
586 memcpy(&pvar->n1.n2.n3, Pos, type_size);
590 if(header->vt & VT_ARRAY)
592 if(header->vt & VT_BYREF)
593 Pos = LPSAFEARRAY_UserUnmarshal(pFlags, Pos, V_ARRAYREF(pvar));
595 Pos = LPSAFEARRAY_UserUnmarshal(pFlags, Pos, &V_ARRAY(pvar));
603 Pos = BSTR_UserUnmarshal(pFlags, Pos, &V_BSTR(pvar));
605 case VT_BSTR | VT_BYREF:
606 *V_BSTRREF(pvar) = NULL;
607 Pos = BSTR_UserUnmarshal(pFlags, Pos, V_BSTRREF(pvar));
609 case VT_VARIANT | VT_BYREF:
610 Pos = VARIANT_UserUnmarshal(pFlags, Pos, V_VARIANTREF(pvar));
612 case VT_DISPATCH | VT_BYREF:
613 FIXME("handle DISPATCH by ref\n");
616 /* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */
617 Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IUnknown, pvar);
620 /* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */
621 Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IDispatch, pvar);
624 FIXME("handle BRECORD by val\n");
626 case VT_RECORD | VT_BYREF:
627 FIXME("handle BRECORD by ref\n");
634 void WINAPI VARIANT_UserFree(ULONG *pFlags, VARIANT *pvar)
636 VARTYPE vt = V_VT(pvar);
639 TRACE("(%lx,%p)\n", *pFlags, pvar);
640 TRACE("vt=%04x\n", V_VT(pvar));
642 if (vt & VT_BYREF) ref = pvar->n1.n2.n3.byref;
648 LPSAFEARRAY_UserFree(pFlags, V_ARRAYREF(pvar));
653 case VT_BSTR | VT_BYREF:
654 BSTR_UserFree(pFlags, V_BSTRREF(pvar));
656 case VT_VARIANT | VT_BYREF:
657 VARIANT_UserFree(pFlags, V_VARIANTREF(pvar));
659 case VT_RECORD | VT_BYREF:
660 FIXME("handle BRECORD by ref\n");
662 case VT_UNKNOWN | VT_BYREF:
663 case VT_DISPATCH | VT_BYREF:
664 IUnknown_Release(*V_UNKNOWNREF(pvar));
674 /* Get the number of cells in a SafeArray */
675 static ULONG SAFEARRAY_GetCellCount(const SAFEARRAY *psa)
677 const SAFEARRAYBOUND* psab = psa->rgsabound;
678 USHORT cCount = psa->cDims;
679 ULONG ulNumCells = 1;
683 /* This is a valid bordercase. See testcases. -Marcus */
684 if (!psab->cElements)
686 ulNumCells *= psab->cElements;
692 static inline SF_TYPE SAFEARRAY_GetUnionType(SAFEARRAY *psa)
697 hr = SafeArrayGetVartype(psa, &vt);
699 RpcRaiseException(hr);
701 if (psa->fFeatures & FADF_HAVEIID)
707 case VT_UI1: return SF_I1;
710 case VT_UI2: return SF_I2;
715 case VT_R4: return SF_I4;
720 case VT_UI8: return SF_I8;
722 case VT_UINT_PTR: return (sizeof(UINT_PTR) == 4 ? SF_I4 : SF_I8);
723 case VT_BSTR: return SF_BSTR;
724 case VT_DISPATCH: return SF_DISPATCH;
725 case VT_VARIANT: return SF_VARIANT;
726 case VT_UNKNOWN: return SF_UNKNOWN;
727 /* Note: Return a non-zero size to indicate vt is valid. The actual size
728 * of a UDT is taken from the result of IRecordInfo_GetSize().
730 case VT_RECORD: return SF_RECORD;
731 default: return SF_ERROR;
735 ULONG WINAPI LPSAFEARRAY_UserSize(ULONG *pFlags, ULONG StartingSize, LPSAFEARRAY *ppsa)
737 ULONG size = StartingSize;
739 TRACE("("); dump_user_flags(pFlags); TRACE(", %ld, %p\n", StartingSize, *ppsa);
741 ALIGN_LENGTH(size, 3);
742 size += sizeof(ULONG_PTR);
745 SAFEARRAY *psa = *ppsa;
746 ULONG ulCellCount = SAFEARRAY_GetCellCount(psa);
750 size += sizeof(ULONG);
751 size += FIELD_OFFSET(struct _wireSAFEARRAY, uArrayStructs);
753 sftype = SAFEARRAY_GetUnionType(psa);
754 size += sizeof(ULONG);
756 size += sizeof(ULONG);
757 size += sizeof(ULONG_PTR);
758 if (sftype == SF_HAVEIID)
761 size += sizeof(psa->rgsabound[0]) * psa->cDims;
763 size += sizeof(ULONG);
771 for (lpBstr = (BSTR*)psa->pvData; ulCellCount; ulCellCount--, lpBstr++)
772 size = BSTR_UserSize(pFlags, size, lpBstr);
779 FIXME("size interfaces\n");
785 for (lpVariant = (VARIANT*)psa->pvData; ulCellCount; ulCellCount--, lpVariant++)
786 size = VARIANT_UserSize(pFlags, size, lpVariant);
792 IRecordInfo* pRecInfo = NULL;
794 hr = SafeArrayGetRecordInfo(psa, &pRecInfo);
796 RpcRaiseException(hr);
800 FIXME("size record info %p\n", pRecInfo);
802 IRecordInfo_Release(pRecInfo);
807 ALIGN_LENGTH(size, 7);
812 size += ulCellCount * psa->cbElements;
823 unsigned char * WINAPI LPSAFEARRAY_UserMarshal(ULONG *pFlags, unsigned char *Buffer, LPSAFEARRAY *ppsa)
827 TRACE("("); dump_user_flags(pFlags); TRACE(", %p, &%p\n", Buffer, *ppsa);
829 ALIGN_POINTER(Buffer, 3);
830 *(ULONG_PTR *)Buffer = *ppsa ? TRUE : FALSE;
831 Buffer += sizeof(ULONG_PTR);
835 SAFEARRAY *psa = *ppsa;
836 ULONG ulCellCount = SAFEARRAY_GetCellCount(psa);
837 wireSAFEARRAY wiresa;
841 *(ULONG *)Buffer = psa->cDims;
842 Buffer += sizeof(ULONG);
843 wiresa = (wireSAFEARRAY)Buffer;
844 wiresa->cDims = psa->cDims;
845 wiresa->fFeatures = psa->fFeatures;
846 wiresa->cbElements = psa->cbElements;
848 hr = SafeArrayGetVartype(psa, &vt);
850 RpcRaiseException(hr);
851 wiresa->cLocks = (USHORT)psa->cLocks | (vt << 16);
853 Buffer += FIELD_OFFSET(struct _wireSAFEARRAY, uArrayStructs);
855 sftype = SAFEARRAY_GetUnionType(psa);
856 *(ULONG *)Buffer = sftype;
857 Buffer += sizeof(ULONG);
859 *(ULONG *)Buffer = ulCellCount;
860 Buffer += sizeof(ULONG);
861 *(ULONG_PTR *)Buffer = (ULONG_PTR)psa->pvData;
862 Buffer += sizeof(ULONG_PTR);
863 if (sftype == SF_HAVEIID)
865 SafeArrayGetIID(psa, &guid);
866 memcpy(Buffer, &guid, sizeof(guid));
867 Buffer += sizeof(guid);
870 memcpy(Buffer, psa->rgsabound, sizeof(psa->rgsabound[0]) * psa->cDims);
871 Buffer += sizeof(psa->rgsabound[0]) * psa->cDims;
873 *(ULONG *)Buffer = ulCellCount;
874 Buffer += sizeof(ULONG);
884 for (lpBstr = (BSTR*)psa->pvData; ulCellCount; ulCellCount--, lpBstr++)
885 Buffer = BSTR_UserMarshal(pFlags, Buffer, lpBstr);
892 FIXME("marshal interfaces\n");
898 for (lpVariant = (VARIANT*)psa->pvData; ulCellCount; ulCellCount--, lpVariant++)
899 Buffer = VARIANT_UserMarshal(pFlags, Buffer, lpVariant);
905 IRecordInfo* pRecInfo = NULL;
907 hr = SafeArrayGetRecordInfo(psa, &pRecInfo);
909 RpcRaiseException(hr);
913 FIXME("write record info %p\n", pRecInfo);
915 IRecordInfo_Release(pRecInfo);
921 ALIGN_POINTER(Buffer, 7);
926 /* Just copy the data over */
927 memcpy(Buffer, psa->pvData, ulCellCount * psa->cbElements);
928 Buffer += ulCellCount * psa->cbElements;
939 #define FADF_AUTOSETFLAGS (FADF_HAVEIID | FADF_RECORD | FADF_HAVEVARTYPE | \
940 FADF_BSTR | FADF_UNKNOWN | FADF_DISPATCH | \
941 FADF_VARIANT | FADF_CREATEVECTOR)
943 unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, LPSAFEARRAY *ppsa)
946 wireSAFEARRAY wiresa;
953 SAFEARRAYBOUND *wiresab;
955 TRACE("("); dump_user_flags(pFlags); TRACE(", %p, %p\n", Buffer, ppsa);
957 ALIGN_POINTER(Buffer, 3);
958 ptr = *(ULONG_PTR *)Buffer;
959 Buffer += sizeof(ULONG_PTR);
965 TRACE("NULL safe array unmarshaled\n");
970 cDims = *(ULONG *)Buffer;
971 Buffer += sizeof(ULONG);
973 wiresa = (wireSAFEARRAY)Buffer;
974 Buffer += FIELD_OFFSET(struct _wireSAFEARRAY, uArrayStructs);
976 if (cDims != wiresa->cDims)
977 RpcRaiseException(RPC_S_INVALID_BOUND);
979 /* FIXME: there should be a limit on how large cDims can be */
981 vt = HIWORD(wiresa->cLocks);
983 sftype = *(ULONG *)Buffer;
984 Buffer += sizeof(ULONG);
986 cell_count = *(ULONG *)Buffer;
987 Buffer += sizeof(ULONG);
988 ptr = *(ULONG_PTR *)Buffer;
989 Buffer += sizeof(ULONG_PTR);
990 if (sftype == SF_HAVEIID)
992 memcpy(&guid, Buffer, sizeof(guid));
993 Buffer += sizeof(guid);
996 wiresab = (SAFEARRAYBOUND *)Buffer;
997 Buffer += sizeof(wiresab[0]) * wiresa->cDims;
999 *ppsa = SafeArrayCreateEx(vt, wiresa->cDims, wiresab, NULL);
1001 RpcRaiseException(E_OUTOFMEMORY);
1003 /* be careful about which flags we set since they could be a security
1005 (*ppsa)->fFeatures &= FADF_AUTOSETFLAGS;
1006 (*ppsa)->fFeatures |= (wiresa->fFeatures & ~(FADF_AUTOSETFLAGS));
1007 /* FIXME: there should be a limit on how large wiresa->cbElements can be */
1008 (*ppsa)->cbElements = wiresa->cbElements;
1009 (*ppsa)->cLocks = LOWORD(wiresa->cLocks);
1011 hr = SafeArrayAllocData(*ppsa);
1013 RpcRaiseException(hr);
1015 if ((*(ULONG *)Buffer != cell_count) || (SAFEARRAY_GetCellCount(*ppsa) != cell_count))
1016 RpcRaiseException(RPC_S_INVALID_BOUND);
1017 Buffer += sizeof(ULONG);
1027 for (lpBstr = (BSTR*)(*ppsa)->pvData; cell_count; cell_count--, lpBstr++)
1028 Buffer = BSTR_UserUnmarshal(pFlags, Buffer, lpBstr);
1035 FIXME("marshal interfaces\n");
1041 for (lpVariant = (VARIANT*)(*ppsa)->pvData; cell_count; cell_count--, lpVariant++)
1042 Buffer = VARIANT_UserUnmarshal(pFlags, Buffer, lpVariant);
1048 FIXME("set record info\n");
1054 ALIGN_POINTER(Buffer, 7);
1059 /* Just copy the data over */
1060 memcpy((*ppsa)->pvData, Buffer, cell_count * (*ppsa)->cbElements);
1061 Buffer += cell_count * (*ppsa)->cbElements;
1068 TRACE("safe array unmarshaled: %p\n", *ppsa);
1073 void WINAPI LPSAFEARRAY_UserFree(ULONG *pFlags, LPSAFEARRAY *ppsa)
1075 TRACE("("); dump_user_flags(pFlags); TRACE(", &%p\n", *ppsa);
1077 SafeArrayDestroy(*ppsa);
1081 /* exactly how Invoke is marshalled is not very clear to me yet,
1082 * but the way I've done it seems to work for me */
1084 HRESULT CALLBACK IDispatch_Invoke_Proxy(
1086 DISPID dispIdMember,
1090 DISPPARAMS* pDispParams,
1091 VARIANT* pVarResult,
1092 EXCEPINFO* pExcepInfo,
1097 UINT* rgVarRefIdx = NULL;
1098 VARIANTARG* rgVarRef = NULL;
1101 EXCEPINFO ExcepInfo;
1103 TRACE("(%p)->(%d,%s,%x,%x,%p,%p,%p,%p)\n", This,
1104 dispIdMember, debugstr_guid(riid),
1105 lcid, wFlags, pDispParams, pVarResult,
1106 pExcepInfo, puArgErr);
1108 /* [out] args can't be null, use dummy vars if needed */
1109 if (!pVarResult) pVarResult = &VarResult;
1110 if (!puArgErr) puArgErr = &uArgErr;
1111 if (!pExcepInfo) pExcepInfo = &ExcepInfo;
1113 /* count by-ref args */
1114 for (cVarRef=0,u=0; u<pDispParams->cArgs; u++) {
1115 VARIANTARG* arg = &pDispParams->rgvarg[u];
1116 if (V_ISBYREF(arg)) {
1121 rgVarRefIdx = CoTaskMemAlloc(sizeof(UINT)*cVarRef);
1122 rgVarRef = CoTaskMemAlloc(sizeof(VARIANTARG)*cVarRef);
1123 /* make list of by-ref args */
1124 for (cVarRef=0,u=0; u<pDispParams->cArgs; u++) {
1125 VARIANTARG* arg = &pDispParams->rgvarg[u];
1126 if (V_ISBYREF(arg)) {
1127 rgVarRefIdx[cVarRef] = u;
1128 VariantInit(&rgVarRef[cVarRef]);
1133 /* [out] args still can't be null,
1134 * but we can point these anywhere in this case,
1135 * since they won't be written to when cVarRef is 0 */
1136 rgVarRefIdx = puArgErr;
1137 rgVarRef = pVarResult;
1139 TRACE("passed by ref: %d args\n", cVarRef);
1140 hr = IDispatch_RemoteInvoke_Proxy(This,
1153 for (u=0; u<cVarRef; u++) {
1154 unsigned i = rgVarRefIdx[u];
1155 VariantCopy(&pDispParams->rgvarg[i],
1157 VariantClear(&rgVarRef[u]);
1159 CoTaskMemFree(rgVarRef);
1160 CoTaskMemFree(rgVarRefIdx);
1163 if(pExcepInfo == &ExcepInfo)
1165 SysFreeString(pExcepInfo->bstrSource);
1166 SysFreeString(pExcepInfo->bstrDescription);
1167 SysFreeString(pExcepInfo->bstrHelpFile);
1172 HRESULT __RPC_STUB IDispatch_Invoke_Stub(
1174 DISPID dispIdMember,
1178 DISPPARAMS* pDispParams,
1179 VARIANT* pVarResult,
1180 EXCEPINFO* pExcepInfo,
1184 VARIANTARG* rgVarRef)
1187 VARIANTARG *rgvarg, *arg;
1190 /* initialize out parameters, so that they can be marshalled
1191 * in case the real Invoke doesn't initialize them */
1192 VariantInit(pVarResult);
1193 memset(pExcepInfo, 0, sizeof(*pExcepInfo));
1196 /* let the real Invoke operate on a copy of the in parameters,
1197 * so we don't risk losing pointers to allocated memory */
1198 rgvarg = pDispParams->rgvarg;
1199 arg = CoTaskMemAlloc(sizeof(VARIANTARG)*pDispParams->cArgs);
1200 if (!arg) return E_OUTOFMEMORY;
1202 /* init all args so we can call VariantClear on all the args if the copy
1204 for (u = 0; u < pDispParams->cArgs; u++)
1205 VariantInit(&arg[u]);
1207 for (u = 0; u < pDispParams->cArgs; u++) {
1208 hr = VariantCopy(&arg[u], &rgvarg[u]);
1213 if (SUCCEEDED(hr)) {
1214 pDispParams->rgvarg = arg;
1216 hr = IDispatch_Invoke(This,
1226 /* copy ref args to out list */
1227 for (u=0; u<cVarRef; u++) {
1228 unsigned i = rgVarRefIdx[u];
1229 VariantInit(&rgVarRef[u]);
1230 VariantCopy(&rgVarRef[u], &arg[i]);
1231 /* clear original if equal, to avoid double-free */
1232 if (V_BYREF(&rgVarRef[u]) == V_BYREF(&rgvarg[i]))
1233 VariantClear(&rgvarg[i]);
1237 /* clear the duplicate argument list */
1238 for (u=0; u<pDispParams->cArgs; u++)
1239 VariantClear(&arg[u]);
1241 pDispParams->rgvarg = rgvarg;
1249 HRESULT CALLBACK IEnumVARIANT_Next_Proxy(
1253 ULONG* pCeltFetched)
1257 pCeltFetched = &fetched;
1258 return IEnumVARIANT_RemoteNext_Proxy(This,
1264 HRESULT __RPC_STUB IEnumVARIANT_Next_Stub(
1268 ULONG* pCeltFetched)
1272 hr = IEnumVARIANT_Next(This,
1276 if (hr == S_OK) *pCeltFetched = celt;
1280 /* TypeInfo related freers */
1282 static void free_embedded_typedesc(TYPEDESC *tdesc);
1283 static void free_embedded_arraydesc(ARRAYDESC *adesc)
1285 switch(adesc->tdescElem.vt)
1289 free_embedded_typedesc(adesc->tdescElem.u.lptdesc);
1290 CoTaskMemFree(adesc->tdescElem.u.lptdesc);
1293 free_embedded_arraydesc(adesc->tdescElem.u.lpadesc);
1294 CoTaskMemFree(adesc->tdescElem.u.lpadesc);
1299 static void free_embedded_typedesc(TYPEDESC *tdesc)
1305 free_embedded_typedesc(tdesc->u.lptdesc);
1306 CoTaskMemFree(tdesc->u.lptdesc);
1309 free_embedded_arraydesc(tdesc->u.lpadesc);
1310 CoTaskMemFree(tdesc->u.lpadesc);
1315 static void free_embedded_elemdesc(ELEMDESC *edesc)
1317 free_embedded_typedesc(&edesc->tdesc);
1318 if(edesc->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
1319 CoTaskMemFree(edesc->u.paramdesc.pparamdescex);
1324 HRESULT CALLBACK ITypeComp_Bind_Proxy(
1329 ITypeInfo** ppTInfo,
1330 DESCKIND* pDescKind,
1333 FIXME("not implemented\n");
1337 HRESULT __RPC_STUB ITypeComp_Bind_Stub(
1342 ITypeInfo** ppTInfo,
1343 DESCKIND* pDescKind,
1344 LPFUNCDESC* ppFuncDesc,
1345 LPVARDESC* ppVarDesc,
1346 ITypeComp** ppTypeComp,
1347 CLEANLOCALSTORAGE* pDummy)
1349 FIXME("not implemented\n");
1353 HRESULT CALLBACK ITypeComp_BindType_Proxy(
1357 ITypeInfo** ppTInfo,
1358 ITypeComp** ppTComp)
1360 FIXME("not implemented\n");
1364 HRESULT __RPC_STUB ITypeComp_BindType_Stub(
1368 ITypeInfo** ppTInfo)
1370 FIXME("not implemented\n");
1376 HRESULT CALLBACK ITypeInfo_GetTypeAttr_Proxy(
1378 TYPEATTR** ppTypeAttr)
1381 CLEANLOCALSTORAGE stg;
1382 TRACE("(%p, %p)\n", This, ppTypeAttr);
1385 stg.pStorage = NULL;
1386 stg.pInterface = NULL;
1388 return ITypeInfo_RemoteGetTypeAttr_Proxy(This, ppTypeAttr, &stg);
1391 HRESULT __RPC_STUB ITypeInfo_GetTypeAttr_Stub(
1393 LPTYPEATTR* ppTypeAttr,
1394 CLEANLOCALSTORAGE* pDummy)
1397 TRACE("(%p, %p)\n", This, ppTypeAttr);
1399 hr = ITypeInfo_GetTypeAttr(This, ppTypeAttr);
1403 pDummy->flags = CLS_TYPEATTR;
1404 ITypeInfo_AddRef(This);
1405 pDummy->pInterface = (IUnknown*)This;
1406 pDummy->pStorage = ppTypeAttr;
1410 HRESULT CALLBACK ITypeInfo_GetFuncDesc_Proxy(
1413 FUNCDESC** ppFuncDesc)
1415 CLEANLOCALSTORAGE stg;
1416 TRACE("(%p, %d, %p)\n", This, index, ppFuncDesc);
1419 stg.pStorage = NULL;
1420 stg.pInterface = NULL;
1422 return ITypeInfo_RemoteGetFuncDesc_Proxy(This, index, ppFuncDesc, &stg);
1425 HRESULT __RPC_STUB ITypeInfo_GetFuncDesc_Stub(
1428 LPFUNCDESC* ppFuncDesc,
1429 CLEANLOCALSTORAGE* pDummy)
1432 TRACE("(%p, %d, %p)\n", This, index, ppFuncDesc);
1434 hr = ITypeInfo_GetFuncDesc(This, index, ppFuncDesc);
1438 pDummy->flags = CLS_FUNCDESC;
1439 ITypeInfo_AddRef(This);
1440 pDummy->pInterface = (IUnknown*)This;
1441 pDummy->pStorage = ppFuncDesc;
1445 HRESULT CALLBACK ITypeInfo_GetVarDesc_Proxy(
1448 VARDESC** ppVarDesc)
1450 CLEANLOCALSTORAGE stg;
1451 TRACE("(%p, %d, %p)\n", This, index, ppVarDesc);
1454 stg.pStorage = NULL;
1455 stg.pInterface = NULL;
1457 return ITypeInfo_RemoteGetVarDesc_Proxy(This, index, ppVarDesc, &stg);
1460 HRESULT __RPC_STUB ITypeInfo_GetVarDesc_Stub(
1463 LPVARDESC* ppVarDesc,
1464 CLEANLOCALSTORAGE* pDummy)
1467 TRACE("(%p, %d, %p)\n", This, index, ppVarDesc);
1469 hr = ITypeInfo_GetVarDesc(This, index, ppVarDesc);
1473 pDummy->flags = CLS_VARDESC;
1474 ITypeInfo_AddRef(This);
1475 pDummy->pInterface = (IUnknown*)This;
1476 pDummy->pStorage = ppVarDesc;
1480 HRESULT CALLBACK ITypeInfo_GetNames_Proxy(
1487 FIXME("not implemented\n");
1491 HRESULT __RPC_STUB ITypeInfo_GetNames_Stub(
1498 FIXME("not implemented\n");
1502 HRESULT CALLBACK ITypeInfo_GetIDsOfNames_Proxy(
1504 LPOLESTR* rgszNames,
1508 FIXME("not implemented\n");
1512 HRESULT __RPC_STUB ITypeInfo_GetIDsOfNames_Stub(
1515 FIXME("not implemented\n");
1519 HRESULT CALLBACK ITypeInfo_Invoke_Proxy(
1524 DISPPARAMS* pDispParams,
1525 VARIANT* pVarResult,
1526 EXCEPINFO* pExcepInfo,
1529 FIXME("not implemented\n");
1533 HRESULT __RPC_STUB ITypeInfo_Invoke_Stub(
1536 FIXME("not implemented\n");
1540 HRESULT CALLBACK ITypeInfo_GetDocumentation_Proxy(
1544 BSTR* pBstrDocString,
1545 DWORD* pdwHelpContext,
1546 BSTR* pBstrHelpFile)
1549 BSTR name, doc_string, help_file;
1551 TRACE("(%p, %08x, %p, %p, %p, %p)\n", This, memid, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
1553 /* FIXME: presumably refPtrFlags is supposed to be a bitmask of which ptrs we actually want? */
1554 hr = ITypeInfo_RemoteGetDocumentation_Proxy(This, memid, 0, &name, &doc_string, &help_context, &help_file);
1557 if(pBstrName) *pBstrName = name;
1558 else SysFreeString(name);
1560 if(pBstrDocString) *pBstrDocString = doc_string;
1561 else SysFreeString(doc_string);
1563 if(pBstrHelpFile) *pBstrHelpFile = help_file;
1564 else SysFreeString(help_file);
1566 if(pdwHelpContext) *pdwHelpContext = help_context;
1571 HRESULT __RPC_STUB ITypeInfo_GetDocumentation_Stub(
1576 BSTR* pBstrDocString,
1577 DWORD* pdwHelpContext,
1578 BSTR* pBstrHelpFile)
1580 TRACE("(%p, %08x, %08x, %p, %p, %p, %p)\n", This, memid, refPtrFlags, pBstrName, pBstrDocString,
1581 pdwHelpContext, pBstrHelpFile);
1582 return ITypeInfo_GetDocumentation(This, memid, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
1585 HRESULT CALLBACK ITypeInfo_GetDllEntry_Proxy(
1593 FIXME("not implemented\n");
1597 HRESULT __RPC_STUB ITypeInfo_GetDllEntry_Stub(
1606 FIXME("not implemented\n");
1610 HRESULT CALLBACK ITypeInfo_AddressOfMember_Proxy(
1616 FIXME("not implemented\n");
1620 HRESULT __RPC_STUB ITypeInfo_AddressOfMember_Stub(
1623 FIXME("not implemented\n");
1627 HRESULT CALLBACK ITypeInfo_CreateInstance_Proxy(
1629 IUnknown* pUnkOuter,
1633 FIXME("not implemented\n");
1637 HRESULT __RPC_STUB ITypeInfo_CreateInstance_Stub(
1642 FIXME("not implemented\n");
1646 HRESULT CALLBACK ITypeInfo_GetContainingTypeLib_Proxy(
1655 TRACE("(%p, %p, %p)\n", This, ppTLib, pIndex );
1657 hr = ITypeInfo_RemoteGetContainingTypeLib_Proxy(This, &pTL, &index);
1666 ITypeLib_Release(pTL);
1671 HRESULT __RPC_STUB ITypeInfo_GetContainingTypeLib_Stub(
1676 TRACE("(%p, %p, %p)\n", This, ppTLib, pIndex );
1677 return ITypeInfo_GetContainingTypeLib(This, ppTLib, pIndex);
1680 void CALLBACK ITypeInfo_ReleaseTypeAttr_Proxy(
1682 TYPEATTR* pTypeAttr)
1684 TRACE("(%p, %p)\n", This, pTypeAttr);
1685 free_embedded_typedesc(&pTypeAttr->tdescAlias);
1686 CoTaskMemFree(pTypeAttr);
1689 HRESULT __RPC_STUB ITypeInfo_ReleaseTypeAttr_Stub(
1692 TRACE("nothing to do\n");
1696 void CALLBACK ITypeInfo_ReleaseFuncDesc_Proxy(
1698 FUNCDESC* pFuncDesc)
1701 TRACE("(%p, %p)\n", This, pFuncDesc);
1703 for(param = 0; param < pFuncDesc->cParams; param++)
1704 free_embedded_elemdesc(pFuncDesc->lprgelemdescParam + param);
1706 CoTaskMemFree(pFuncDesc->lprgelemdescParam);
1708 free_embedded_elemdesc(&pFuncDesc->elemdescFunc);
1710 if(pFuncDesc->cScodes != 0 && pFuncDesc->cScodes != -1)
1711 CoTaskMemFree(pFuncDesc->lprgscode);
1713 CoTaskMemFree(pFuncDesc);
1716 HRESULT __RPC_STUB ITypeInfo_ReleaseFuncDesc_Stub(
1719 TRACE("nothing to do\n");
1723 void CALLBACK ITypeInfo_ReleaseVarDesc_Proxy(
1727 TRACE("(%p, %p)\n", This, pVarDesc);
1729 CoTaskMemFree(pVarDesc->lpstrSchema);
1731 if(pVarDesc->varkind == VAR_CONST)
1732 CoTaskMemFree(pVarDesc->u.lpvarValue);
1734 free_embedded_elemdesc(&pVarDesc->elemdescVar);
1735 CoTaskMemFree(pVarDesc);
1738 HRESULT __RPC_STUB ITypeInfo_ReleaseVarDesc_Stub(
1741 TRACE("nothing to do\n");
1748 HRESULT CALLBACK ITypeInfo2_GetDocumentation2_Proxy(
1752 BSTR* pbstrHelpString,
1753 DWORD* pdwHelpStringContext,
1754 BSTR* pbstrHelpStringDll)
1756 FIXME("not implemented\n");
1760 HRESULT __RPC_STUB ITypeInfo2_GetDocumentation2_Stub(
1765 BSTR* pbstrHelpString,
1766 DWORD* pdwHelpStringContext,
1767 BSTR* pbstrHelpStringDll)
1769 FIXME("not implemented\n");
1775 UINT CALLBACK ITypeLib_GetTypeInfoCount_Proxy(
1779 TRACE("(%p)\n", This);
1781 ITypeLib_RemoteGetTypeInfoCount_Proxy(This, &count);
1786 HRESULT __RPC_STUB ITypeLib_GetTypeInfoCount_Stub(
1790 TRACE("(%p, %p)\n", This, pcTInfo);
1791 *pcTInfo = ITypeLib_GetTypeInfoCount(This);
1795 HRESULT CALLBACK ITypeLib_GetLibAttr_Proxy(
1797 TLIBATTR** ppTLibAttr)
1799 CLEANLOCALSTORAGE stg;
1800 TRACE("(%p, %p)\n", This, ppTLibAttr);
1803 stg.pStorage = NULL;
1804 stg.pInterface = NULL;
1806 return ITypeLib_RemoteGetLibAttr_Proxy(This, ppTLibAttr, &stg);
1809 HRESULT __RPC_STUB ITypeLib_GetLibAttr_Stub(
1811 LPTLIBATTR* ppTLibAttr,
1812 CLEANLOCALSTORAGE* pDummy)
1815 TRACE("(%p, %p)\n", This, ppTLibAttr);
1817 hr = ITypeLib_GetLibAttr(This, ppTLibAttr);
1821 pDummy->flags = CLS_LIBATTR;
1822 ITypeLib_AddRef(This);
1823 pDummy->pInterface = (IUnknown*)This;
1824 pDummy->pStorage = ppTLibAttr;
1828 HRESULT CALLBACK ITypeLib_GetDocumentation_Proxy(
1832 BSTR* pBstrDocString,
1833 DWORD* pdwHelpContext,
1834 BSTR* pBstrHelpFile)
1836 FIXME("not implemented\n");
1840 HRESULT __RPC_STUB ITypeLib_GetDocumentation_Stub(
1845 BSTR* pBstrDocString,
1846 DWORD* pdwHelpContext,
1847 BSTR* pBstrHelpFile)
1849 FIXME("not implemented\n");
1853 HRESULT CALLBACK ITypeLib_IsName_Proxy(
1859 FIXME("not implemented\n");
1863 HRESULT __RPC_STUB ITypeLib_IsName_Stub(
1870 FIXME("not implemented\n");
1874 HRESULT CALLBACK ITypeLib_FindName_Proxy(
1878 ITypeInfo** ppTInfo,
1882 FIXME("not implemented\n");
1886 HRESULT __RPC_STUB ITypeLib_FindName_Stub(
1890 ITypeInfo** ppTInfo,
1895 FIXME("not implemented\n");
1899 void CALLBACK ITypeLib_ReleaseTLibAttr_Proxy(
1901 TLIBATTR* pTLibAttr)
1903 TRACE("(%p, %p)\n", This, pTLibAttr);
1904 CoTaskMemFree(pTLibAttr);
1907 HRESULT __RPC_STUB ITypeLib_ReleaseTLibAttr_Stub(
1910 TRACE("nothing to do\n");
1917 HRESULT CALLBACK ITypeLib2_GetLibStatistics_Proxy(
1919 ULONG* pcUniqueNames,
1920 ULONG* pcchUniqueNames)
1922 FIXME("not implemented\n");
1926 HRESULT __RPC_STUB ITypeLib2_GetLibStatistics_Stub(
1928 ULONG* pcUniqueNames,
1929 ULONG* pcchUniqueNames)
1931 FIXME("not implemented\n");
1935 HRESULT CALLBACK ITypeLib2_GetDocumentation2_Proxy(
1939 BSTR* pbstrHelpString,
1940 DWORD* pdwHelpStringContext,
1941 BSTR* pbstrHelpStringDll)
1943 FIXME("not implemented\n");
1947 HRESULT __RPC_STUB ITypeLib2_GetDocumentation2_Stub(
1952 BSTR* pbstrHelpString,
1953 DWORD* pdwHelpStringContext,
1954 BSTR* pbstrHelpStringDll)
1956 FIXME("not implemented\n");