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 static 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("(%x,%d,%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 %d\n", Start);
155 unsigned char * WINAPI BSTR_UserMarshal(ULONG *pFlags, unsigned char *Buffer, BSTR *pstr)
158 DWORD len = SysStringByteLen(*pstr);
160 TRACE("(%x,%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("(%x,%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("(%x,%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=%d, 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=%d, 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("(%x,%d,%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 %d\n", Start);
450 unsigned char * WINAPI VARIANT_UserMarshal(ULONG *pFlags, unsigned char *Buffer, VARIANT *pvar)
452 variant_wire_t *header;
457 TRACE("(%x,%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("(%x,%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("(%x,%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);
700 switch(psa->cbElements)
702 case 1: vt = VT_I1; break;
703 case 2: vt = VT_I2; break;
704 case 4: vt = VT_I4; break;
705 case 8: vt = VT_I8; break;
707 RpcRaiseException(hr);
711 if (psa->fFeatures & FADF_HAVEIID)
717 case VT_UI1: return SF_I1;
720 case VT_UI2: return SF_I2;
725 case VT_R4: return SF_I4;
730 case VT_UI8: return SF_I8;
732 case VT_UINT_PTR: return (sizeof(UINT_PTR) == 4 ? SF_I4 : SF_I8);
733 case VT_BSTR: return SF_BSTR;
734 case VT_DISPATCH: return SF_DISPATCH;
735 case VT_VARIANT: return SF_VARIANT;
736 case VT_UNKNOWN: return SF_UNKNOWN;
737 /* Note: Return a non-zero size to indicate vt is valid. The actual size
738 * of a UDT is taken from the result of IRecordInfo_GetSize().
740 case VT_RECORD: return SF_RECORD;
741 default: return SF_ERROR;
745 ULONG WINAPI LPSAFEARRAY_UserSize(ULONG *pFlags, ULONG StartingSize, LPSAFEARRAY *ppsa)
747 ULONG size = StartingSize;
749 TRACE("("); dump_user_flags(pFlags); TRACE(", %d, %p\n", StartingSize, *ppsa);
751 ALIGN_LENGTH(size, 3);
752 size += sizeof(ULONG_PTR);
755 SAFEARRAY *psa = *ppsa;
756 ULONG ulCellCount = SAFEARRAY_GetCellCount(psa);
760 size += sizeof(ULONG);
761 size += FIELD_OFFSET(struct _wireSAFEARRAY, uArrayStructs);
763 sftype = SAFEARRAY_GetUnionType(psa);
764 size += sizeof(ULONG);
766 size += sizeof(ULONG);
767 size += sizeof(ULONG_PTR);
768 if (sftype == SF_HAVEIID)
771 size += sizeof(psa->rgsabound[0]) * psa->cDims;
773 size += sizeof(ULONG);
781 for (lpBstr = (BSTR*)psa->pvData; ulCellCount; ulCellCount--, lpBstr++)
782 size = BSTR_UserSize(pFlags, size, lpBstr);
789 FIXME("size interfaces\n");
795 for (lpVariant = (VARIANT*)psa->pvData; ulCellCount; ulCellCount--, lpVariant++)
796 size = VARIANT_UserSize(pFlags, size, lpVariant);
802 IRecordInfo* pRecInfo = NULL;
804 hr = SafeArrayGetRecordInfo(psa, &pRecInfo);
806 RpcRaiseException(hr);
810 FIXME("size record info %p\n", pRecInfo);
812 IRecordInfo_Release(pRecInfo);
817 ALIGN_LENGTH(size, 7);
822 size += ulCellCount * psa->cbElements;
833 unsigned char * WINAPI LPSAFEARRAY_UserMarshal(ULONG *pFlags, unsigned char *Buffer, LPSAFEARRAY *ppsa)
837 TRACE("("); dump_user_flags(pFlags); TRACE(", %p, &%p\n", Buffer, *ppsa);
839 ALIGN_POINTER(Buffer, 3);
840 *(ULONG_PTR *)Buffer = *ppsa ? TRUE : FALSE;
841 Buffer += sizeof(ULONG_PTR);
845 SAFEARRAY *psa = *ppsa;
846 ULONG ulCellCount = SAFEARRAY_GetCellCount(psa);
847 wireSAFEARRAY wiresa;
851 *(ULONG *)Buffer = psa->cDims;
852 Buffer += sizeof(ULONG);
853 wiresa = (wireSAFEARRAY)Buffer;
854 wiresa->cDims = psa->cDims;
855 wiresa->fFeatures = psa->fFeatures;
856 wiresa->cbElements = psa->cbElements;
858 hr = SafeArrayGetVartype(psa, &vt);
859 if (FAILED(hr)) vt = 0;
861 wiresa->cLocks = (USHORT)psa->cLocks | (vt << 16);
863 Buffer += FIELD_OFFSET(struct _wireSAFEARRAY, uArrayStructs);
865 sftype = SAFEARRAY_GetUnionType(psa);
866 *(ULONG *)Buffer = sftype;
867 Buffer += sizeof(ULONG);
869 *(ULONG *)Buffer = ulCellCount;
870 Buffer += sizeof(ULONG);
871 *(ULONG_PTR *)Buffer = (ULONG_PTR)psa->pvData;
872 Buffer += sizeof(ULONG_PTR);
873 if (sftype == SF_HAVEIID)
875 SafeArrayGetIID(psa, &guid);
876 memcpy(Buffer, &guid, sizeof(guid));
877 Buffer += sizeof(guid);
880 memcpy(Buffer, psa->rgsabound, sizeof(psa->rgsabound[0]) * psa->cDims);
881 Buffer += sizeof(psa->rgsabound[0]) * psa->cDims;
883 *(ULONG *)Buffer = ulCellCount;
884 Buffer += sizeof(ULONG);
894 for (lpBstr = (BSTR*)psa->pvData; ulCellCount; ulCellCount--, lpBstr++)
895 Buffer = BSTR_UserMarshal(pFlags, Buffer, lpBstr);
902 FIXME("marshal interfaces\n");
908 for (lpVariant = (VARIANT*)psa->pvData; ulCellCount; ulCellCount--, lpVariant++)
909 Buffer = VARIANT_UserMarshal(pFlags, Buffer, lpVariant);
915 IRecordInfo* pRecInfo = NULL;
917 hr = SafeArrayGetRecordInfo(psa, &pRecInfo);
919 RpcRaiseException(hr);
923 FIXME("write record info %p\n", pRecInfo);
925 IRecordInfo_Release(pRecInfo);
931 ALIGN_POINTER(Buffer, 7);
936 /* Just copy the data over */
937 memcpy(Buffer, psa->pvData, ulCellCount * psa->cbElements);
938 Buffer += ulCellCount * psa->cbElements;
949 #define FADF_AUTOSETFLAGS (FADF_HAVEIID | FADF_RECORD | FADF_HAVEVARTYPE | \
950 FADF_BSTR | FADF_UNKNOWN | FADF_DISPATCH | \
951 FADF_VARIANT | FADF_CREATEVECTOR)
953 unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, LPSAFEARRAY *ppsa)
956 wireSAFEARRAY wiresa;
963 SAFEARRAYBOUND *wiresab;
965 TRACE("("); dump_user_flags(pFlags); TRACE(", %p, %p\n", Buffer, ppsa);
967 ALIGN_POINTER(Buffer, 3);
968 ptr = *(ULONG_PTR *)Buffer;
969 Buffer += sizeof(ULONG_PTR);
975 TRACE("NULL safe array unmarshaled\n");
980 cDims = *(ULONG *)Buffer;
981 Buffer += sizeof(ULONG);
983 wiresa = (wireSAFEARRAY)Buffer;
984 Buffer += FIELD_OFFSET(struct _wireSAFEARRAY, uArrayStructs);
986 if (cDims != wiresa->cDims)
987 RpcRaiseException(RPC_S_INVALID_BOUND);
989 /* FIXME: there should be a limit on how large cDims can be */
991 vt = HIWORD(wiresa->cLocks);
993 sftype = *(ULONG *)Buffer;
994 Buffer += sizeof(ULONG);
996 cell_count = *(ULONG *)Buffer;
997 Buffer += sizeof(ULONG);
998 ptr = *(ULONG_PTR *)Buffer;
999 Buffer += sizeof(ULONG_PTR);
1000 if (sftype == SF_HAVEIID)
1002 memcpy(&guid, Buffer, sizeof(guid));
1003 Buffer += sizeof(guid);
1006 wiresab = (SAFEARRAYBOUND *)Buffer;
1007 Buffer += sizeof(wiresab[0]) * wiresa->cDims;
1010 *ppsa = SafeArrayCreateEx(vt, wiresa->cDims, wiresab, NULL);
1013 SafeArrayAllocDescriptor(wiresa->cDims, ppsa);
1015 memcpy((*ppsa)->rgsabound, wiresab, sizeof(SAFEARRAYBOUND) * wiresa->cDims);
1018 RpcRaiseException(E_OUTOFMEMORY);
1020 /* be careful about which flags we set since they could be a security
1022 (*ppsa)->fFeatures &= FADF_AUTOSETFLAGS;
1023 (*ppsa)->fFeatures |= (wiresa->fFeatures & ~(FADF_AUTOSETFLAGS));
1024 /* FIXME: there should be a limit on how large wiresa->cbElements can be */
1025 (*ppsa)->cbElements = wiresa->cbElements;
1026 (*ppsa)->cLocks = LOWORD(wiresa->cLocks);
1028 hr = SafeArrayAllocData(*ppsa);
1030 RpcRaiseException(hr);
1032 if ((*(ULONG *)Buffer != cell_count) || (SAFEARRAY_GetCellCount(*ppsa) != cell_count))
1033 RpcRaiseException(RPC_S_INVALID_BOUND);
1034 Buffer += sizeof(ULONG);
1044 for (lpBstr = (BSTR*)(*ppsa)->pvData; cell_count; cell_count--, lpBstr++)
1045 Buffer = BSTR_UserUnmarshal(pFlags, Buffer, lpBstr);
1052 FIXME("marshal interfaces\n");
1058 for (lpVariant = (VARIANT*)(*ppsa)->pvData; cell_count; cell_count--, lpVariant++)
1059 Buffer = VARIANT_UserUnmarshal(pFlags, Buffer, lpVariant);
1065 FIXME("set record info\n");
1071 ALIGN_POINTER(Buffer, 7);
1076 /* Just copy the data over */
1077 memcpy((*ppsa)->pvData, Buffer, cell_count * (*ppsa)->cbElements);
1078 Buffer += cell_count * (*ppsa)->cbElements;
1085 TRACE("safe array unmarshaled: %p\n", *ppsa);
1090 void WINAPI LPSAFEARRAY_UserFree(ULONG *pFlags, LPSAFEARRAY *ppsa)
1092 TRACE("("); dump_user_flags(pFlags); TRACE(", &%p\n", *ppsa);
1094 SafeArrayDestroy(*ppsa);
1098 /* exactly how Invoke is marshalled is not very clear to me yet,
1099 * but the way I've done it seems to work for me */
1101 HRESULT CALLBACK IDispatch_Invoke_Proxy(
1103 DISPID dispIdMember,
1107 DISPPARAMS* pDispParams,
1108 VARIANT* pVarResult,
1109 EXCEPINFO* pExcepInfo,
1114 UINT* rgVarRefIdx = NULL;
1115 VARIANTARG* rgVarRef = NULL;
1118 EXCEPINFO ExcepInfo;
1120 TRACE("(%p)->(%d,%s,%x,%x,%p,%p,%p,%p)\n", This,
1121 dispIdMember, debugstr_guid(riid),
1122 lcid, wFlags, pDispParams, pVarResult,
1123 pExcepInfo, puArgErr);
1125 /* [out] args can't be null, use dummy vars if needed */
1126 if (!pVarResult) pVarResult = &VarResult;
1127 if (!puArgErr) puArgErr = &uArgErr;
1128 if (!pExcepInfo) pExcepInfo = &ExcepInfo;
1130 /* count by-ref args */
1131 for (cVarRef=0,u=0; u<pDispParams->cArgs; u++) {
1132 VARIANTARG* arg = &pDispParams->rgvarg[u];
1133 if (V_ISBYREF(arg)) {
1138 rgVarRefIdx = CoTaskMemAlloc(sizeof(UINT)*cVarRef);
1139 rgVarRef = CoTaskMemAlloc(sizeof(VARIANTARG)*cVarRef);
1140 /* make list of by-ref args */
1141 for (cVarRef=0,u=0; u<pDispParams->cArgs; u++) {
1142 VARIANTARG* arg = &pDispParams->rgvarg[u];
1143 if (V_ISBYREF(arg)) {
1144 rgVarRefIdx[cVarRef] = u;
1145 VariantInit(&rgVarRef[cVarRef]);
1150 /* [out] args still can't be null,
1151 * but we can point these anywhere in this case,
1152 * since they won't be written to when cVarRef is 0 */
1153 rgVarRefIdx = puArgErr;
1154 rgVarRef = pVarResult;
1156 TRACE("passed by ref: %d args\n", cVarRef);
1157 hr = IDispatch_RemoteInvoke_Proxy(This,
1170 for (u=0; u<cVarRef; u++) {
1171 unsigned i = rgVarRefIdx[u];
1172 VariantCopy(&pDispParams->rgvarg[i],
1174 VariantClear(&rgVarRef[u]);
1176 CoTaskMemFree(rgVarRef);
1177 CoTaskMemFree(rgVarRefIdx);
1180 if(pExcepInfo == &ExcepInfo)
1182 SysFreeString(pExcepInfo->bstrSource);
1183 SysFreeString(pExcepInfo->bstrDescription);
1184 SysFreeString(pExcepInfo->bstrHelpFile);
1189 HRESULT __RPC_STUB IDispatch_Invoke_Stub(
1191 DISPID dispIdMember,
1195 DISPPARAMS* pDispParams,
1196 VARIANT* pVarResult,
1197 EXCEPINFO* pExcepInfo,
1201 VARIANTARG* rgVarRef)
1204 VARIANTARG *rgvarg, *arg;
1207 /* initialize out parameters, so that they can be marshalled
1208 * in case the real Invoke doesn't initialize them */
1209 VariantInit(pVarResult);
1210 memset(pExcepInfo, 0, sizeof(*pExcepInfo));
1213 /* let the real Invoke operate on a copy of the in parameters,
1214 * so we don't risk losing pointers to allocated memory */
1215 rgvarg = pDispParams->rgvarg;
1216 arg = CoTaskMemAlloc(sizeof(VARIANTARG)*pDispParams->cArgs);
1217 if (!arg) return E_OUTOFMEMORY;
1219 /* init all args so we can call VariantClear on all the args if the copy
1221 for (u = 0; u < pDispParams->cArgs; u++)
1222 VariantInit(&arg[u]);
1224 for (u = 0; u < pDispParams->cArgs; u++) {
1225 hr = VariantCopy(&arg[u], &rgvarg[u]);
1230 if (SUCCEEDED(hr)) {
1231 pDispParams->rgvarg = arg;
1233 hr = IDispatch_Invoke(This,
1243 /* copy ref args to out list */
1244 for (u=0; u<cVarRef; u++) {
1245 unsigned i = rgVarRefIdx[u];
1246 VariantInit(&rgVarRef[u]);
1247 VariantCopy(&rgVarRef[u], &arg[i]);
1248 /* clear original if equal, to avoid double-free */
1249 if (V_BYREF(&rgVarRef[u]) == V_BYREF(&rgvarg[i]))
1250 VariantClear(&rgvarg[i]);
1254 /* clear the duplicate argument list */
1255 for (u=0; u<pDispParams->cArgs; u++)
1256 VariantClear(&arg[u]);
1258 pDispParams->rgvarg = rgvarg;
1266 HRESULT CALLBACK IEnumVARIANT_Next_Proxy(
1270 ULONG* pCeltFetched)
1274 pCeltFetched = &fetched;
1275 return IEnumVARIANT_RemoteNext_Proxy(This,
1281 HRESULT __RPC_STUB IEnumVARIANT_Next_Stub(
1285 ULONG* pCeltFetched)
1289 hr = IEnumVARIANT_Next(This,
1293 if (hr == S_OK) *pCeltFetched = celt;
1297 /* TypeInfo related freers */
1299 static void free_embedded_typedesc(TYPEDESC *tdesc);
1300 static void free_embedded_arraydesc(ARRAYDESC *adesc)
1302 switch(adesc->tdescElem.vt)
1306 free_embedded_typedesc(adesc->tdescElem.u.lptdesc);
1307 CoTaskMemFree(adesc->tdescElem.u.lptdesc);
1310 free_embedded_arraydesc(adesc->tdescElem.u.lpadesc);
1311 CoTaskMemFree(adesc->tdescElem.u.lpadesc);
1316 static void free_embedded_typedesc(TYPEDESC *tdesc)
1322 free_embedded_typedesc(tdesc->u.lptdesc);
1323 CoTaskMemFree(tdesc->u.lptdesc);
1326 free_embedded_arraydesc(tdesc->u.lpadesc);
1327 CoTaskMemFree(tdesc->u.lpadesc);
1332 static void free_embedded_elemdesc(ELEMDESC *edesc)
1334 free_embedded_typedesc(&edesc->tdesc);
1335 if(edesc->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT)
1336 CoTaskMemFree(edesc->u.paramdesc.pparamdescex);
1341 HRESULT CALLBACK ITypeComp_Bind_Proxy(
1346 ITypeInfo** ppTInfo,
1347 DESCKIND* pDescKind,
1350 FIXME("not implemented\n");
1354 HRESULT __RPC_STUB ITypeComp_Bind_Stub(
1359 ITypeInfo** ppTInfo,
1360 DESCKIND* pDescKind,
1361 LPFUNCDESC* ppFuncDesc,
1362 LPVARDESC* ppVarDesc,
1363 ITypeComp** ppTypeComp,
1364 CLEANLOCALSTORAGE* pDummy)
1366 FIXME("not implemented\n");
1370 HRESULT CALLBACK ITypeComp_BindType_Proxy(
1374 ITypeInfo** ppTInfo,
1375 ITypeComp** ppTComp)
1377 FIXME("not implemented\n");
1381 HRESULT __RPC_STUB ITypeComp_BindType_Stub(
1385 ITypeInfo** ppTInfo)
1387 FIXME("not implemented\n");
1393 HRESULT CALLBACK ITypeInfo_GetTypeAttr_Proxy(
1395 TYPEATTR** ppTypeAttr)
1398 CLEANLOCALSTORAGE stg;
1399 TRACE("(%p, %p)\n", This, ppTypeAttr);
1402 stg.pStorage = NULL;
1403 stg.pInterface = NULL;
1405 return ITypeInfo_RemoteGetTypeAttr_Proxy(This, ppTypeAttr, &stg);
1408 HRESULT __RPC_STUB ITypeInfo_GetTypeAttr_Stub(
1410 LPTYPEATTR* ppTypeAttr,
1411 CLEANLOCALSTORAGE* pDummy)
1414 TRACE("(%p, %p)\n", This, ppTypeAttr);
1416 hr = ITypeInfo_GetTypeAttr(This, ppTypeAttr);
1420 pDummy->flags = CLS_TYPEATTR;
1421 ITypeInfo_AddRef(This);
1422 pDummy->pInterface = (IUnknown*)This;
1423 pDummy->pStorage = ppTypeAttr;
1427 HRESULT CALLBACK ITypeInfo_GetFuncDesc_Proxy(
1430 FUNCDESC** ppFuncDesc)
1432 CLEANLOCALSTORAGE stg;
1433 TRACE("(%p, %d, %p)\n", This, index, ppFuncDesc);
1436 stg.pStorage = NULL;
1437 stg.pInterface = NULL;
1439 return ITypeInfo_RemoteGetFuncDesc_Proxy(This, index, ppFuncDesc, &stg);
1442 HRESULT __RPC_STUB ITypeInfo_GetFuncDesc_Stub(
1445 LPFUNCDESC* ppFuncDesc,
1446 CLEANLOCALSTORAGE* pDummy)
1449 TRACE("(%p, %d, %p)\n", This, index, ppFuncDesc);
1451 hr = ITypeInfo_GetFuncDesc(This, index, ppFuncDesc);
1455 pDummy->flags = CLS_FUNCDESC;
1456 ITypeInfo_AddRef(This);
1457 pDummy->pInterface = (IUnknown*)This;
1458 pDummy->pStorage = ppFuncDesc;
1462 HRESULT CALLBACK ITypeInfo_GetVarDesc_Proxy(
1465 VARDESC** ppVarDesc)
1467 CLEANLOCALSTORAGE stg;
1468 TRACE("(%p, %d, %p)\n", This, index, ppVarDesc);
1471 stg.pStorage = NULL;
1472 stg.pInterface = NULL;
1474 return ITypeInfo_RemoteGetVarDesc_Proxy(This, index, ppVarDesc, &stg);
1477 HRESULT __RPC_STUB ITypeInfo_GetVarDesc_Stub(
1480 LPVARDESC* ppVarDesc,
1481 CLEANLOCALSTORAGE* pDummy)
1484 TRACE("(%p, %d, %p)\n", This, index, ppVarDesc);
1486 hr = ITypeInfo_GetVarDesc(This, index, ppVarDesc);
1490 pDummy->flags = CLS_VARDESC;
1491 ITypeInfo_AddRef(This);
1492 pDummy->pInterface = (IUnknown*)This;
1493 pDummy->pStorage = ppVarDesc;
1497 HRESULT CALLBACK ITypeInfo_GetNames_Proxy(
1504 FIXME("not implemented\n");
1508 HRESULT __RPC_STUB ITypeInfo_GetNames_Stub(
1515 FIXME("not implemented\n");
1519 HRESULT CALLBACK ITypeInfo_GetIDsOfNames_Proxy(
1521 LPOLESTR* rgszNames,
1525 FIXME("not implemented\n");
1529 HRESULT __RPC_STUB ITypeInfo_GetIDsOfNames_Stub(
1532 FIXME("not implemented\n");
1536 HRESULT CALLBACK ITypeInfo_Invoke_Proxy(
1541 DISPPARAMS* pDispParams,
1542 VARIANT* pVarResult,
1543 EXCEPINFO* pExcepInfo,
1546 FIXME("not implemented\n");
1550 HRESULT __RPC_STUB ITypeInfo_Invoke_Stub(
1553 FIXME("not implemented\n");
1557 HRESULT CALLBACK ITypeInfo_GetDocumentation_Proxy(
1561 BSTR* pBstrDocString,
1562 DWORD* pdwHelpContext,
1563 BSTR* pBstrHelpFile)
1566 BSTR name, doc_string, help_file;
1568 TRACE("(%p, %08x, %p, %p, %p, %p)\n", This, memid, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
1570 /* FIXME: presumably refPtrFlags is supposed to be a bitmask of which ptrs we actually want? */
1571 hr = ITypeInfo_RemoteGetDocumentation_Proxy(This, memid, 0, &name, &doc_string, &help_context, &help_file);
1574 if(pBstrName) *pBstrName = name;
1575 else SysFreeString(name);
1577 if(pBstrDocString) *pBstrDocString = doc_string;
1578 else SysFreeString(doc_string);
1580 if(pBstrHelpFile) *pBstrHelpFile = help_file;
1581 else SysFreeString(help_file);
1583 if(pdwHelpContext) *pdwHelpContext = help_context;
1588 HRESULT __RPC_STUB ITypeInfo_GetDocumentation_Stub(
1593 BSTR* pBstrDocString,
1594 DWORD* pdwHelpContext,
1595 BSTR* pBstrHelpFile)
1597 TRACE("(%p, %08x, %08x, %p, %p, %p, %p)\n", This, memid, refPtrFlags, pBstrName, pBstrDocString,
1598 pdwHelpContext, pBstrHelpFile);
1599 return ITypeInfo_GetDocumentation(This, memid, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
1602 HRESULT CALLBACK ITypeInfo_GetDllEntry_Proxy(
1610 FIXME("not implemented\n");
1614 HRESULT __RPC_STUB ITypeInfo_GetDllEntry_Stub(
1623 FIXME("not implemented\n");
1627 HRESULT CALLBACK ITypeInfo_AddressOfMember_Proxy(
1633 FIXME("not implemented\n");
1637 HRESULT __RPC_STUB ITypeInfo_AddressOfMember_Stub(
1640 FIXME("not implemented\n");
1644 HRESULT CALLBACK ITypeInfo_CreateInstance_Proxy(
1646 IUnknown* pUnkOuter,
1650 FIXME("not implemented\n");
1654 HRESULT __RPC_STUB ITypeInfo_CreateInstance_Stub(
1659 FIXME("not implemented\n");
1663 HRESULT CALLBACK ITypeInfo_GetContainingTypeLib_Proxy(
1672 TRACE("(%p, %p, %p)\n", This, ppTLib, pIndex );
1674 hr = ITypeInfo_RemoteGetContainingTypeLib_Proxy(This, &pTL, &index);
1683 ITypeLib_Release(pTL);
1688 HRESULT __RPC_STUB ITypeInfo_GetContainingTypeLib_Stub(
1693 TRACE("(%p, %p, %p)\n", This, ppTLib, pIndex );
1694 return ITypeInfo_GetContainingTypeLib(This, ppTLib, pIndex);
1697 void CALLBACK ITypeInfo_ReleaseTypeAttr_Proxy(
1699 TYPEATTR* pTypeAttr)
1701 TRACE("(%p, %p)\n", This, pTypeAttr);
1702 free_embedded_typedesc(&pTypeAttr->tdescAlias);
1703 CoTaskMemFree(pTypeAttr);
1706 HRESULT __RPC_STUB ITypeInfo_ReleaseTypeAttr_Stub(
1709 TRACE("nothing to do\n");
1713 void CALLBACK ITypeInfo_ReleaseFuncDesc_Proxy(
1715 FUNCDESC* pFuncDesc)
1718 TRACE("(%p, %p)\n", This, pFuncDesc);
1720 for(param = 0; param < pFuncDesc->cParams; param++)
1721 free_embedded_elemdesc(pFuncDesc->lprgelemdescParam + param);
1723 CoTaskMemFree(pFuncDesc->lprgelemdescParam);
1725 free_embedded_elemdesc(&pFuncDesc->elemdescFunc);
1727 if(pFuncDesc->cScodes != 0 && pFuncDesc->cScodes != -1)
1728 CoTaskMemFree(pFuncDesc->lprgscode);
1730 CoTaskMemFree(pFuncDesc);
1733 HRESULT __RPC_STUB ITypeInfo_ReleaseFuncDesc_Stub(
1736 TRACE("nothing to do\n");
1740 void CALLBACK ITypeInfo_ReleaseVarDesc_Proxy(
1744 TRACE("(%p, %p)\n", This, pVarDesc);
1746 CoTaskMemFree(pVarDesc->lpstrSchema);
1748 if(pVarDesc->varkind == VAR_CONST)
1749 CoTaskMemFree(pVarDesc->u.lpvarValue);
1751 free_embedded_elemdesc(&pVarDesc->elemdescVar);
1752 CoTaskMemFree(pVarDesc);
1755 HRESULT __RPC_STUB ITypeInfo_ReleaseVarDesc_Stub(
1758 TRACE("nothing to do\n");
1765 HRESULT CALLBACK ITypeInfo2_GetDocumentation2_Proxy(
1769 BSTR* pbstrHelpString,
1770 DWORD* pdwHelpStringContext,
1771 BSTR* pbstrHelpStringDll)
1773 FIXME("not implemented\n");
1777 HRESULT __RPC_STUB ITypeInfo2_GetDocumentation2_Stub(
1782 BSTR* pbstrHelpString,
1783 DWORD* pdwHelpStringContext,
1784 BSTR* pbstrHelpStringDll)
1786 FIXME("not implemented\n");
1792 UINT CALLBACK ITypeLib_GetTypeInfoCount_Proxy(
1796 TRACE("(%p)\n", This);
1798 ITypeLib_RemoteGetTypeInfoCount_Proxy(This, &count);
1803 HRESULT __RPC_STUB ITypeLib_GetTypeInfoCount_Stub(
1807 TRACE("(%p, %p)\n", This, pcTInfo);
1808 *pcTInfo = ITypeLib_GetTypeInfoCount(This);
1812 HRESULT CALLBACK ITypeLib_GetLibAttr_Proxy(
1814 TLIBATTR** ppTLibAttr)
1816 CLEANLOCALSTORAGE stg;
1817 TRACE("(%p, %p)\n", This, ppTLibAttr);
1820 stg.pStorage = NULL;
1821 stg.pInterface = NULL;
1823 return ITypeLib_RemoteGetLibAttr_Proxy(This, ppTLibAttr, &stg);
1826 HRESULT __RPC_STUB ITypeLib_GetLibAttr_Stub(
1828 LPTLIBATTR* ppTLibAttr,
1829 CLEANLOCALSTORAGE* pDummy)
1832 TRACE("(%p, %p)\n", This, ppTLibAttr);
1834 hr = ITypeLib_GetLibAttr(This, ppTLibAttr);
1838 pDummy->flags = CLS_LIBATTR;
1839 ITypeLib_AddRef(This);
1840 pDummy->pInterface = (IUnknown*)This;
1841 pDummy->pStorage = ppTLibAttr;
1845 HRESULT CALLBACK ITypeLib_GetDocumentation_Proxy(
1849 BSTR* pBstrDocString,
1850 DWORD* pdwHelpContext,
1851 BSTR* pBstrHelpFile)
1853 FIXME("not implemented\n");
1857 HRESULT __RPC_STUB ITypeLib_GetDocumentation_Stub(
1862 BSTR* pBstrDocString,
1863 DWORD* pdwHelpContext,
1864 BSTR* pBstrHelpFile)
1866 FIXME("not implemented\n");
1870 HRESULT CALLBACK ITypeLib_IsName_Proxy(
1876 FIXME("not implemented\n");
1880 HRESULT __RPC_STUB ITypeLib_IsName_Stub(
1887 FIXME("not implemented\n");
1891 HRESULT CALLBACK ITypeLib_FindName_Proxy(
1895 ITypeInfo** ppTInfo,
1899 FIXME("not implemented\n");
1903 HRESULT __RPC_STUB ITypeLib_FindName_Stub(
1907 ITypeInfo** ppTInfo,
1912 FIXME("not implemented\n");
1916 void CALLBACK ITypeLib_ReleaseTLibAttr_Proxy(
1918 TLIBATTR* pTLibAttr)
1920 TRACE("(%p, %p)\n", This, pTLibAttr);
1921 CoTaskMemFree(pTLibAttr);
1924 HRESULT __RPC_STUB ITypeLib_ReleaseTLibAttr_Stub(
1927 TRACE("nothing to do\n");
1934 HRESULT CALLBACK ITypeLib2_GetLibStatistics_Proxy(
1936 ULONG* pcUniqueNames,
1937 ULONG* pcchUniqueNames)
1939 FIXME("not implemented\n");
1943 HRESULT __RPC_STUB ITypeLib2_GetLibStatistics_Stub(
1945 ULONG* pcUniqueNames,
1946 ULONG* pcchUniqueNames)
1948 FIXME("not implemented\n");
1952 HRESULT CALLBACK ITypeLib2_GetDocumentation2_Proxy(
1956 BSTR* pbstrHelpString,
1957 DWORD* pdwHelpStringContext,
1958 BSTR* pbstrHelpStringDll)
1960 FIXME("not implemented\n");
1964 HRESULT __RPC_STUB ITypeLib2_GetDocumentation2_Stub(
1969 BSTR* pbstrHelpString,
1970 DWORD* pdwHelpStringContext,
1971 BSTR* pbstrHelpStringDll)
1973 FIXME("not implemented\n");